Examples of AbstractBuild


Examples of hudson.model.AbstractBuild

    }
   
    @Test
    public void testShouldPrintDefaultMessageWhenNoChanges()
            throws Exception {
        AbstractBuild failureBuild = createBuild(Result.FAILURE, 41, "[DEFECT-666] Changes for a failed build.");

        AbstractBuild currentBuild = createBuildWithNoChanges(Result.SUCCESS, 42);
        when(currentBuild.getPreviousBuild()).thenReturn(failureBuild);
        when(failureBuild.getNextBuild()).thenReturn(currentBuild);

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

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

Examples of hudson.model.AbstractBuild

    @Test
    public void testShouldPrintMessageWhenNoChanges()
            throws Exception {
        content.def = "another default message\n";
        AbstractBuild failureBuild = createBuild(Result.FAILURE, 41, "[DEFECT-666] Changes for a failed build.");

        AbstractBuild currentBuild = createBuildWithNoChanges(Result.SUCCESS, 42);
        when(currentBuild.getPreviousBuild()).thenReturn(failureBuild);
        when(failureBuild.getNextBuild()).thenReturn(currentBuild);

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

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

Examples of hudson.model.AbstractBuild

                + "another default message\n"
                + "\n", contentStr);
    }
   
    private AbstractBuild createBuildWithNoChanges(Result result, int buildNumber) {
        AbstractBuild build = mock(AbstractBuild.class);
        when(build.getResult()).thenReturn(result);
        ChangeLogSet changes1 = createEmptyChangeLog();
        when(build.getChangeSet()).thenReturn(changes1);
        when(build.getNumber()).thenReturn(buildNumber);

        return build;
    }
View Full Code Here

Examples of hudson.model.AbstractBuild

        return changes;
    }

    private AbstractBuild createBuild(Result result, int buildNumber, String message) {
        AbstractBuild build = mock(AbstractBuild.class);
        when(build.getResult()).thenReturn(result);
        ChangeLogSet changes1 = createChangeLog(message);
        when(build.getChangeSet()).thenReturn(changes1);
        when(build.getNumber()).thenReturn(buildNumber);

        return build;
    }
View Full Code Here

Examples of hudson.model.AbstractBuild

    @Test
    public void testGetContent_emptyBuildLogShouldStayEmpty()
            throws Exception {

        AbstractBuild build = mock(AbstractBuild.class);
        when(build.getLogReader()).thenReturn(new StringReader(""));

        buildLogExcerptContent.start = "START";
        buildLogExcerptContent.end = "END";

        final String result = buildLogExcerptContent.evaluate(build, listener, BuildLogExcerptContent.MACRO_NAME);
View Full Code Here

Examples of hudson.model.AbstractBuild

    @Test
    public void testGetContent_simpleStartEndTags()
            throws Exception {

        AbstractBuild build = mock(AbstractBuild.class);

        when(build.getLogReader()).thenReturn(new StringReader("1\n2\n3\n4\n5\nSTART\n7\n8\n9\nEND\n10\n11\n12\n"));

        buildLogExcerptContent.start = "START";
        buildLogExcerptContent.end = "END";

        final String result = buildLogExcerptContent.evaluate(build, listener, BuildLogExcerptContent.MACRO_NAME);
View Full Code Here

Examples of hudson.model.AbstractBuild

    }

    @Test
    public void testGetContent_regexpStartEndTags()
            throws Exception {
        AbstractBuild build = mock(AbstractBuild.class);
        when(build.getLogReader()).thenReturn(new StringReader("1\n2\n3\n4\n5\nTEST STARTED\n7\n8\n9\nTEST STOPED\n10\n11\n12\n"));

        buildLogExcerptContent.start = ".*START.*";
        buildLogExcerptContent.end = ".*STOP.*";

        final String result = buildLogExcerptContent.evaluate(build, listener, BuildLogExcerptContent.MACRO_NAME);
View Full Code Here

Examples of hudson.model.AbstractBuild

                            return outer;
                        }

                        public void run() {
                            WorkUnitContext wuc = Executor.currentExecutor().getCurrentWorkUnit().context;
                            AbstractBuild b = (AbstractBuild)wuc.getPrimaryWorkUnit().getExecutable();
                            try {
                                b.setDescription("I was here");
                            } catch (IOException e) {
                                e.printStackTrace();
                            }
                        }
View Full Code Here

Examples of hudson.model.AbstractBuild

     *     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

Examples of hudson.model.AbstractBuild

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

        // TODO: should we abort the build if the CLI is cancelled?
        AbstractBuild b = f.get();    // wait for the completion
        stdout.println("Completed "+b.getFullDisplayName()+" : "+b.getResult());
        return b.getResult().ordinal;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.