use of com.thoughtworks.go.plugin.domain.elastic.Capabilities in project gocd by gocd.
the class JobControllerIntegrationTest method jobDetailModel_shouldHaveTheElasticProfilePluginIdWhenAgentIsNotAssigned.
@Test
public void jobDetailModel_shouldHaveTheElasticProfilePluginIdWhenAgentIsNotAssigned() throws Exception {
Pipeline pipeline = fixture.createPipelineWithFirstStageAssigned();
Stage stage = pipeline.getFirstStage();
JobInstance job = stage.getFirstJob();
GoPluginDescriptor.About about = new GoPluginDescriptor.About("name", "0.1", "17.3.0", "desc", null, null);
GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin_id", null, about, null, null, false);
ElasticAgentMetadataStore.instance().setPluginInfo(new ElasticAgentPluginInfo(descriptor, null, null, null, new Capabilities(false, true)));
fixture.addJobAgentMetadata(new JobAgentMetadata(job.getId(), new ElasticProfile("profile_id", "plugin_id", Collections.EMPTY_LIST)));
ModelAndView modelAndView = controller.jobDetail(pipeline.getName(), String.valueOf(pipeline.getCounter()), stage.getName(), String.valueOf(stage.getCounter()), job.getName());
assertThat(modelAndView.getModel().get("elasticAgentPluginId"), is("plugin_id"));
}
use of com.thoughtworks.go.plugin.domain.elastic.Capabilities in project gocd by gocd.
the class ElasticAgentExtensionV2Test method shouldGetCapabilitiesOfAPlugin.
@Test
public void shouldGetCapabilitiesOfAPlugin() {
final String responseBody = "{\"supports_status_report\":\"true\"}";
when(pluginManager.submitTo(eq(PLUGIN_ID), eq(ELASTIC_AGENT_EXTENSION), requestArgumentCaptor.capture())).thenReturn(DefaultGoPluginApiResponse.success(responseBody));
final Capabilities capabilities = extensionV2.getCapabilities(PLUGIN_ID);
assertTrue(capabilities.supportsStatusReport());
assertFalse(capabilities.supportsAgentStatusReport());
}
use of com.thoughtworks.go.plugin.domain.elastic.Capabilities in project gocd by gocd.
the class ElasticAgentExtensionV2Test method getCapabilitiesOfAPluginShouldAlwaysReturnFalseForAgentStatusReport.
@Test
public void getCapabilitiesOfAPluginShouldAlwaysReturnFalseForAgentStatusReport() {
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 = extensionV2.getCapabilities(PLUGIN_ID);
assertTrue(capabilities.supportsStatusReport());
assertFalse(capabilities.supportsAgentStatusReport());
}
use of com.thoughtworks.go.plugin.domain.elastic.Capabilities in project gocd by gocd.
the class ElasticAgentExtensionConverterV2Test method shouldGetCapabilitiesFromResponseBody.
@Test
public void shouldGetCapabilitiesFromResponseBody() {
String responseBody = "{\"supports_status_report\":\"true\"}";
Capabilities capabilities = converterV2.getCapabilitiesFromResponseBody(responseBody);
assertTrue(capabilities.supportsStatusReport());
}
use of com.thoughtworks.go.plugin.domain.elastic.Capabilities in project gocd by gocd.
the class ElasticAgentPluginServiceTest method shouldErrorOutWhenPluginDoesNotAgentSupportStatusReport.
@Test
public void shouldErrorOutWhenPluginDoesNotAgentSupportStatusReport() {
final Capabilities capabilities = new Capabilities(true, 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 support agent status report.");
service.getAgentStatusReport("cd.go.example.plugin", null, null);
}
Aggregations