use of com.thoughtworks.go.plugin.domain.elastic.Capabilities in project gocd by gocd.
the class ElasticAgentExtensionV3Test method shouldGetCapabilitiesOfAPlugin.
@Test
public void shouldGetCapabilitiesOfAPlugin() {
final String responseBody = "{\"supports_status_report\":\"true\", \"supports_agent_status_report\":\"true\"}";
when(pluginManager.submitTo(eq(PLUGIN_ID), eq(ELASTIC_AGENT_EXTENSION), requestArgumentCaptor.capture())).thenReturn(DefaultGoPluginApiResponse.success(responseBody));
final Capabilities capabilities = extensionV3.getCapabilities(PLUGIN_ID);
assertTrue(capabilities.supportsStatusReport());
assertTrue(capabilities.supportsAgentStatusReport());
}
use of com.thoughtworks.go.plugin.domain.elastic.Capabilities in project gocd by gocd.
the class ElasticAgentPluginInfoBuilderTest method shouldGetCapabilitiesForAPlugin.
@Test
public void shouldGetCapabilitiesForAPlugin() {
GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin1", null, null, null, null, false);
when(pluginManager.resolveExtensionVersion("plugin1", ELASTIC_AGENT_EXTENSION, SUPPORTED_VERSIONS)).thenReturn("2.0");
Capabilities capabilities = new Capabilities(true);
when(extension.getCapabilities(descriptor.id())).thenReturn(capabilities);
ElasticAgentPluginInfo pluginInfo = new ElasticAgentPluginInfoBuilder(extension).pluginInfoFor(descriptor);
assertThat(pluginInfo.getCapabilities(), is(capabilities));
}
use of com.thoughtworks.go.plugin.domain.elastic.Capabilities in project gocd by gocd.
the class CapabilitiesConverterV2Test method toDTO_shouldErrorOutWithUnSupportedException.
@Test
public void toDTO_shouldErrorOutWithUnSupportedException() {
thrown.expect(UnsupportedOperationException.class);
thrown.expectMessage("Does not support conversion of com.thoughtworks.go.plugin.domain.elastic.Capabilities to com.thoughtworks.go.plugin.access.elastic.v2.CapabilitiesDTO.");
new CapabilitiesConverterV2().toDTO(new Capabilities(false));
}
use of com.thoughtworks.go.plugin.domain.elastic.Capabilities in project gocd by gocd.
the class ElasticAgentExtensionConverterV2Test method shouldGetCapabilitiesFromResponseBodyAndIgnoreSupportAgentStatusReportForV2WhenItIsSpecifiedInJson.
@Test
public void shouldGetCapabilitiesFromResponseBodyAndIgnoreSupportAgentStatusReportForV2WhenItIsSpecifiedInJson() {
String responseBody = "{\"supports_status_report\":\"true\",\"supports_agent_status_report\":\"true\"}";
Capabilities capabilities = converterV2.getCapabilitiesFromResponseBody(responseBody);
assertTrue(capabilities.supportsStatusReport());
assertFalse(capabilities.supportsAgentStatusReport());
}
use of com.thoughtworks.go.plugin.domain.elastic.Capabilities in project gocd by gocd.
the class ElasticAgentExtensionConverterV3Test method shouldGetCapabilitiesFromResponseBody.
@Test
public void shouldGetCapabilitiesFromResponseBody() {
String responseBody = "{\"supports_status_report\":\"true\",\"supports_agent_status_report\":\"true\"}";
Capabilities capabilities = new ElasticAgentExtensionConverterV3().getCapabilitiesFromResponseBody(responseBody);
assertTrue(capabilities.supportsStatusReport());
assertTrue(capabilities.supportsAgentStatusReport());
}
Aggregations