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\"."));
}
}
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())));
}
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());
}
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)));
}
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)));
}
Aggregations