use of com.thoughtworks.go.config.remote.RepoConfigOrigin in project gocd by gocd.
the class PipelineConfigTest method shouldReturnTrueWhenOneOfPipelineMaterialsIsTheSameAsConfigOrigin.
@Test
public void shouldReturnTrueWhenOneOfPipelineMaterialsIsTheSameAsConfigOrigin() {
PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfig("pipeline", "stage", "build");
MaterialConfig material = pipelineConfig.materialConfigs().first();
pipelineConfig.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(material, "plugin"), "1233"));
assertThat(pipelineConfig.isConfigOriginSameAsOneOfMaterials(), is(true));
}
use of com.thoughtworks.go.config.remote.RepoConfigOrigin in project gocd by gocd.
the class PipelineGroupsTest method shouldErrorOutIfDuplicatePipelineIsAdded.
@Test
public void shouldErrorOutIfDuplicatePipelineIsAdded() {
PipelineConfig pipeline1 = createPipelineConfig("pipeline1", "stage1");
PipelineConfig pipeline2 = createPipelineConfig("pipeline1", "stage1");
PipelineConfig pipeline3 = createPipelineConfig("pipeline1", "stage1");
PipelineConfig pipeline4 = createPipelineConfig("pipeline1", "stage1");
pipeline3.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(MaterialConfigsMother.gitMaterialConfig(), "plugin"), "rev1"));
pipeline4.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(MaterialConfigsMother.svnMaterialConfig(), "plugin"), "1"));
PipelineConfigs defaultGroup = createGroup("defaultGroup", pipeline1);
PipelineConfigs anotherGroup = createGroup("anotherGroup", pipeline2);
PipelineConfigs thirdGroup = createGroup("thirdGroup", pipeline3);
PipelineConfigs fourthGroup = createGroup("fourthGroup", pipeline4);
PipelineGroups pipelineGroups = new PipelineGroups(defaultGroup, anotherGroup, thirdGroup, fourthGroup);
pipelineGroups.validate(null);
List<String> expectedSources = asList(pipeline1.getOriginDisplayName(), pipeline2.getOriginDisplayName(), pipeline3.getOriginDisplayName(), pipeline4.getOriginDisplayName());
assertDuplicateNameErrorOnPipeline(pipeline1, expectedSources, 3);
assertDuplicateNameErrorOnPipeline(pipeline2, expectedSources, 3);
assertDuplicateNameErrorOnPipeline(pipeline3, expectedSources, 3);
assertDuplicateNameErrorOnPipeline(pipeline4, expectedSources, 3);
}
use of com.thoughtworks.go.config.remote.RepoConfigOrigin in project gocd by gocd.
the class PipelineGroupsTest method shouldGetLocalPartsWhenOriginIsRepo.
@Test
public void shouldGetLocalPartsWhenOriginIsRepo() {
PipelineConfigs defaultGroup = createGroup("defaultGroup", createPipelineConfig("pipeline1", "stage1"));
defaultGroup.setOrigins(new RepoConfigOrigin());
PipelineGroups groups = new PipelineGroups(defaultGroup);
assertThat(groups.getLocal().size(), is(0));
assertThat(groups.getLocal().isEmpty(), is(true));
}
use of com.thoughtworks.go.config.remote.RepoConfigOrigin in project gocd by gocd.
the class BuildCauseTest method shouldNotThrowWhenMaterialAndConfigOriginRevisionMatch_WhenAutoTrigger.
@Test
public void shouldNotThrowWhenMaterialAndConfigOriginRevisionMatch_WhenAutoTrigger() {
SvnMaterial material = MaterialsMother.svnMaterial();
MaterialConfig materialConfig = material.config();
MaterialRevisions first = new MaterialRevisions(new MaterialRevision(material, oneModifiedFile("revision1")));
BuildCause buildCause = BuildCause.createWithModifications(first, "");
buildCause.setMaterialRevisions(first);
PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfigWithStages("pipe1", "build");
pipelineConfig.materialConfigs().clear();
pipelineConfig.materialConfigs().add(materialConfig);
pipelineConfig.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(materialConfig, "plug"), "revision1"));
buildCause.assertPipelineConfigAndMaterialRevisionMatch(pipelineConfig);
}
use of com.thoughtworks.go.config.remote.RepoConfigOrigin in project gocd by gocd.
the class FetchPluggableArtifactTaskTest method validate_shouldNotErrorWhenReferencingFilePipelineFromConfigRepositoryPipeline.
@Test
public void validate_shouldNotErrorWhenReferencingFilePipelineFromConfigRepositoryPipeline() {
uppestStream.getStage("uppest-stage2").jobConfigByConfigName("uppest-job2").artifactConfigs().add(new PluggableArtifactConfig("s3", "cd.go.s3"));
uppestStream.setOrigin(new FileConfigOrigin());
downstream.setOrigin(new RepoConfigOrigin());
FetchPluggableArtifactTask task = new FetchPluggableArtifactTask(new CaseInsensitiveString("uppest_stream/upstream"), new CaseInsensitiveString("uppest-stage2"), new CaseInsensitiveString("uppest-job2"), "s3");
task.validate(ConfigSaveValidationContext.forChain(config, new BasicPipelineConfigs(), downstream, downstream.getStage(new CaseInsensitiveString("stage"))));
assertThat(task.errors().isEmpty(), is(true));
}
Aggregations