hudson.model.Project Java Examples
The following examples show how to use
hudson.model.Project.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LinkResolverTest.java From blueocean-plugin with MIT License | 6 votes |
@Test public void nestedFolderJobLinkResolveTest() throws IOException { Project f = j.createFreeStyleProject("fstyle1"); MockFolder folder1 = j.createFolder("folder1"); Project p1 = folder1.createProject(FreeStyleProject.class, "test1"); MockFolder folder2 = folder1.createProject(MockFolder.class, "folder2"); MockFolder folder3 = folder2.createProject(MockFolder.class, "folder3"); Project p2 = folder2.createProject(FreeStyleProject.class, "test2"); Project p3 = folder3.createProject(FreeStyleProject.class, "test3"); Assert.assertEquals("/blue/rest/organizations/jenkins/pipelines/fstyle1/",LinkResolver.resolveLink(f).getHref()); Assert.assertEquals("/blue/rest/organizations/jenkins/pipelines/folder1/",LinkResolver.resolveLink(folder1).getHref()); Assert.assertEquals("/blue/rest/organizations/jenkins/pipelines/folder1/pipelines/test1/",LinkResolver.resolveLink(p1).getHref()); Assert.assertEquals("/blue/rest/organizations/jenkins/pipelines/folder1/pipelines/folder2/",LinkResolver.resolveLink(folder2).getHref()); Assert.assertEquals("/blue/rest/organizations/jenkins/pipelines/folder1/pipelines/folder2/pipelines/test2/",LinkResolver.resolveLink(p2).getHref()); Assert.assertEquals("/blue/rest/organizations/jenkins/pipelines/folder1/pipelines/folder2/pipelines/folder3/",LinkResolver.resolveLink(folder3).getHref()); Assert.assertEquals("/blue/rest/organizations/jenkins/pipelines/folder1/pipelines/folder2/pipelines/folder3/pipelines/test3/",LinkResolver.resolveLink(p3).getHref()); }
Example #2
Source File: FavoritesApiTest.java From blueocean-plugin with MIT License | 6 votes |
@Test public void testFavoritePagination() throws IOException, Favorites.FavoriteException { j.jenkins.setSecurityRealm(j.createDummySecurityRealm()); hudson.model.User user = User.get("alice"); Project job1 = j.createFreeStyleProject("job1"); Project job2 = j.createFreeStyleProject("job2"); Favorites.addFavorite(user, job1); Favorites.addFavorite(user, job2); List<Map> favorites = new RequestBuilder(baseUrl) .get("/users/"+user.getId()+"/favorites/") .auth("alice", "alice") .build(List.class); assertEquals(2, favorites.size()); favorites = new RequestBuilder(baseUrl) .get("/users/"+user.getId()+"/favorites/?limit=1") .auth("alice", "alice") .build(List.class); assertEquals(1, favorites.size()); }
Example #3
Source File: PendingBuildsHandlerTest.java From gitlab-plugin with GNU General Public License v2.0 | 6 votes |
@Test public void queuedMergeRequestBuildsCanBeCancelledOnMergeRequestUpdate() throws IOException { Project project = freestyleProject("project1", new GitLabCommitStatusPublisher(GITLAB_BUILD_NAME, false)); GitLabPushTrigger gitLabPushTrigger = gitLabPushTrigger(project); gitLabPushTrigger.setCancelPendingBuildsOnUpdate(true); assertThat(jenkins.getInstance().getQueue().getItems().length, is(0)); gitLabPushTrigger.onPost(mergeRequestHook(1, "sourceBranch", "commit1")); // Will be cancelled gitLabPushTrigger.onPost(mergeRequestHook(1, "sourceBranch", "commit2")); // Will be cancelled gitLabPushTrigger.onPost(mergeRequestHook(1, "sourceBranch", "commit3")); gitLabPushTrigger.onPost(mergeRequestHook(1, "anotherBranch", "commit4")); gitLabPushTrigger.onPost(mergeRequestHook(2, "sourceBranch", "commit5")); verify(gitLabClient).changeBuildStatus(eq(1), eq("commit1"), eq(BuildState.canceled), eq("sourceBranch"), eq("Jenkins"), contains("project1"), eq(BuildState.canceled.name())); verify(gitLabClient).changeBuildStatus(eq(1), eq("commit2"), eq(BuildState.canceled), eq("sourceBranch"), eq("Jenkins"), contains("project1"), eq(BuildState.canceled.name())); assertThat(jenkins.getInstance().getQueue().getItems().length, is(3)); }
Example #4
Source File: PipelineApiTest.java From blueocean-plugin with MIT License | 6 votes |
@Test public void PipelineSecureWithLoggedInUserPermissionTest() throws IOException, UnirestException { j.jenkins.setSecurityRealm(j.createDummySecurityRealm()); hudson.model.User user = User.get("alice"); user.setFullName("Alice Cooper"); MockFolder folder = j.createFolder("folder1"); Project p = folder.createProject(FreeStyleProject.class, "test1"); String token = getJwtToken(j.jenkins, "alice", "alice"); assertNotNull(token); Map response = new RequestBuilder(baseUrl) .get("/organizations/jenkins/pipelines/folder1/pipelines/test1") .jwtToken(token) .build(Map.class); validatePipeline(p, response); Map<String,Boolean> permissions = (Map<String, Boolean>) response.get("permissions"); assertTrue(permissions.get("create")); assertTrue(permissions.get("start")); assertTrue(permissions.get("stop")); assertTrue(permissions.get("read")); }
Example #5
Source File: PipelineApiTest.java From blueocean-plugin with MIT License | 6 votes |
@Test public void PipelineSecureWithAnonymousUserPermissionTest() throws IOException { j.jenkins.setSecurityRealm(new HudsonPrivateSecurityRealm(false)); j.jenkins.setAuthorizationStrategy(new LegacyAuthorizationStrategy()); MockFolder folder = j.createFolder("folder1"); Project p = folder.createProject(FreeStyleProject.class, "test1"); Map response = get("/organizations/jenkins/pipelines/folder1/pipelines/test1"); validatePipeline(p, response); Map<String,Boolean> permissions = (Map<String, Boolean>) response.get("permissions"); Assert.assertFalse(permissions.get("create")); Assert.assertFalse(permissions.get("start")); Assert.assertFalse(permissions.get("stop")); assertTrue(permissions.get("read")); response = get("/organizations/jenkins/pipelines/folder1/"); permissions = (Map<String, Boolean>) response.get("permissions"); Assert.assertFalse(permissions.get("create")); Assert.assertFalse(permissions.get("start")); Assert.assertFalse(permissions.get("stop")); assertTrue(permissions.get("read")); }
Example #6
Source File: PipelineApiTest.java From blueocean-plugin with MIT License | 6 votes |
@Test public void getPipelinesTest() throws Exception { Project p2 = j.createFreeStyleProject("pipeline2"); Project p1 = j.createFreeStyleProject("pipeline1"); List<Map> responses = get("/search/?q=type:pipeline", List.class); assertEquals(2, responses.size()); validatePipeline(p1, responses.get(0)); validatePipeline(p2, responses.get(1)); p1.getBuildersList().add(new Shell("echo hello!\nsleep 1")); FreeStyleBuild b = (FreeStyleBuild) p1.scheduleBuild2(0).get(); j.assertBuildStatusSuccess(b); }
Example #7
Source File: PipelineApiTest.java From blueocean-plugin with MIT License | 6 votes |
@Test public void getPipelineTest() throws IOException { Project p = j.createFreeStyleProject("pipeline1"); Map<String,Object> response = get("/organizations/jenkins/pipelines/pipeline1"); validatePipeline(p, response); String clazz = (String) response.get("_class"); response = get("/classes/"+clazz+"/"); assertNotNull(response); List<String> classes = (List<String>) response.get("classes"); assertTrue(classes.contains("hudson.model.Job") && !classes.contains("org.jenkinsci.plugins.workflow.job.WorkflowJob") && !classes.contains("io.jenkins.blueocean.rest.model.BlueBranch")); }
Example #8
Source File: TestResultPublishingTest.java From junit-plugin with MIT License | 6 votes |
/** * Test to demonstrate bug HUDSON-5246, inter-build diffs for junit test results are wrong */ @Issue("JENKINS-5246") @LocalData @Test public void testInterBuildDiffs() throws IOException, SAXException { Project proj = (Project)rule.jenkins.getItem(TEST_PROJECT_WITH_HISTORY); assertNotNull("We should have a project named " + TEST_PROJECT_WITH_HISTORY, proj); // Validate that there are test results where I expect them to be: WebClient wc = rule.createWebClient(); Run theRun = proj.getBuildByNumber(4); assertTestResultsAsExpected(wc, theRun, "/testReport", "org.jvnet.hudson.examples.small", "12 ms", "FAILURE", /* total tests expected, diff */ 3, 0, /* fail count expected, diff */ 1, 0, /* skip count expected, diff */ 0, 0); }
Example #9
Source File: PipelineApiTest.java From blueocean-plugin with MIT License | 6 votes |
@Test public void getFreeStyleJobTest() throws Exception { Project p1 = j.createFreeStyleProject("pipeline1"); Project p2 = j.createFreeStyleProject("pipeline2"); p1.getBuildersList().add(new Shell("echo hello!\nsleep 1")); FreeStyleBuild b = (FreeStyleBuild) p1.scheduleBuild2(0).get(); j.assertBuildStatusSuccess(b); List<Map> resp = get("/organizations/jenkins/pipelines/", List.class); Project[] projects = {p1,p2}; assertEquals(projects.length, resp.size()); for(int i=0; i<projects.length; i++){ Map p = resp.get(i); validatePipeline(projects[i], p); } }
Example #10
Source File: PipelineApiTest.java From blueocean-plugin with MIT License | 6 votes |
@Test public void findAllPipelineTest() throws IOException, ExecutionException, InterruptedException { MockFolder folder1 = j.createFolder("folder1"); j.createFolder("afolder"); Project p1 = folder1.createProject(FreeStyleProject.class, "test1"); MockFolder folder2 = folder1.createProject(MockFolder.class, "folder2"); folder1.createProject(MockFolder.class, "folder3"); folder2.createProject(FreeStyleProject.class, "test2"); FreeStyleBuild b1 = (FreeStyleBuild) p1.scheduleBuild2(0).get(); List<Map> resp = get("/search?q=type:pipeline", List.class); assertEquals(6, resp.size()); }
Example #11
Source File: PipelineApiTest.java From blueocean-plugin with MIT License | 6 votes |
@Test public void findAllPipelineByGlob() throws IOException, ExecutionException, InterruptedException { MockFolder folder1 = j.createFolder("folder1"); j.createFolder("afolder"); Project p1 = folder1.createProject(FreeStyleProject.class, "test1"); MockFolder folder2 = folder1.createProject(MockFolder.class, "folder2"); folder1.createProject(MockFolder.class, "folder3"); folder2.createProject(FreeStyleProject.class, "test2"); folder2.createProject(FreeStyleProject.class, "coolPipeline"); List<Map> resp = get("/search?q=type:pipeline;pipeline:*TEST*", List.class); assertEquals(2, resp.size()); resp = get("/search?q=type:pipeline;pipeline:*cool*", List.class); assertEquals(1, resp.size()); resp = get("/search?q=type:pipeline;pipeline:*nothing*", List.class); assertEquals(0, resp.size()); resp = get("/search?q=type:pipeline;pipeline:*f*", List.class); assertEquals(7, resp.size()); }
Example #12
Source File: LinkResolverTest.java From blueocean-plugin with MIT License | 5 votes |
@Test public void nestedFolderJobLinkResolveTest() throws IOException { Project f = j.createFreeStyleProject("fstyle1"); MockFolder folder1 = j.createFolder("folder1"); Project p1 = folder1.createProject(FreeStyleProject.class, "test1"); MockFolder folder2 = folder1.createProject(MockFolder.class, "folder2"); MockFolder folder3 = folder2.createProject(MockFolder.class, "folder3"); Project p2 = folder2.createProject(FreeStyleProject.class, "test2"); Project p3 = folder3.createProject(FreeStyleProject.class, "test3"); WorkflowJob pipelineJob1 = j.jenkins.createProject(WorkflowJob.class, "pipeline1"); pipelineJob1.setDefinition(new CpsFlowDefinition("stage \"Build\"\n" + " node {\n" + " sh \"echo here\"\n" + " }\n" + "\n")); WorkflowJob pipelineJob2 = folder2.createProject(WorkflowJob.class, "pipeline2"); pipelineJob2.setDefinition(new CpsFlowDefinition("stage \"Build\"\n" + " node {\n" + " sh \"echo here\"\n" + " }\n" + "\n")); Assert.assertEquals("/blue/rest/organizations/jenkins/pipelines/pipeline1/",LinkResolver.resolveLink(pipelineJob1).getHref()); Assert.assertEquals("/blue/rest/organizations/jenkins/pipelines/folder1/pipelines/folder2/pipelines/pipeline2/",LinkResolver.resolveLink(pipelineJob2).getHref()); Assert.assertEquals("/blue/rest/organizations/jenkins/pipelines/fstyle1/",LinkResolver.resolveLink(f).getHref()); Assert.assertEquals("/blue/rest/organizations/jenkins/pipelines/folder1/",LinkResolver.resolveLink(folder1).getHref()); Assert.assertEquals("/blue/rest/organizations/jenkins/pipelines/folder1/pipelines/test1/",LinkResolver.resolveLink(p1).getHref()); Assert.assertEquals("/blue/rest/organizations/jenkins/pipelines/folder1/pipelines/folder2/",LinkResolver.resolveLink(folder2).getHref()); Assert.assertEquals("/blue/rest/organizations/jenkins/pipelines/folder1/pipelines/folder2/pipelines/test2/",LinkResolver.resolveLink(p2).getHref()); Assert.assertEquals("/blue/rest/organizations/jenkins/pipelines/folder1/pipelines/folder2/pipelines/folder3/",LinkResolver.resolveLink(folder3).getHref()); Assert.assertEquals("/blue/rest/organizations/jenkins/pipelines/folder1/pipelines/folder2/pipelines/folder3/pipelines/test3/",LinkResolver.resolveLink(p3).getHref()); }
Example #13
Source File: PipelineApiTest.java From blueocean-plugin with MIT License | 5 votes |
@Test public void PipelineUnsecurePermissionTest() throws IOException { MockFolder folder = j.createFolder("folder1"); Project p = folder.createProject(FreeStyleProject.class, "test1"); Map response = get("/organizations/jenkins/pipelines/folder1/pipelines/test1"); validatePipeline(p, response); Map<String,Boolean> permissions = (Map<String, Boolean>) response.get("permissions"); assertTrue(permissions.get("create")); assertTrue(permissions.get("start")); assertTrue(permissions.get("stop")); assertTrue(permissions.get("read")); }
Example #14
Source File: AWSCodePipelineSCMTest.java From aws-codepipeline-plugin-for-jenkins with Apache License 2.0 | 5 votes |
@Test public void testRoundTripConfiguration() throws Exception { final AWSCodePipelineSCM before = awsCodePipelineSCM; final Project project = jenkinsRule.createFreeStyleProject(); project.setScm(before); jenkinsRule.configRoundtrip(project); final SCM after = project.getScm(); jenkinsRule.assertEqualDataBoundBeans(before, after); }
Example #15
Source File: AWSCodePipelineSCMTest.java From aws-codepipeline-plugin-for-jenkins with Apache License 2.0 | 5 votes |
@Test public void storeAwsSecretKeyAsSecret() throws Exception { final Project project = jenkinsRule.createFreeStyleProject(); project.setScm(awsCodePipelineSCM); jenkinsRule.configRoundtrip(project); assertFalse(project.getConfigFile().asString().contains(PLAIN_SECRET)); }
Example #16
Source File: AnsiblePlaybookStep.java From ansible-plugin with Apache License 2.0 | 5 votes |
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Project project) { return new StandardListBoxModel() .withEmptySelection() .withMatching(anyOf( instanceOf(SSHUserPrivateKey.class), instanceOf(UsernamePasswordCredentials.class)), CredentialsProvider.lookupCredentials(StandardUsernameCredentials.class, project)); }
Example #17
Source File: AbstractAnsibleBuilderDescriptor.java From ansible-plugin with Apache License 2.0 | 5 votes |
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Project project) { return new StandardListBoxModel() .withEmptySelection() .withMatching(anyOf( instanceOf(SSHUserPrivateKey.class), instanceOf(UsernamePasswordCredentials.class)), CredentialsProvider.lookupCredentials(StandardUsernameCredentials.class, project)); }
Example #18
Source File: TestResultPublishingTest.java From junit-plugin with MIT License | 5 votes |
/** * Make sure the open junit publisher shows junit history * @throws IOException * @throws SAXException */ @LocalData @Test public void testHistoryPageOpenJunit() throws IOException, SAXException { Project proj = (Project)rule.jenkins.getItem(TEST_PROJECT_WITH_HISTORY); assertNotNull("We should have a project named " + TEST_PROJECT_WITH_HISTORY, proj); // Validate that there are test results where I expect them to be: WebClient wc = rule.createWebClient(); HtmlPage historyPage = wc.getPage(proj.getBuildByNumber(7),"/testReport/history/"); rule.assertGoodStatus(historyPage); rule.assertXPath(historyPage, "//img[@id='graph']"); rule.assertXPath(historyPage, "//table[@id='testresult']"); DomElement wholeTable = historyPage.getElementById("testresult"); assertNotNull("table with id 'testresult' exists", wholeTable); assertTrue("wholeTable is a table", wholeTable instanceof HtmlTable); HtmlTable table = (HtmlTable) wholeTable; // We really want to call table.getRowCount(), but // it returns 1, not the real answer, // because this table has *two* tbody elements, // and getRowCount() only seems to count the *first* tbody. // Maybe HtmlUnit can't handle the two tbody's. In any case, // the tableText.contains tests do a (ahem) passable job // of detecting whether the history results are present. String tableText = table.getTextContent(); assertTrue("Table text is missing the project name", tableText.contains(TEST_PROJECT_WITH_HISTORY)); assertTrue("Table text is missing the build number", tableText.contains("7")); assertTrue("Table text is missing the test duration", tableText.contains("4 ms")); }
Example #19
Source File: HistoryTest.java From junit-plugin with MIT License | 5 votes |
@Before public void setUp() throws Exception { List<FreeStyleProject> projects = rule.jenkins.getAllItems(FreeStyleProject.class); Project theProject = null; for (Project p : projects) { if (p.getName().equals(PROJECT_NAME)) theProject = p; } assertNotNull("We should have a project named " + PROJECT_NAME, theProject); project = (FreeStyleProject) theProject; }
Example #20
Source File: PendingBuildsHandlerTest.java From gitlab-plugin with GNU General Public License v2.0 | 5 votes |
@Test public void projectCanBeConfiguredToSendPendingBuildStatusWhenTriggered() throws IOException { Project project = freestyleProject("freestyleProject1", new GitLabCommitStatusPublisher(GITLAB_BUILD_NAME, false)); GitLabPushTrigger gitLabPushTrigger = gitLabPushTrigger(project); gitLabPushTrigger.onPost(pushHook(1, "branch1", "commit1")); verify(gitLabClient).changeBuildStatus(eq(1), eq("commit1"), eq(BuildState.pending), eq("branch1"), eq(GITLAB_BUILD_NAME), contains("/freestyleProject1/"), eq(BuildState.pending.name())); verifyNoMoreInteractions(gitLabClient); }
Example #21
Source File: PendingBuildsHandlerTest.java From gitlab-plugin with GNU General Public License v2.0 | 5 votes |
private Project freestyleProject(String name, GitLabCommitStatusPublisher gitLabCommitStatusPublisher) throws IOException { FreeStyleProject project = jenkins.createFreeStyleProject(name); project.setQuietPeriod(5000); project.getPublishersList().add(gitLabCommitStatusPublisher); project.addProperty(gitLabConnectionProperty); return project; }
Example #22
Source File: DockerQueueListener.java From docker-plugin with MIT License | 5 votes |
/** * Helper method to determine the template from a given item. * * @param item Item which includes a template. * @return If the item includes a template then the template will be returned. Otherwise <code>null</code>. */ @CheckForNull private static DockerJobTemplateProperty getJobTemplate(Item item) { if (item.task instanceof Project) { final Project<?, ?> project = (Project<?, ?>) item.task; final DockerJobTemplateProperty p = project.getProperty(DockerJobTemplateProperty.class); if (p != null) return p; // backward compatibility. DockerJobTemplateProperty used to be a nested object in DockerJobProperty final DockerJobProperty property = project.getProperty(DockerJobProperty.class); if (property != null) { return property.getDockerJobTemplate(); } } return null; }
Example #23
Source File: BlueTrendsApiTest.java From blueocean-plugin with MIT License | 5 votes |
@Test public void getTrendsListFreestyle() throws IOException { Project p = j.createProject(FreeStyleProject.class, "freestyle1"); List response = new RequestBuilder(baseUrl) .get("/organizations/jenkins/pipelines/"+p.getName()+"/trends/") .build(List.class); Assert.assertNotNull(response); }
Example #24
Source File: BlueTrendTest.java From blueocean-plugin with MIT License | 5 votes |
@Test public void testTrendsIdCollision() throws Exception { // verify the extension did register correctly ExtensionList<BlueTrendFactory> extensionList = ExtensionList.lookup(BlueTrendFactory.class); Assert.assertEquals(2, extensionList.size()); Project project = j.createProject(FreeStyleProject.class, "freestyle1"); BlueOrganization org = new OrganizationImpl("jenkins", j.jenkins); BluePipeline pipeline = new AbstractPipelineImpl(org, project); BlueTrendContainer trends = pipeline.getTrends(); BlueTrend trend = trends.get("junit"); Assert.assertEquals("junit", trend.getId()); Assert.assertEquals("JUnit", trend.getDisplayName()); }
Example #25
Source File: PipelineApiTest.java From blueocean-plugin with MIT License | 5 votes |
@Test public void getPipelinesExtensionTest() throws Exception { Project p = j.createProject(TestProject.class,"pipeline1"); j.assertBuildStatusSuccess(p.scheduleBuild2(0)); Map<String,Object> response = get("/organizations/jenkins/pipelines/pipeline1"); validatePipeline(p, response); assertEquals("hello world!", response.get("hello")); assertNotNull(response.get("latestRun")); Map latestRun = (Map) response.get("latestRun"); assertEquals("pipeline1", latestRun.get("pipeline")); assertEquals("TestBuild", latestRun.get("type")); }
Example #26
Source File: PipelineApiTest.java From blueocean-plugin with MIT License | 5 votes |
@Test public void findPipelinesTest() throws IOException { FreeStyleProject p1 = j.createFreeStyleProject("pipeline2"); FreeStyleProject p2 = j.createFreeStyleProject("pipeline3"); List<Map> resp = get("/search?q=type:pipeline;organization:jenkins", List.class); Project[] projects = {p1,p2}; assertEquals(projects.length, resp.size()); for(int i=0; i<projects.length; i++){ Map p = resp.get(i); validatePipeline(projects[i], p); } }
Example #27
Source File: PipelineApiTest.java From blueocean-plugin with MIT License | 5 votes |
/** TODO: latest stapler change broke delete, disabled for now */ @Test @Ignore public void deletePipelineTest() throws IOException { Project p = j.createFreeStyleProject("pipeline1"); delete("/organizations/jenkins/pipelines/pipeline1/"); assertNull(j.jenkins.getItem(p.getName())); }
Example #28
Source File: PipelineApiTest.java From blueocean-plugin with MIT License | 5 votes |
@Test public void linkStartLimitTest() throws IOException, UnirestException { MockFolder folder = j.createFolder("folder1"); Project p = folder.createProject(FreeStyleProject.class, "test1"); HttpResponse<String> response = Unirest.get(getBaseUrl("/organizations/jenkins/pipelines/folder1/pipelines/")) .header("Accept-Encoding","") .header("Authorization", "Bearer "+jwtToken) .asString(); String link = response.getHeaders().get("Link").get(0); assertEquals("</jenkins/blue/rest/organizations/jenkins/pipelines/folder1/pipelines/?start=100&limit=100>; rel=\"next\"", link); response = Unirest.get(getBaseUrl("/search/?q=type:pipeline;excludedFromFlattening:jenkins.branch.MultiBranchProject,hudson.matrix.MatrixProject&filter1=no-folders&start=0&limit=26")) .header("Accept-Encoding","") .header("Authorization", "Bearer "+jwtToken) .asString(); link = response.getHeaders().get("Link").get(0); assertEquals("</jenkins/blue/rest/search/?q=type:pipeline;excludedFromFlattening:jenkins.branch.MultiBranchProject,hudson.matrix.MatrixProject&filter1=no-folders&start=26&limit=26>; rel=\"next\"", link); response = Unirest.get(getBaseUrl("/organizations/jenkins/pipelines/folder1/pipelines/?start=10&limit=10&foo=bar")) .header("Accept-Encoding","") .header("Authorization", "Bearer "+jwtToken) .asString(); link = response.getHeaders().get("Link").get(0); assertEquals("</jenkins/blue/rest/organizations/jenkins/pipelines/folder1/pipelines/?foo=bar&start=20&limit=10>; rel=\"next\"", link); }
Example #29
Source File: PipelineApiTest.java From blueocean-plugin with MIT License | 5 votes |
@Test public void getFolderPipelineTest() throws IOException { MockFolder folder = j.createFolder("folder1"); Project p = folder.createProject(FreeStyleProject.class, "test1"); Map response = get("/organizations/jenkins/pipelines/folder1/pipelines/test1"); validatePipeline(p, response); }
Example #30
Source File: ContainerFilterTest.java From blueocean-plugin with MIT License | 5 votes |
@Test public void customFilter() throws IOException { MockFolder folder = j.createFolder("folder1"); Project p = folder.createProject(FreeStyleProject.class, "test1"); Collection<Item> items = ContainerFilter.filter(j.getInstance().getAllItems(), "itemgroup-only"); assertEquals(1, items.size()); assertEquals(folder.getFullName(), items.iterator().next().getFullName()); }