Search in sources :

Example 11 with Capabilities

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

Example 12 with Capabilities

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

Example 14 with Capabilities

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

Example 15 with Capabilities

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());
}
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