use of com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig in project gocd by gocd.
the class MagicalGoConfigXmlWriterTest method shouldWriteHgMaterialToXmlPartial.
@Test
public void shouldWriteHgMaterialToXmlPartial() throws Exception {
HgMaterialConfig material = com.thoughtworks.go.helper.MaterialConfigsMother.hgMaterialConfig();
material.setConfigAttributes(m(HgMaterialConfig.URL, "http://user:pass@hg", HgMaterialConfig.AUTO_UPDATE, "true"));
assertThat(xmlWriter.toXmlPartial(material), is("<hg url=\"http://user:pass@hg\" />"));
}
use of com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig in project gocd by gocd.
the class MagicalGoConfigXmlLoaderTest method shouldBeHgMaterial.
private void shouldBeHgMaterial(MaterialConfig material) {
assertThat(material, is(instanceOf(HgMaterialConfig.class)));
HgMaterialConfig hgMaterial = (HgMaterialConfig) material;
assertThat(hgMaterial.getUrlArgument(), is(new HgUrlArgument("http://username:password@hgUrl.com")));
}
use of com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig in project gocd by gocd.
the class MaterialsTest method shouldFailIfMultipleMaterialsHaveSameFolderNameSet_CaseInSensitive.
@Test
@RunIf(value = EnhancedOSChecker.class, arguments = { DO_NOT_RUN_ON, WINDOWS })
public void shouldFailIfMultipleMaterialsHaveSameFolderNameSet_CaseInSensitive() {
HgMaterialConfig materialOne = new HgMaterialConfig("http://url1", null);
materialOne.setConfigAttributes(Collections.singletonMap(ScmMaterialConfig.FOLDER, "folder"));
HgMaterialConfig materialTwo = new HgMaterialConfig("http://url2", null);
materialTwo.setConfigAttributes(Collections.singletonMap(ScmMaterialConfig.FOLDER, "foLder"));
CruiseConfig config = GoConfigMother.configWithPipelines("one");
PipelineConfig pipelineOne = config.pipelineConfigByName(new CaseInsensitiveString("one"));
pipelineOne.setMaterialConfigs(new MaterialConfigs(materialOne, materialTwo));
MaterialConfigs materials = pipelineOne.materialConfigs();
materials.validate(ConfigSaveValidationContext.forChain(config));
assertThat(materials.get(0).errors().isEmpty(), is(false));
assertThat(materials.get(1).errors().isEmpty(), is(false));
assertThat(materials.get(0).errors().on(ScmMaterialConfig.FOLDER), is("The destination directory must be unique across materials."));
assertThat(materials.get(1).errors().on(ScmMaterialConfig.FOLDER), is("The destination directory must be unique across materials."));
}
use of com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig in project gocd by gocd.
the class PipelineServiceTriangleDependencyTest method shouldCopyMissingRevisionsForSameMaterialThatsUsedMoreThanOnce.
@Test
public void shouldCopyMissingRevisionsForSameMaterialThatsUsedMoreThanOnce() throws Exception {
PipelineConfig pipelineConfig = PipelineConfigMother.pipelineConfig("last");
pipelineConfig.materialConfigs().clear();
HgMaterialConfig onDirOne = MaterialConfigsMother.hgMaterialConfig("google.com", "dirOne");
HgMaterialConfig onDirTwo = MaterialConfigsMother.hgMaterialConfig("google.com", "dirTwo");
pipelineConfig.addMaterialConfig(onDirOne);
pipelineConfig.addMaterialConfig(onDirTwo);
HashMap<Material, String> materialToCommit = new HashMap<>();
materialToCommit.put(new MaterialConfigConverter().toMaterial(onDirOne), "abc");
materialToCommit.put(new MaterialConfigConverter().toMaterial(onDirTwo), "abc");
MaterialRevisions revs = ModificationsMother.getMaterialRevisions(materialToCommit);
MaterialRevisions finalRevisions = service.getRevisionsBasedOnDependencies(new PipelineConfigDependencyGraph(pipelineConfig), revs);
assertThat(finalRevisions.getRevisions(), is(revs.getRevisions()));
}
use of com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig in project gocd by gocd.
the class BuildAssignmentServiceIntegrationTest method shouldNotAssignWorkWhenPipelineScheduledWithStaleMaterials.
@Test
public void shouldNotAssignWorkWhenPipelineScheduledWithStaleMaterials() {
AgentIdentifier instance = agent(AgentMother.localAgent());
Pipeline pipeline = instanceFactory.createPipelineInstance(evolveConfig, modifyNoFiles(evolveConfig), new DefaultSchedulingContext(DEFAULT_APPROVED_BY), md5, new TimeProvider());
dbHelper.savePipelineWithStagesAndMaterials(pipeline);
evolveConfig.setMaterialConfigs(new MaterialConfigs(new HgMaterialConfig("foo", null)));
configHelper.removePipeline(CaseInsensitiveString.str(evolveConfig.name()));
configHelper.addPipeline(evolveConfig);
buildAssignmentService.onConfigChange(goConfigService.getCurrentConfig());
JobInstance job = buildOf(pipeline);
jobInstanceDao.updateStateAndResult(job);
assertThat(buildAssignmentService.assignWorkToAgent(instance), is(BuildAssignmentService.NO_WORK));
}
Aggregations