use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class MagicalGoConfigXmlLoaderTest method shouldDeserializeGroupXml.
@Test
public void shouldDeserializeGroupXml() throws Exception {
String partialXml = "<pipelines group=\"group_name\">\n" + " <pipeline name=\"new_name\">\n" + " <materials>\n" + " <svn url=\"file:///tmp/foo\" />\n" + " </materials>\n" + " <stage name=\"stage_name\">\n" + " <jobs>\n" + " <job name=\"job_name\" />\n" + " </jobs>\n" + " </stage>\n" + " </pipeline>\n" + "</pipelines>";
PipelineConfigs pipelineConfigs = xmlLoader.fromXmlPartial(partialXml, BasicPipelineConfigs.class);
PipelineConfig pipeline = pipelineConfigs.findBy(new CaseInsensitiveString("new_name"));
assertThat(pipeline, is(notNullValue()));
assertThat(pipeline.materialConfigs().size(), is(1));
MaterialConfig material = pipeline.materialConfigs().get(0);
assertThat(material, is(Matchers.instanceOf(SvnMaterialConfig.class)));
assertThat(material.getUriForDisplay(), is("file:///tmp/foo"));
assertThat(pipeline.size(), is(1));
assertThat(pipeline.get(0).getJobs().size(), is(1));
}
use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class MagicalGoConfigXmlLoaderTest method shouldResolvePackageReferenceElementForAMaterialInConfig.
@Test
public void shouldResolvePackageReferenceElementForAMaterialInConfig() throws Exception {
String xml = "<cruise schemaVersion='" + CONFIG_SCHEMA_VERSION + "'>\n" + "<repositories>\n" + " <repository id='repo-id' name='name'>\n" + " <pluginConfiguration id='plugin-id' version='1.0'/>\n" + " <configuration>\n" + " <property>\n" + " <key>url</key>\n" + " <value>http://go</value>\n" + " </property>\n" + " </configuration>\n" + " <packages>\n" + " <package id='package-id' name='name'>\n" + " <configuration>\n" + " <property>\n" + " <key>name</key>\n" + " <value>go-agent</value>\n" + " </property>\n" + " </configuration>\n" + " </package>\n" + " </packages>\n" + " </repository>\n" + " </repositories>" + "<pipelines group=\"group_name\">\n" + " <pipeline name=\"new_name\">\n" + " <materials>\n" + " <package ref='package-id' />\n" + " </materials>\n" + " <stage name=\"stage_name\">\n" + " <jobs>\n" + " <job name=\"job_name\" />\n" + " </jobs>\n" + " </stage>\n" + " </pipeline>\n" + "</pipelines></cruise>";
GoConfigHolder goConfigHolder = xmlLoader.loadConfigHolder(xml);
PackageDefinition packageDefinition = goConfigHolder.config.getPackageRepositories().first().getPackages().first();
PipelineConfig pipelineConfig = goConfigHolder.config.pipelineConfigByName(new CaseInsensitiveString("new_name"));
PackageMaterialConfig packageMaterialConfig = (PackageMaterialConfig) pipelineConfig.materialConfigs().get(0);
assertThat(packageMaterialConfig.getPackageDefinition(), is(packageDefinition));
}
use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class MagicalGoConfigXmlLoaderTest method shouldLoadPipelineWithTimer.
@Test
public void shouldLoadPipelineWithTimer() throws Exception {
CruiseConfig config = ConfigMigrator.loadWithMigration(PIPELINE_WITH_TIMER).config;
PipelineConfig pipelineConfig = config.pipelineConfigByName(new CaseInsensitiveString("pipeline"));
assertThat(pipelineConfig.getTimer(), is(new TimerConfig("0 15 10 ? * MON-FRI", false)));
}
use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class MagicalGoConfigXmlLoaderTest method shouldSetConfigOriginInPipeline_AfterLoadingConfigFile.
@Test
public void shouldSetConfigOriginInPipeline_AfterLoadingConfigFile() throws Exception {
CruiseConfig cruiseConfig = xmlLoader.loadConfigHolder(CONFIG).config;
PipelineConfig pipelineConfig1 = cruiseConfig.pipelineConfigByName(new CaseInsensitiveString("pipeline1"));
assertThat(pipelineConfig1.getOrigin(), Is.<ConfigOrigin>is(new FileConfigOrigin()));
}
use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class PackageMaterialAddWithExistingPackageDefinitionCommand method updateConfig.
@Override
protected void updateConfig(CruiseConfig cruiseConfig) {
PackageDefinition packageDefinition = getPackageDefinition(cruiseConfig);
packageMaterialConfig.setPackageDefinition(packageDefinition);
PipelineConfig pipelineConfig = cruiseConfig.pipelineConfigByName(new CaseInsensitiveString(pipeline));
pipelineConfig.addMaterialConfig(packageMaterialConfig);
}
Aggregations