use of com.thoughtworks.go.domain.builder.FetchArtifactBuilder in project gocd by gocd.
the class FetchTaskBuilderTest method shouldUseCorrectStageCounterWhenFetchingFromSamePipelineAndStageThatHasBeenRun.
@Test
public void shouldUseCorrectStageCounterWhenFetchingFromSamePipelineAndStageThatHasBeenRun() {
FetchTask fetchTask = new FetchTask(new CaseInsensitiveString("mingle"), new CaseInsensitiveString("dev"), new CaseInsensitiveString("linux-firefox"), "", "");
Pipeline pipeline = pipelineWithStage("mingle", 1, "label-1", "dev", 2);
FetchArtifactBuilder builder = (FetchArtifactBuilder) fetchTaskBuilder.createBuilder(builderFactory, fetchTask, pipeline, resolver);
assertThat(builder.getJobIdentifier(), Matchers.is(new JobIdentifier("mingle", 1, "label-1", "dev", "2", "linux-firefox", 0L)));
}
use of com.thoughtworks.go.domain.builder.FetchArtifactBuilder in project gocd by gocd.
the class FetchTaskBuilderTest method shouldUseNameAndLabelFromPipelineWhenPipelineNameOfFetchTaskIsEmpty.
@Test
public void shouldUseNameAndLabelFromPipelineWhenPipelineNameOfFetchTaskIsEmpty() {
FetchTask fetchTask = new FetchTask();
fetchTask.setSrcfile("a.txt");
Pipeline pipeline = pipeline(LABEL);
FetchArtifactBuilder builder = (FetchArtifactBuilder) fetchTaskBuilder.createBuilder(builderFactory, fetchTask, pipeline, resolver);
assertThat(builder.getJobIdentifier().getPipelineName(), is("cruise"));
assertThat(builder.getJobIdentifier().getPipelineLabel(), is(LABEL));
}
use of com.thoughtworks.go.domain.builder.FetchArtifactBuilder in project gocd by gocd.
the class FetchTaskBuilderTest method shouldUseLatestStageWhenFetchingFromDifferentStageInDependencyPipeline.
@Test
public void shouldUseLatestStageWhenFetchingFromDifferentStageInDependencyPipeline() {
FetchTask fetchTask = new FetchTask(new CaseInsensitiveString("mingle"), new CaseInsensitiveString("ft"), new CaseInsensitiveString("linux-firefox"), "", "");
Pipeline pipeline = pipelineWithDepencencyMaterial("cruise", "mingle", 1, "label-1", "dev", 2);
FetchArtifactBuilder builder = (FetchArtifactBuilder) fetchTaskBuilder.createBuilder(builderFactory, fetchTask, pipeline, resolver);
assertThat(builder.getJobIdentifier(), is(new JobIdentifier("mingle", 1, "label-1", "ft", "latest", "linux-firefox", 0L)));
}
use of com.thoughtworks.go.domain.builder.FetchArtifactBuilder in project gocd by gocd.
the class FetchTaskBuilderTest method shouldGetTheRightDestAndJobLocatorOnAgent.
@Test
public void shouldGetTheRightDestAndJobLocatorOnAgent() {
Pipeline pipeline = pipelineWithDepencencyMaterial("cruise", "mingle", 1, "label-1", "dev", 2);
FetchTask fetchTask = new FetchTask(new CaseInsensitiveString("mingle"), new CaseInsensitiveString("dev"), new CaseInsensitiveString("one"), "", "dest");
FetchHandler fetchHandler = fetchTaskBuilder.getHandler(fetchTask, pipeline.getName());
FetchArtifactBuilder builder = (FetchArtifactBuilder) fetchTaskBuilder.createBuilder(builderFactory, fetchTask, pipeline, resolver);
assertThat(fetchHandler, is(new FileHandler(new File("pipelines/cruise/dest"), getSrc())));
assertThat(builder.jobLocatorForDisplay(), is("mingle/label-1/dev/2/one"));
}
use of com.thoughtworks.go.domain.builder.FetchArtifactBuilder in project gocd by gocd.
the class FetchTaskBuilderTest method shouldFetchFromCorrectAncestorStageInstance_InCaseOfLinerDependency.
@Test
public void shouldFetchFromCorrectAncestorStageInstance_InCaseOfLinerDependency() {
FetchTask fetchTask = new FetchTask(new CaseInsensitiveString("uppest/up/down"), new CaseInsensitiveString("uppest-stage"), new CaseInsensitiveString("uppest-job"), "src", "dest");
Pipeline pipeline = pipelineWithDepencencyMaterial("downest", "down", 1, "down-1", "down-stage", 2);
DependencyMaterialRevision revisionOfDown = DependencyMaterialRevision.create("down/1/down-stage/2", "down-1");
when(resolver.buildCauseFor(revisionOfDown.getPipelineName(), revisionOfDown.getPipelineCounter())).thenReturn(pipelineWithDepencencyMaterial("down", "up", 5, "up-5", "up-stage", 3).getBuildCause());
DependencyMaterialRevision revisionOfUp = DependencyMaterialRevision.create("up/5/up-stage/3", "up-5");
when(resolver.buildCauseFor(revisionOfUp.getPipelineName(), revisionOfUp.getPipelineCounter())).thenReturn(pipelineWithDepencencyMaterial("up", "uppest", 3, "uppest-3", "uppest-stage", 4).getBuildCause());
FetchArtifactBuilder builder = (FetchArtifactBuilder) fetchTaskBuilder.createBuilder(builderFactory, fetchTask, pipeline, resolver);
verify(resolver).buildCauseFor(revisionOfDown.getPipelineName(), revisionOfDown.getPipelineCounter());
verify(resolver).buildCauseFor(revisionOfUp.getPipelineName(), revisionOfUp.getPipelineCounter());
assertThat(builder.getJobIdentifier(), is(new JobIdentifier("uppest", 3, "uppest-3", "uppest-stage", "4", "uppest-job", 0l)));
}
Aggregations