use of com.thoughtworks.go.config.materials.mercurial.HgMaterial in project gocd by gocd.
the class MaterialsTest method shouldReturnMaterialBasedOnPiplineUniqueFingerPrint.
@Test
public void shouldReturnMaterialBasedOnPiplineUniqueFingerPrint() {
Materials materials = new Materials();
HgMaterial expectedMaterial = MaterialsMother.hgMaterial();
materials.add(expectedMaterial);
materials.add(MaterialsMother.gitMaterial("url"));
materials.add(MaterialsMother.svnMaterial("url", "folder"));
Material actualMaterial = materials.getByFingerPrint(expectedMaterial.getPipelineUniqueFingerprint());
assertThat(actualMaterial, is(expectedMaterial));
}
use of com.thoughtworks.go.config.materials.mercurial.HgMaterial in project gocd by gocd.
the class Materials method latestModification.
/**
* @deprecated Used only in tests
*/
public MaterialRevisions latestModification(File baseDir, final SubprocessExecutionContext execCtx) {
MaterialRevisions revisions = new MaterialRevisions();
for (Material material : this) {
List<Modification> modifications = new ArrayList<>();
if (material instanceof SvnMaterial) {
modifications = ((SvnMaterial) material).latestModification(baseDir, execCtx);
}
if (material instanceof HgMaterial) {
modifications = ((HgMaterial) material).latestModification(baseDir, execCtx);
}
if (material instanceof GitMaterial) {
modifications = ((GitMaterial) material).latestModification(baseDir, execCtx);
}
if (material instanceof P4Material) {
modifications = ((P4Material) material).latestModification(baseDir, execCtx);
}
if (material instanceof TfsMaterial) {
modifications = ((TfsMaterial) material).latestModification(baseDir, execCtx);
}
if (material instanceof DependencyMaterial) {
modifications = ((DependencyMaterial) material).latestModification(baseDir, execCtx);
}
revisions.addRevision(material, modifications);
}
return revisions;
}
use of com.thoughtworks.go.config.materials.mercurial.HgMaterial in project gocd by gocd.
the class MaterialsTest method shouldNotGetDependencyMaterialWhenOneOtherScmMaterialWithNoFolder.
@Test
public void shouldNotGetDependencyMaterialWhenOneOtherScmMaterialWithNoFolder() {
Materials materials = new Materials();
Material material1 = new DependencyMaterial(new CaseInsensitiveString("foo"), new CaseInsensitiveString("bar"));
Material material2 = new HgMaterial("", null);
materials.add(material1);
materials.add(material2);
assertThat(materials.byFolder(null), is(material2));
}
use of com.thoughtworks.go.config.materials.mercurial.HgMaterial in project gocd by gocd.
the class MaterialsTest method shouldGetMaterialByFolder.
@Test
public void shouldGetMaterialByFolder() {
Materials materials = new Materials();
HgMaterial material1 = MaterialsMother.hgMaterial();
material1.setFolder("folder1");
HgMaterial material2 = MaterialsMother.hgMaterial();
material2.setFolder("folder2");
materials.add(material1);
materials.add(material2);
assertThat(materials.byFolder("folder1"), is(material1));
}
use of com.thoughtworks.go.config.materials.mercurial.HgMaterial in project gocd by gocd.
the class MaterialsTest method shouldGetPluggableSCMMaterial_byFolder.
@Test
public void shouldGetPluggableSCMMaterial_byFolder() {
Materials materials = new Materials();
PluggableSCMMaterial material1 = new PluggableSCMMaterial("scm-id");
material1.setFolder("folder");
Material material2 = new HgMaterial("", "folder");
materials.add(material1);
materials.add(material2);
assertThat(materials.byFolder("folder"), is(material1));
}
Aggregations