use of com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor in project gocd by gocd.
the class PluginSettingsMetadataLoaderTest method shouldNotFetchPluginSettingsMetadataForTaskPlugin.
@Test
public void shouldNotFetchPluginSettingsMetadataForTaskPlugin() throws Exception {
PluginSettingsConfiguration configuration = new PluginSettingsConfiguration();
configuration.add(new PluginSettingsProperty("k1").with(Property.REQUIRED, true).with(Property.SECURE, false));
GoPluginDescriptor pluginDescriptor = new GoPluginDescriptor(UUID.randomUUID().toString(), "1.0", null, null, null, true);
setupSettingsResponses(taskExtension, pluginDescriptor.id(), configuration, "template");
metadataLoader.fetchPluginSettingsMetaData(pluginDescriptor);
verify(taskExtension, never()).getPluginSettingsConfiguration(pluginDescriptor.id());
verify(taskExtension, never()).getPluginSettingsView(pluginDescriptor.id());
assertThat(PluginSettingsMetadataStore.getInstance().configuration(pluginDescriptor.id()), is(nullValue()));
}
use of com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor in project gocd by gocd.
the class PluginSettingsMetadataLoaderTest method shouldNotStoreMetadataIfConfigurationIsMissing.
@Test
public void shouldNotStoreMetadataIfConfigurationIsMissing() {
PluginSettingsConfiguration configuration = new PluginSettingsConfiguration();
configuration.add(new PluginSettingsProperty("k1").with(Property.REQUIRED, true).with(Property.SECURE, false));
GoPluginDescriptor pluginDescriptor = new GoPluginDescriptor("plugin-id", "1.0", null, null, null, true);
setupSettingsResponses(packageRepositoryExtension, pluginDescriptor.id(), null, "template");
metadataLoader.fetchPluginSettingsMetaData(pluginDescriptor);
assertThat(PluginSettingsMetadataStore.getInstance().hasPlugin(pluginDescriptor.id()), is(false));
}
use of com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor in project gocd by gocd.
the class PluginServiceTest method shouldGetPluginInfoFromTheExtensionWhichImplementsPluginSettingsIfThePluginImplementsMultipleExtensions.
@Test
public void shouldGetPluginInfoFromTheExtensionWhichImplementsPluginSettingsIfThePluginImplementsMultipleExtensions() {
String pluginId = "plugin-id-1";
CombinedPluginInfo combinedPluginInfo = new CombinedPluginInfo();
PluggableInstanceSettings pluginSettings = new PluggableInstanceSettings(Arrays.asList(new PluginConfiguration("key", new Metadata(false, false))));
GoPluginDescriptor pluginDescriptor = new GoPluginDescriptor(pluginId, "1", null, "location", new File(""), false);
NotificationPluginInfo notificationPluginInfo = new NotificationPluginInfo(pluginDescriptor, null);
combinedPluginInfo.add(notificationPluginInfo);
SCMPluginInfo scmPluginInfo = new SCMPluginInfo(pluginDescriptor, "display_name", new PluggableInstanceSettings(null), pluginSettings);
combinedPluginInfo.add(scmPluginInfo);
PluginSettingsMetadataStore.getInstance().addMetadataFor(pluginId, PluginConstants.SCM_EXTENSION, new PluginSettingsConfiguration(), "template-1");
when(defaultPluginInfoFinder.pluginInfoFor(pluginId)).thenReturn(combinedPluginInfo);
when(notificationExtension.canHandlePlugin(pluginId)).thenReturn(true);
when(scmExtension.canHandlePlugin(pluginId)).thenReturn(true);
PluginInfo pluginInfo = pluginService.pluginInfoForExtensionThatHandlesPluginSettings(pluginId);
assertTrue(pluginInfo instanceof SCMPluginInfo);
assertThat(pluginInfo, is(scmPluginInfo));
}
use of com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor in project gocd by gocd.
the class SecurityAuthConfigServiceTest method pluginInfo.
private AuthorizationPluginInfo pluginInfo(String githubPluginId, String name, SupportedAuthType supportedAuthType) {
GoPluginDescriptor.About about = new GoPluginDescriptor.About(name, "1.0", null, null, null, null);
GoPluginDescriptor descriptor = new GoPluginDescriptor(githubPluginId, "1.0", about, null, null, false);
return new AuthorizationPluginInfo(descriptor, null, null, new Image("svg", "data", "hash"), new Capabilities(supportedAuthType, true, true));
}
use of com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor 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