use of com.thoughtworks.go.config.materials.svn.SvnMaterial in project gocd by gocd.
the class SvnMaterialTest method shouldNotBeEqualWhenAlternateFolderDifferent.
@Test
public void shouldNotBeEqualWhenAlternateFolderDifferent() throws Exception {
final SvnMaterial material1 = MaterialsMother.svnMaterial("url1");
final SvnMaterial material2 = MaterialsMother.svnMaterial("url1");
assertComplementaryEquals(material1, material2, true);
material1.setFolder("foo");
material2.setFolder(null);
assertComplementaryEquals(material1, material2, false);
material1.setFolder("foo");
material2.setFolder("bar");
assertComplementaryEquals(material1, material2, false);
}
use of com.thoughtworks.go.config.materials.svn.SvnMaterial in project gocd by gocd.
the class MixedMultipleMaterialsTest method shouldGetLatestModificationswithThreeRepositories.
@Test
public void shouldGetLatestModificationswithThreeRepositories() throws Exception {
HgMaterial hgMaterial = hgRepo.material();
SvnMaterial svnMaterial = svnRepo.createMaterial("multiple-materials/trunk/part1", "part1");
GitMaterial gitMaterial = gitRepo.createMaterial();
Materials materials = new Materials(hgMaterial, svnMaterial, gitMaterial);
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.getMaterialRevision(2).numberOfModifications(), is(1));
assertThat(revisions.getMaterialRevision(2).getRevision(), is(new Modifications(gitRepo.latestModifications()).latestRevision(gitMaterial)));
assertThat(revisions.toString(), revisions.totalNumberOfModifications(), is(3));
}
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 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 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