Package hudson.model

Examples of hudson.model.AbstractBuild


    @Test
    public void testGetContent_whenBuildIsBuildingThenStatusShouldBeBuilding()
        throws Exception {
        // Test for HUDSON-953
        AbstractBuild build = mock(AbstractBuild.class);
        when(build.isBuilding()).thenReturn(true);

        String content = new BuildStatusContent().evaluate(build, StreamTaskListener.fromStdout(), BuildStatusContent.MACRO_NAME);

        assertEquals("Building", content);
    }
View Full Code Here


    }
   
    @Test
    public void testGetContent_shouldGetNoContentSinceUnstableBuildIfNoPreviousBuild()
            throws Exception {
        AbstractBuild build = mock(AbstractBuild.class);

        String contentStr = content.evaluate(build, listener, ChangesSinceLastUnstableBuildContent.MACRO_NAME);

        assertEquals("", contentStr);
    }
View Full Code Here

    }

    @Test
    public void testGetContent_shouldGetPreviousBuildFailures()
            throws Exception {
        AbstractBuild failureBuild = createBuild(Result.FAILURE, 41, "Changes for a failed build.");

        AbstractBuild currentBuild = createBuild(Result.SUCCESS, 42, "Changes for a successful build.");
        when(currentBuild.getPreviousBuild()).thenReturn(failureBuild);
        when(failureBuild.getNextBuild()).thenReturn(currentBuild);

        String contentStr = content.evaluate(currentBuild, listener, ChangesSinceLastUnstableBuildContent.MACRO_NAME);

        assertEquals("Changes for Build #41\n"
View Full Code Here

    @Test
    public void testGetContent_whenReverseOrderIsTrueShouldReverseOrderOfChanges()
            throws Exception {
        content.reverse = true;

        AbstractBuild failureBuild = createBuild(Result.FAILURE, 41, "Changes for a failed build.");

        AbstractBuild currentBuild = createBuild(Result.SUCCESS, 42, "Changes for a successful build.");
        when(currentBuild.getPreviousBuild()).thenReturn(failureBuild);
        when(failureBuild.getNextBuild()).thenReturn(currentBuild);

        String contentStr = content.evaluate(currentBuild, listener, ChangesSinceLastUnstableBuildContent.MACRO_NAME);

        assertEquals("Changes for Build #42\n" + "[Ash Lux] Changes for a successful build.\n" + "\n" + "\n"
View Full Code Here

    @Test
    public void testGetContent_shouldGetPreviousBuildsThatArentUnstable_HUDSON3519()
            throws Exception {
        // Test for HUDSON-3519

        AbstractBuild successfulBuild = createBuild(Result.SUCCESS, 2, "Changes for a successful build.");

        AbstractBuild unstableBuild = createBuild(Result.UNSTABLE, 3, "Changes for an unstable build.");
        when(unstableBuild.getPreviousBuild()).thenReturn(successfulBuild);
        when(successfulBuild.getNextBuild()).thenReturn(unstableBuild);

        AbstractBuild abortedBuild = createBuild(Result.ABORTED, 4, "Changes for an aborted build.");
        when(abortedBuild.getPreviousBuild()).thenReturn(unstableBuild);
        when(unstableBuild.getNextBuild()).thenReturn(abortedBuild);

        AbstractBuild failureBuild = createBuild(Result.FAILURE, 5, "Changes for a failed build.");
        when(failureBuild.getPreviousBuild()).thenReturn(abortedBuild);
        when(abortedBuild.getNextBuild()).thenReturn(failureBuild);

        AbstractBuild notBuiltBuild = createBuild(Result.NOT_BUILT, 6, "Changes for a not-built build.");
        when(notBuiltBuild.getPreviousBuild()).thenReturn(failureBuild);
        when(failureBuild.getNextBuild()).thenReturn(notBuiltBuild);

        AbstractBuild currentBuild = createBuild(Result.UNSTABLE, 7, "Changes for an unstable build.");
        when(currentBuild.getPreviousBuild()).thenReturn(notBuiltBuild);
        when(notBuiltBuild.getNextBuild()).thenReturn(currentBuild);

        String contentStr = content.evaluate(currentBuild, listener, ChangesSinceLastUnstableBuildContent.MACRO_NAME);

        assertEquals(
View Full Code Here

    @Test
    public void testShouldPrintDate()
            throws Exception{
        content.changesFormat = "%d";

        AbstractBuild failureBuild = createBuild(Result.FAILURE, 41, "Changes for a failed build.");

        AbstractBuild currentBuild = createBuild(Result.SUCCESS, 42, "Changes for a successful build.");
        when(currentBuild.getPreviousBuild()).thenReturn(failureBuild);
        when(failureBuild.getNextBuild()).thenReturn(currentBuild);

        String contentStr = content.evaluate(currentBuild, listener, ChangesSinceLastUnstableBuildContent.MACRO_NAME);

        Assert.assertEquals("Changes for Build #41\n" + "Oct 21, 2013 7:39:00 PM\n" + "Changes for Build #42\n" + "Oct 21, 2013 7:39:00 PM\n", contentStr);
View Full Code Here

    @Test
    public void testShouldPrintRevision()
            throws Exception {
        content.changesFormat = "%r";

        AbstractBuild failureBuild = createBuild(Result.FAILURE, 41, "Changes for a failed build.");

        AbstractBuild currentBuild = createBuild(Result.SUCCESS, 42, "Changes for a successful build.");
        when(currentBuild.getPreviousBuild()).thenReturn(failureBuild);
        when(failureBuild.getNextBuild()).thenReturn(currentBuild);

        String contentStr = content.evaluate(currentBuild, listener, ChangesSinceLastUnstableBuildContent.MACRO_NAME);

        Assert.assertEquals("Changes for Build #41\n" + "REVISION\n" + "Changes for Build #42\n" + "REVISION\n", contentStr);
View Full Code Here

    @Test
    public void testShouldPrintPath()
            throws Exception {
        content.changesFormat = "%p";

        AbstractBuild failureBuild = createBuild(Result.FAILURE, 41, "Changes for a failed build.");

        AbstractBuild currentBuild = createBuild(Result.SUCCESS, 42, "Changes for a successful build.");
        when(currentBuild.getPreviousBuild()).thenReturn(failureBuild);
        when(failureBuild.getNextBuild()).thenReturn(currentBuild);

        String contentStr = content.evaluate(currentBuild, listener, ChangesSinceLastUnstableBuildContent.MACRO_NAME);

        Assert.assertEquals("Changes for Build #41\n" + "\tPATH1\n" + "\tPATH2\n" + "\tPATH3\n" + "\n"
View Full Code Here

    @Test
    public void testWhenShowPathsIsTrueShouldPrintPath()
            throws Exception{
        content.showPaths = true;

        AbstractBuild failureBuild = createBuild(Result.FAILURE, 41, "Changes for a failed build.");

        AbstractBuild currentBuild = createBuild(Result.SUCCESS, 42, "Changes for a successful build.");
        when(currentBuild.getPreviousBuild()).thenReturn(failureBuild);
        when(failureBuild.getNextBuild()).thenReturn(currentBuild);

        String contentStr = content.evaluate(currentBuild, listener, ChangesSinceLastUnstableBuildContent.MACRO_NAME);

        Assert.assertEquals("Changes for Build #41\n" + "[Ash Lux] Changes for a failed build.\n" + "\tPATH1\n"
View Full Code Here

            throws Exception {
        content.regex = "<defectId>(DEFECT-[0-9]+)</defectId><message>(.*)</message>";
        content.replace = "[$1] $2";
        content.changesFormat = "%m\\n";

        AbstractBuild failureBuild = createBuild(Result.FAILURE, 41, "<defectId>DEFECT-666</defectId><message>Changes for a failed build.</message>");

        AbstractBuild currentBuild = createBuild(Result.SUCCESS, 42, "<defectId>DEFECT-666</defectId><message>Changes for a successful build.</message>");
        when(currentBuild.getPreviousBuild()).thenReturn(failureBuild);
        when(failureBuild.getNextBuild()).thenReturn(currentBuild);

        String contentStr = content.evaluate(currentBuild, listener, ChangesSinceLastUnstableBuildContent.MACRO_NAME);

        assertEquals("Changes for Build #41\n"
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.