Search in sources :

Example 6 with SingletonMap

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()));
}
Also used : SingletonMap(org.apache.commons.collections.map.SingletonMap) Test(org.junit.Test)

Example 7 with SingletonMap

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));
}
Also used : SingletonMap(org.apache.commons.collections.map.SingletonMap) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 8 with SingletonMap

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(""));
}
Also used : SingletonMap(org.apache.commons.collections.map.SingletonMap) Test(org.junit.Test)

Example 9 with SingletonMap

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")));
}
Also used : SingletonMap(org.apache.commons.collections.map.SingletonMap) Test(org.junit.Test)

Example 10 with SingletonMap

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));
}
Also used : SingletonMap(org.apache.commons.collections.map.SingletonMap) Test(org.junit.Test)

Aggregations

SingletonMap (org.apache.commons.collections.map.SingletonMap)15 Test (org.junit.Test)15 HashMap (java.util.HashMap)5 MingleConfig (com.thoughtworks.go.config.MingleConfig)1 FileConfigOrigin (com.thoughtworks.go.config.remote.FileConfigOrigin)1 RepoConfigOrigin (com.thoughtworks.go.config.remote.RepoConfigOrigin)1 Map (java.util.Map)1