Package hudson.model

Examples of hudson.model.AbstractBuild


     * @throws Exception the exception
     */
    @SuppressWarnings("rawtypes")
    @Test
    public void testHasReferenceResult() throws Exception {
        AbstractBuild withSuccessResult = mockBuild();
        AbstractBuild noResult2 = mockBuild();
        AbstractBuild withFailureResult = mockBuild();
        AbstractBuild noResult1 = mockBuild();
        AbstractBuild baseline = mockBuild();

        when(baseline.getPreviousBuild()).thenReturn(noResult1);
        when(noResult1.getPreviousBuild()).thenReturn(withFailureResult);
        when(withFailureResult.getPreviousBuild()).thenReturn(noResult2);
        when(noResult2.getPreviousBuild()).thenReturn(withSuccessResult);

        BuildResult failureResult = createFailureResult(withFailureResult);
View Full Code Here


     * @throws Exception the exception
     */
    @SuppressWarnings("rawtypes")
    @Test
    public void testHasNoReferenceResult() throws Exception {
        AbstractBuild withSuccessResultAndSuccessfulBuild = mockBuild();
        AbstractBuild withSuccessResult = mockBuild(Result.ABORTED);
        AbstractBuild noResult2 = mockBuild();
        AbstractBuild withFailureResult = mockBuild();
        AbstractBuild noResult1 = mockBuild();
        AbstractBuild baseline = mockBuild();

        when(baseline.getPreviousBuild()).thenReturn(noResult1);
        when(noResult1.getPreviousBuild()).thenReturn(withFailureResult);
        when(withFailureResult.getPreviousBuild()).thenReturn(noResult2);
        when(noResult2.getPreviousBuild()).thenReturn(withSuccessResult);
        when(withSuccessResult.getPreviousBuild()).thenReturn(withSuccessResultAndSuccessfulBuild);

View Full Code Here

     * and history is NOT configured to use only stable builds as reference builds.
     */
    @SuppressWarnings("rawtypes")
    @Test
    public void testUsesUnstableBuildAsReferenceBuildWhenConfigured() {
        AbstractBuild unstableBuild = mockBuild(Result.UNSTABLE);
        AbstractBuild stableBuild = mockBuild(Result.SUCCESS);
        AbstractBuild baseline = mockBuild();

        when(baseline.getPreviousBuild()).thenReturn(unstableBuild);
        when(unstableBuild.getPreviousBuild()).thenReturn(stableBuild);

        createSuccessfulResult(unstableBuild);
        createSuccessfulResult(stableBuild);

View Full Code Here

     * build is unstable and history IS configured to use only stable builds as reference builds.
     */
    @SuppressWarnings("rawtypes")
    @Test
    public void testUsesStableBuildAsReferenceBuildWhenConfigured() {
        AbstractBuild unstableBuild = mockBuild(Result.UNSTABLE);
        AbstractBuild stableBuild = mockBuild(Result.SUCCESS);
        AbstractBuild baseline = mockBuild();

        when(baseline.getPreviousBuild()).thenReturn(unstableBuild);
        when(unstableBuild.getPreviousBuild()).thenReturn(stableBuild);

        createSuccessfulResult(unstableBuild);
        createSuccessfulResult(stableBuild);

View Full Code Here

        }

        Future<? extends AbstractBuild> f = job.scheduleBuild2(0, new CLICause(), a);
        if (!syncreturn 0;

        AbstractBuild b = f.get();    // wait for the completion
        stdout.println("Completed "+b.getFullDisplayName()+" : "+b.getResult());
        return b.getResult().ordinal;
    }
View Full Code Here

     *     then we want to return N+1.
     * </ol>
     */
    @Override
    public int getNextBuildNumber() {
        AbstractBuild lb = getParent().getLastBuild();
        if(lb==null)    return 0;
       

        int n=lb.getNumber();
        if(!lb.isBuilding())    n++;

        lb = getLastBuild();
        if(lb!=null)
            n = Math.max(n,lb.getNumber()+1);

        return n;
    }
View Full Code Here

        project.getBuildersList().add(new SleepBuilder(2000));
        server.waitForCommand(GERRIT_STREAM_EVENTS, 2000);
        ManualPatchsetCreated firstEvent = Setup.createManualPatchsetCreated();
        AtomicReference<AbstractBuild> firstBuildRef = TestUtils.getFutureBuildToStart(firstEvent);
        gerritServer.triggerEvent(firstEvent);
        AbstractBuild firstBuild = TestUtils.waitForBuildToStart(firstBuildRef);
        PatchsetCreated secondEvent = Setup.createPatchsetCreated();
        if (null != secondEvent.getPatchSet()) {
            secondEvent.getPatchSet().setNumber("2");
        }
        gerritServer.triggerEvent(secondEvent);
        TestUtils.waitForBuilds(project, 2);
        assertEquals(2, project.getLastCompletedBuild().getNumber());
        assertSame(Result.ABORTED, firstBuild.getResult());
        assertSame(Result.ABORTED, project.getFirstBuild().getResult());
        assertSame(Result.SUCCESS, project.getLastBuild().getResult());
    }
View Full Code Here

        project.getBuildersList().add(new SleepBuilder(2000));
        server.waitForCommand(GERRIT_STREAM_EVENTS, 2000);
        ManualPatchsetCreated firstEvent = Setup.createManualPatchsetCreated();
        AtomicReference<AbstractBuild> firstBuildRef = TestUtils.getFutureBuildToStart(firstEvent);
        gerritServer.triggerEvent(firstEvent);
        AbstractBuild firstBuild = TestUtils.waitForBuildToStart(firstBuildRef);
        PatchsetCreated secondEvent = Setup.createPatchsetCreated();
        if (null != secondEvent.getPatchSet()) {
            secondEvent.getPatchSet().setNumber("2");
        }
        gerritServer.triggerEvent(secondEvent);
        TestUtils.waitForBuilds(project, 2);
        assertEquals(2, project.getLastCompletedBuild().getNumber());
        assertSame(Result.SUCCESS, firstBuild.getResult());
        assertSame(Result.SUCCESS, project.getFirstBuild().getResult());
        assertSame(Result.SUCCESS, project.getLastBuild().getResult());
    }
View Full Code Here

     * @return an entry with the parameters.
     */
    public static MemoryImprint.Entry createAndSetupMemoryImprintEntry(GerritTrigger trigger, Result result) {
        AbstractProject project = mock(AbstractProject.class);
        when(project.getTrigger(GerritTrigger.class)).thenReturn(trigger);
        AbstractBuild build = mock(AbstractBuild.class);
        when(build.getResult()).thenReturn(result);
        return createImprintEntry(project, build);
    }
View Full Code Here

     * @throws java.io.IOException if so.
     * @throws InterruptedException if so.
     */
    public static AbstractBuild createBuild(AbstractProject project, TaskListener taskListener, EnvVars env)
            throws IOException, InterruptedException {
        AbstractBuild build = mock(AbstractBuild.class);
        when(build.getUrl()).thenReturn("test/");
        when(build.getProject()).thenReturn(project);
        when(build.getEnvironment(taskListener)).thenReturn(env);
        return build;
    }
View Full Code Here

TOP

Related Classes of hudson.model.AbstractBuild

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.