Search in sources :

Example 41 with FreeStyleBuild

use of hudson.model.FreeStyleBuild 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);
    }
}
Also used : Shell(hudson.tasks.Shell) FreeStyleBuild(hudson.model.FreeStyleBuild) FreeStyleProject(hudson.model.FreeStyleProject) Map(java.util.Map) ImmutableMap(com.google.common.collect.ImmutableMap) Stack(java.util.Stack) Test(org.junit.Test)

Example 42 with FreeStyleBuild

use of hudson.model.FreeStyleBuild in project blueocean-plugin by jenkinsci.

the class PipelineApiTest method findAllPipelineTest.

@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());
}
Also used : Project(hudson.model.Project) FreeStyleProject(hudson.model.FreeStyleProject) FreeStyleBuild(hudson.model.FreeStyleBuild) MockFolder(org.jvnet.hudson.test.MockFolder) Map(java.util.Map) ImmutableMap(com.google.common.collect.ImmutableMap) Test(org.junit.Test)

Aggregations

FreeStyleBuild (hudson.model.FreeStyleBuild)42 FreeStyleProject (hudson.model.FreeStyleProject)42 Test (org.junit.Test)25 JobPropertyImpl (hudson.plugins.promoted_builds.JobPropertyImpl)14 PromotionProcess (hudson.plugins.promoted_builds.PromotionProcess)13 Shell (hudson.tasks.Shell)13 Map (java.util.Map)12 ImmutableMap (com.google.common.collect.ImmutableMap)11 PromotedBuildAction (hudson.plugins.promoted_builds.PromotedBuildAction)8 Promotion (hudson.plugins.promoted_builds.Promotion)7 StringParameterDefinition (hudson.model.StringParameterDefinition)6 ManualCondition (hudson.plugins.promoted_builds.conditions.ManualCondition)6 ManualApproval (hudson.plugins.promoted_builds.conditions.ManualCondition.ManualApproval)6 Descriptor (hudson.model.Descriptor)5 ParameterValue (hudson.model.ParameterValue)5 StringParameterValue (hudson.model.StringParameterValue)4 MockFolder (org.jvnet.hudson.test.MockFolder)4 HtmlPage (com.gargoylesoftware.htmlunit.html.HtmlPage)3 Project (hudson.model.Project)3 DescriptorImpl (hudson.plugins.promoted_builds.JobPropertyImpl.DescriptorImpl)3