use of com.thoughtworks.go.plugin.domain.elastic.Capabilities in project gocd by gocd.
the class ElasticAgentPluginServiceTest method shouldErrorOutWhenPluginDoesNotSupportStatusReport.
@Test
public void shouldErrorOutWhenPluginDoesNotSupportStatusReport() {
final Capabilities capabilities = new Capabilities(false);
final GoPluginDescriptor descriptor = new GoPluginDescriptor("cd.go.example.plugin", null, null, null, null, false);
elasticAgentMetadataStore.setPluginInfo(new ElasticAgentPluginInfo(descriptor, null, null, null, capabilities));
thrown.expect(UnsupportedOperationException.class);
thrown.expectMessage("Plugin does not plugin support status report.");
service.getPluginStatusReport("cd.go.example.plugin");
}
use of com.thoughtworks.go.plugin.domain.elastic.Capabilities in project gocd by gocd.
the class ElasticAgentPluginServiceTest method shouldGetAPluginAgentReportWhenPluginSupportsStatusReport.
@Test
public void shouldGetAPluginAgentReportWhenPluginSupportsStatusReport() {
final Capabilities capabilities = new Capabilities(false, true);
final GoPluginDescriptor descriptor = new GoPluginDescriptor("cd.go.example.plugin", null, null, null, null, false);
elasticAgentMetadataStore.setPluginInfo(new ElasticAgentPluginInfo(descriptor, null, null, null, capabilities));
when(registry.getAgentStatusReport("cd.go.example.plugin", null, "some-id")).thenReturn("<div>This is a agent status report snippet.</div>");
final String agentStatusReport = service.getAgentStatusReport("cd.go.example.plugin", null, "some-id");
assertThat(agentStatusReport, is("<div>This is a agent status report snippet.</div>"));
}
use of com.thoughtworks.go.plugin.domain.elastic.Capabilities in project gocd by gocd.
the class ElasticAgentPluginServiceTest method shouldGetAPluginStatusReportWhenPluginSupportsStatusReport.
@Test
public void shouldGetAPluginStatusReportWhenPluginSupportsStatusReport() {
final Capabilities capabilities = new Capabilities(true);
final GoPluginDescriptor descriptor = new GoPluginDescriptor("cd.go.example.plugin", null, null, null, null, false);
elasticAgentMetadataStore.setPluginInfo(new ElasticAgentPluginInfo(descriptor, null, null, null, capabilities));
when(registry.getPluginStatusReport("cd.go.example.plugin")).thenReturn("<div>This is a plugin status report snippet.</div>");
final String pluginStatusReport = service.getPluginStatusReport("cd.go.example.plugin");
assertThat(pluginStatusReport, is("<div>This is a plugin status report snippet.</div>"));
}
use of com.thoughtworks.go.plugin.domain.elastic.Capabilities in project gocd by gocd.
the class ElasticAgentExtensionTest 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 = extension.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 ElasticAgentExtensionV1Test method shouldGetCapabilitiesOfAPlugin.
@Test
public void shouldGetCapabilitiesOfAPlugin() {
final Capabilities capabilities = extensionV1.getCapabilities(PLUGIN_ID);
assertFalse(capabilities.supportsAgentStatusReport());
assertFalse(capabilities.supportsStatusReport());
}
Aggregations