use of com.thoughtworks.go.config.materials.svn.SvnMaterial in project gocd by gocd.
the class PipelineInstanceModelTest method shouldGetCurrentRevisionForMaterialByName.
@Test
public void shouldGetCurrentRevisionForMaterialByName() {
MaterialRevisions revisions = new MaterialRevisions();
HgMaterial material = MaterialsMother.hgMaterial();
SvnMaterial svnMaterial = MaterialsMother.svnMaterial();
material.setName(new CaseInsensitiveString("hg_material"));
revisions.addRevision(svnMaterial, new Modification(new Date(), "1024", "MOCK_LABEL-12", null));
revisions.addRevision(material, HG_MATERIAL_MODIFICATION);
BuildCause buildCause = BuildCause.createWithModifications(revisions, "");
PipelineInstanceModel model = PipelineInstanceModel.createPipeline("pipeline", -1, "label", buildCause, new StageInstanceModels());
assertThat(model.getCurrentRevision("hg_material").getRevision(), is("a087402bd2a7828a130c1bdf43f2d9ef8f48fd46"));
}
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 BuildCauseProducerServiceIntegrationTest method setup.
@Before
public void setup() throws Exception {
diskSpaceSimulator = new DiskSpaceSimulator();
new HgTestRepo("testHgRepo");
svnRepository = new SvnTestRepo("testSvnRepo");
dbHelper.onSetUp();
configHelper.onSetUp();
configHelper.usingCruiseConfigDao(goConfigDao).initializeConfigFile();
repository = new SvnCommand(null, svnRepository.projectRepositoryUrl());
goParentPipelineConfig = configHelper.addPipeline(GO_PIPELINE_UPSTREAM, STAGE_NAME, new MaterialConfigs(new GitMaterialConfig("foo-bar")), "unit");
goPipelineConfig = configHelper.addPipeline(GO_PIPELINE_NAME, STAGE_NAME, repository, "unit");
svnMaterialRevs = new MaterialRevisions();
SvnMaterial svnMaterial = SvnMaterial.createSvnMaterialWithMock(repository);
svnMaterialRevs.addRevision(svnMaterial, svnMaterial.latestModification(null, new ServerSubprocessExecutionContext(goConfigService, new SystemEnvironment())));
final MaterialRevisions materialRevisions = new MaterialRevisions();
SvnMaterial anotherSvnMaterial = SvnMaterial.createSvnMaterialWithMock(repository);
materialRevisions.addRevision(anotherSvnMaterial, anotherSvnMaterial.latestModification(null, subprocessExecutionContext));
transactionTemplate.execute(new TransactionCallbackWithoutResult() {
@Override
protected void doInTransactionWithoutResult(TransactionStatus status) {
materialRepository.save(svnMaterialRevs);
}
});
BuildCause buildCause = BuildCause.createWithModifications(svnMaterialRevs, "");
mingleConfig = configHelper.addPipeline(MINGLE_PIPELINE_NAME, STAGE_NAME, repository, new Filter(new IgnoredFiles("**/*.doc")), "unit", "functional");
latestPipeline = PipelineMother.schedule(this.mingleConfig, buildCause);
latestPipeline = pipelineDao.saveWithStages(latestPipeline);
dbHelper.passStage(latestPipeline.getStages().first());
pipelineScheduleQueue.clear();
}
use of com.thoughtworks.go.config.materials.svn.SvnMaterial in project gocd by gocd.
the class BuildCauseProducerServiceIntegrationTest method shouldUnderstandChangedMaterial_forManual_triggerWithOptions_DoneWithANewRevision.
@Test
public void shouldUnderstandChangedMaterial_forManual_triggerWithOptions_DoneWithANewRevision() throws Exception {
SvnMaterial svn = SvnMaterial.createSvnMaterialWithMock(repository);
MaterialRevisions revsAfterFoo = checkinFile(svn, "foo.c", svnRepository);
String revisionForFingerPrint = revsAfterFoo.findRevisionForFingerPrint(svn.getFingerprint()).getRevision().getRevision();
scheduleHelper.manuallySchedulePipelineWithRealMaterials(MINGLE_PIPELINE_NAME, new Username(new CaseInsensitiveString("loser")), m(new MaterialConfigConverter().toMaterial(mingleConfig.materialConfigs().get(0)).getPipelineUniqueFingerprint(), revisionForFingerPrint));
assertThat(pipelineScheduleQueue.toBeScheduled().keySet(), hasItem(MINGLE_PIPELINE_NAME));
BuildCause bisectAfterBisectBuildCause = pipelineScheduleQueue.toBeScheduled().get(MINGLE_PIPELINE_NAME);
for (MaterialRevision materialRevision : bisectAfterBisectBuildCause.getMaterialRevisions()) {
assertThat("material revision " + materialRevision + " should have been considered changed.", materialRevision.isChanged(), is(true));
}
assertThat(bisectAfterBisectBuildCause.getMaterialRevisions().getRevisions().size(), is(1));
}
use of com.thoughtworks.go.config.materials.svn.SvnMaterial in project gocd by gocd.
the class BuildCauseProducerServiceIntegrationTest method should_produceBuildCause_whenMaterialConfigurationChanges.
@Test
public void should_produceBuildCause_whenMaterialConfigurationChanges() throws Exception {
SvnMaterial svn1 = SvnMaterial.createSvnMaterialWithMock(repository);
mingleConfig = configHelper.replaceMaterialForPipeline(MINGLE_PIPELINE_NAME, svn1.config());
runAndPassWith(svn1, "foo.c", svnRepository);
scheduleHelper.autoSchedulePipelinesWithRealMaterials(MINGLE_PIPELINE_NAME);
BuildCause mingleBuildCause = pipelineScheduleQueue.toBeScheduled().get(MINGLE_PIPELINE_NAME);
assertThat(mingleBuildCause, is(nullValue()));
svn1.setFolder("another_repo");
mingleConfig = configHelper.replaceMaterialForPipeline(MINGLE_PIPELINE_NAME, svn1.config());
scheduleHelper.autoSchedulePipelinesWithRealMaterials(MINGLE_PIPELINE_NAME);
assertThat(pipelineScheduleQueue.toBeScheduled().keySet(), hasItem(MINGLE_PIPELINE_NAME));
mingleBuildCause = pipelineScheduleQueue.toBeScheduled().get(MINGLE_PIPELINE_NAME);
//because material configuration changed, and not actual revisions
verifyChanged(svn1, mingleBuildCause, false);
}
Aggregations