use of com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig in project gocd by gocd.
the class MaterialConfigsMother method filteredHgMaterialConfig.
public static HgMaterialConfig filteredHgMaterialConfig(String pattern) {
HgMaterialConfig materialConfig = hgMaterialConfig();
materialConfig.setFilter(new Filter(new IgnoredFiles(pattern)));
return materialConfig;
}
use of com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig in project gocd by gocd.
the class MaterialExpansionServiceTest method shouldExpandMaterialForScheduling.
@Test
public void shouldExpandMaterialForScheduling() {
HgMaterialConfig hg = MaterialConfigsMother.hgMaterialConfig();
MaterialConfigs materialConfigs = new MaterialConfigs();
materialExpansionService.expandForScheduling(hg, materialConfigs);
assertThat(materialConfigs.size(), is(1));
assertThat(materialConfigs.get(0), is(hg));
}
use of com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig in project gocd by gocd.
the class AutoBuildCauseTest method shouldReturnPeggedRevisionsForUpstreamMaterialWhenFirstOrderDependencyMaterialIsChanged.
@Test
public void shouldReturnPeggedRevisionsForUpstreamMaterialWhenFirstOrderDependencyMaterialIsChanged() throws Exception {
HgMaterialConfig hg = MaterialConfigsMother.hgMaterialConfig();
PipelineConfig third = PipelineConfigMother.pipelineConfig("third", MaterialConfigsMother.dependencyMaterialConfig("second", "mingle"), new JobConfigs());
PipelineConfig second = PipelineConfigMother.pipelineConfig("second", MaterialConfigsMother.dependencyMaterialConfig("first", "mingle"), new JobConfigs());
PipelineConfig first = PipelineConfigMother.pipelineConfig("first", hg, new JobConfigs());
PipelineConfigDependencyGraph dependencyGraph = new PipelineConfigDependencyGraph(third, new PipelineConfigDependencyGraph(second, new PipelineConfigDependencyGraph(first)), new PipelineConfigDependencyGraph(first));
MaterialRevisions revisions = new MaterialRevisions();
MaterialRevision firstRev = dependencyMaterialRevision("first", 10, "label", "mingle", 1, new Date());
firstRev.markAsNotChanged();
MaterialRevision secondRev = dependencyMaterialRevision("second", 1, "label", "mingle", 1, new Date());
secondRev.markAsChanged();
revisions.addRevision(secondRev);
revisions.addRevision(firstRev);
when(goConfigService.upstreamDependencyGraphOf("third", cruiseConfig)).thenReturn(dependencyGraph);
MaterialRevisions expectedRevisions = new MaterialRevisions();
when(pipelineService.getRevisionsBasedOnDependencies(eq(revisions), eq(cruiseConfig), eq(dependencyGraph.getCurrent().name()))).thenReturn(expectedRevisions);
assertThat(new AutoBuild(goConfigService, pipelineService, "third", new SystemEnvironment(), materialChecker).onModifications(revisions, false, null).getMaterialRevisions(), sameInstance(expectedRevisions));
}
use of com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig in project gocd by gocd.
the class AutoBuildCauseTest method shouldReturnNullIfUpstreamMaterialHasChangedButNoFirstOrderMaterialHas_WithFaninOff.
@Test
public void shouldReturnNullIfUpstreamMaterialHasChangedButNoFirstOrderMaterialHas_WithFaninOff() throws Exception {
HgMaterialConfig hg = MaterialConfigsMother.hgMaterialConfig();
PipelineConfig third = PipelineConfigMother.pipelineConfig("third", MaterialConfigsMother.dependencyMaterialConfig("second", "mingle"), new JobConfigs());
PipelineConfig second = PipelineConfigMother.pipelineConfig("second", MaterialConfigsMother.dependencyMaterialConfig("first", "mingle"), new JobConfigs());
PipelineConfig first = PipelineConfigMother.pipelineConfig("first", hg, new JobConfigs());
PipelineConfigDependencyGraph dependencyGraph = new PipelineConfigDependencyGraph(third, new PipelineConfigDependencyGraph(second, new PipelineConfigDependencyGraph(first)), new PipelineConfigDependencyGraph(first));
MaterialRevisions revisions = new MaterialRevisions();
MaterialRevision firstRev = dependencyMaterialRevision("first", 1, "label", "mingle", 1, new Date());
firstRev.markAsChanged();
MaterialRevision secondRev = dependencyMaterialRevision("second", 1, "label", "mingle", 1, new Date());
secondRev.markAsNotChanged();
revisions.addRevision(secondRev);
revisions.addRevision(firstRev);
when(goConfigService.upstreamDependencyGraphOf("third", cruiseConfig)).thenReturn(dependencyGraph);
when(systemEnvironment.enforceRevisionCompatibilityWithUpstream()).thenReturn(false);
AutoBuild build = new AutoBuild(goConfigService, pipelineService, "third", systemEnvironment, materialChecker);
BuildCause cause = build.onModifications(revisions, false, null);
assertThat(cause, is(nullValue()));
}
use of com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig in project gocd by gocd.
the class PipelineConfigDependencyGraphTest method shouldReturnTheListOfFirstOrderMaterialsIgnoringDestFoldersForScmMaterials.
@Test
public void shouldReturnTheListOfFirstOrderMaterialsIgnoringDestFoldersForScmMaterials() throws Exception {
HgMaterialConfig common1 = MaterialConfigsMother.hgMaterialConfig("hg-url", "one-folder");
HgMaterialConfig common2 = MaterialConfigsMother.hgMaterialConfig("hg-url", "another-folder");
SvnMaterialConfig firstOrderSVNMaterial = MaterialConfigsMother.svnMaterialConfig();
GitMaterialConfig firstOrderGitMaterial = MaterialConfigsMother.gitMaterialConfig("url", "submodule", "branch", false);
P4MaterialConfig firstOrderP4Material = MaterialConfigsMother.p4MaterialConfig();
DependencyMaterialConfig up1DependencyMaterial = new DependencyMaterialConfig(new CaseInsensitiveString("up1"), new CaseInsensitiveString("first"));
DependencyMaterialConfig up2DependencyMaterial = new DependencyMaterialConfig(new CaseInsensitiveString("up2"), new CaseInsensitiveString("first"));
DependencyMaterialConfig uppestDependencyMaterial = new DependencyMaterialConfig(new CaseInsensitiveString("uppest"), new CaseInsensitiveString("first"));
PipelineConfig current = GoConfigMother.createPipelineConfigWithMaterialConfig("current", common1, up1DependencyMaterial, up2DependencyMaterial);
PipelineConfig up1 = GoConfigMother.createPipelineConfigWithMaterialConfig("up1", common2, firstOrderGitMaterial, uppestDependencyMaterial);
PipelineConfig up2 = GoConfigMother.createPipelineConfigWithMaterialConfig("up2", firstOrderSVNMaterial, common2, uppestDependencyMaterial);
PipelineConfig uppest = GoConfigMother.createPipelineConfigWithMaterialConfig("uppest", common1, firstOrderP4Material);
PipelineConfigDependencyGraph uppestGraph = new PipelineConfigDependencyGraph(uppest);
PipelineConfigDependencyGraph up1Graph = new PipelineConfigDependencyGraph(up1, uppestGraph);
PipelineConfigDependencyGraph up2Graph = new PipelineConfigDependencyGraph(up2, uppestGraph);
PipelineConfigDependencyGraph dependencyGraph = new PipelineConfigDependencyGraph(current, up1Graph, up2Graph);
assertThat(dependencyGraph.unsharedMaterialConfigs().size(), is(2));
assertThat(dependencyGraph.unsharedMaterialConfigs().get(0), is(up1DependencyMaterial));
assertThat(dependencyGraph.unsharedMaterialConfigs().get(1), is(up2DependencyMaterial));
assertThat(up1Graph.unsharedMaterialConfigs().size(), is(2));
assertThat(up1Graph.unsharedMaterialConfigs().get(0), is(firstOrderGitMaterial));
assertThat(up1Graph.unsharedMaterialConfigs().get(1), is(uppestDependencyMaterial));
assertThat(up2Graph.unsharedMaterialConfigs().size(), is(2));
assertThat(up2Graph.unsharedMaterialConfigs().get(0), is(firstOrderSVNMaterial));
assertThat(up2Graph.unsharedMaterialConfigs().get(1), is(uppestDependencyMaterial));
assertThat(uppestGraph.unsharedMaterialConfigs().size(), is(2));
assertThat(uppestGraph.unsharedMaterialConfigs().get(0), is(common1));
assertThat(uppestGraph.unsharedMaterialConfigs().get(1), is(firstOrderP4Material));
}
Aggregations