Search in sources :

Example 1 with MagicalGoConfigXmlWriter

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());
}
Also used : ConfigCache(com.thoughtworks.go.config.ConfigCache) MagicalGoConfigXmlLoader(com.thoughtworks.go.config.MagicalGoConfigXmlLoader) ByteArrayOutputStream(java.io.ByteArrayOutputStream) MagicalGoConfigXmlWriter(com.thoughtworks.go.config.MagicalGoConfigXmlWriter) Before(org.junit.Before)

Example 2 with MagicalGoConfigXmlWriter

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)));
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) MagicalGoConfigXmlWriter(com.thoughtworks.go.config.MagicalGoConfigXmlWriter) Test(org.junit.Test)

Example 3 with MagicalGoConfigXmlWriter

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()));
}
Also used : ConfigCache(com.thoughtworks.go.config.ConfigCache) ByteArrayOutputStream(java.io.ByteArrayOutputStream) MagicalGoConfigXmlWriter(com.thoughtworks.go.config.MagicalGoConfigXmlWriter) Test(org.junit.jupiter.api.Test)

Example 4 with MagicalGoConfigXmlWriter

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()));
}
Also used : ConfigCache(com.thoughtworks.go.config.ConfigCache) ByteArrayOutputStream(java.io.ByteArrayOutputStream) MagicalGoConfigXmlWriter(com.thoughtworks.go.config.MagicalGoConfigXmlWriter) Test(org.junit.jupiter.api.Test)

Example 5 with MagicalGoConfigXmlWriter

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());
}
Also used : ConfigCache(com.thoughtworks.go.config.ConfigCache) MagicalGoConfigXmlLoader(com.thoughtworks.go.config.MagicalGoConfigXmlLoader) ByteArrayOutputStream(java.io.ByteArrayOutputStream) MagicalGoConfigXmlWriter(com.thoughtworks.go.config.MagicalGoConfigXmlWriter) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

MagicalGoConfigXmlWriter (com.thoughtworks.go.config.MagicalGoConfigXmlWriter)5 ConfigCache (com.thoughtworks.go.config.ConfigCache)4 ByteArrayOutputStream (java.io.ByteArrayOutputStream)4 MagicalGoConfigXmlLoader (com.thoughtworks.go.config.MagicalGoConfigXmlLoader)2 Test (org.junit.jupiter.api.Test)2 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)1 Before (org.junit.Before)1 Test (org.junit.Test)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1