use of com.thoughtworks.go.plugin.domain.common.PluginConfiguration in project gocd by gocd.
the class ElasticAgentExtensionTest method shouldGetProfileMetadata.
@Test
public void shouldGetProfileMetadata() throws JSONException {
String responseBody = "[{\"key\":\"Username\",\"metadata\":{\"required\":true,\"secure\":false}},{\"key\":\"Password\",\"metadata\":{\"required\":true,\"secure\":true}}]";
when(pluginManager.submitTo(eq(PLUGIN_ID), eq(ELASTIC_AGENT_EXTENSION), requestArgumentCaptor.capture())).thenReturn(DefaultGoPluginApiResponse.success(responseBody));
final List<PluginConfiguration> metadata = extension.getProfileMetadata(PLUGIN_ID);
MatcherAssert.assertThat(metadata, hasSize(2));
MatcherAssert.assertThat(metadata, containsInAnyOrder(new PluginConfiguration("Username", new Metadata(true, false)), new PluginConfiguration("Password", new Metadata(true, true))));
assertExtensionRequest("3.0", REQUEST_GET_PROFILE_METADATA, null);
}
use of com.thoughtworks.go.plugin.domain.common.PluginConfiguration in project gocd by gocd.
the class ElasticAgentExtensionV3Test method shouldGetProfileMetadata.
@Test
public void shouldGetProfileMetadata() throws JSONException {
String responseBody = "[{\"key\":\"Username\",\"metadata\":{\"required\":true,\"secure\":false}},{\"key\":\"Password\",\"metadata\":{\"required\":true,\"secure\":true}}]";
when(pluginManager.submitTo(eq(PLUGIN_ID), eq(ELASTIC_AGENT_EXTENSION), requestArgumentCaptor.capture())).thenReturn(DefaultGoPluginApiResponse.success(responseBody));
final List<PluginConfiguration> metadata = extensionV3.getElasticProfileMetadata(PLUGIN_ID);
assertThat(metadata, hasSize(2));
assertThat(metadata, containsInAnyOrder(new PluginConfiguration("Username", new Metadata(true, false)), new PluginConfiguration("Password", new Metadata(true, true))));
assertExtensionRequest("3.0", REQUEST_GET_PROFILE_METADATA, null);
}
use of com.thoughtworks.go.plugin.domain.common.PluginConfiguration in project gocd by gocd.
the class NotificationPluginInfoBuilderTest method shouldBuildPluginInfo.
@Test
public void shouldBuildPluginInfo() throws Exception {
GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin1", null, null, null, null, false);
NotificationPluginInfo pluginInfo = new NotificationPluginInfoBuilder(extension).pluginInfoFor(descriptor);
List<PluginConfiguration> pluginConfigurations = Arrays.asList(new PluginConfiguration("username", new Metadata(true, false)), new PluginConfiguration("password", new Metadata(true, true)));
PluginView pluginView = new PluginView("some-html");
assertThat(pluginInfo.getDescriptor(), is(descriptor));
assertThat(pluginInfo.getExtensionName(), is("notification"));
assertThat(pluginInfo.getPluginSettings(), is(new PluggableInstanceSettings(pluginConfigurations, pluginView)));
}
use of com.thoughtworks.go.plugin.domain.common.PluginConfiguration in project gocd by gocd.
the class ArtifactExtensionTest method shouldGetFetchArtifactMetadataFromPlugin.
@Test
public void shouldGetFetchArtifactMetadataFromPlugin() {
String responseBody = "[{\"key\":\"FILENAME\",\"metadata\":{\"required\":true,\"secure\":false}},{\"key\":\"VERSION\",\"metadata\":{\"required\":true,\"secure\":true}}]";
when(pluginManager.submitTo(eq(PLUGIN_ID), eq(ARTIFACT_EXTENSION), requestArgumentCaptor.capture())).thenReturn(DefaultGoPluginApiResponse.success(responseBody));
final List<PluginConfiguration> response = artifactExtension.getFetchArtifactMetadata(PLUGIN_ID);
final GoPluginApiRequest request = requestArgumentCaptor.getValue();
assertThat(request.extension(), is(ARTIFACT_EXTENSION));
assertThat(request.requestName(), is(REQUEST_FETCH_ARTIFACT_METADATA));
assertNull(request.requestBody());
assertThat(response.size(), is(2));
assertThat(response, containsInAnyOrder(new PluginConfiguration("FILENAME", new Metadata(true, false)), new PluginConfiguration("VERSION", new Metadata(true, true))));
}
use of com.thoughtworks.go.plugin.domain.common.PluginConfiguration in project gocd by gocd.
the class AuthorizationExtensionTest method shouldTalkToPlugin_To_GetPluginConfigurationMetadata.
@Test
public void shouldTalkToPlugin_To_GetPluginConfigurationMetadata() throws Exception {
String responseBody = "[{\"key\":\"username\",\"metadata\":{\"required\":true,\"secure\":false}},{\"key\":\"password\",\"metadata\":{\"required\":true,\"secure\":true}}]";
when(pluginManager.submitTo(eq(PLUGIN_ID), eq(AUTHORIZATION_EXTENSION), requestArgumentCaptor.capture())).thenReturn(new DefaultGoPluginApiResponse(SUCCESS_RESPONSE_CODE, responseBody));
List<PluginConfiguration> authConfigMetadata = authorizationExtension.getAuthConfigMetadata(PLUGIN_ID);
assertRequest(requestArgumentCaptor.getValue(), AUTHORIZATION_EXTENSION, "1.0", REQUEST_GET_AUTH_CONFIG_METADATA, null);
assertThat(authConfigMetadata.size(), is(2));
assertThat(authConfigMetadata, containsInAnyOrder(new PluginConfiguration("username", new Metadata(true, false)), new PluginConfiguration("password", new Metadata(true, true))));
}
Aggregations