use of com.thoughtworks.go.config.materials.dependency.DependencyMaterial in project gocd by gocd.
the class MaterialRepositoryIntegrationTest method shouldBeAbleToPersistADependencyMaterial.
@Test
public void shouldBeAbleToPersistADependencyMaterial() {
MaterialInstance materialInstance = new DependencyMaterial(new CaseInsensitiveString("name"), new CaseInsensitiveString("pipeline"), new CaseInsensitiveString("stage"), "serverAlias").createMaterialInstance();
repo.saveOrUpdate(materialInstance);
MaterialInstance loaded = repo.find(materialInstance.getId());
assertThat(loaded, is(materialInstance));
}
use of com.thoughtworks.go.config.materials.dependency.DependencyMaterial in project gocd by gocd.
the class MaterialRepositoryIntegrationTest method shouldPersistActualFromRevisionUsingTheRealFromForDependencyMaterial.
@Test
public void shouldPersistActualFromRevisionUsingTheRealFromForDependencyMaterial() throws Exception {
Material material = new DependencyMaterial(new CaseInsensitiveString("pipeline_name"), new CaseInsensitiveString("stage_name"));
Modification actualFrom = modification("pipeline_name/8/stage_name/2");
Modification from = modification("pipeline_name/10/stage_name/1");
MaterialRevision firstRevision = new MaterialRevision(material, new Modifications(from, modification("pipeline_name/9/stage_name/2"), actualFrom));
saveMaterialRev(firstRevision);
Pipeline firstPipeline = createPipeline();
savePMR(firstRevision, firstPipeline);
List<PipelineMaterialRevision> pmrs = repo.findPipelineMaterialRevisions(firstPipeline.getId());
assertThat(pmrs.get(0).getActualFromRevisionId(), is(actualFrom.getId()));
assertEquals(from, pmrs.get(0).getFromModification());
}
use of com.thoughtworks.go.config.materials.dependency.DependencyMaterial in project gocd by gocd.
the class MaterialRepositoryIntegrationTest method hasPipelineEverRunWithMultipleMaterialsAndMultipleRuns.
@Test
public void hasPipelineEverRunWithMultipleMaterialsAndMultipleRuns() {
HgMaterial hgMaterial1 = MaterialsMother.hgMaterial("hgUrl", "dest");
MaterialRevision hgMaterialRevision1 = saveOneScmModification(hgMaterial1, "user", "file");
DependencyMaterial depMaterial1 = new DependencyMaterial(new CaseInsensitiveString("blahPipeline"), new CaseInsensitiveString("blahStage"));
MaterialRevision depMaterialRevision1 = saveOneDependencyModification(depMaterial1, "blahPipeline/1/blahStage/1");
PipelineConfig pipelineConfig = PipelineMother.createPipelineConfig("mingle", new MaterialConfigs(hgMaterial1.config(), depMaterial1.config()), "dev");
MaterialRevisions materialRevisions1 = new MaterialRevisions(hgMaterialRevision1, depMaterialRevision1);
pipelineSqlMapDao.save(instanceFactory.createPipelineInstance(pipelineConfig, BuildCause.createManualForced(materialRevisions1, Username.ANONYMOUS), new DefaultSchedulingContext(DEFAULT_APPROVED_BY), md5, new TimeProvider()));
HgMaterial hgMaterial2 = MaterialsMother.hgMaterial("hgUrl", "dest");
MaterialRevision hgMaterialRevision2 = saveOneScmModification(hgMaterial2, "user", "file");
DependencyMaterial depMaterial2 = new DependencyMaterial(new CaseInsensitiveString("blahPipeline"), new CaseInsensitiveString("blahStage"));
MaterialRevision depMaterialRevision2 = saveOneDependencyModification(depMaterial2, "blahPipeline/2/blahStage/1");
PipelineConfig pipelineConfig2 = PipelineMother.createPipelineConfig("mingle", new MaterialConfigs(hgMaterial2.config(), depMaterial2.config()), "dev");
MaterialRevisions materialRevisions2 = new MaterialRevisions(hgMaterialRevision2, depMaterialRevision2);
savePipeline(instanceFactory.createPipelineInstance(pipelineConfig2, BuildCause.createManualForced(materialRevisions2, Username.ANONYMOUS), new DefaultSchedulingContext(DEFAULT_APPROVED_BY), md5, new TimeProvider()));
MaterialRevisions revisions = new MaterialRevisions(new MaterialRevision(depMaterial1, depMaterialRevision1.getLatestModification()), new MaterialRevision(hgMaterial2, hgMaterialRevision2.getLatestModification()));
assertThat(repo.hasPipelineEverRunWith("mingle", revisions), is(true));
}
use of com.thoughtworks.go.config.materials.dependency.DependencyMaterial in project gocd by gocd.
the class ValueStreamMapPerformanceTest method setupVSM.
private CruiseConfig setupVSM(int numberOfDownstreamPipelines) {
HgMaterial hg = new HgMaterial("hgurl", "folder");
String hg_revs = "hg1";
u.checkinInOrder(hg, hg_revs);
ScheduleTestUtil.AddedPipeline up = u.saveConfigWith("u", new ScheduleTestUtil.MaterialDeclaration(hg, "dest"));
String up_r = u.runAndPass(up, hg_revs);
ScheduleTestUtil.AddedPipeline previouslyCreatedPipeline = up;
String previousRun = up_r;
for (int i = 0; i < numberOfDownstreamPipelines; i++) {
DependencyMaterial dep = new DependencyMaterial(previouslyCreatedPipeline.config.name(), previouslyCreatedPipeline.config.get(0).name());
ScheduleTestUtil.AddedPipeline d = u.saveConfigWith("d" + i, new ScheduleTestUtil.MaterialDeclaration(dep, "random"));
String currentRun = u.runAndPass(d, previousRun);
previouslyCreatedPipeline = d;
previousRun = currentRun;
}
return goConfigDao.load();
}
use of com.thoughtworks.go.config.materials.dependency.DependencyMaterial in project gocd by gocd.
the class ModificationBuildCauseTest method shouldReturnBuildCauseMessageForLegacyDependencyRevision.
@Test
public void shouldReturnBuildCauseMessageForLegacyDependencyRevision() {
MaterialRevisions revisions = new MaterialRevisions();
Modification modification = new Modification(new Date(), "pipelineName/10/stageName/1", "MOCK_LABEL-12", null);
revisions.addRevision(new DependencyMaterial(new CaseInsensitiveString("cruise"), new CaseInsensitiveString("dev")), modification);
BuildCause modificationBuildCause = BuildCause.createWithModifications(revisions, "");
String message = modificationBuildCause.getBuildCauseMessage();
assertThat(message, containsString("triggered by pipelineName/10/stageName/1"));
}
Aggregations