use of com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor 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.infra.plugininfo.GoPluginDescriptor 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.infra.plugininfo.GoPluginDescriptor in project gocd by gocd.
the class PluginInfoProvider method asJson.
@Override
public Map<String, Object> asJson() {
List<Map<String, Object>> plugins = new ArrayList<>();
List<GoPluginDescriptor> goPluginDescriptors = pluginManager.plugins();
for (GoPluginDescriptor goPluginDescriptor : goPluginDescriptors) {
CombinedPluginInfo combinedPluginInfo = pluginInfoFinder.pluginInfoFor(goPluginDescriptor.id());
Map<String, Object> pluginJson = getPluginJson(combinedPluginInfo, goPluginDescriptor);
plugins.add(pluginJson);
}
Map<String, Object> json = new LinkedHashMap<>();
json.put("plugins", plugins);
return json;
}
use of com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor in project gocd by gocd.
the class TaskViewService method allPluginTasks.
private List<PluggableTask> allPluginTasks() {
final ArrayList<PluggableTask> tasks = new ArrayList<>();
for (final String pluginId : PluggableTaskConfigStore.store().pluginIds()) {
GoPluginDescriptor pluginDescriptor = pluginManager.getPluginDescriptorFor(pluginId);
TaskPreference taskPreference = PluggableTaskConfigStore.store().preferenceFor(pluginId);
if (pluginDescriptor != null && taskPreference != null) {
tasks.add(new PluggableTask(new PluginConfiguration(pluginId, pluginDescriptor.version()), getConfiguration(taskPreference.getConfig())));
}
}
return tasks;
}
use of com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor in project gocd by gocd.
the class GoPluginDescriptorModelTest method shouldFillDefaultValuesWhenPluginXmlIsNotPresent.
@Test
public void shouldFillDefaultValuesWhenPluginXmlIsNotPresent() throws Exception {
GoPluginDescriptor descriptor = GoPluginDescriptor.usingId("plugin.jar", "some_path", new File("bundle_location"), true);
GoPluginDescriptor descriptorModel = GoPluginDescriptorModel.convertToDescriptorWithAllValues(descriptor);
assertThat(descriptor.about(), is(nullValue()));
assertThat(descriptorModel.about(), is(notNullValue()));
assertThat(descriptorModel.about().description(), is("No description available."));
assertThat(descriptorModel.about().version().isEmpty(), is(true));
assertThat(descriptorModel.about().vendor(), is(notNullValue()));
assertThat(descriptorModel.about().vendor().name(), is("Unknown"));
assertThat(descriptorModel.about().vendor().url(), is(nullValue()));
assertThat(descriptorModel.about().name(), is("plugin.jar"));
assertThat(descriptorModel.about().targetGoVersion(), is("Unknown"));
assertThat(descriptorModel.about().targetOperatingSystems().contains("No restrictions"), is(true));
}
Aggregations