use of com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig in project gocd by gocd.
the class PipelineSqlMapDaoIntegrationTest method shouldGenerateGraphForMultipleRunsOfDownstreamPipelinesOfAGivenPipelineNameAndCounter.
@Test
public void shouldGenerateGraphForMultipleRunsOfDownstreamPipelinesOfAGivenPipelineNameAndCounter() throws Exception {
PipelineConfig shine = PipelineMother.twoBuildPlansWithResourcesAndMaterials("shine", "shineStage");
PipelineConfig cruise = PipelineMother.twoBuildPlansWithResourcesAndMaterials("cruise", "cruiseStage");
cruise.materialConfigs().clear();
cruise.addMaterialConfig(new DependencyMaterialConfig(new CaseInsensitiveString("shine"), new CaseInsensitiveString("shineStage")));
Pipeline shineInstance = dbHelper.newPipelineWithAllStagesPassed(shine);
Pipeline cruiseInstance1 = dbHelper.newPipelineWithAllStagesPassed(cruise);
Pipeline cruiseInstance2 = dbHelper.newPipelineWithAllStagesPassed(cruise);
Pipeline cruiseInstance3 = dbHelper.newPipelineWithAllStagesPassed(cruise);
PipelineDependencyGraphOld dependencyGraph = pipelineDao.pipelineGraphByNameAndCounter("shine", 1);
PipelineInstanceModel upstream = dependencyGraph.pipeline();
assertPipelineEquals(shineInstance, upstream);
ensureBuildCauseIsLoadedFor(upstream);
assertThat(dependencyGraph.dependencies().size(), is(3));
assertThat(dependencyGraph.dependencies(), hasPipeline(cruiseInstance1));
assertThat(dependencyGraph.dependencies(), hasPipeline(cruiseInstance2));
assertThat(dependencyGraph.dependencies(), hasPipeline(cruiseInstance3));
}
use of com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig in project gocd by gocd.
the class GoConfigMother method setDependencyOn.
public void setDependencyOn(CruiseConfig cruiseConfig, PipelineConfig pipelineConfig, String dependsOnPipeline, String dependsOnStage) {
PipelineConfig config = cruiseConfig.pipelineConfigByName(pipelineConfig.name());
config.addMaterialConfig(new DependencyMaterialConfig(new CaseInsensitiveString(dependsOnPipeline), new CaseInsensitiveString(dependsOnStage)));
}
use of com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig in project gocd by gocd.
the class BasicCruiseConfigTest method shouldGenerateAMapOfAllPipelinesAndTheirParentDependencies.
@Test
public void shouldGenerateAMapOfAllPipelinesAndTheirParentDependencies() {
/*
* -----+ p2 --> p4
* p1
* -----+ p3
*
* */
PipelineConfig p1 = createPipelineConfig("p1", "s1", "j1");
PipelineConfig p2 = createPipelineConfig("p2", "s2", "j1");
p2.addMaterialConfig(new DependencyMaterialConfig(new CaseInsensitiveString("p1"), new CaseInsensitiveString("s1")));
PipelineConfig p3 = createPipelineConfig("p3", "s3", "j1");
p3.addMaterialConfig(new DependencyMaterialConfig(new CaseInsensitiveString("p1"), new CaseInsensitiveString("s1")));
PipelineConfig p4 = createPipelineConfig("p4", "s4", "j1");
p4.addMaterialConfig(new DependencyMaterialConfig(new CaseInsensitiveString("p2"), new CaseInsensitiveString("s2")));
pipelines.addAll(asList(p4, p2, p1, p3));
Map<String, List<PipelineConfig>> expectedPipelines = cruiseConfig.generatePipelineVsDownstreamMap();
assertThat(expectedPipelines.size(), is(4));
assertThat(expectedPipelines.get("p1"), hasItems(p2, p3));
assertThat(expectedPipelines.get("p2"), hasItems(p4));
assertThat(expectedPipelines.get("p3").isEmpty(), is(true));
assertThat(expectedPipelines.get("p4").isEmpty(), is(true));
}
use of com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig in project gocd by gocd.
the class MergeCruiseConfigTest method shouldGenerateAMapOfAllPipelinesAndTheirParentDependencies_WhenThereAreRemotePipelinesInMap.
@Test
public void shouldGenerateAMapOfAllPipelinesAndTheirParentDependencies_WhenThereAreRemotePipelinesInMap() {
/*
* -----+ p2 --> p4
* p1
* -----+ p3 --> remote-pipe-1
*
* */
PipelineConfig p1 = createPipelineConfig("p1", "s1", "j1");
PipelineConfig p2 = createPipelineConfig("p2", "s2", "j1");
p2.addMaterialConfig(new DependencyMaterialConfig(new CaseInsensitiveString("p1"), new CaseInsensitiveString("s1")));
PipelineConfig p3 = createPipelineConfig("p3", "s3", "j1");
p3.addMaterialConfig(new DependencyMaterialConfig(new CaseInsensitiveString("p1"), new CaseInsensitiveString("s1")));
PipelineConfig p4 = createPipelineConfig("p4", "s4", "j1");
p4.addMaterialConfig(new DependencyMaterialConfig(new CaseInsensitiveString("p2"), new CaseInsensitiveString("s2")));
pipelines.addAll(Arrays.asList(p4, p2, p1, p3));
PipelineConfig remotePipe1 = createPipelineConfig("remote-pipe-1", "s5", "j1");
remotePipe1.addMaterialConfig(new DependencyMaterialConfig(new CaseInsensitiveString("p3"), new CaseInsensitiveString("s3")));
PartialConfig part = new PartialConfig();
part.getGroups().addPipeline("remoteGroup", remotePipe1);
cruiseConfig = new BasicCruiseConfig(new BasicCruiseConfig(pipelines), part);
Map<String, List<PipelineConfig>> expectedPipelines = cruiseConfig.generatePipelineVsDownstreamMap();
assertThat(expectedPipelines.size(), is(5));
assertThat(expectedPipelines.get("p1"), hasItems(p2, p3));
assertThat(expectedPipelines.get("p2"), hasItems(p4));
assertThat(expectedPipelines.get("p3"), hasItems(remotePipe1));
assertThat(expectedPipelines.get("remote-pipe-1").isEmpty(), is(true));
assertThat(expectedPipelines.get("p4").isEmpty(), is(true));
}
use of com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig in project gocd by gocd.
the class MergeCruiseConfigTest method shouldGenerateAMapOfAllPipelinesAndTheirParentDependencies_WhenAllPipelinesInMapAreLocal.
@Test
public void shouldGenerateAMapOfAllPipelinesAndTheirParentDependencies_WhenAllPipelinesInMapAreLocal() {
/*
* -----+ p2 --> p4
* p1
* -----+ p3
*
* */
PipelineConfig p1 = createPipelineConfig("p1", "s1", "j1");
PipelineConfig p2 = createPipelineConfig("p2", "s2", "j1");
p2.addMaterialConfig(new DependencyMaterialConfig(new CaseInsensitiveString("p1"), new CaseInsensitiveString("s1")));
PipelineConfig p3 = createPipelineConfig("p3", "s3", "j1");
p3.addMaterialConfig(new DependencyMaterialConfig(new CaseInsensitiveString("p1"), new CaseInsensitiveString("s1")));
PipelineConfig p4 = createPipelineConfig("p4", "s4", "j1");
p4.addMaterialConfig(new DependencyMaterialConfig(new CaseInsensitiveString("p2"), new CaseInsensitiveString("s2")));
pipelines.addAll(Arrays.asList(p4, p2, p1, p3));
cruiseConfig = new BasicCruiseConfig(new BasicCruiseConfig(pipelines), PartialConfigMother.withPipelineInGroup("remote-pipe-1", "remote_group"));
Map<String, List<PipelineConfig>> expectedPipelines = cruiseConfig.generatePipelineVsDownstreamMap();
assertThat(expectedPipelines.size(), is(5));
assertThat(expectedPipelines.get("p1"), hasItems(p2, p3));
assertThat(expectedPipelines.get("p2"), hasItems(p4));
assertThat(expectedPipelines.get("p3").isEmpty(), is(true));
assertThat(expectedPipelines.get("p4").isEmpty(), is(true));
assertThat(expectedPipelines.get("remote-pipe-1").isEmpty(), is(true));
}
Aggregations