use of com.thoughtworks.go.plugin.api.request.GoPluginApiRequest in project gocd by gocd.
the class ArtifactExtensionTest method shouldGetCapabilities.
@Test
public void shouldGetCapabilities() {
when(pluginManager.submitTo(eq(PLUGIN_ID), eq(ARTIFACT_EXTENSION), requestArgumentCaptor.capture())).thenReturn(DefaultGoPluginApiResponse.success("{}"));
artifactExtension.getCapabilities(PLUGIN_ID);
final GoPluginApiRequest request = requestArgumentCaptor.getValue();
assertThat(request.extension(), is(ARTIFACT_EXTENSION));
assertThat(request.requestName(), is(REQUEST_GET_CAPABILITIES));
assertNull(request.requestBody());
}
use of com.thoughtworks.go.plugin.api.request.GoPluginApiRequest in project gocd by gocd.
the class ArtifactExtensionTest method shouldGetPluggableArtifactViewFromPlugin.
@Test
public void shouldGetPluggableArtifactViewFromPlugin() {
when(pluginManager.submitTo(eq(PLUGIN_ID), eq(ARTIFACT_EXTENSION), requestArgumentCaptor.capture())).thenReturn(new DefaultGoPluginApiResponse(SUCCESS_RESPONSE_CODE, "{ \"template\": \"pluggable-artifact-view\"}"));
String view = artifactExtension.getPublishArtifactView(PLUGIN_ID);
final GoPluginApiRequest request = requestArgumentCaptor.getValue();
assertThat(request.extension(), is(ARTIFACT_EXTENSION));
assertThat(request.requestName(), is(REQUEST_PUBLISH_ARTIFACT_VIEW));
assertNull(request.requestBody());
assertThat(view, is("pluggable-artifact-view"));
}
use of com.thoughtworks.go.plugin.api.request.GoPluginApiRequest in project gocd by gocd.
the class ElasticAgentExtensionTest method assertExtensionRequest.
private void assertExtensionRequest(String extensionVersion, String requestName, String requestBody) {
final GoPluginApiRequest request = requestArgumentCaptor.getValue();
assertThat(request.requestName(), is(requestName));
assertThat(request.extensionVersion(), is(extensionVersion));
assertThat(request.extension(), is(ELASTIC_AGENT_EXTENSION));
assertThatJson(requestBody).isEqualTo(request.requestBody());
}
use of com.thoughtworks.go.plugin.api.request.GoPluginApiRequest in project gocd by gocd.
the class AbstractExtensionTest method shouldNotifySettingsChangeForPluginWhichSupportsNotification.
@Test
public void shouldNotifySettingsChangeForPluginWhichSupportsNotification() throws Exception {
String supportedVersion = "2.0";
Map<String, String> settings = Collections.singletonMap("foo", "bar");
ArgumentCaptor<GoPluginApiRequest> requestArgumentCaptor = ArgumentCaptor.forClass(GoPluginApiRequest.class);
extension.registerHandler(supportedVersion, new PluginSettingsJsonMessageHandler2_0());
when(pluginManager.resolveExtensionVersion(pluginId, extensionName, goSupportedVersions)).thenReturn(supportedVersion);
when(pluginManager.submitTo(eq(pluginId), eq(extensionName), requestArgumentCaptor.capture())).thenReturn(new DefaultGoPluginApiResponse(SUCCESS_RESPONSE_CODE, ""));
extension.notifyPluginSettingsChange(pluginId, settings);
assertRequest(requestArgumentCaptor.getValue(), extensionName, supportedVersion, REQUEST_NOTIFY_PLUGIN_SETTINGS_CHANGE, "{\"foo\":\"bar\"}");
}
use of com.thoughtworks.go.plugin.api.request.GoPluginApiRequest in project gocd by gocd.
the class ElasticAgentExtensionV5Test method assertExtensionRequest.
private void assertExtensionRequest(String extensionVersion, String requestName, String requestBody) {
final GoPluginApiRequest request = requestArgumentCaptor.getValue();
assertThat(request.requestName(), Matchers.is(requestName));
assertThat(request.extensionVersion(), Matchers.is(extensionVersion));
assertThat(request.extension(), Matchers.is(PluginConstants.ELASTIC_AGENT_EXTENSION));
assertThatJson(requestBody).isEqualTo(request.requestBody());
}
Aggregations