use of hudson.model.FreeStyleBuild in project blueocean-plugin by jenkinsci.
the class PipelineApiTest method getFreeStyleJobTest.
@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);
}
}
use of hudson.model.FreeStyleBuild in project blueocean-plugin by jenkinsci.
the class PipelineApiTest method findPipelineRunsForAPipelineTest.
@Test
public void findPipelineRunsForAPipelineTest() throws Exception {
FreeStyleProject p1 = j.createFreeStyleProject("pipeline1");
FreeStyleProject p2 = j.createFreeStyleProject("pipeline2");
p1.getBuildersList().add(new Shell("echo hello!\nsleep 1"));
p2.getBuildersList().add(new Shell("echo hello!\nsleep 1"));
Stack<FreeStyleBuild> builds = new Stack<FreeStyleBuild>();
FreeStyleBuild b11 = p1.scheduleBuild2(0).get();
FreeStyleBuild b12 = p1.scheduleBuild2(0).get();
builds.push(b11);
builds.push(b12);
j.assertBuildStatusSuccess(b11);
j.assertBuildStatusSuccess(b12);
List<Map> resp = get("/search?q=type:run;organization:jenkins;pipeline:pipeline1", List.class);
assertEquals(builds.size(), resp.size());
for (int i = 0; i < builds.size(); i++) {
Map p = resp.get(i);
FreeStyleBuild b = builds.pop();
validateRun(b, p);
}
}
use of hudson.model.FreeStyleBuild 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.FreeStyleBuild 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.FreeStyleBuild in project blueocean-plugin by jenkinsci.
the class PipelineApiTest method getPipelinesTest.
@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);
}
Aggregations