use of com.thoughtworks.go.domain.builder.Builder in project gocd by gocd.
the class AntTaskBuilderTest method expectedBuilder.
private Builder expectedBuilder(AntTask antTask, Builder builderForCancelTask) {
Builder expected = antTaskBuilder.createBuilder(builderFactory, antTask, pipeline, resolver);
expected.setCancelBuilder(builderForCancelTask);
return expected;
}
use of com.thoughtworks.go.domain.builder.Builder in project gocd by gocd.
the class AntTaskBuilderTest method shouldReturnBuilderWithCancelBuilderIfOnCancelDefined.
@Test
public void shouldReturnBuilderWithCancelBuilderIfOnCancelDefined() throws Exception {
ExecTask cancelTask = new ExecTask();
Builder builderForCancelTask = execTaskBuilder.createBuilder(builderFactory, cancelTask, pipeline, resolver);
AntTask antTask = new AntTask();
antTask.setCancelTask(cancelTask);
when(builderFactory.builderFor(cancelTask, pipeline, resolver)).thenReturn(builderForCancelTask);
Builder expected = expectedBuilder(antTask, builderForCancelTask);
Builder actualBuilder = antTaskBuilder.createBuilder(builderFactory, antTask, pipeline, resolver);
assertThat(actualBuilder, is(expected));
}
use of com.thoughtworks.go.domain.builder.Builder in project gocd by gocd.
the class BuilderFactoryTest method shouldCreateABuilderForEachTypeOfTaskWhichExists.
@Test
public void shouldCreateABuilderForEachTypeOfTaskWhichExists() throws Exception {
Pipeline pipeline = PipelineMother.pipeline("pipeline1", StageMother.custom("stage1"));
AntTask antTask = new AntTask();
NantTask nantTask = new NantTask();
RakeTask rakeTask = new RakeTask();
PluggableTask pluggableTask = new PluggableTask();
Builder expectedBuilderForAntTask = myFakeBuilder();
Builder expectedBuilderForNantTask = myFakeBuilder();
Builder expectedBuilderForRakeTask = myFakeBuilder();
Builder expectedBuilderForPluggableTask = myFakeBuilder();
when(antTaskBuilder.createBuilder(builderFactory, antTask, pipeline, pipelineResolver)).thenReturn(expectedBuilderForAntTask);
when(nantTaskBuilder.createBuilder(builderFactory, nantTask, pipeline, pipelineResolver)).thenReturn(expectedBuilderForNantTask);
when(rakeTaskBuilder.createBuilder(builderFactory, rakeTask, pipeline, pipelineResolver)).thenReturn(expectedBuilderForRakeTask);
when(pluggableTaskBuilderCreator.createBuilder(builderFactory, pluggableTask, pipeline, pipelineResolver)).thenReturn(expectedBuilderForPluggableTask);
List<Builder> builders = builderFactory.buildersForTasks(pipeline, listOf(antTask, nantTask, rakeTask, pluggableTask), pipelineResolver);
assertThat(builders.size(), is(4));
assertThat(builders.get(0), is(expectedBuilderForAntTask));
assertThat(builders.get(1), is(expectedBuilderForNantTask));
assertThat(builders.get(2), is(expectedBuilderForRakeTask));
assertThat(builders.get(3), is(expectedBuilderForPluggableTask));
}
use of com.thoughtworks.go.domain.builder.Builder in project gocd by gocd.
the class BuilderFactoryTest method assertBuilderForTask.
private void assertBuilderForTask(Task task, TaskBuilder expectedBuilderToBeUsed) {
Pipeline pipeline = PipelineMother.pipeline("pipeline1", StageMother.custom("stage1"));
Builder expectedBuilder = myFakeBuilder();
when(expectedBuilderToBeUsed.createBuilder(builderFactory, task, pipeline, pipelineResolver)).thenReturn(expectedBuilder);
Builder builder = builderFactory.builderFor(task, pipeline, pipelineResolver);
assertThat(builder, is(expectedBuilder));
}
use of com.thoughtworks.go.domain.builder.Builder in project gocd by gocd.
the class PluggableTaskBuilderCreatorTest method expectedBuilder.
private Builder expectedBuilder(PluggableTask pluggableTask, Builder builderForCancelTask) {
Builder expected = pluggableTaskBuilderCreator.createBuilder(builderFactory, pluggableTask, pipeline, resolver);
expected.setCancelBuilder(builderForCancelTask);
return expected;
}
Aggregations