use of com.thoughtworks.go.domain.builder.FetchPluggableArtifactBuilder in project gocd by gocd.
the class FetchTaskBuilderTest method FetchPluggableArtifactTask_shouldFindStageCounterFromDependenciesWhenPipelineNameIsDifferent.
@Test
public void FetchPluggableArtifactTask_shouldFindStageCounterFromDependenciesWhenPipelineNameIsDifferent() {
FetchPluggableArtifactTask fetchTask = new FetchPluggableArtifactTask(new CaseInsensitiveString("uppest_stream"), new CaseInsensitiveString("uppest-stage1"), new CaseInsensitiveString("uppest-job1"), "installer");
Pipeline pipeline = pipelineWithDepencencyMaterial("cruise", "uppest_stream", 1, "label-1", "uppest-stage1", 2);
FetchPluggableArtifactBuilder builder = (FetchPluggableArtifactBuilder) fetchTaskBuilder.createBuilder(builderFactory, fetchTask, pipeline, resolver);
assertThat(builder.getJobIdentifier().getStageCounter(), is("2"));
}
use of com.thoughtworks.go.domain.builder.FetchPluggableArtifactBuilder in project gocd by gocd.
the class FetchTaskBuilderTest method FetchPluggableArtifactTask_shouldFetchFromCorrectAncestorStageInstance_InCaseOfLinerDependency.
@Test
public void FetchPluggableArtifactTask_shouldFetchFromCorrectAncestorStageInstance_InCaseOfLinerDependency() {
FetchPluggableArtifactTask fetchTask = new FetchPluggableArtifactTask(new CaseInsensitiveString("uppest_stream/upstream/downstream"), new CaseInsensitiveString("uppest-stage1"), new CaseInsensitiveString("uppest-job1"), "installer");
Pipeline pipeline = pipelineWithDepencencyMaterial("downest", "downstream", 1, "down-1", "stage", 2);
DependencyMaterialRevision revisionOfDown = DependencyMaterialRevision.create("downstream/1/stage/2", "down-1");
when(resolver.buildCauseFor(revisionOfDown.getPipelineName(), revisionOfDown.getPipelineCounter())).thenReturn(pipelineWithDepencencyMaterial("downstream", "upstream", 5, "up-5", "stage", 3).getBuildCause());
DependencyMaterialRevision revisionOfUp = DependencyMaterialRevision.create("upstream/5/stage/3", "up-5");
when(resolver.buildCauseFor(revisionOfUp.getPipelineName(), revisionOfUp.getPipelineCounter())).thenReturn(pipelineWithDepencencyMaterial("upstream", "uppest_stream", 3, "uppest-3", "uppest-stage1", 4).getBuildCause());
FetchPluggableArtifactBuilder builder = (FetchPluggableArtifactBuilder) 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_stream", 3, "uppest-3", "uppest-stage1", "4", "uppest-job1", 0l)));
}
use of com.thoughtworks.go.domain.builder.FetchPluggableArtifactBuilder in project gocd by gocd.
the class FetchTaskBuilderTest method FetchPluggableArtifactTask_shouldUseCorrectStageCounterWhenFetchingFromDependencyStage.
@Test
public void FetchPluggableArtifactTask_shouldUseCorrectStageCounterWhenFetchingFromDependencyStage() {
FetchPluggableArtifactTask fetchTask = new FetchPluggableArtifactTask(new CaseInsensitiveString("uppest_stream"), new CaseInsensitiveString("uppest-stage1"), new CaseInsensitiveString("uppest-job1"), "installer");
Pipeline pipeline = pipelineWithDepencencyMaterial("cruise", "uppest_stream", 1, "label-1", "uppest-stage1", 2);
FetchPluggableArtifactBuilder builder = (FetchPluggableArtifactBuilder) fetchTaskBuilder.createBuilder(builderFactory, fetchTask, pipeline, resolver);
assertThat(builder.getJobIdentifier(), is(new JobIdentifier("uppest_stream", 1, "label-1", "uppest-stage1", "2", "uppest-job1", 0L)));
}
use of com.thoughtworks.go.domain.builder.FetchPluggableArtifactBuilder in project gocd by gocd.
the class FetchTaskBuilder method createPluggableFetchTaskBuilder.
private Builder createPluggableFetchTaskBuilder(FetchPluggableArtifactTask task, Pipeline pipeline, JobIdentifier fetchFrom, Builder cancelBuilder, ChecksumFileHandler checksumHandler) {
final ArtifactStore artifactStore = getArtifactStoreFor(task, fetchFrom);
final String fileName = format("%s.json", artifactStore.getPluginId());
final String metadataFileLocationOnServer = format("%s/%s", PLUGGABLE_ARTIFACT_METADATA_FOLDER, fileName);
final File metadataFileDest = task.artifactDest(pipeline.getName(), fileName);
return new FetchPluggableArtifactBuilder(task.getConditions(), cancelBuilder, task.describe(), fetchFrom, artifactStore, task.getConfiguration(), task.getArtifactId(), metadataFileLocationOnServer, metadataFileDest, checksumHandler);
}
use of com.thoughtworks.go.domain.builder.FetchPluggableArtifactBuilder in project gocd by gocd.
the class FetchTaskBuilderTest method FetchPluggableArtifactTask_shouldUseLatestStageWhenFetchingFromDifferentStageInDependencyPipeline.
@Test
public void FetchPluggableArtifactTask_shouldUseLatestStageWhenFetchingFromDifferentStageInDependencyPipeline() {
FetchPluggableArtifactTask fetchTask = new FetchPluggableArtifactTask(new CaseInsensitiveString("uppest_stream"), new CaseInsensitiveString("uppest-stage2"), new CaseInsensitiveString("uppest-job2"), "installer");
Pipeline pipeline = pipelineWithDepencencyMaterial("cruise", "uppest_stream", 1, "label-1", "uppest-stage1", 2);
FetchPluggableArtifactBuilder builder = (FetchPluggableArtifactBuilder) fetchTaskBuilder.createBuilder(builderFactory, fetchTask, pipeline, resolver);
assertThat(builder.getJobIdentifier(), is(new JobIdentifier("uppest_stream", 1, "label-1", "uppest-stage2", "latest", "uppest-job2", 0L)));
}
Aggregations