Search in sources :

Example 6 with MagicalGoConfigXmlLoader

use of com.thoughtworks.go.config.MagicalGoConfigXmlLoader in project gocd by gocd.

the class UniqueRunIfStatusValidatorTest method shouldThrowExceptionWhenThereIsMoreThanOneOnCancelInEachTask.

@Test
public void shouldThrowExceptionWhenThereIsMoreThanOneOnCancelInEachTask() throws Exception {
    try {
        final ByteArrayInputStream inputStream = new ByteArrayInputStream(ConfigFileFixture.CONTAINS_MULTI_SAME_STATUS_RUN_IF.getBytes());
        new MagicalGoConfigXmlLoader(new ConfigCache(), ConfigElementImplementationRegistryMother.withNoPlugins()).loadConfigHolder(IOUtils.toString(inputStream, UTF_8));
        fail();
    } catch (Exception e) {
        assertThat(e.getMessage(), is("Duplicate unique value [passed] declared for identity constraint of element \"exec\"."));
    }
}
Also used : ConfigCache(com.thoughtworks.go.config.ConfigCache) ByteArrayInputStream(java.io.ByteArrayInputStream) MagicalGoConfigXmlLoader(com.thoughtworks.go.config.MagicalGoConfigXmlLoader) Test(org.junit.Test)

Example 7 with MagicalGoConfigXmlLoader

use of com.thoughtworks.go.config.MagicalGoConfigXmlLoader in project gocd by gocd.

the class UniqueRunIfStatusValidatorTest method shouldPassWhenEachJobContainsOnCancel.

@Test
public void shouldPassWhenEachJobContainsOnCancel() throws Exception {
    final ByteArrayInputStream inputStream = new ByteArrayInputStream(ConfigMigrator.migrate(ConfigFileFixture.CONTAINS_MULTI_DIFFERENT_STATUS_RUN_IF).getBytes());
    CruiseConfig cruiseConfig = new MagicalGoConfigXmlLoader(new ConfigCache(), ConfigElementImplementationRegistryMother.withNoPlugins()).loadConfigHolder(IOUtils.toString(inputStream, UTF_8)).config;
    assertThat(cruiseConfig, is(not(nullValue())));
}
Also used : ConfigCache(com.thoughtworks.go.config.ConfigCache) ByteArrayInputStream(java.io.ByteArrayInputStream) MagicalGoConfigXmlLoader(com.thoughtworks.go.config.MagicalGoConfigXmlLoader) CruiseConfig(com.thoughtworks.go.config.CruiseConfig) Test(org.junit.Test)

Example 8 with MagicalGoConfigXmlLoader

use of com.thoughtworks.go.config.MagicalGoConfigXmlLoader in project gocd by gocd.

the class BaseConfigXmlLoaderTest method setup.

@Before
public void setup() throws Exception {
    SCMMetadataStore.getInstance().clear();
    xmlLoader = new MagicalGoConfigXmlLoader(configCache, ConfigElementImplementationRegistryMother.withNoPlugins());
}
Also used : MagicalGoConfigXmlLoader(com.thoughtworks.go.config.MagicalGoConfigXmlLoader) Before(org.junit.Before)

Example 9 with MagicalGoConfigXmlLoader

use of com.thoughtworks.go.config.MagicalGoConfigXmlLoader in project gocd by gocd.

the class RakeTaskTest method shouldDefaultToUsingAKillAllChildrenCancelTask.

@Test
public void shouldDefaultToUsingAKillAllChildrenCancelTask() throws Exception {
    RakeTask rakeTask = new MagicalGoConfigXmlLoader(new ConfigCache(), ConfigElementImplementationRegistryMother.withNoPlugins()).fromXmlPartial("<rake/>", RakeTask.class);
    assertThat(rakeTask.cancelTask(), is(instanceOf(KillAllChildProcessTask.class)));
}
Also used : ConfigCache(com.thoughtworks.go.config.ConfigCache) RakeTask(com.thoughtworks.go.config.RakeTask) MagicalGoConfigXmlLoader(com.thoughtworks.go.config.MagicalGoConfigXmlLoader) Test(org.junit.Test)

Example 10 with MagicalGoConfigXmlLoader

use of com.thoughtworks.go.config.MagicalGoConfigXmlLoader in project gocd by gocd.

the class RakeTaskTest method shouldNotKillAllChildrenWhenEmptyOnCancel.

@Test
public void shouldNotKillAllChildrenWhenEmptyOnCancel() throws Exception {
    RakeTask rakeTask = new MagicalGoConfigXmlLoader(new ConfigCache(), ConfigElementImplementationRegistryMother.withNoPlugins()).fromXmlPartial("<rake>" + "  <oncancel />" + "</rake>", RakeTask.class);
    assertThat(rakeTask.cancelTask(), is(instanceOf(NullTask.class)));
}
Also used : ConfigCache(com.thoughtworks.go.config.ConfigCache) RakeTask(com.thoughtworks.go.config.RakeTask) MagicalGoConfigXmlLoader(com.thoughtworks.go.config.MagicalGoConfigXmlLoader) Test(org.junit.Test)

Aggregations

MagicalGoConfigXmlLoader (com.thoughtworks.go.config.MagicalGoConfigXmlLoader)10 ConfigCache (com.thoughtworks.go.config.ConfigCache)9 Test (org.junit.Test)7 CruiseConfig (com.thoughtworks.go.config.CruiseConfig)3 RakeTask (com.thoughtworks.go.config.RakeTask)2 ConfigElementImplementationRegistry (com.thoughtworks.go.config.registry.ConfigElementImplementationRegistry)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 StringContains.containsString (org.hamcrest.core.StringContains.containsString)2 Before (org.junit.Before)2 Argument (com.thoughtworks.go.config.Argument)1 ExecTask (com.thoughtworks.go.config.ExecTask)1 JobConfig (com.thoughtworks.go.config.JobConfig)1 MagicalGoConfigXmlWriter (com.thoughtworks.go.config.MagicalGoConfigXmlWriter)1 MailHost (com.thoughtworks.go.config.MailHost)1 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)1 Builder (com.thoughtworks.go.domain.builder.Builder)1 Arguments (com.thoughtworks.go.domain.config.Arguments)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1