use of com.thoughtworks.go.plugin.infra.PluginManager in project gocd by gocd.
the class AuthenticationPluginInfoBuilderTest method pluginInfoFor_ShouldReturnNullWhenPluginIsNotFound.
@Test
public void pluginInfoFor_ShouldReturnNullWhenPluginIsNotFound() throws Exception {
PluginManager pluginManager = mock(PluginManager.class);
AuthenticationPluginRegistry registry = mock(AuthenticationPluginRegistry.class);
AuthenticationPluginInfoBuilder builder = new AuthenticationPluginInfoBuilder(pluginManager, registry);
AuthenticationPluginInfo pluginInfo = builder.pluginInfoFor("docker-plugin");
assertEquals(null, pluginInfo);
}
use of com.thoughtworks.go.plugin.infra.PluginManager 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);
}
use of com.thoughtworks.go.plugin.infra.PluginManager 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);
}
use of com.thoughtworks.go.plugin.infra.PluginManager 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);
}
use of com.thoughtworks.go.plugin.infra.PluginManager in project gocd by gocd.
the class PackageRepositoryPluginInfoBuilderTest 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);
PackageMetadataStore packageMetadataStore = mock(PackageMetadataStore.class);
RepositoryMetadataStore repositoryMetadataStore = mock(RepositoryMetadataStore.class);
when(packageMetadataStore.getPlugins()).thenReturn(Collections.singletonList(plugin.id()));
when(pluginManager.getPluginDescriptorFor(plugin.id())).thenReturn(plugin);
PackageConfigurations packageConfigurations = new PackageConfigurations();
packageConfigurations.add(new com.thoughtworks.go.plugin.access.packagematerial.PackageConfiguration("key1"));
packageConfigurations.add(new com.thoughtworks.go.plugin.access.packagematerial.PackageConfiguration("key2"));
PackageConfigurations repoConfigurations = new PackageConfigurations();
repoConfigurations.add(new com.thoughtworks.go.plugin.access.packagematerial.PackageConfiguration("key1"));
repoConfigurations.add(new com.thoughtworks.go.plugin.access.packagematerial.PackageConfiguration("key2"));
when(packageMetadataStore.getMetadata(plugin.id())).thenReturn(packageConfigurations);
when(repositoryMetadataStore.getMetadata(plugin.id())).thenReturn(repoConfigurations);
PackageRepositoryPluginInfoBuilder builder = new PackageRepositoryPluginInfoBuilder(pluginManager, packageMetadataStore, repositoryMetadataStore);
PackageRepositoryPluginInfo pluginInfo = builder.pluginInfoFor(plugin.id());
PackageRepositoryPluginInfo expectedPluginInfo = new PackageRepositoryPluginInfo(plugin, new PluggableInstanceSettings(configurations(packageConfigurations)), new PluggableInstanceSettings(configurations(repoConfigurations)));
assertEquals(expectedPluginInfo, pluginInfo);
}
Aggregations