use of org.jvnet.hudson.test.MockFolder in project promoted-builds-plugin by jenkinsci.
the class ItemPathResolverTest method shouldRetainTheLegacyBehaviorIfEnabled.
@Test
public void shouldRetainTheLegacyBehaviorIfEnabled() throws Exception {
assertsPath("prj", null, projectInTop);
// FOO exists on both top level and within the folder
final MockFolder folder = rule.createFolder("F");
final FreeStyleProject prjInRoot = rule.createFreeStyleProject("FOO");
final FreeStyleProject prjInFolder = folder.createProject(FreeStyleProject.class, "FOO");
// Raw addressing with different roots, should always point to the root
assertsPath("FOO", null, prjInRoot);
assertsPath("FOO", prjInRoot, prjInRoot);
assertsPath("FOO", folder, prjInRoot);
assertsPath("FOO", prjInFolder, prjInRoot);
}
use of org.jvnet.hudson.test.MockFolder in project blueocean-plugin by jenkinsci.
the class LinkResolverTest method runLinkResolveTest.
@Test
public void runLinkResolveTest() throws IOException, ExecutionException, InterruptedException {
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");
Run r = (Run) f.scheduleBuild2(0).get();
Assert.assertEquals("/blue/rest/organizations/jenkins/pipelines/fstyle1/runs/" + r.getId() + "/", LinkResolver.resolveLink(r).getHref());
r = (Run) p1.scheduleBuild2(0).get();
Assert.assertEquals("/blue/rest/organizations/jenkins/pipelines/folder1/pipelines/test1/runs/" + r.getId() + "/", LinkResolver.resolveLink(r).getHref());
r = (Run) p2.scheduleBuild2(0).get();
Assert.assertEquals("/blue/rest/organizations/jenkins/pipelines/folder1/pipelines/folder2/pipelines/test2/runs/" + r.getId() + "/", LinkResolver.resolveLink(r).getHref());
r = (Run) p3.scheduleBuild2(0).get();
Assert.assertEquals("/blue/rest/organizations/jenkins/pipelines/folder1/pipelines/folder2/pipelines/folder3/pipelines/test3/runs/" + r.getId() + "/", LinkResolver.resolveLink(r).getHref());
}
use of org.jvnet.hudson.test.MockFolder in project blueocean-plugin by jenkinsci.
the class LinkResolverTest method nestedFolderJobLinkResolveTest.
@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());
}
use of org.jvnet.hudson.test.MockFolder in project blueocean-plugin by jenkinsci.
the class PipelineApiTest method linkStartLimitTest.
@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);
}
use of org.jvnet.hudson.test.MockFolder in project blueocean-plugin by jenkinsci.
the class PipelineApiTest method getFolderPipelineTest.
@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);
}
Aggregations