use of com.thoughtworks.go.plugin.api.request.GoPluginApiRequest in project gocd by gocd.
the class ElasticAgentExtensionV1Test method assertExtensionRequest.
private void assertExtensionRequest(String extensionVersion, String requestName, String requestBody) throws JSONException {
final GoPluginApiRequest request = requestArgumentCaptor.getValue();
Assert.assertThat(request.requestName(), Matchers.is(requestName));
Assert.assertThat(request.extensionVersion(), Matchers.is(extensionVersion));
Assert.assertThat(request.extension(), Matchers.is(PluginConstants.ELASTIC_AGENT_EXTENSION));
JSONAssert.assertEquals(requestBody, request.requestBody(), true);
}
use of com.thoughtworks.go.plugin.api.request.GoPluginApiRequest in project gocd by gocd.
the class ElasticAgentExtensionV2Test method assertExtensionRequest.
private void assertExtensionRequest(String extensionVersion, String requestName, String requestBody) throws JSONException {
final GoPluginApiRequest request = requestArgumentCaptor.getValue();
Assert.assertThat(request.requestName(), Matchers.is(requestName));
Assert.assertThat(request.extensionVersion(), Matchers.is(extensionVersion));
Assert.assertThat(request.extension(), Matchers.is(PluginConstants.ELASTIC_AGENT_EXTENSION));
JSONAssert.assertEquals(requestBody, request.requestBody(), true);
}
use of com.thoughtworks.go.plugin.api.request.GoPluginApiRequest in project gocd by gocd.
the class ArtifactExtensionTest method shouldGetFetchArtifactViewFromPlugin.
@Test
public void shouldGetFetchArtifactViewFromPlugin() {
when(pluginManager.submitTo(eq(PLUGIN_ID), eq(ARTIFACT_EXTENSION), requestArgumentCaptor.capture())).thenReturn(new DefaultGoPluginApiResponse(SUCCESS_RESPONSE_CODE, "{ \"template\": \"fetch-artifact-view\"}"));
String view = artifactExtension.getFetchArtifactView(PLUGIN_ID);
final GoPluginApiRequest request = requestArgumentCaptor.getValue();
assertThat(request.extension(), is(ARTIFACT_EXTENSION));
assertThat(request.requestName(), is(REQUEST_FETCH_ARTIFACT_VIEW));
assertNull(request.requestBody());
assertThat(view, is("fetch-artifact-view"));
}
use of com.thoughtworks.go.plugin.api.request.GoPluginApiRequest in project gocd by gocd.
the class ArtifactExtensionTest method shouldGetArtifactStoreMetadataFromPlugin.
@Test
public void shouldGetArtifactStoreMetadataFromPlugin() {
String responseBody = "[{\"key\":\"BUCKET_NAME\",\"metadata\":{\"required\":true,\"secure\":false}},{\"key\":\"AWS_ACCESS_KEY\",\"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.getArtifactStoreMetadata(PLUGIN_ID);
final GoPluginApiRequest request = requestArgumentCaptor.getValue();
assertThat(request.extension(), is(ARTIFACT_EXTENSION));
assertThat(request.requestName(), is(REQUEST_STORE_CONFIG_METADATA));
assertNull(request.requestBody());
assertThat(response.size(), is(2));
assertThat(response, containsInAnyOrder(new PluginConfiguration("BUCKET_NAME", new Metadata(true, false)), new PluginConfiguration("AWS_ACCESS_KEY", new Metadata(true, true))));
}
use of com.thoughtworks.go.plugin.api.request.GoPluginApiRequest in project gocd by gocd.
the class ArtifactExtensionTest method shouldGetPluggableArtifactMetadataFromPlugin.
@Test
public void shouldGetPluggableArtifactMetadataFromPlugin() {
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.getPublishArtifactMetadata(PLUGIN_ID);
final GoPluginApiRequest request = requestArgumentCaptor.getValue();
assertThat(request.extension(), is(ARTIFACT_EXTENSION));
assertThat(request.requestName(), is(REQUEST_PUBLISH_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))));
}
Aggregations