use of com.thoughtworks.go.server.domain.PluginSettings in project gocd by gocd.
the class PluginServiceTest method shouldGetSettingsFromDBIfExists.
@Test
public void shouldGetSettingsFromDBIfExists() {
PluginSettings pluginSettings = pluginService.getPluginSettingsFor("plugin-id-1");
assertThat(pluginSettings.getPluginSettingsKeys().size(), is(3));
assertThat(pluginSettings.getValueFor("p1-k1"), is("v1"));
assertThat(pluginSettings.getValueFor("p1-k2"), is(""));
assertThat(pluginSettings.getValueFor("p1-k3"), is(nullValue()));
}
use of com.thoughtworks.go.server.domain.PluginSettings in project gocd by gocd.
the class PluginServiceTest method shouldNotUpdatePluginSettingsWithErrorsIfNotExists.
@Test
public void shouldNotUpdatePluginSettingsWithErrorsIfNotExists() {
when(notificationExtension.canHandlePlugin("plugin-id-4")).thenReturn(true);
when(notificationExtension.validatePluginSettings(eq("plugin-id-4"), any(PluginSettingsConfiguration.class))).thenReturn(new ValidationResult());
Map<String, String> parameterMap = new HashMap<>();
parameterMap.put("p4-k1", "v1");
parameterMap.put("p4-k2", "v2");
PluginSettings pluginSettings = new PluginSettings("plugin-id-4");
pluginSettings.populateSettingsMap(parameterMap);
pluginService.validatePluginSettingsFor(pluginSettings);
assertThat(pluginSettings.hasErrors(), is(false));
}
use of com.thoughtworks.go.server.domain.PluginSettings in project gocd by gocd.
the class JsonMessageHandler1_0Test method shouldHandleResponseMessageForPluginSettingsGet.
@Test
public void shouldHandleResponseMessageForPluginSettingsGet() {
PluginSettings pluginSettings = new PluginSettings("plugin-id-1");
Map<String, String> map = new LinkedHashMap<>();
map.put("k1", "v1");
map.put("k2", "v2");
pluginSettings.populateSettingsMap(map);
assertThat(messageHandler.responseMessagePluginSettingsGet(pluginSettings), is("{\"k1\":\"v1\",\"k2\":\"v2\"}"));
}
use of com.thoughtworks.go.server.domain.PluginSettings in project gocd by gocd.
the class PluginServiceTest method shouldGetSettingsFromConfigurationIfItDoesNotExistInDB.
@Test
public void shouldGetSettingsFromConfigurationIfItDoesNotExistInDB() {
PluginSettings pluginSettings = pluginService.getPluginSettingsFor("plugin-id-2");
assertThat(pluginSettings.getPluginSettingsKeys().size(), is(3));
assertThat(pluginSettings.getValueFor("p2-k1"), is(""));
assertThat(pluginSettings.getValueFor("p2-k2"), is(""));
assertThat(pluginSettings.getValueFor("p2-k3"), is(""));
}
use of com.thoughtworks.go.server.domain.PluginSettings in project gocd by gocd.
the class PluginServiceTest method shouldTalkToPluginForPluginSettingsValidation_ConfigRepo.
@Test
public void shouldTalkToPluginForPluginSettingsValidation_ConfigRepo() {
when(configRepoExtension.isConfigRepoPlugin("plugin-id-4")).thenReturn(true);
when(configRepoExtension.canHandlePlugin("plugin-id-4")).thenReturn(true);
when(configRepoExtension.validatePluginSettings(eq("plugin-id-4"), any(PluginSettingsConfiguration.class))).thenReturn(new ValidationResult());
PluginSettings pluginSettings = new PluginSettings("plugin-id-4");
pluginService.validatePluginSettingsFor(pluginSettings);
verify(configRepoExtension).validatePluginSettings(eq("plugin-id-4"), any(PluginSettingsConfiguration.class));
}
Aggregations