Search in sources :

Example 6 with FetchPluggableArtifactBuilder

use of com.thoughtworks.go.domain.builder.FetchPluggableArtifactBuilder in project gocd by gocd.

the class FetchTaskBuilderTest method FetchPluggableArtifactTask_shouldUseCorrectStageCounterWhenFetchingFromSamePipelineAndStageThatHasBeenRun.

@Test
public void FetchPluggableArtifactTask_shouldUseCorrectStageCounterWhenFetchingFromSamePipelineAndStageThatHasBeenRun() {
    FetchPluggableArtifactTask fetchTask = new FetchPluggableArtifactTask(new CaseInsensitiveString("uppest_stream"), new CaseInsensitiveString("uppest-stage1"), new CaseInsensitiveString("uppest-job1"), "installer");
    Pipeline pipeline = pipelineWithStage("uppest_stream", 1, "label-1", "uppest-stage1", 2);
    FetchPluggableArtifactBuilder builder = (FetchPluggableArtifactBuilder) fetchTaskBuilder.createBuilder(builderFactory, fetchTask, pipeline, resolver);
    assertThat(builder.getJobIdentifier(), Matchers.is(new JobIdentifier("uppest_stream", 1, "label-1", "uppest-stage1", "2", "uppest-job1", 0L)));
}
Also used : FetchPluggableArtifactBuilder(com.thoughtworks.go.domain.builder.FetchPluggableArtifactBuilder) Test(org.junit.Test)

Example 7 with FetchPluggableArtifactBuilder

use of com.thoughtworks.go.domain.builder.FetchPluggableArtifactBuilder in project gocd by gocd.

the class FetchTaskBuilderTest method FetchPluggableArtifactTask_shouldGetTheRightDestAndJobLocatorOnAgent.

@Test
public void FetchPluggableArtifactTask_shouldGetTheRightDestAndJobLocatorOnAgent() {
    Pipeline pipeline = pipelineWithDepencencyMaterial("cruise", "uppest_stream", 1, "10", "uppest_stage1", 2);
    FetchPluggableArtifactTask fetchTask = new FetchPluggableArtifactTask(new CaseInsensitiveString("uppest_stream"), new CaseInsensitiveString("uppest-stage1"), new CaseInsensitiveString("uppest-job1"), "installer");
    FetchPluggableArtifactBuilder builder = (FetchPluggableArtifactBuilder) fetchTaskBuilder.createBuilder(builderFactory, fetchTask, pipeline, resolver);
    assertThat(builder.getJobIdentifier().buildLocatorForDisplay(), is("uppest_stream/10/uppest-stage1/latest/uppest-job1"));
}
Also used : FetchPluggableArtifactBuilder(com.thoughtworks.go.domain.builder.FetchPluggableArtifactBuilder) Test(org.junit.Test)

Example 8 with FetchPluggableArtifactBuilder

use of com.thoughtworks.go.domain.builder.FetchPluggableArtifactBuilder in project gocd by gocd.

the class FetchTaskBuilderTest method FetchPluggableArtifactTask_shouldNormalizeDestOnAgent.

@Test
public void FetchPluggableArtifactTask_shouldNormalizeDestOnAgent() {
    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);
    final FileHandler expectedHandler = new FileHandler(new File("pipelines/cruise/cd.go.s3.json"), PLUGGABLE_ARTIFACT_METADATA_FOLDER + "/cd.go.s3.json");
    assertThat(builder.getHandler(), is(expectedHandler));
}
Also used : FetchPluggableArtifactBuilder(com.thoughtworks.go.domain.builder.FetchPluggableArtifactBuilder) File(java.io.File) Test(org.junit.Test)

Example 9 with FetchPluggableArtifactBuilder

use of com.thoughtworks.go.domain.builder.FetchPluggableArtifactBuilder in project gocd by gocd.

the class FetchTaskBuilderTest method FetchPluggableArtifactTask_shouldUseNameAndLabelFromPipelineWhenPipelineNameOfTaskIsEmpty.

@Test
public void FetchPluggableArtifactTask_shouldUseNameAndLabelFromPipelineWhenPipelineNameOfTaskIsEmpty() {
    final PipelineConfig cruise = goConfigService.getCurrentConfig().pipelineConfigByName(new CaseInsensitiveString("cruise"));
    cruise.getStage("stage").jobConfigByConfigName("job").artifactConfigs().add(new PluggableArtifactConfig("installer", "s3"));
    FetchPluggableArtifactTask fetchTask = new FetchPluggableArtifactTask(null, new CaseInsensitiveString("stage"), new CaseInsensitiveString("job"), "installer");
    Pipeline pipeline = pipeline(LABEL);
    FetchPluggableArtifactBuilder builder = (FetchPluggableArtifactBuilder) fetchTaskBuilder.createBuilder(builderFactory, fetchTask, pipeline, resolver);
    assertThat(builder.getJobIdentifier().getPipelineName(), is("cruise"));
    assertThat(builder.getJobIdentifier().getPipelineLabel(), is(LABEL));
}
Also used : FetchPluggableArtifactBuilder(com.thoughtworks.go.domain.builder.FetchPluggableArtifactBuilder) Test(org.junit.Test)

Example 10 with FetchPluggableArtifactBuilder

use of com.thoughtworks.go.domain.builder.FetchPluggableArtifactBuilder in project gocd by gocd.

the class FetchTaskBuilderTest method FetchPluggableArtifactTask_shouldUsePipelineCounterWhenFetchingArtifactFromDependentPipeline.

@Test
public void FetchPluggableArtifactTask_shouldUsePipelineCounterWhenFetchingArtifactFromDependentPipeline() {
    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.metadataFileLocator(), is("uppest_stream/1/uppest-stage1/2/uppest-job1/cd.go.s3.json"));
}
Also used : FetchPluggableArtifactBuilder(com.thoughtworks.go.domain.builder.FetchPluggableArtifactBuilder) Test(org.junit.Test)

Aggregations

FetchPluggableArtifactBuilder (com.thoughtworks.go.domain.builder.FetchPluggableArtifactBuilder)10 Test (org.junit.Test)9 File (java.io.File)2 DependencyMaterialRevision (com.thoughtworks.go.domain.materials.dependency.DependencyMaterialRevision)1