use of com.thoughtworks.go.plugin.access.common.settings.PluginSettingsConfiguration in project gocd by gocd.
the class NotificationExtensionTestBase method shouldTalkToPluginToGetPluginSettingsConfiguration.
@Test
public void shouldTalkToPluginToGetPluginSettingsConfiguration() throws Exception {
PluginSettingsConfiguration deserializedResponse = new PluginSettingsConfiguration();
when(pluginSettingsJSONMessageHandler().responseMessageForPluginSettingsConfiguration(RESPONSE_BODY)).thenReturn(deserializedResponse);
PluginSettingsConfiguration response = notificationExtension.getPluginSettingsConfiguration(PLUGIN_ID);
assertRequest(requestArgumentCaptor.getValue(), NotificationExtension.EXTENSION_NAME, apiVersion(), PluginSettingsConstants.REQUEST_PLUGIN_SETTINGS_CONFIGURATION, null);
verify(pluginSettingsJSONMessageHandler()).responseMessageForPluginSettingsConfiguration(RESPONSE_BODY);
assertSame(response, deserializedResponse);
}
use of com.thoughtworks.go.plugin.access.common.settings.PluginSettingsConfiguration in project gocd by gocd.
the class PluginSettingsTest method shouldPopulateSettingsMapFromPluginFromConfiguration.
@Test
public void shouldPopulateSettingsMapFromPluginFromConfiguration() {
PluginSettingsConfiguration configuration = new PluginSettingsConfiguration();
configuration.add(new PluginSettingsProperty("k1", "v1"));
configuration.add(new PluginSettingsProperty("k2", ""));
configuration.add(new PluginSettingsProperty("k3", null));
PluginSettings pluginSettings = new PluginSettings(PLUGIN_ID);
pluginSettings.populateSettingsMap(configuration);
assertThat(pluginSettings.getPluginSettingsKeys().size(), is(3));
assertThat(pluginSettings.getValueFor("k1"), is(""));
assertThat(pluginSettings.getValueFor("k2"), is(""));
assertThat(pluginSettings.getValueFor("k3"), is(""));
}
use of com.thoughtworks.go.plugin.access.common.settings.PluginSettingsConfiguration in project gocd by gocd.
the class AuthenticationExtensionTest method setUp.
@Before
public void setUp() throws Exception {
initMocks(this);
authenticationExtension = new AuthenticationExtension(pluginManager);
authenticationExtension.getPluginSettingsMessageHandlerMap().put("1.0", pluginSettingsJSONMessageHandler);
authenticationExtension.getMessageHandlerMap().put("1.0", jsonMessageHandler);
pluginSettingsConfiguration = new PluginSettingsConfiguration();
requestArgumentCaptor = ArgumentCaptor.forClass(GoPluginApiRequest.class);
when(pluginManager.resolveExtensionVersion(PLUGIN_ID, Arrays.asList("1.0"))).thenReturn("1.0");
when(pluginManager.isPluginOfType(AuthenticationExtension.EXTENSION_NAME, PLUGIN_ID)).thenReturn(true);
when(pluginManager.submitTo(eq(PLUGIN_ID), requestArgumentCaptor.capture())).thenReturn(DefaultGoPluginApiResponse.success(RESPONSE_BODY));
}
use of com.thoughtworks.go.plugin.access.common.settings.PluginSettingsConfiguration in project gocd by gocd.
the class SCMExtensionTest method setUp.
@Before
public void setUp() throws Exception {
initMocks(this);
scmExtension = new SCMExtension(pluginManager);
scmExtension.getPluginSettingsMessageHandlerMap().put("1.0", pluginSettingsJSONMessageHandler);
scmExtension.getMessageHandlerMap().put("1.0", jsonMessageHandler);
pluginSettingsConfiguration = new PluginSettingsConfiguration();
scmPropertyConfiguration = new SCMPropertyConfiguration();
materialData = new HashMap<>();
requestArgumentCaptor = ArgumentCaptor.forClass(GoPluginApiRequest.class);
when(pluginManager.resolveExtensionVersion(PLUGIN_ID, asList("1.0"))).thenReturn("1.0");
when(pluginManager.isPluginOfType(SCMExtension.EXTENSION_NAME, PLUGIN_ID)).thenReturn(true);
when(pluginManager.submitTo(eq(PLUGIN_ID), requestArgumentCaptor.capture())).thenReturn(DefaultGoPluginApiResponse.success(responseBody));
}
use of com.thoughtworks.go.plugin.access.common.settings.PluginSettingsConfiguration in project gocd by gocd.
the class PackageRepositoryExtensionTest method setUp.
@Before
public void setUp() throws Exception {
initMocks(this);
extension = new PackageRepositoryExtension(pluginManager);
pluginSettingsConfiguration = new PluginSettingsConfiguration();
repositoryConfiguration = new RepositoryConfiguration();
repositoryConfiguration.add(new PackageMaterialProperty("key-one", "value-one"));
repositoryConfiguration.add(new PackageMaterialProperty("key-two", "value-two"));
packageConfiguration = new com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration();
packageConfiguration.add(new PackageMaterialProperty("key-three", "value-three"));
packageConfiguration.add(new PackageMaterialProperty("key-four", "value-four"));
requestArgumentCaptor = ArgumentCaptor.forClass(GoPluginApiRequest.class);
when(pluginManager.resolveExtensionVersion(PLUGIN_ID, asList("1.0"))).thenReturn("1.0");
}
Aggregations