Search in sources :

Example 1 with NotificationPluginRegistry

use of com.thoughtworks.go.plugin.access.notification.NotificationPluginRegistry in project gocd by gocd.

the class NotificationPluginInfoBuilderTest method pluginInfoFor_ShouldProvidePluginInfoForAPlugin.

@Test
public void pluginInfoFor_ShouldProvidePluginInfoForAPlugin() throws Exception {
    GoPluginDescriptor.About about = new GoPluginDescriptor.About("Plugin Descriptor Validator", "1.0.1", "12.4", "Validates its own plugin descriptor", new GoPluginDescriptor.Vendor("ThoughtWorks Go Team", "www.thoughtworks.com"), Arrays.asList("Linux", "Windows", "Mac OS X"));
    GoPluginDescriptor plugin = new GoPluginDescriptor("docker-plugin", "1.0", about, null, null, false);
    PluginManager pluginManager = mock(PluginManager.class);
    NotificationPluginRegistry registry = mock(NotificationPluginRegistry.class);
    when(registry.getNotificationPlugins()).thenReturn(Collections.singleton(plugin.id()));
    when(pluginManager.getPluginDescriptorFor(plugin.id())).thenReturn(plugin);
    NotificationPluginInfoBuilder builder = new NotificationPluginInfoBuilder(pluginManager, registry);
    NotificationPluginInfo pluginInfo = builder.pluginInfoFor(plugin.id());
    assertEquals(new NotificationPluginInfo(plugin), pluginInfo);
}
Also used : PluginManager(com.thoughtworks.go.plugin.infra.PluginManager) NotificationPluginInfo(com.thoughtworks.go.server.ui.plugins.NotificationPluginInfo) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) NotificationPluginRegistry(com.thoughtworks.go.plugin.access.notification.NotificationPluginRegistry) Test(org.junit.Test)

Example 2 with NotificationPluginRegistry

use of com.thoughtworks.go.plugin.access.notification.NotificationPluginRegistry in project gocd by gocd.

the class NotificationPluginInfoBuilderTest method allPluginInfos_ShouldReturnAListOfAllPluginInfos.

@Test
public void allPluginInfos_ShouldReturnAListOfAllPluginInfos() throws Exception {
    GoPluginDescriptor.About about = new GoPluginDescriptor.About("Plugin Descriptor Validator", "1.0.1", "12.4", "Validates its own plugin descriptor", new GoPluginDescriptor.Vendor("ThoughtWorks Go Team", "www.thoughtworks.com"), Arrays.asList("Linux", "Windows", "Mac OS X"));
    GoPluginDescriptor plugin = new GoPluginDescriptor("docker-plugin", "1.0", about, null, null, false);
    PluginManager pluginManager = mock(PluginManager.class);
    NotificationPluginRegistry registry = mock(NotificationPluginRegistry.class);
    when(registry.getNotificationPlugins()).thenReturn(Collections.singleton(plugin.id()));
    when(pluginManager.getPluginDescriptorFor(plugin.id())).thenReturn(plugin);
    NotificationPluginInfoBuilder builder = new NotificationPluginInfoBuilder(pluginManager, registry);
    Collection<NotificationPluginInfo> pluginInfos = builder.allPluginInfos();
    assertEquals(Arrays.asList(new NotificationPluginInfo(plugin)), pluginInfos);
}
Also used : PluginManager(com.thoughtworks.go.plugin.infra.PluginManager) NotificationPluginInfo(com.thoughtworks.go.server.ui.plugins.NotificationPluginInfo) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) NotificationPluginRegistry(com.thoughtworks.go.plugin.access.notification.NotificationPluginRegistry) Test(org.junit.Test)

Example 3 with NotificationPluginRegistry

use of com.thoughtworks.go.plugin.access.notification.NotificationPluginRegistry in project gocd by gocd.

the class NotificationPluginInfoBuilderTest method pluginInfoFor_ShouldReturnNullWhenPluginIsNotFound.

@Test
public void pluginInfoFor_ShouldReturnNullWhenPluginIsNotFound() throws Exception {
    PluginManager pluginManager = mock(PluginManager.class);
    NotificationPluginRegistry registry = mock(NotificationPluginRegistry.class);
    NotificationPluginInfoBuilder builder = new NotificationPluginInfoBuilder(pluginManager, registry);
    NotificationPluginInfo pluginInfo = builder.pluginInfoFor("docker-plugin");
    assertEquals(null, pluginInfo);
}
Also used : PluginManager(com.thoughtworks.go.plugin.infra.PluginManager) NotificationPluginInfo(com.thoughtworks.go.server.ui.plugins.NotificationPluginInfo) NotificationPluginRegistry(com.thoughtworks.go.plugin.access.notification.NotificationPluginRegistry) Test(org.junit.Test)

Aggregations

NotificationPluginRegistry (com.thoughtworks.go.plugin.access.notification.NotificationPluginRegistry)3 PluginManager (com.thoughtworks.go.plugin.infra.PluginManager)3 NotificationPluginInfo (com.thoughtworks.go.server.ui.plugins.NotificationPluginInfo)3 Test (org.junit.Test)3 GoPluginDescriptor (com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)2