use of com.thoughtworks.go.plugin.access.scm.SCMConfigurations in project gocd by gocd.
the class SCMTest method shouldConvertKeysToLowercaseInGetConfigForDisplay.
@Test
void shouldConvertKeysToLowercaseInGetConfigForDisplay() {
SCMMetadataStore.getInstance().addMetadataFor("plugin-id", new SCMConfigurations(), null);
Configuration configuration = new Configuration(create("kEY1", false, "vALue1"), create("KEY_MORE_2", false, "VALUE_2"), create("key_3", false, "value3"));
SCM scm = SCMMother.create("scm", "scm-name", "plugin-id", "1.0", configuration);
assertThat(scm.getConfigForDisplay()).isEqualTo("[key1=vALue1, key_more_2=VALUE_2, key_3=value3]");
}
use of com.thoughtworks.go.plugin.access.scm.SCMConfigurations in project gocd by gocd.
the class SCMTest method shouldIgnoreKeysPresentInConfigAttributesMapButNotPresentInConfigStore.
@Test
void shouldIgnoreKeysPresentInConfigAttributesMapButNotPresentInConfigStore() {
SCMConfigurations scmConfigurations = new SCMConfigurations();
scmConfigurations.add(new SCMConfiguration("KEY1"));
SCMPreference scmPreference = mock(SCMPreference.class);
when(scmPreference.getScmConfigurations()).thenReturn(scmConfigurations);
SCMMetadataStore.getInstance().setPreferenceFor("plugin-id", scmPreference);
Configuration configuration = new Configuration(ConfigurationPropertyMother.create("KEY1"));
SCM scm = new SCM("scm-id", new PluginConfiguration("plugin-id", "1"), configuration);
Map<String, String> attributeMap = DataStructureUtils.m("KEY1", "value1", "Key2", "value2");
scm.setConfigAttributes(attributeMap);
assertThat(scm.getConfigAsMap().get("KEY1").get(SCM.VALUE_KEY)).isEqualTo("value1");
assertThat(scm.getConfigAsMap().containsKey("Key2")).isFalse();
}
use of com.thoughtworks.go.plugin.access.scm.SCMConfigurations in project gocd by gocd.
the class SCMTest method shouldNotDisplayEmptyValuesInGetConfigForDisplay.
@Test
void shouldNotDisplayEmptyValuesInGetConfigForDisplay() {
SCMMetadataStore.getInstance().addMetadataFor("plugin-id", new SCMConfigurations(), null);
Configuration configuration = new Configuration(create("rk1", false, ""), create("rk2", false, "some-non-empty-value"), create("rk3", false, null));
SCM scm = SCMMother.create("scm", "scm-name", "plugin-id", "1.0", configuration);
assertThat(scm.getConfigForDisplay()).isEqualTo("[rk2=some-non-empty-value]");
}
use of com.thoughtworks.go.plugin.access.scm.SCMConfigurations in project gocd by gocd.
the class SCMTest method shouldNotOverwriteValuesIfTheyAreNotAvailableInConfigAttributesMap.
@Test
void shouldNotOverwriteValuesIfTheyAreNotAvailableInConfigAttributesMap() {
SCMConfigurations scmConfigurations = new SCMConfigurations();
scmConfigurations.add(new SCMConfiguration("KEY1"));
scmConfigurations.add(new SCMConfiguration("Key2"));
SCMPreference scmPreference = mock(SCMPreference.class);
when(scmPreference.getScmConfigurations()).thenReturn(scmConfigurations);
SCMMetadataStore.getInstance().setPreferenceFor("plugin-id", scmPreference);
Configuration configuration = new Configuration(ConfigurationPropertyMother.create("KEY1"), ConfigurationPropertyMother.create("Key2"));
SCM scm = new SCM("scm-id", new PluginConfiguration("plugin-id", "1"), configuration);
Map<String, String> attributeMap = DataStructureUtils.m("KEY1", "value1");
scm.setConfigAttributes(attributeMap);
assertThat(scm.getConfigAsMap().get("KEY1").get(SCM.VALUE_KEY)).isEqualTo("value1");
assertThat(scm.getConfigAsMap().get("Key2").get(SCM.VALUE_KEY)).isNull();
}
use of com.thoughtworks.go.plugin.access.scm.SCMConfigurations in project gocd by gocd.
the class PluggableSCMMaterialTest method shouldReturnSomethingMoreSaneForToString.
@Test
void shouldReturnSomethingMoreSaneForToString() throws Exception {
PluggableSCMMaterial material = MaterialsMother.pluggableSCMMaterial();
SCMMetadataStore.getInstance().addMetadataFor(material.getPluginId(), new SCMConfigurations(), null);
assertThat(material.toString()).isEqualTo("'PluggableSCMMaterial{[k1=v1, k2=v2]}'");
}
Aggregations