Search in sources :

Example 1 with JobResult

use of com.thoughtworks.go.domain.JobResult in project gocd by gocd.

the class Builders method build.

public JobResult build(EnvironmentVariableContext environmentVariableContext) {
    JobResult result = JobResult.Passed;
    for (Builder builder : builders) {
        if (cancelStarted) {
            return JobResult.Cancelled;
        }
        synchronized (this) {
            currentBuilder = builder;
        }
        BuildLogElement buildLogElement = new BuildLogElement();
        try {
            builder.build(buildLogElement, RunIfConfig.fromJobResult(result.toLowerCase()), goPublisher, environmentVariableContext, taskExtension);
        } catch (Exception e) {
            result = JobResult.Failed;
        }
        buildLog.addContent(buildLogElement.getElement());
    }
    synchronized (this) {
        currentBuilder = new NullBuilder();
    }
    if (cancelStarted) {
        return JobResult.Cancelled;
    }
    return result;
}
Also used : BuildLogElement(com.thoughtworks.go.domain.BuildLogElement) JobResult(com.thoughtworks.go.domain.JobResult) Builder(com.thoughtworks.go.domain.builder.Builder) NullBuilder(com.thoughtworks.go.domain.builder.NullBuilder) NullBuilder(com.thoughtworks.go.domain.builder.NullBuilder)

Example 2 with JobResult

use of com.thoughtworks.go.domain.JobResult in project gocd by gocd.

the class BuildResultTypeHandlerCallbackTest method shouldReturnScheduledWhenGivenStringScheduled.

@Test
public void shouldReturnScheduledWhenGivenStringScheduled() throws SQLException {
    context.checking(new Expectations() {

        {
            one(resultGetter).getString();
            will(returnValue(JobResult.Passed.toString()));
        }
    });
    JobResult result = (JobResult) callback.getResult(resultGetter);
    assertThat(result, is(equal(JobResult.Passed)));
}
Also used : Expectations(org.jmock.Expectations) JobResult(com.thoughtworks.go.domain.JobResult) Test(org.junit.Test)

Example 3 with JobResult

use of com.thoughtworks.go.domain.JobResult in project gocd by gocd.

the class BuildRepositoryServiceTest method checkUpdateResult.

private void checkUpdateResult(final String uuid) {
    final JobResult result = JobResult.Passed;
    context.checking(new Expectations() {

        {
            one(scheduleService).jobCompleting(jobIdendifier, result, uuid);
        }
    });
    buildRepositoryService.completing(jobIdendifier, result, uuid);
}
Also used : Expectations(org.jmock.Expectations) JobResult(com.thoughtworks.go.domain.JobResult)

Example 4 with JobResult

use of com.thoughtworks.go.domain.JobResult in project gocd by gocd.

the class GitMaterialUpdaterTest method updateTo.

private void updateTo(GitMaterial material, RevisionContext revisionContext, JobResult expectedResult) {
    BuildSession buildSession = newBuildSession();
    JobResult result = buildSession.build(new GitMaterialUpdater(material).updateTo("working", revisionContext));
    assertThat(buildInfo(), result, is(expectedResult));
}
Also used : JobResult(com.thoughtworks.go.domain.JobResult) BuildSession(com.thoughtworks.go.buildsession.BuildSession) GitMaterialUpdater(com.thoughtworks.go.domain.materials.git.GitMaterialUpdater)

Example 5 with JobResult

use of com.thoughtworks.go.domain.JobResult in project gocd by gocd.

the class BuildSessionBasedTestCase method runBuild.

protected void runBuild(BuildSession buildSession, BuildCommand command, JobResult expectedResult) {
    JobResult result = buildSession.build(command);
    assertThat(buildInfo(), result, is(expectedResult));
}
Also used : JobResult(com.thoughtworks.go.domain.JobResult)

Aggregations

JobResult (com.thoughtworks.go.domain.JobResult)5 Expectations (org.jmock.Expectations)2 BuildSession (com.thoughtworks.go.buildsession.BuildSession)1 BuildLogElement (com.thoughtworks.go.domain.BuildLogElement)1 Builder (com.thoughtworks.go.domain.builder.Builder)1 NullBuilder (com.thoughtworks.go.domain.builder.NullBuilder)1 GitMaterialUpdater (com.thoughtworks.go.domain.materials.git.GitMaterialUpdater)1 Test (org.junit.Test)1