use of hudson.model.FreeStyleProject in project blueocean-plugin by jenkinsci.
the class PipelineApiTest method findPipelinesTest.
@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);
}
}
use of hudson.model.FreeStyleProject in project blueocean-plugin by jenkinsci.
the class PipelineApiTest method getPipelineRunLatestTest.
@Test
public void getPipelineRunLatestTest() throws Exception {
FreeStyleProject p = j.createFreeStyleProject("pipeline5");
p.getBuildersList().add(new Shell("echo hello!\nsleep 1"));
FreeStyleBuild b = p.scheduleBuild2(0).get();
j.assertBuildStatusSuccess(b);
List<Map> resp = get("/search?q=type:run;organization:jenkins;pipeline:pipeline5;latestOnly:true", List.class);
Run[] run = { b };
assertEquals(run.length, resp.size());
for (int i = 0; i < run.length; i++) {
Map lr = resp.get(i);
validateRun(run[i], lr);
}
}
use of hudson.model.FreeStyleProject in project blueocean-plugin by jenkinsci.
the class PipelineApiTest method getPipelineWithLastSuccessfulRun.
@Test
public void getPipelineWithLastSuccessfulRun() throws Exception {
FreeStyleProject p = j.createFreeStyleProject("pipeline4");
p.getBuildersList().add(new Shell("echo hello!\nsleep 1"));
FreeStyleBuild b = p.scheduleBuild2(0).get();
j.assertBuildStatusSuccess(b);
Map resp = get("/organizations/jenkins/pipelines/pipeline4/");
validatePipeline(p, resp);
}
use of hudson.model.FreeStyleProject in project blueocean-plugin by jenkinsci.
the class PipelineApiTest method findPipelineRunsForAllPipelineTest.
@Test
public void findPipelineRunsForAllPipelineTest() throws IOException, ExecutionException, InterruptedException {
FreeStyleProject p1 = j.createFreeStyleProject("pipeline11");
FreeStyleProject p2 = j.createFreeStyleProject("pipeline22");
p1.getBuildersList().add(new Shell("echo hello!\nsleep 1"));
p2.getBuildersList().add(new Shell("echo hello!\nsleep 1"));
Stack<FreeStyleBuild> p1builds = new Stack<FreeStyleBuild>();
p1builds.push(p1.scheduleBuild2(0).get());
p1builds.push(p1.scheduleBuild2(0).get());
Stack<FreeStyleBuild> p2builds = new Stack<FreeStyleBuild>();
p2builds.push(p2.scheduleBuild2(0).get());
p2builds.push(p2.scheduleBuild2(0).get());
Map<String, Stack<FreeStyleBuild>> buildMap = ImmutableMap.of(p1.getName(), p1builds, p2.getName(), p2builds);
List<Map> resp = get("/search?q=type:run;organization:jenkins", List.class);
assertEquals(4, resp.size());
for (int i = 0; i < 4; i++) {
Map p = resp.get(i);
String pipeline = (String) p.get("pipeline");
assertNotNull(pipeline);
validateRun(buildMap.get(pipeline).pop(), p);
}
}
use of hudson.model.FreeStyleProject in project hudson-2.x by hudson.
the class FunctionsTest method testGetTemplateWithoutTemplates.
@Test
public void testGetTemplateWithoutTemplates() {
List<FreeStyleProject> items = new ArrayList<FreeStyleProject>();
FreeStyleProject project = Functions.getItemByName(items, TEMPLATE_NAME);
assertNull(project);
}
Aggregations