use of com.thoughtworks.go.domain.MaterialRevisions in project gocd by gocd.
the class MaterialDatabaseSvnWithExternalsUpdaterTest method shouldNotTryToSaveModificationForAnExternalThathasAlreadyBeenSaved.
@Test
public void shouldNotTryToSaveModificationForAnExternalThathasAlreadyBeenSaved() throws Exception {
updater.updateMaterial(material);
SvnTestRepoWithExternal otherRepo = new SvnTestRepoWithExternal(testRepoWithExternal.externalRepositoryUrl(), temporaryFolder);
SvnMaterial otherMaterial = new SvnMaterial(otherRepo.projectRepositoryUrl(), null, null, true);
updater.updateMaterial(otherMaterial);
MaterialRevisions materialRevisions = materialRepository.findLatestModification(otherMaterial);
assertThat(materialRevisions.numberOfRevisions(), is(2));
}
use of com.thoughtworks.go.domain.MaterialRevisions in project gocd by gocd.
the class MaterialDatabaseSvnWithExternalsUpdaterTest method shouldUpdateModificationsForNewlyAddedExternalToExistingMaterial.
@Test
public void shouldUpdateModificationsForNewlyAddedExternalToExistingMaterial() throws Exception {
updater.updateMaterial(material);
testRepoWithExternal.checkInOneFile("another_dir/some_file");
testRepoWithExternal.setupExternals("another_repo", new File(testRepoWithExternal.workingFolder(), "another_dir"));
updater.updateMaterial(material);
MaterialRevisions materialRevisions = materialRepository.findLatestModification(material);
assertThat(materialRevisions.numberOfRevisions(), is(3));
}
use of com.thoughtworks.go.domain.MaterialRevisions in project gocd by gocd.
the class TestBaseForDatabaseUpdater method shouldSaveTheRevisionsInRightOrder.
@Test
public void shouldSaveTheRevisionsInRightOrder() throws Exception {
updater.updateMaterial(material);
testRepo.checkInOneFile("test1.txt", "This is a new checkin");
updater.updateMaterial(material);
MaterialRevisions original = materialRepository.findLatestModification(material);
testRepo.checkInOneFile("test2.txt", "Checkin 1");
testRepo.checkInOneFile("test3.txt", "Checkin 2");
testRepo.checkInOneFile("test4.txt", "Checkin 3");
updater.updateMaterial(material);
List<Modification> changes = materialRepository.findModificationsSince(material, original.getMaterialRevision(0));
assertThat(changes.size(), is(3));
assertThat(changes.get(0).getComment(), is("Checkin 3"));
assertThat(changes.get(1).getComment(), is("Checkin 2"));
assertThat(changes.get(2).getComment(), is("Checkin 1"));
}
use of com.thoughtworks.go.domain.MaterialRevisions in project gocd by gocd.
the class PipelineServiceIntegrationTest method shouldReturnCorrectNumberOfMaterialRevisionsAndMaterials.
@Test
public void shouldReturnCorrectNumberOfMaterialRevisionsAndMaterials() throws Exception {
File file1 = new File("file1");
File file2 = new File("file2");
File file3 = new File("file3");
File file4 = new File("file4");
Material hg = new HgMaterial("url", "Dest");
String[] hgRevs = new String[] { "h1" };
u.checkinFiles(hg, "h1", a(file1, file2, file3, file4), ModifiedAction.added);
ScheduleTestUtil.AddedPipeline pair01 = u.saveConfigWith("pair01", "stageName", u.m(hg));
u.runAndPass(pair01, hgRevs);
ReflectionUtil.invoke(pipelineSqlMapDao, "initDao");
Pipeline pipeline = pipelineService.mostRecentFullPipelineByName("pair01");
MaterialRevisions materialRevisions = pipeline.getBuildCause().getMaterialRevisions();
assertThat(materialRevisions.getMaterials().size(), is(1));
}
use of com.thoughtworks.go.domain.MaterialRevisions in project gocd by gocd.
the class PipelineServiceTriangleDependencyTest method shouldNotGetTheRevisionsFromUpStreamPipelineIfTheDependencyMaterialHasNotChanged.
@Test
public void shouldNotGetTheRevisionsFromUpStreamPipelineIfTheDependencyMaterialHasNotChanged() throws Exception {
MaterialRevisions expected = createHgMaterialWithMultipleRevisions(1L, first);
MaterialRevision up1Revision = dependencyMaterialRevision("up1", 1, "label", "stage", 1, new Date());
expected.addRevision(up1Revision);
MaterialRevisions actual = createHgMaterialWithMultipleRevisions(1L, third);
actual.addRevision(up1Revision);
up1Revision.markAsNotChanged();
PipelineConfig current = createPipelineConfigWithMaterialConfig("current", actual.getMaterials().get(0).config(), new DependencyMaterialConfig(new CaseInsensitiveString("up1"), new CaseInsensitiveString("first")));
PipelineConfig up1 = createPipelineConfigWithMaterialConfig("up1", expected.getMaterials().get(0).config());
when(pipelineDao.findBuildCauseOfPipelineByNameAndCounter("up1", 1)).thenReturn(BuildCause.createManualForced(expected, new Username(str("loser"))));
PipelineConfigDependencyGraph dependencyGraph = new PipelineConfigDependencyGraph(current, new PipelineConfigDependencyGraph(up1));
assertThat(service.getRevisionsBasedOnDependencies(dependencyGraph, actual), is(actual));
}
Aggregations