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 BuildCauseTest method shouldNotThrowWhenMaterialAndConfigOriginRevisionDontMatch_WhenManualTrigger.
@Test
public void shouldNotThrowWhenMaterialAndConfigOriginRevisionDontMatch_WhenManualTrigger() {
SvnMaterial material = MaterialsMother.svnMaterial();
MaterialConfig materialConfig = material.config();
MaterialRevisions first = new MaterialRevisions(new MaterialRevision(material, oneModifiedFile("revision1")));
BuildCause buildCause = BuildCause.createManualForced();
buildCause.setMaterialRevisions(first);
PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfigWithStages("pipe1", "build");
pipelineConfig.materialConfigs().clear();
pipelineConfig.materialConfigs().add(materialConfig);
pipelineConfig.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(materialConfig, "plug"), "revision2"));
buildCause.assertPipelineConfigAndMaterialRevisionMatch(pipelineConfig);
}
use of com.thoughtworks.go.config.materials.svn.SvnMaterial in project gocd by gocd.
the class BuildCauseTest method shouldThrowWhenMaterialAndConfigOriginRevisionDontMatch_WhenAutoTrigger.
@Test
public void shouldThrowWhenMaterialAndConfigOriginRevisionDontMatch_WhenAutoTrigger() {
SvnMaterial material = MaterialsMother.svnMaterial();
MaterialConfig materialConfig = material.config();
MaterialRevisions first = new MaterialRevisions(new MaterialRevision(material, oneModifiedFile("revision1")));
BuildCause buildCause = BuildCause.createWithModifications(first, "");
buildCause.setMaterialRevisions(first);
PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfigWithStages("pipe1", "build");
pipelineConfig.materialConfigs().clear();
pipelineConfig.materialConfigs().add(materialConfig);
pipelineConfig.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(materialConfig, "plug"), "revision2"));
try {
buildCause.assertPipelineConfigAndMaterialRevisionMatch(pipelineConfig);
} catch (BuildCauseOutOfDateException ex) {
//good
return;
}
fail("should have thrown");
}
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 ModificationBuildCauseTest method shouldBeInvalidWhenMaterialsFromConfigAreNotInBuildCause.
@Test
public void shouldBeInvalidWhenMaterialsFromConfigAreNotInBuildCause() {
SvnMaterial mainRepo = MaterialsMother.svnMaterial("mainRepo");
SvnMaterial extRepo = MaterialsMother.svnMaterial("externalRepo");
MaterialRevisions revisions = new MaterialRevisions();
revisions.addRevision(mainRepo, multipleModificationList());
buildCause = BuildCause.createWithModifications(revisions, "");
try {
buildCause.assertMaterialsMatch(new MaterialConfigs(mainRepo.config(), extRepo.config()));
fail("All the materials from config file should be in build cause");
} catch (Exception expected) {
}
}
Aggregations