use of com.thoughtworks.go.config.materials.MaterialConfigs in project gocd by gocd.
the class CruiseConfigTestBase method addPipeline.
private PipelineConfig addPipeline(String pipelineName, String stageName, JobConfig... jobConfigs) {
PipelineConfig pipeline = new PipelineConfig(new CaseInsensitiveString(pipelineName), new MaterialConfigs());
pipeline.add(new StageConfig(new CaseInsensitiveString(stageName), new JobConfigs(jobConfigs)));
pipelines.add(pipeline);
return pipeline;
}
use of com.thoughtworks.go.config.materials.MaterialConfigs in project gocd by gocd.
the class CruiseConfigTestBase method shouldReturnAllUniqueSchedulableScmMaterials.
@Test
public void shouldReturnAllUniqueSchedulableScmMaterials() {
final MaterialConfig svnMaterialConfig = new SvnMaterialConfig("http://svn_url_1", "username", "password", false);
svnMaterialConfig.setAutoUpdate(false);
final MaterialConfig svnMaterialConfigWithAutoUpdate = new SvnMaterialConfig("http://svn_url_2", "username", "password", false);
svnMaterialConfigWithAutoUpdate.setAutoUpdate(true);
final MaterialConfig hgMaterialConfig = new HgMaterialConfig("http://hg_url", null);
hgMaterialConfig.setAutoUpdate(false);
final MaterialConfig gitMaterialConfig = new GitMaterialConfig("http://git_url");
gitMaterialConfig.setAutoUpdate(false);
final MaterialConfig tfsMaterialConfig = new TfsMaterialConfig(mock(GoCipher.class), new UrlArgument("http://tfs_url"), "username", "domain", "password", "project_path");
tfsMaterialConfig.setAutoUpdate(false);
final MaterialConfig p4MaterialConfig = new P4MaterialConfig("http://p4_url", "view", "username");
p4MaterialConfig.setAutoUpdate(false);
final MaterialConfig dependencyMaterialConfig = MaterialConfigsMother.dependencyMaterialConfig();
final PluggableSCMMaterialConfig pluggableSCMMaterialConfig = MaterialConfigsMother.pluggableSCMMaterialConfig("scm-id-1", null, null);
pluggableSCMMaterialConfig.getSCMConfig().setAutoUpdate(false);
final PipelineConfig p1 = PipelineConfigMother.pipelineConfig("pipeline1", new MaterialConfigs(svnMaterialConfig), new JobConfigs(new JobConfig(new CaseInsensitiveString("jobName"))));
final PipelineConfig p2 = PipelineConfigMother.pipelineConfig("pipeline2", new MaterialConfigs(svnMaterialConfig, gitMaterialConfig), new JobConfigs(new JobConfig(new CaseInsensitiveString("jobName"))));
final PipelineConfig p3 = PipelineConfigMother.pipelineConfig("pipeline3", new MaterialConfigs(hgMaterialConfig, dependencyMaterialConfig), new JobConfigs(new JobConfig(new CaseInsensitiveString("jobName"))));
final PipelineConfig p4 = PipelineConfigMother.pipelineConfig("pipeline4", new MaterialConfigs(p4MaterialConfig, pluggableSCMMaterialConfig), new JobConfigs(new JobConfig(new CaseInsensitiveString("jobName"))));
final PipelineConfig p5 = PipelineConfigMother.pipelineConfig("pipeline5", new MaterialConfigs(svnMaterialConfigWithAutoUpdate, tfsMaterialConfig), new JobConfigs(new JobConfig(new CaseInsensitiveString("jobName"))));
cruiseConfig.getGroups().add(new BasicPipelineConfigs(p1, p2, p3, p4, p5));
final Set<MaterialConfig> materials = cruiseConfig.getAllUniquePostCommitSchedulableMaterials();
assertThat(materials.size(), is(6));
assertThat(materials, hasItems(svnMaterialConfig, hgMaterialConfig, gitMaterialConfig, tfsMaterialConfig, p4MaterialConfig, pluggableSCMMaterialConfig));
assertThat(materials, not(hasItem(svnMaterialConfigWithAutoUpdate)));
}
use of com.thoughtworks.go.config.materials.MaterialConfigs in project gocd by gocd.
the class GoConfigMother method simpleDiamond.
public static CruiseConfig simpleDiamond() {
CruiseConfig cruiseConfig = new BasicCruiseConfig();
PipelineConfig pipeline1 = PipelineConfigMother.pipelineConfig("p1", new MaterialConfigs(MaterialConfigsMother.gitMaterialConfig("g1")));
PipelineConfig pipeline2 = PipelineConfigMother.pipelineConfig("p2", new MaterialConfigs(MaterialConfigsMother.gitMaterialConfig("g1")));
PipelineConfig pipeline3 = PipelineConfigMother.pipelineConfig("p3", new MaterialConfigs(MaterialConfigsMother.dependencyMaterialConfig("p1", "stage-1-1"), MaterialConfigsMother.dependencyMaterialConfig("p2", "stage-1-1")));
cruiseConfig.addPipeline("group-1", pipeline1);
cruiseConfig.addPipeline("group-1", pipeline2);
cruiseConfig.addPipeline("group-1", pipeline3);
return cruiseConfig;
}
use of com.thoughtworks.go.config.materials.MaterialConfigs in project gocd by gocd.
the class TemplateExpansionPreprocessorTest method shouldNotExpandWhenTemplateAssociatedWithPipelineDoesNotExist.
@Test
public void shouldNotExpandWhenTemplateAssociatedWithPipelineDoesNotExist() throws Exception {
PipelineConfig pipelineConfig = new PipelineConfig(new CaseInsensitiveString("p"), new MaterialConfigs());
pipelineConfig.templatize(new CaseInsensitiveString("does_not_exist"));
preprocessor.process(new BasicCruiseConfig(new BasicPipelineConfigs(pipelineConfig)));
assertThat(pipelineConfig.hasTemplateApplied(), is(false));
}
use of com.thoughtworks.go.config.materials.MaterialConfigs in project gocd by gocd.
the class TemplateExpansionPreprocessorTest method shouldValidatePipelineToCheckItDoesNotAllowBothTemplateAndStages.
@Test
public void shouldValidatePipelineToCheckItDoesNotAllowBothTemplateAndStages() throws Exception {
PipelineConfig pipelineConfig = new PipelineConfig(new CaseInsensitiveString("p"), new MaterialConfigs());
pipelineConfig.templatize(new CaseInsensitiveString("template"));
pipelineConfig.addStageWithoutValidityAssertion(new StageConfig(new CaseInsensitiveString("stage"), new JobConfigs()));
preprocessor.process(new BasicCruiseConfig(new BasicPipelineConfigs(pipelineConfig)));
assertThat(pipelineConfig.hasTemplateApplied(), is(false));
assertThat(pipelineConfig.errors().on("stages"), is("Cannot add stages to pipeline 'p' which already references template 'template'"));
assertThat(pipelineConfig.errors().on("template"), is("Cannot set template 'template' on pipeline 'p' because it already has stages defined"));
}
Aggregations