use of com.thoughtworks.go.config.MagicalGoConfigXmlWriter in project gocd by gocd.
the class BaseConfigXmlWriterTest method setup.
@Before
public void setup() {
output = new ByteArrayOutputStream();
ConfigCache configCache = new ConfigCache();
xmlWriter = new MagicalGoConfigXmlWriter(configCache, ConfigElementImplementationRegistryMother.withNoPlugins());
xmlLoader = new MagicalGoConfigXmlLoader(configCache, ConfigElementImplementationRegistryMother.withNoPlugins());
}
use of com.thoughtworks.go.config.MagicalGoConfigXmlWriter in project gocd by gocd.
the class EntityHashingServiceTest method shouldComputeTheMD5OfAGivenXmlPartialGeneratedFromAnObject.
@Test
public void shouldComputeTheMD5OfAGivenXmlPartialGeneratedFromAnObject() {
PipelineConfig pipelineConfig = PipelineConfigMother.pipelineConfig("P1");
String xml = new MagicalGoConfigXmlWriter(configCache, registry).toXmlPartial(pipelineConfig);
assertThat(entityHashingService.md5ForEntity(pipelineConfig), is(CachedDigestUtils.md5Hex(xml)));
}
use of com.thoughtworks.go.config.MagicalGoConfigXmlWriter in project gocd by gocd.
the class GoConfigAdministrationControllerIntegrationTest method shouldConflictWhenGivenMd5IsDifferent.
@Test
public void shouldConflictWhenGivenMd5IsDifferent() throws Exception {
configHelper.addPipeline("pipeline", "stage", "build1", "build2");
controller.getCurrentConfigXml("crapy_md5", response);
ByteArrayOutputStream os = new ByteArrayOutputStream();
new MagicalGoConfigXmlWriter(new ConfigCache(), ConfigElementImplementationRegistryMother.withNoPlugins()).write(goConfigDao.loadForEditing(), os, true);
assertValidContentAndStatus(SC_CONFLICT, "text/plain; charset=utf-8", CONFIG_CHANGED_PLEASE_REFRESH);
assertThat(response.getHeader(XmlAction.X_CRUISE_CONFIG_MD5), is(goConfigDao.md5OfConfigFile()));
}
use of com.thoughtworks.go.config.MagicalGoConfigXmlWriter in project gocd by gocd.
the class GoConfigAdministrationControllerIntegrationTest method shouldGetConfigAsXml.
@Test
public void shouldGetConfigAsXml() throws Exception {
configHelper.addPipeline("pipeline", "stage", "build1", "build2");
controller.getCurrentConfigXml(null, response);
ByteArrayOutputStream os = new ByteArrayOutputStream();
new MagicalGoConfigXmlWriter(new ConfigCache(), registry).write(goConfigDao.loadForEditing(), os, true);
assertValidContentAndStatus(SC_OK, "text/xml", os.toString());
assertThat(response.getHeader(XmlAction.X_CRUISE_CONFIG_MD5), is(goConfigDao.md5OfConfigFile()));
}
use of com.thoughtworks.go.config.MagicalGoConfigXmlWriter in project gocd by gocd.
the class AbstractConfigXmlWriterTest method setup.
@BeforeEach
public void setup() {
output = new ByteArrayOutputStream();
ConfigCache configCache = new ConfigCache();
xmlWriter = new MagicalGoConfigXmlWriter(configCache, ConfigElementImplementationRegistryMother.withNoPlugins());
xmlLoader = new MagicalGoConfigXmlLoader(configCache, ConfigElementImplementationRegistryMother.withNoPlugins());
}
Aggregations