use of com.thoughtworks.go.config.BasicCruiseConfig in project gocd by gocd.
the class UnrunStagesPopulatorTest method shouldPopulateUnrunStagesAndConfiguredStagesFromMaterial.
@Test
public void shouldPopulateUnrunStagesAndConfiguredStagesFromMaterial() throws Exception {
/*
git --> p1 --> p2
\
+-> p3
*/
GitMaterial gitMaterial = new GitMaterial("url");
ValueStreamMap graph = new ValueStreamMap(gitMaterial, null, ModificationsMother.aCheckIn("r1"));
Node git_node = graph.getCurrentMaterial();
Node p1_node = graph.addDownstreamNode(new PipelineDependencyNode("p1", "p1"), git_node.getId());
Node p2_node = graph.addDownstreamNode(new PipelineDependencyNode("p2", "p2"), "p1");
Node p3_node = graph.addDownstreamNode(new PipelineDependencyNode("p3", "p3"), git_node.getId());
addRevisions(p1_node);
addRevisions(p3_node);
CruiseConfig cruiseConfig = new BasicCruiseConfig();
String group = "first";
cruiseConfig.addPipeline(group, pipelineConfig("p"));
cruiseConfig.addPipeline(group, pipelineConfig("p1"));
cruiseConfig.addPipeline(group, pipelineConfig("p2"));
cruiseConfig.addPipeline(group, pipelineConfig("p3"));
when(goConfigService.getCurrentConfig()).thenReturn(cruiseConfig);
unrunStagesPopulator.apply(graph);
assertStages(p1_node);
assertStages(p3_node);
assertUnrunPipeline(p2_node, "p2");
}
use of com.thoughtworks.go.config.BasicCruiseConfig in project gocd by gocd.
the class FanInGraphTest method shouldConstructAFaninGraph.
@Test
public void shouldConstructAFaninGraph() throws Exception {
GitMaterialConfig git = new GitMaterialConfig("giturl", "dest");
HgMaterialConfig hg = new HgMaterialConfig("hgurl", "dest");
PipelineConfig p1 = PipelineConfigMother.pipelineConfig("p1", new MaterialConfigs(git));
DependencyMaterialConfig p1Dep = new DependencyMaterialConfig(p1.name(), p1.get(0).name());
PipelineConfig p2 = PipelineConfigMother.pipelineConfig("p2", new MaterialConfigs(p1Dep));
PipelineConfig p3 = PipelineConfigMother.pipelineConfig("p3", new MaterialConfigs(p1Dep, hg));
DependencyMaterialConfig p2Dep = new DependencyMaterialConfig(p2.name(), p2.get(0).name());
DependencyMaterialConfig p3Dep = new DependencyMaterialConfig(p3.name(), p3.get(0).name());
PipelineConfig p4 = PipelineConfigMother.pipelineConfig("p4", new MaterialConfigs(p2Dep, p3Dep));
CruiseConfig cruiseConfig = new BasicCruiseConfig(new BasicPipelineConfigs(p1, p2, p3, p4));
FanInGraph faninGraph = new FanInGraph(cruiseConfig, p4.name(), null, null, null, null);
List<ScmMaterialConfig> scmMaterialNodes = faninGraph.getScmMaterials();
List<String> scmMaterialUrls = new ArrayList<>();
for (ScmMaterialConfig scmMaterialNode : scmMaterialNodes) {
scmMaterialUrls.add(scmMaterialNode.getUrl().toString());
}
assertThat(scmMaterialUrls.contains("giturl"), is(true));
assertThat(scmMaterialUrls.contains("hgurl"), is(true));
}
Aggregations