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 MaterialDatabaseSvnWithExternalsUpdaterTest method shouldUpdateModificationsForExternals.
@Test
public void shouldUpdateModificationsForExternals() throws Exception {
updater.updateMaterial(material);
testRepoWithExternal.checkInExternalFile("foo_bar", "foo bar quux");
updater.updateMaterial(material);
MaterialRevisions materialRevisions = materialRepository.findLatestModification(material);
assertThat(materialRevisions.numberOfRevisions(), is(2));
SvnMaterial externalMaterial = testRepoWithExternal.externalMaterial();
MaterialRevision revisionForExternal = materialRevisions.findRevisionFor(externalMaterial);
assertThat(revisionForExternal.getModification(0).getComment(), is("foo bar quux"));
}
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());
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 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 StageNotificationServiceTest method stubPipelineAndStage.
private void stubPipelineAndStage(Date date) {
final PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfig("go", "dev", "compile", "test", "twist");
final Modification svnModification = new Modification("lgao", "Fixing the not checked in files", "jez@cruise.com", date, "123");
svnModification.createModifiedFile("build.xml", "some_dir", ModifiedAction.added);
svnModification.createModifiedFile("some.xml", "other_dir", ModifiedAction.deleted);
Pipeline pipeline = instanceFactory.createPipelineInstance(pipelineConfig, new ManualBuild(new Username(new CaseInsensitiveString("loser"))).onModifications(new MaterialRevisions(new MaterialRevision(new MaterialConfigConverter().toMaterials(pipelineConfig.materialConfigs()).get(0), svnModification)), false, null), new DefaultSchedulingContext("loser"), "md5-test", new TimeProvider());
Stage stage = pipeline.getStages().get(0);
when(stageService.findStageWithIdentifier(stageIdentifier)).thenReturn(stage);
stage.setPipelineId(100L);
when(pipelineService.fullPipelineById(100)).thenReturn(pipeline);
}
Aggregations