Package com.groupon.jenkins.dynamic.build

Examples of com.groupon.jenkins.dynamic.build.DynamicBuild


    }

    @Test
    public void should_set_building_status_on_commit() throws IOException {
        DynamicBuild build = newBuild().get();
        commitStatusUpdateListener.onStarted(build, null);

        verify(githubRepository).createCommitStatus(build.getSha(), GHCommitState.PENDING, build.getFullUrl(), "Build in progress");
    }
View Full Code Here


        verify(githubRepository).createCommitStatus(build.getSha(), GHCommitState.PENDING, build.getFullUrl(), "Build in progress");
    }

    @Test
    public void should_set_success_status_on_commit_if_build_is_successful() throws IOException {
        DynamicBuild build = newBuild().success().get();

        commitStatusUpdateListener.onCompleted(build, BuildListenerFactory.newBuildListener().get());
        verify(githubRepository).createCommitStatus(build.getSha(), GHCommitState.SUCCESS, build.getFullUrl(), "Success", "DotCi");


    }
View Full Code Here

    }

    @Test
    public void should_set_failure_status_on_commit_if_build_fails() throws IOException {
        DynamicBuild build = newBuild().fail().get();
        commitStatusUpdateListener.onCompleted(build, BuildListenerFactory.newBuildListener().get());
        verify(githubRepository).createCommitStatus(build.getSha(), GHCommitState.FAILURE, build.getFullUrl(), "Failed", "DotCi");
    }
View Full Code Here

        verify(githubRepository).createCommitStatus(build.getSha(), GHCommitState.FAILURE, build.getFullUrl(), "Failed", "DotCi");
    }

    @Test
    public void should_set_failure_status_on_commit_if_build_is_unstable() throws IOException {
        DynamicBuild build = newBuild().unstable().get();
        commitStatusUpdateListener.onCompleted(build,  BuildListenerFactory.newBuildListener().get());
        verify(githubRepository).createCommitStatus(build.getSha(), GHCommitState.FAILURE, build.getFullUrl(), "Unstable", "DotCi");
    }
View Full Code Here

        when(build.getResult()).thenReturn(Result.FAILURE);
        return this;
    }

    public DynamicBuildFactory recovery() {
        DynamicBuild failedPrevBuild = newBuild().fail().get();
        when(build.getPreviousFinishedBuildOfSameBranch(null)).thenReturn(failedPrevBuild);
        return this;
    }
View Full Code Here

        when(build.getResult()).thenReturn(Result.SUCCESS);
        return this;
    }

    public DynamicBuildFactory notRecovery() {
        DynamicBuild successPrevBuild = newBuild().success().get();
        when(build.getPreviousFinishedBuildOfSameBranch(null)).thenReturn(successPrevBuild);
        return this;
    }
View Full Code Here

public class DockerImageBuildTest {

    @Test(expected = InvalidBuildConfigurationException.class)
    public void should_throw_exception_when_dotciyml_is_not_specified() throws IOException, InterruptedException {
        DockerImageBuild dockerImageBuildtype = new DockerImageBuild();
        DynamicBuild dynamicBuild = DynamicBuildFactory.newBuild().get();
        when(dynamicBuild.getGithubRepositoryService().getGHFile(".ci.yml",dynamicBuild.getSha())).thenThrow(FileNotFoundException.class);
        dockerImageBuildtype.runBuild(dynamicBuild, mock(BuildExecutionContext.class), mock(Launcher.class), mock(BuildListener.class));
    }
View Full Code Here

        historyWidget = new BranchHistoryWidgetModel<DbBackedBuild>(project, buildRepo, null);
    }

    @Test
    public void should_not_show_skipped_builds() {
        DynamicBuild unSkippedBuild = newBuild().get();
        DynamicBuild skippedBuild = newBuild().skipped().get();
        when(skippedBuild.isSkipped()).thenReturn(true);
        List<? extends DbBackedBuild> builds = list(skippedBuild, unSkippedBuild);
        when(buildRepo.getLast(project, BranchHistoryWidget.BUILD_COUNT, null)).thenReturn((Iterable<DbBackedBuild>) builds);
        assertEquals(1, Iterables.size(historyWidget.getBaseList()));
        assertEquals(unSkippedBuild, Iterables.getOnlyElement(historyWidget.getBaseList()));
    }
View Full Code Here

        assertEquals(unSkippedBuild, Iterables.getOnlyElement(historyWidget.getBaseList()));
    }

    @Test
    public void should_return_oldest_running_build() {
        DynamicBuild finishedBuild = newBuild().get();
        DynamicBuild finishedBuild2 = newBuild().get();
        DynamicBuild runningBuild = newBuild().building().get();
        DynamicBuild runningBuild2 = newBuild().building().get();
        List<? extends DbBackedBuild> builds = list(finishedBuild, runningBuild, finishedBuild2, runningBuild2);
        String buildId = String.valueOf(runningBuild2.getNumber());
        when(buildRepo.getLast(project, BranchHistoryWidget.BUILD_COUNT, null)).thenReturn((Iterable<DbBackedBuild>) builds);

        assertEquals(buildId, historyWidget.getNextBuildToFetch((Iterable<DbBackedBuild>) builds, adapter).getBuildNumber(adapter));

    }
View Full Code Here

    }

    @Test
    public void should_return_most_recent_build_plus_one() {
        DynamicBuild finishedBuild = newBuild().get();
        DynamicBuild finishedBuild2 = newBuild().get();
        DynamicBuild finishedBuild3 = newBuild().get();
        List<? extends DbBackedBuild> builds = list(finishedBuild, finishedBuild2, finishedBuild3);
        String buildId = String.valueOf(finishedBuild.getNumber() + 1);

        when(buildRepo.getLast(project, BranchHistoryWidget.BUILD_COUNT, null)).thenReturn((Iterable<DbBackedBuild>) builds);
View Full Code Here

TOP

Related Classes of com.groupon.jenkins.dynamic.build.DynamicBuild

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.