use of com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig in project gocd by gocd.
the class MaterialConfigsTest method shouldValidateTree.
@Test
public void shouldValidateTree() {
GitMaterialConfig git = new GitMaterialConfig();
git.setName(new CaseInsensitiveString("mat-name"));
SvnMaterialConfig svn = new SvnMaterialConfig("url", true);
svn.setName(new CaseInsensitiveString("mat-name"));
P4MaterialConfig p4 = new P4MaterialConfig();
TfsMaterialConfig tfs = new TfsMaterialConfig();
HgMaterialConfig hg = new HgMaterialConfig();
MaterialConfigs materialConfigs = new MaterialConfigs(git, svn, p4, tfs, hg);
PipelineConfig pipelineConfig = new PipelineConfig(new CaseInsensitiveString("p1"), new MaterialConfigs(svn));
materialConfigs.validateTree(PipelineConfigSaveValidationContext.forChain(true, "group", new BasicCruiseConfig(new BasicPipelineConfigs(pipelineConfig)), pipelineConfig));
assertThat(git.errors().on(GitMaterialConfig.MATERIAL_NAME), contains("You have defined multiple materials called 'mat-name'"));
assertThat(git.errors().on(GitMaterialConfig.URL), is("URL cannot be blank"));
assertThat(svn.errors().on(SvnMaterialConfig.MATERIAL_NAME), contains("You have defined multiple materials called 'mat-name'"));
assertThat(p4.errors().on(P4MaterialConfig.VIEW), contains("P4 view cannot be empty."));
assertThat(tfs.errors().on(TfsMaterialConfig.URL), contains("URL cannot be blank"));
assertThat(hg.errors().on(HgMaterialConfig.URL), is("URL cannot be blank"));
}
use of com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig in project gocd by gocd.
the class ConfigSaveValidationContextTest method shouldReturnAllMaterialsMatchingTheFingerprint.
@Test
public void shouldReturnAllMaterialsMatchingTheFingerprint() {
CruiseConfig cruiseConfig = new BasicCruiseConfig();
HgMaterialConfig hg = new HgMaterialConfig("url", null);
for (int i = 0; i < 10; i++) {
PipelineConfig pipelineConfig = PipelineConfigMother.pipelineConfig("pipeline" + i, new MaterialConfigs(hg));
cruiseConfig.addPipeline("defaultGroup", pipelineConfig);
}
ValidationContext context = ConfigSaveValidationContext.forChain(cruiseConfig);
assertThat(context.getAllMaterialsByFingerPrint(hg.getFingerprint()).size(), is(10));
}
use of com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig in project gocd by gocd.
the class MaterialRepositoryIntegrationTest method shouldSaveHgPipelineMaterialRevisions.
@Test
public void shouldSaveHgPipelineMaterialRevisions() throws Exception {
HgMaterialConfig hgMaterialConfig = MaterialConfigsMother.hgMaterialConfig("hgUrl", "dest");
assertCanLoadAndSaveMaterialRevisionsFor(hgMaterialConfig);
}
use of com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig in project gocd by gocd.
the class TimeReportingTest method getConfigWith.
private CruiseConfig getConfigWith(CruiseConfig cruiseConfig, int numberOfGroups, int numberOfNewPipelinesInEachGroup) {
int numberOfJobs = 10;
int numberOfMaterials = 5;
int numberOfTasks = 2;
for (int z = 0; z < numberOfGroups; z++) {
for (int i = 0; i < numberOfNewPipelinesInEachGroup; i++) {
PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfigWithStage("pipeline" + i, "stage" + i);
for (int j = 0; j < numberOfJobs; j++) {
JobConfig jobConfig = new JobConfig("job" + j);
for (int k = 0; k < numberOfTasks; k++) {
jobConfig.addTask(new ExecTask("command" + k, "args", "workingdir"));
}
pipelineConfig.get(0).getJobs().add(jobConfig);
}
for (int j = 0; j < numberOfMaterials; j++) {
pipelineConfig.addMaterialConfig(new HgMaterialConfig("url" + j, "dest" + j));
}
cruiseConfig.addPipeline("group" + z, pipelineConfig);
}
}
return cruiseConfig;
}
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\" />"));
}
Aggregations