use of com.thoughtworks.go.config.materials.Materials in project gocd by gocd.
the class HgMultipleMaterialsTest method shouldFindModificationsForBothMaterials.
@Test
public void shouldFindModificationsForBothMaterials() throws Exception {
Materials materials = new Materials(repo.createMaterial("dest1"), repo.createMaterial("dest2"));
repo.commitAndPushFile("SomeDocumentation.txt");
MaterialRevisions materialRevisions = materials.latestModification(pipelineDir, new TestSubprocessExecutionContext());
assertThat(materialRevisions.getRevisions().size(), is(2));
assertThat(materialRevisions, containsModifiedBy("SomeDocumentation.txt", "user"));
}
use of com.thoughtworks.go.config.materials.Materials in project gocd by gocd.
the class SvnMultipleMaterialsTest method shouldNotThrowNPEIfTheWorkingDirectoryIsEmpty.
@Test
public void shouldNotThrowNPEIfTheWorkingDirectoryIsEmpty() throws Exception {
SvnMaterial svnMaterial1 = repo.createMaterial("multiple-materials/trunk/part1", "part1");
SvnMaterial svnMaterial2 = repo.createMaterial("multiple-materials/trunk/part2", "part2");
Materials materials = new Materials(svnMaterial1, svnMaterial2);
Revision revision = latestRevision(svnMaterial1, pipelineDir, new TestSubprocessExecutionContext());
updateMaterials(materials, revision);
FileUtils.deleteQuietly(pipelineDir);
updateMaterials(materials, revision);
}
use of com.thoughtworks.go.config.materials.Materials in project gocd by gocd.
the class SvnMultipleMaterialsTest method shouldFindModificationForEachMaterial.
@Test
public void shouldFindModificationForEachMaterial() throws Exception {
SvnMaterial material1 = repo.createMaterial("multiple-materials/trunk/part1", "part1");
SvnMaterial material2 = repo.createMaterial("multiple-materials/trunk/part2", "part2");
Materials materials = new Materials(material1, material2);
repo.checkInOneFile("filename.txt", material1);
repo.checkInOneFile("filename2.txt", material2);
MaterialRevisions materialRevisions = materials.latestModification(pipelineDir, new TestSubprocessExecutionContext());
assertThat(materialRevisions.getRevisions().size(), is(2));
assertThat(materialRevisions, containsModifiedFile("/trunk/part1/filename.txt"));
assertThat(materialRevisions, containsModifiedFile("/trunk/part2/filename2.txt"));
}
use of com.thoughtworks.go.config.materials.Materials in project gocd by gocd.
the class SvnMultipleMaterialsTest method shouldNotDeleteWorkingDirIfMaterialsAreCheckedOutToSubfoldersWithTheSameRootBug2320.
// This is bug #2320 - Cruise doing full checkouts most times
@Test
public void shouldNotDeleteWorkingDirIfMaterialsAreCheckedOutToSubfoldersWithTheSameRootBug2320() throws Exception {
SvnMaterial svnMaterial1 = repo.createMaterial("multiple-materials/trunk/part1", "root/part1");
SvnMaterial svnMaterial2 = repo.createMaterial("multiple-materials/trunk/part2", "root/part2");
Materials materials = new Materials(svnMaterial1, svnMaterial2);
Revision revision = latestRevision(svnMaterial1, pipelineDir, new TestSubprocessExecutionContext());
updateMaterials(materials, revision);
assertThat(new File(pipelineDir, "root/part1").exists(), is(true));
assertThat(new File(pipelineDir, "root/part2").exists(), is(true));
File testFile = new File(pipelineDir, "root/part1/test-file");
testFile.createNewFile();
assertThat(testFile.exists(), is(true));
// simulates what a build will do
new File(pipelineDir, ArtifactLogUtil.CRUISE_OUTPUT_FOLDER).mkdir();
assertThat(pipelineDir.listFiles().length, is(2));
updateMaterials(materials, revision);
assertThat(new File(pipelineDir, "root/part1").exists(), is(true));
assertThat(new File(pipelineDir, "root/part2").exists(), is(true));
assertThat("Should not delete the part1 directory", testFile.exists(), is(true));
}
use of com.thoughtworks.go.config.materials.Materials in project gocd by gocd.
the class MixedMultipleMaterialsTest method shouldGetLatestModifications.
@Test
public void shouldGetLatestModifications() throws Exception {
HgMaterial hgMaterial = hgRepo.material();
SvnMaterial svnMaterial = svnRepo.createMaterial("multiple-materials/trunk/part1", "part1");
Materials materials = new Materials(hgMaterial, svnMaterial);
MaterialRevisions revisions = materials.latestModification(pipelineDir, new TestSubprocessExecutionContext());
assertThat(revisions.getMaterialRevision(0).numberOfModifications(), is(1));
assertThat(revisions.getMaterialRevision(0).getRevision(), is(new Modifications(hgRepo.latestModifications()).latestRevision(hgMaterial)));
assertThat(revisions.getMaterialRevision(1).numberOfModifications(), is(1));
assertThat(revisions.getMaterialRevision(1).getRevision(), is(latestRevision(svnMaterial, pipelineDir, new TestSubprocessExecutionContext())));
assertThat(revisions.toString(), revisions.totalNumberOfModifications(), is(2));
}
Aggregations