Search in sources :

Example 6 with Capabilities

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");
}
Also used : ElasticAgentPluginInfo(com.thoughtworks.go.plugin.domain.elastic.ElasticAgentPluginInfo) Capabilities(com.thoughtworks.go.plugin.domain.elastic.Capabilities) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) Test(org.junit.Test)

Example 7 with Capabilities

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>"));
}
Also used : ElasticAgentPluginInfo(com.thoughtworks.go.plugin.domain.elastic.ElasticAgentPluginInfo) Capabilities(com.thoughtworks.go.plugin.domain.elastic.Capabilities) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) Test(org.junit.Test)

Example 8 with Capabilities

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>"));
}
Also used : ElasticAgentPluginInfo(com.thoughtworks.go.plugin.domain.elastic.ElasticAgentPluginInfo) Capabilities(com.thoughtworks.go.plugin.domain.elastic.Capabilities) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) Test(org.junit.Test)

Example 9 with Capabilities

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());
}
Also used : Capabilities(com.thoughtworks.go.plugin.domain.elastic.Capabilities) Test(org.junit.Test)

Example 10 with Capabilities

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());
}
Also used : Capabilities(com.thoughtworks.go.plugin.domain.elastic.Capabilities) Test(org.junit.Test)

Aggregations

Capabilities (com.thoughtworks.go.plugin.domain.elastic.Capabilities)16 Test (org.junit.Test)16 ElasticAgentPluginInfo (com.thoughtworks.go.plugin.domain.elastic.ElasticAgentPluginInfo)7 GoPluginDescriptor (com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)7 ElasticProfile (com.thoughtworks.go.config.elastic.ElasticProfile)2 ModelAndView (org.springframework.web.servlet.ModelAndView)2 AgentConfig (com.thoughtworks.go.config.AgentConfig)1