use of com.thoughtworks.go.config.materials.svn.SvnMaterial in project gocd by gocd.
the class ModificationBuildCauseTest method shouldBeValidWithExternalMaterials.
@Test
public void shouldBeValidWithExternalMaterials() {
SvnMaterial mainRepo = MaterialsMother.svnMaterial("mainRepo");
MaterialRevisions revisions = new MaterialRevisions();
revisions.addRevision(mainRepo, multipleModificationList());
revisions.addRevision(MaterialsMother.svnMaterial("externalRepo"), multipleModificationList());
buildCause = BuildCause.createWithModifications(revisions, "");
buildCause.assertMaterialsMatch(new MaterialConfigs(mainRepo.config()));
}
use of com.thoughtworks.go.config.materials.svn.SvnMaterial in project gocd by gocd.
the class SvnTestRepo method createMaterial.
public SvnMaterial createMaterial(String repo, String folder) {
SvnMaterial material = MaterialsMother.svnMaterial(urlFor(repo), folder);
material.setAutoUpdate(true);
return material;
}
use of com.thoughtworks.go.config.materials.svn.SvnMaterial in project gocd by gocd.
the class MaterialRevisionTest method shouldDetectChangedRevision.
@Test
public void shouldDetectChangedRevision() {
Modification modification1 = oneModifiedFile("revision1");
Modification modification2 = oneModifiedFile("revision2");
SvnMaterial material = MaterialsMother.svnMaterial();
MaterialRevision materialRevision1 = new MaterialRevision(material, modification1);
MaterialRevision materialRevision2 = new MaterialRevision(material, modification2);
assertThat(materialRevision1.hasChangedSince(materialRevision2), is(true));
}
use of com.thoughtworks.go.config.materials.svn.SvnMaterial in project gocd by gocd.
the class MaterialRevisionTest method shouldNotConsiderChangedFlagAsPartOfEqualityAndHashCodeCheck.
@Test
public void shouldNotConsiderChangedFlagAsPartOfEqualityAndHashCodeCheck() {
Modification modification = oneModifiedFile("revision1");
SvnMaterial material = MaterialsMother.svnMaterial();
MaterialRevision notChanged = new MaterialRevision(material, false, modification);
MaterialRevision changed = new MaterialRevision(material, true, modification);
changed.markAsChanged();
assertThat(changed, is(notChanged));
assertThat(changed.hashCode(), is(notChanged.hashCode()));
}
use of com.thoughtworks.go.config.materials.svn.SvnMaterial in project gocd by gocd.
the class MaterialCheckerTest method shouldSkipLatestRevisionsForMaterialsThatWereAlreadyChecked.
@Test
public void shouldSkipLatestRevisionsForMaterialsThatWereAlreadyChecked() throws Exception {
DependencyMaterial dependencyMaterial = new DependencyMaterial(new CaseInsensitiveString("pipeline-name"), new CaseInsensitiveString("stage-name"));
SvnMaterial svnMaterial = new SvnMaterial("svnUrl", null, null, false);
Stage passedStage = StageMother.passedStageInstance("stage-name", "job-name", "pipeline-name");
Modification dependencyModification = new Modification("Unknown", "Unknown", null, passedStage.completedDate(), "pipeline-name/1[LABEL-1]/stage-name/0");
Modification svnModification = new Modification("user", "commend", "em@il", new Date(), "1");
Mockito.when(materialRepository.findLatestModification(svnMaterial)).thenReturn(revisions(dependencyMaterial, svnModification));
materialChecker.findLatestRevisions(new MaterialRevisions(new MaterialRevision(dependencyMaterial, dependencyModification)), new Materials(dependencyMaterial, svnMaterial));
Mockito.verify(materialRepository, never()).findLatestModification(dependencyMaterial);
Mockito.verify(materialRepository).findLatestModification(svnMaterial);
}
Aggregations