use of com.thoughtworks.go.domain.MaterialRevision in project gocd by gocd.
the class FaninDependencyResolutionTest method shouldRestoreMaterialNamesBasedOnMaterialConfig.
@Test
public void shouldRestoreMaterialNamesBasedOnMaterialConfig() throws Exception {
/*
g -> up -> down
+-> mid -+
*/
GitMaterial git = u.wf(new GitMaterial("git"), "folder1");
u.checkinInOrder(git, "g1");
ScheduleTestUtil.AddedPipeline up = u.saveConfigWith("up", u.m(git));
ScheduleTestUtil.MaterialDeclaration upForMid = u.m(up);
((DependencyMaterial) upForMid.material).setName(new CaseInsensitiveString("up-for-mid"));
ScheduleTestUtil.AddedPipeline mid = u.saveConfigWith("mid", upForMid);
ScheduleTestUtil.MaterialDeclaration upForDown = u.m(up);
((DependencyMaterial) upForDown.material).setName(new CaseInsensitiveString("up-for-down"));
ScheduleTestUtil.AddedPipeline down = u.saveConfigWith("down", u.m(mid), upForDown);
CruiseConfig cruiseConfig = goConfigDao.load();
String up_1 = u.runAndPass(up, "g1");
String mid_1 = u.runAndPass(mid, up_1);
String down_1 = u.runAndPass(down, mid_1, up_1);
MaterialRevisions given = u.mrs(u.mr(mid, false, mid_1), u.mr(up, false, up_1));
MaterialRevisions revisionsBasedOnDependencies = getRevisionsBasedOnDependencies(down, cruiseConfig, given);
for (MaterialRevision revisionsBasedOnDependency : revisionsBasedOnDependencies) {
DependencyMaterial dependencyPipeline = (DependencyMaterial) revisionsBasedOnDependency.getMaterial();
if (dependencyPipeline.getPipelineName().equals(new CaseInsensitiveString("up"))) {
assertThat(dependencyPipeline.getName(), is(new CaseInsensitiveString("up-for-down")));
}
}
assertThat(revisionsBasedOnDependencies, is(given));
}
use of com.thoughtworks.go.domain.MaterialRevision in project gocd by gocd.
the class DependencyMaterialAgentTest method materialRevision.
private MaterialRevision materialRevision(String pipelineName, Integer pipelineCounter, String pipelineLabel, String stageName, int stageCounter) {
DependencyMaterial material = new DependencyMaterial(new CaseInsensitiveString(pipelineName), new CaseInsensitiveString(stageName));
DependencyMaterialRevision revision = DependencyMaterialRevision.create(pipelineName, pipelineCounter, pipelineLabel, stageName, stageCounter);
MaterialRevision materialRevision = revision.convert(material, new Date());
return materialRevision;
}
use of com.thoughtworks.go.domain.MaterialRevision in project gocd by gocd.
the class GitMultipleMaterialsTest method shouldIgnoreDestinationFolderWhenCloningMaterialWhenServerSide.
@Test
public void shouldIgnoreDestinationFolderWhenCloningMaterialWhenServerSide() throws Exception {
GitMaterial material1 = repo.createMaterial("dest1");
MaterialRevision materialRevision = new MaterialRevision(material1, material1.latestModification(pipelineDir, new TestSubprocessExecutionContext()));
materialRevision.updateTo(pipelineDir, ProcessOutputStreamConsumer.inMemoryConsumer(), new TestSubprocessExecutionContext(true));
assertThat(new File(pipelineDir, "dest1").exists(), is(false));
assertThat(new File(pipelineDir, ".git").exists(), is(true));
}
use of com.thoughtworks.go.domain.MaterialRevision in project gocd by gocd.
the class SvnExternalTest method shouldGetLatestRevisionFromExpandedSvnExternalRepository.
@Test
public void shouldGetLatestRevisionFromExpandedSvnExternalRepository() {
MaterialRevisions materialRevisions = new MaterialRevisions();
Material svnExt = svnMaterial(svnRepo.externalRepositoryUrl(), "end2end");
List<Modification> modifications = ((SvnMaterial) svnExt).latestModification(svnRepo.workingFolder(), new TestSubprocessExecutionContext());
materialRevisions.addRevision(svnExt, modifications);
assertThat(materialRevisions.numberOfRevisions(), is(1));
MaterialRevision materialRevision = materialRevisions.getRevisions().get(0);
assertThat(materialRevision.getMaterial(), is(svnExt));
assertThat(materialRevision.getRevision().getRevision(), is("4"));
}
use of com.thoughtworks.go.domain.MaterialRevision in project gocd by gocd.
the class SvnExternalTest method shouldGetLatestRevision.
@Test
public void shouldGetLatestRevision() {
SvnMaterial svn = svnMaterial(svnRepo.projectRepositoryUrl(), null);
SvnMaterial svnExt = svnMaterial(svnRepo.externalRepositoryUrl(), "end2end");
final Materials materials = new Materials(svn, svnExt);
final MaterialRevisions materialRevisions = materials.latestModification(svnRepo.workingFolder(), new TestSubprocessExecutionContext());
assertThat(materialRevisions.numberOfRevisions(), is(2));
MaterialRevision main = materialRevisions.getRevisions().get(0);
assertThat(main.getMaterial(), is(svn));
assertThat(main.getModifications().size(), is(1));
assertThat(main.getRevision().getRevision(), is("5"));
MaterialRevision external = materialRevisions.getRevisions().get(1);
assertThat(external.getMaterial(), is(svnExt));
assertThat(external.getRevision().getRevision(), is("4"));
assertThat(external.getModifications().size(), is(1));
}
Aggregations