Search in sources :

Example 1 with StubGoPublisher

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

the class BuildersTest method shouldNotCancelAnythingIfAllBuildersHaveRun.

@Test
public void shouldNotCancelAnythingIfAllBuildersHaveRun() throws Exception {
    EnvironmentVariableContext environmentVariableContext = new EnvironmentVariableContext();
    Builder builder = new StubBuilder(new RunIfConfigs(ANY));
    Builders builders = new Builders(Collections.singletonList(builder), new StubGoPublisher(), null, null, null);
    builders.build(environmentVariableContext, "utf-8");
    builders.cancel(environmentVariableContext, "utf-8");
}
Also used : StubGoPublisher(com.thoughtworks.go.domain.StubGoPublisher) CommandBuilder(com.thoughtworks.go.domain.builder.CommandBuilder) Builder(com.thoughtworks.go.domain.builder.Builder) StubBuilder(com.thoughtworks.go.domain.builder.StubBuilder) RunIfConfigs(com.thoughtworks.go.domain.RunIfConfigs) EnvironmentVariableContext(com.thoughtworks.go.util.command.EnvironmentVariableContext) StubBuilder(com.thoughtworks.go.domain.builder.StubBuilder) Test(org.junit.jupiter.api.Test)

Example 2 with StubGoPublisher

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

the class BuildersTest method shouldNotBuildIfTheJobIsCanceled.

@Test
public void shouldNotBuildIfTheJobIsCanceled() throws Exception {
    StubGoPublisher goPublisher = new StubGoPublisher();
    EnvironmentVariableContext environmentVariableContext = new EnvironmentVariableContext();
    CommandBuilder builder = new CommandBuilder("echo", "hello", new File("."), new RunIfConfigs(FAILED), new com.thoughtworks.go.domain.builder.StubBuilder(), "");
    Builders builders = new Builders(Collections.singletonList(builder), goPublisher, null, null, null);
    builders.setIsCancelled(true);
    builders.build(environmentVariableContext, "utf-8");
    assertThat(goPublisher.getMessage(), is(""));
}
Also used : StubGoPublisher(com.thoughtworks.go.domain.StubGoPublisher) RunIfConfigs(com.thoughtworks.go.domain.RunIfConfigs) StubBuilder(com.thoughtworks.go.domain.builder.StubBuilder) EnvironmentVariableContext(com.thoughtworks.go.util.command.EnvironmentVariableContext) CommandBuilder(com.thoughtworks.go.domain.builder.CommandBuilder) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 3 with StubGoPublisher

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

the class AntTaskBuilderTest method shouldFailWhenTargetDoesNotExist.

@Test
void shouldFailWhenTargetDoesNotExist() {
    String target = "not-exist-target";
    String buildXml = "./build.xml";
    antTask.setBuildFile(buildXml);
    antTask.setTarget(target);
    Builder builder = antTaskBuilder.createBuilder(builderFactory, antTask, ExecTaskBuilderTest.pipelineStub(PIPELINE_LABEL, "."), resolver);
    try {
        builder.build(new StubGoPublisher(), new EnvironmentVariableContext(), taskEntension, null, null, "utf-8");
    } catch (CruiseControlException e) {
        assertThat(e.getMessage()).contains("Build failed. Command ant reported [BUILD FAILED].");
    }
}
Also used : StubGoPublisher(com.thoughtworks.go.domain.StubGoPublisher) CruiseControlException(com.thoughtworks.go.util.command.CruiseControlException) CommandBuilder(com.thoughtworks.go.domain.builder.CommandBuilder) Builder(com.thoughtworks.go.domain.builder.Builder) EnvironmentVariableContext(com.thoughtworks.go.util.command.EnvironmentVariableContext) Test(org.junit.jupiter.api.Test)

Aggregations

StubGoPublisher (com.thoughtworks.go.domain.StubGoPublisher)3 CommandBuilder (com.thoughtworks.go.domain.builder.CommandBuilder)3 EnvironmentVariableContext (com.thoughtworks.go.util.command.EnvironmentVariableContext)3 Test (org.junit.jupiter.api.Test)3 RunIfConfigs (com.thoughtworks.go.domain.RunIfConfigs)2 Builder (com.thoughtworks.go.domain.builder.Builder)2 StubBuilder (com.thoughtworks.go.domain.builder.StubBuilder)2 CruiseControlException (com.thoughtworks.go.util.command.CruiseControlException)1 File (java.io.File)1