use of com.thoughtworks.go.config.remote.PartialConfig in project gocd by gocd.
the class MagicalGoConfigXmlWriterTest method shouldThrowInvalidConfigWhenAttemptedToSaveMergedConfig.
@Test
public void shouldThrowInvalidConfigWhenAttemptedToSaveMergedConfig() throws Exception {
String xml = ConfigFileFixture.TWO_PIPELINES;
CruiseConfig cruiseConfig = ConfigMigrator.loadWithMigration(IOUtils.toInputStream(xml)).config;
PartialConfig remotePart = PartialConfigMother.withPipeline("some-pipe");
remotePart.setOrigin(new RepoConfigOrigin());
BasicCruiseConfig merged = new BasicCruiseConfig((BasicCruiseConfig) cruiseConfig, remotePart);
try {
xmlWriter.write(merged, output, true);
} catch (GoConfigInvalidException ex) {
// ok
assertThat(ex.getMessage(), is("Attempted to save merged configuration with patials"));
return;
}
fail("should have thrown when saving merged configuration");
}
use of com.thoughtworks.go.config.remote.PartialConfig in project gocd by gocd.
the class PartialConfigHelper method addFileWithEnvironment.
public File addFileWithEnvironment(String relativePath, EnvironmentConfig env) throws Exception {
PartialConfig partialConfig = new PartialConfig();
partialConfig.getEnvironments().add(env);
return this.addFileWithPartialConfig(relativePath, partialConfig);
}
use of com.thoughtworks.go.config.remote.PartialConfig in project gocd by gocd.
the class XmlPartialConfigProviderTest method shouldLoadDirectoryWithOnePipelineGroup.
@Test
public void shouldLoadDirectoryWithOnePipelineGroup() throws Exception {
GoConfigMother mother = new GoConfigMother();
PipelineConfigs group1 = mother.cruiseConfigWithOnePipelineGroup().getGroups().get(0);
helper.addFileWithPipelineGroup("group1.gocd.xml", group1);
PartialConfig part = xmlPartialProvider.load(tmpFolder, mock(PartialConfigLoadContext.class));
PipelineConfigs groupRead = part.getGroups().get(0);
assertThat(groupRead, is(group1));
assertThat(groupRead.size(), is(group1.size()));
assertThat(groupRead.get(0), is(group1.get(0)));
}
use of com.thoughtworks.go.config.remote.PartialConfig in project gocd by gocd.
the class XmlPartialConfigProviderTest method shouldParseFileWithOnePipeline.
@Test
public void shouldParseFileWithOnePipeline() throws Exception {
GoConfigMother mother = new GoConfigMother();
PipelineConfig pipe1 = mother.cruiseConfigWithOnePipelineGroup().getAllPipelineConfigs().get(0);
File file = helper.addFileWithPipeline("pipe1.gocd.xml", pipe1);
PartialConfig part = xmlPartialProvider.parseFile(file);
PipelineConfig pipeRead = part.getGroups().get(0).get(0);
assertThat(pipeRead, is(pipe1));
}
use of com.thoughtworks.go.config.remote.PartialConfig in project gocd by gocd.
the class XmlPartialConfigProviderTest method shouldLoadDirectoryWithOnePipeline.
@Test
public void shouldLoadDirectoryWithOnePipeline() throws Exception {
GoConfigMother mother = new GoConfigMother();
PipelineConfig pipe1 = mother.cruiseConfigWithOnePipelineGroup().getAllPipelineConfigs().get(0);
helper.addFileWithPipeline("pipe1.gocd.xml", pipe1);
PartialConfig part = xmlPartialProvider.load(tmpFolder, mock(PartialConfigLoadContext.class));
PipelineConfig pipeRead = part.getGroups().get(0).get(0);
assertThat(pipeRead, is(pipe1));
}
Aggregations