use of org.apache.commons.collections.map.SingletonMap in project gocd by gocd.
the class StageConfigTest method shouldSetArtifactCleanupOptOutAttribute.
@Test
public void shouldSetArtifactCleanupOptOutAttribute() throws Exception {
StageConfig config = new StageConfig();
assertThat(config.isArtifactCleanupProhibited(), is(false));
config.setConfigAttributes(new SingletonMap(StageConfig.ARTIFACT_CLEANUP_PROHIBITED, "1"));
assertThat(config.isArtifactCleanupProhibited(), is(true));
config.setConfigAttributes(new HashMap());
assertThat(config.isArtifactCleanupProhibited(), is(true));
config.setConfigAttributes(new SingletonMap(StageConfig.ARTIFACT_CLEANUP_PROHIBITED, "0"));
assertThat(config.isArtifactCleanupProhibited(), is(false));
}
use of org.apache.commons.collections.map.SingletonMap in project gocd by gocd.
the class ApprovalTest method shouldValidateApprovalType.
@Test
public void shouldValidateApprovalType() throws Exception {
Approval approval = new Approval();
approval.setConfigAttributes(new SingletonMap(Approval.TYPE, "not-manual-or-success"));
assertThat(approval.getType(), is("not-manual-or-success"));
approval.validate(ConfigSaveValidationContext.forChain(new BasicCruiseConfig(), new BasicPipelineConfigs()));
assertThat(approval.errors().firstError(), is("You have defined approval type as 'not-manual-or-success'. Approval can only be of the type 'manual' or 'success'."));
}
use of org.apache.commons.collections.map.SingletonMap in project gocd by gocd.
the class ApprovalTest method shouldNotAssignType.
@Test
public void shouldNotAssignType() throws Exception {
Approval approval = new Approval();
approval.setConfigAttributes(new SingletonMap(Approval.TYPE, Approval.SUCCESS));
assertThat(approval.getType(), is(Approval.SUCCESS));
approval.setConfigAttributes(new HashMap());
assertThat(approval.getType(), is(Approval.SUCCESS));
approval.setConfigAttributes(new SingletonMap(Approval.TYPE, Approval.MANUAL));
assertThat(approval.getType(), is(Approval.MANUAL));
approval.setConfigAttributes(new HashMap());
assertThat(approval.getType(), is(Approval.MANUAL));
}
use of org.apache.commons.collections.map.SingletonMap in project gocd by gocd.
the class StageConfigTest method shouldSetApprovalFromConfigAttrs.
@Test
public void shouldSetApprovalFromConfigAttrs() throws Exception {
StageConfig config = new StageConfig();
config.setConfigAttributes(new SingletonMap(StageConfig.APPROVAL, new SingletonMap(Approval.TYPE, Approval.MANUAL)));
assertThat(config.getApproval().getType(), is(Approval.MANUAL));
config.setConfigAttributes(new HashMap());
assertThat(config.getApproval().getType(), is(Approval.MANUAL));
config.setConfigAttributes(new SingletonMap(StageConfig.APPROVAL, new SingletonMap(Approval.TYPE, Approval.SUCCESS)));
assertThat(config.getApproval().getType(), is(Approval.SUCCESS));
config.setConfigAttributes(new HashMap());
assertThat(config.getApproval().getType(), is(Approval.SUCCESS));
}
use of org.apache.commons.collections.map.SingletonMap in project gocd by gocd.
the class MingleConfigTest method shouldSetMingleConfigFromConfigAttributes.
@Test
public void shouldSetMingleConfigFromConfigAttributes() {
MingleConfig mingleConfig = new MingleConfig();
Map configMap = new HashMap();
configMap.put(MingleConfig.BASE_URL, "http://mingle01.tw.com/mingle");
configMap.put(MingleConfig.PROJECT_IDENTIFIER, "go");
configMap.put(MingleConfig.MQL_GROUPING_CONDITIONS, new SingletonMap(MqlCriteria.MQL, "Some MQL"));
mingleConfig.setConfigAttributes(configMap);
assertThat(mingleConfig.getBaseUrl(), is("http://mingle01.tw.com/mingle"));
assertThat(mingleConfig.getProjectIdentifier(), is("go"));
assertThat(mingleConfig.getMqlCriteria().getMql(), is("Some MQL"));
}
Aggregations