use of com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig 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