Package hudson.model

Examples of hudson.model.FreeStyleBuild


    project.getBuildersList().add(builder);
    project.setAssignedLabel(node.getSelfLabel());

    // use a timeout so we don't wait infinitely in case of failure
    FreeStyleBuild build = project.scheduleBuild2(0).get(/*10, TimeUnit.SECONDS*/);
   
    System.out.println(build.getLog());
    Assert.assertEquals(Result.SUCCESS, build.getResult());

    return builder.getEnvVars();
  }
View Full Code Here


    // build the project, wait until tests are running, then cancel.
    project.scheduleBuild(0);
    Thread.sleep(2000);

        FreeStyleBuild b = project.getLastBuild();
        b.doStop(
        EasyMock.createNiceMock(StaplerRequest.class),
        EasyMock.createNiceMock(StaplerResponse.class));

    Thread.sleep(1000);
   
    // will fail (at least on windows) if test process is still running
    b.getWorkspace().deleteRecursive();

  }
View Full Code Here

            private Object writeReplace() { // don't really care about save
                return new NullSCM();
            }
        });
       
        FreeStyleBuild build = p.scheduleBuild2(0).get();
        assertEquals(Result.ABORTED, build.getResult());
    }
View Full Code Here

        });
        FreeStyleProject p = createFreeStyleProject();
        p.getBuildersList().add(new Shell("echo abc"));
        p.setAssignedNode(s);
       
        FreeStyleBuild b = assertBuildStatusSuccess(p.scheduleBuild2(0).get());

        assertEquals(1,s.numLaunch);
        assertTrue(FileUtils.readFileToString(b.getLogFile()).contains("Hudson was here"));
    }
View Full Code Here

        Future<FreeStyleBuild> f2 = p2.scheduleBuild2(0);

        Thread.sleep(1000); // time window to ensure queue has tried to assign f2 build

        // p3 is tied to 'win', so even though p1 is busy, this should still go ahead and complete
        FreeStyleBuild b3 = assertBuildStatusSuccess(p3.scheduleBuild2(0));
        assertSame(w64,b3.getBuiltOn());

        seq.phase(3);   // once we confirm that p3 build is over, we let p1 proceed

        // p1 should have been built on w32
        FreeStyleBuild b1 = assertBuildStatusSuccess(f1);
        assertSame(w32,b1.getBuiltOn());

        // and so is p2
        FreeStyleBuild b2 = assertBuildStatusSuccess(f2);
        assertSame(w32,b2.getBuiltOn());
    }
View Full Code Here

        DumbSlave s = createSlave("win",null);

        FreeStyleProject p = createFreeStyleProject();

        p.setAssignedLabel(hudson.getLabel("!win"));
        FreeStyleBuild b = assertBuildStatusSuccess(p.scheduleBuild2(0));
        assertSame(hudson,b.getBuiltOn());

        p.setAssignedLabel(hudson.getLabel("win"));
        b = assertBuildStatusSuccess(p.scheduleBuild2(0));
        assertSame(s,b.getBuiltOn());

        p.setAssignedLabel(hudson.getLabel("!win"));
        b = assertBuildStatusSuccess(p.scheduleBuild2(0));
        assertSame(hudson,b.getBuiltOn());
    }
View Full Code Here

        }
    }

    public void testRun() throws Exception {
        FreeStyleProject p = createFreeStyleProject();
        FreeStyleBuild b = assertBuildStatusSuccess(p.scheduleBuild2(0));
        assertTrue(b.getDescription().equals("I was here"));
    }
View Full Code Here

    project.getBuildersList().add(new TouchBuilder());
  }
 
  @LocalData
  public void testBasic() throws Exception {
    FreeStyleBuild build = project.scheduleBuild2(0).get(10, TimeUnit.SECONDS);
   
    assertTestResults(build);
   
    WebClient wc =new WebClient();
    wc.getPage(project); // project page
View Full Code Here

  public void testPersistence() throws Exception {
        project.scheduleBuild2(0).get(60, TimeUnit.SECONDS);
   
    reloadJenkins();
   
    FreeStyleBuild build = project.getBuildByNumber(1);
   
    assertTestResults(build);
  }
View Full Code Here

    project = (FreeStyleProject) hudson.getItem("junit");
  }
 
  @LocalData
  public void testSetDescription() throws Exception {
    FreeStyleBuild build = project.scheduleBuild2(0).get(10, TimeUnit.SECONDS);
   
    CaseResult caseResult = build.getAction(TestResultAction.class).getFailedTests().get(0);
    String url = build.getUrl() + "/testReport/" + caseResult.getRelativePathFrom(caseResult.getTestResult());
   
    testSetDescription(url, caseResult);
   
    ClassResult classResult = caseResult.getParent();
    url = build.getUrl() + "/testReport/" + classResult.getParent().getSafeName() + "/" + classResult.getSafeName();
    testSetDescription(url, classResult);
   
    PackageResult packageResult = classResult.getParent();
    url = build.getUrl() + "/testReport/" + classResult.getParent().getSafeName();
    testSetDescription(url, packageResult);
   
  }
View Full Code Here

TOP

Related Classes of hudson.model.FreeStyleBuild

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.