use of com.thoughtworks.go.plugin.domain.notification.NotificationPluginInfo 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.domain.notification.NotificationPluginInfo in project gocd by gocd.
the class NotificationPluginInfoBuilderTest method shouldBuildPluginInfo.
@Test
public void shouldBuildPluginInfo() throws Exception {
GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin1", null, null, null, null, false);
NotificationPluginInfo pluginInfo = new NotificationPluginInfoBuilder(extension).pluginInfoFor(descriptor);
List<PluginConfiguration> pluginConfigurations = Arrays.asList(new PluginConfiguration("username", new Metadata(true, false)), new PluginConfiguration("password", new Metadata(true, true)));
PluginView pluginView = new PluginView("some-html");
assertThat(pluginInfo.getDescriptor(), is(descriptor));
assertThat(pluginInfo.getExtensionName(), is("notification"));
assertThat(pluginInfo.getPluginSettings(), is(new PluggableInstanceSettings(pluginConfigurations, pluginView)));
}
use of com.thoughtworks.go.plugin.domain.notification.NotificationPluginInfo in project gocd by gocd.
the class CombinedPluginInfoTest method shouldGetAllIndividualExtensionInfos.
@Test
public void shouldGetAllIndividualExtensionInfos() throws Exception {
NotificationPluginInfo notificationPluginInfo = new NotificationPluginInfo(null, null);
PluggableTaskPluginInfo pluggableTaskPluginInfo = new PluggableTaskPluginInfo(null, null, null);
CombinedPluginInfo pluginInfo = new CombinedPluginInfo(asList(pluggableTaskPluginInfo, notificationPluginInfo));
assertThat(pluginInfo.getExtensionInfos(), containsInAnyOrder(notificationPluginInfo, pluggableTaskPluginInfo));
}
use of com.thoughtworks.go.plugin.domain.notification.NotificationPluginInfo in project gocd by gocd.
the class PluginServiceTest method shouldReturnNullForGetPluginInfoIfDoesNotImplementPluginSettings_MultipleExtensionImpl.
@Test
public void shouldReturnNullForGetPluginInfoIfDoesNotImplementPluginSettings_MultipleExtensionImpl() {
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);
when(notificationExtension.canHandlePlugin(pluginId)).thenReturn(true);
when(scmExtension.canHandlePlugin(pluginId)).thenReturn(true);
assertNull(pluginService.pluginInfoForExtensionThatHandlesPluginSettings(pluginId));
}
Aggregations