use of org.apache.commons.collections.map.SingletonMap in project gocd by gocd.
the class ScmMaterialConfigTest method shouldSetFolderToNullWhenBlank.
@Test
public void shouldSetFolderToNullWhenBlank() {
material.setConfigAttributes(Collections.singletonMap(ScmMaterialConfig.FOLDER, "foo"));
assertThat(material.getFolder(), is(not(nullValue())));
material.setConfigAttributes(new SingletonMap(ScmMaterialConfig.FOLDER, ""));
assertThat(material.getFolder(), is(nullValue()));
}
use of org.apache.commons.collections.map.SingletonMap in project gocd by gocd.
the class ScmMaterialConfigTest method shouldUpdateAutoUpdateFieldFromConfigAttributes.
@Test
public void shouldUpdateAutoUpdateFieldFromConfigAttributes() {
material.setConfigAttributes(new SingletonMap(AUTO_UPDATE, "false"));
assertThat(material.isAutoUpdate(), is(false));
material.setConfigAttributes(new SingletonMap(AUTO_UPDATE, null));
assertThat(material.isAutoUpdate(), is(false));
material.setConfigAttributes(new SingletonMap(AUTO_UPDATE, "true"));
assertThat(material.isAutoUpdate(), is(true));
material.setConfigAttributes(new HashMap());
assertThat(material.isAutoUpdate(), is(false));
material.setConfigAttributes(new SingletonMap(AUTO_UPDATE, null));
assertThat(material.isAutoUpdate(), is(false));
material.setConfigAttributes(new SingletonMap(AUTO_UPDATE, "random-stuff"));
assertThat(material.isAutoUpdate(), is(false));
}
use of org.apache.commons.collections.map.SingletonMap in project gocd by gocd.
the class ScmMaterialConfigTest method shouldSetFilterToNullWhenBlank.
@Test
public void shouldSetFilterToNullWhenBlank() {
material.setFilter(new Filter(new IgnoredFiles("*.*")));
material.setConfigAttributes(new SingletonMap(ScmMaterialConfig.FILTER, ""));
assertThat(material.filter(), is(new Filter()));
assertThat(material.getFilterAsString(), is(""));
}
use of org.apache.commons.collections.map.SingletonMap in project gocd by gocd.
the class EnvironmentConfigBasicTest method shouldUpdateName.
@Test
public void shouldUpdateName() {
environmentConfig.setConfigAttributes(new SingletonMap(BasicEnvironmentConfig.NAME_FIELD, "PROD"));
assertThat(environmentConfig.name(), is(new CaseInsensitiveString("PROD")));
}
use of org.apache.commons.collections.map.SingletonMap in project gocd by gocd.
the class EnvironmentConfigTestBase method shouldUpdateAgents.
@Test
public void shouldUpdateAgents() {
environmentConfig.addAgent("uuid-1");
environmentConfig.setConfigAttributes(new SingletonMap(BasicEnvironmentConfig.AGENTS_FIELD, Arrays.asList(new SingletonMap("uuid", "uuid-2"), new SingletonMap("uuid", "uuid-3"))));
EnvironmentAgentsConfig expectedAgents = new EnvironmentAgentsConfig();
expectedAgents.add(new EnvironmentAgentConfig("uuid-2"));
expectedAgents.add(new EnvironmentAgentConfig("uuid-3"));
assertThat(environmentConfig.getAgents(), is(expectedAgents));
}
Aggregations