Search in sources :

Example 21 with GoPluginDescriptor

use of com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor in project gocd by gocd.

the class NotificationViewModelBuilderTest method setUp.

@Before
public void setUp() {
    initMocks(this);
    builder = new NotificationViewModelBuilder(manager, registry);
    emailNotifier = new GoPluginDescriptor("email.notifier", "version1", new GoPluginDescriptor.About("Email Notifier", "1.0", null, null, null, null), null, null, false);
    slackNotifier = new GoPluginDescriptor("slack.notifier", "version1", new GoPluginDescriptor.About("Slack Notifier", "2.0", null, null, null, null), null, null, false);
}
Also used : GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) Before(org.junit.Before)

Example 22 with GoPluginDescriptor

use of com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor in project gocd by gocd.

the class PackageRepositoryPluginInfoBuilderTest 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);
    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);
    Collection<PackageRepositoryPluginInfo> pluginInfos = builder.allPluginInfos();
    PackageRepositoryPluginInfo expectedPluginInfo = new PackageRepositoryPluginInfo(plugin, new PluggableInstanceSettings(configurations(packageConfigurations)), new PluggableInstanceSettings(configurations(repoConfigurations)));
    assertEquals(Arrays.asList(expectedPluginInfo), pluginInfos);
}
Also used : RepositoryMetadataStore(com.thoughtworks.go.plugin.access.packagematerial.RepositoryMetadataStore) PluginManager(com.thoughtworks.go.plugin.infra.PluginManager) PackageMetadataStore(com.thoughtworks.go.plugin.access.packagematerial.PackageMetadataStore) PackageRepositoryPluginInfo(com.thoughtworks.go.server.ui.plugins.PackageRepositoryPluginInfo) PluggableInstanceSettings(com.thoughtworks.go.server.ui.plugins.PluggableInstanceSettings) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) PackageConfigurations(com.thoughtworks.go.plugin.access.packagematerial.PackageConfigurations) Test(org.junit.Test)

Example 23 with GoPluginDescriptor

use of com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor in project gocd by gocd.

the class AuthenticationPluginInfoBuilderTest 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);
    AuthenticationPluginRegistry registry = mock(AuthenticationPluginRegistry.class);
    when(registry.getAuthenticationPlugins()).thenReturn(Collections.singleton(plugin.id()));
    when(pluginManager.getPluginDescriptorFor(plugin.id())).thenReturn(plugin);
    AuthenticationPluginInfoBuilder builder = new AuthenticationPluginInfoBuilder(pluginManager, registry);
    AuthenticationPluginInfo pluginInfo = builder.pluginInfoFor(plugin.id());
    assertEquals(new AuthenticationPluginInfo(plugin), pluginInfo);
}
Also used : PluginManager(com.thoughtworks.go.plugin.infra.PluginManager) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) AuthenticationPluginInfo(com.thoughtworks.go.server.ui.plugins.AuthenticationPluginInfo) AuthenticationPluginRegistry(com.thoughtworks.go.plugin.access.authentication.AuthenticationPluginRegistry) Test(org.junit.Test)

Example 24 with GoPluginDescriptor

use of com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor in project gocd by gocd.

the class AuthenticationPluginInfoBuilderTest 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);
    AuthenticationPluginRegistry registry = mock(AuthenticationPluginRegistry.class);
    when(registry.getAuthenticationPlugins()).thenReturn(Collections.singleton(plugin.id()));
    when(pluginManager.getPluginDescriptorFor(plugin.id())).thenReturn(plugin);
    AuthenticationPluginInfoBuilder builder = new AuthenticationPluginInfoBuilder(pluginManager, registry);
    Collection<AuthenticationPluginInfo> pluginInfos = builder.allPluginInfos();
    assertEquals(Arrays.asList(new AuthenticationPluginInfo(plugin)), pluginInfos);
}
Also used : PluginManager(com.thoughtworks.go.plugin.infra.PluginManager) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) AuthenticationPluginInfo(com.thoughtworks.go.server.ui.plugins.AuthenticationPluginInfo) AuthenticationPluginRegistry(com.thoughtworks.go.plugin.access.authentication.AuthenticationPluginRegistry) Test(org.junit.Test)

Example 25 with GoPluginDescriptor

use of com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor in project gocd by gocd.

the class AuthenticationViewModelBuilderTest method setUp.

@Before
public void setUp() {
    initMocks(this);
    builder = new AuthenticationViewModelBuilder(manager, registry);
    githubDescriptor = new GoPluginDescriptor("github.oauth", "version1", new GoPluginDescriptor.About("Github OAuth Plugin", "1.0", null, null, null, null), null, null, false);
    googleDescriptor = new GoPluginDescriptor("google.oauth", "version1", new GoPluginDescriptor.About("auth_plugin", "2.0", null, null, null, null), null, null, false);
}
Also used : GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) Before(org.junit.Before)

Aggregations

GoPluginDescriptor (com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)214 Test (org.junit.jupiter.api.Test)114 Test (org.junit.Test)53 ElasticAgentPluginInfo (com.thoughtworks.go.plugin.domain.elastic.ElasticAgentPluginInfo)20 File (java.io.File)19 PluginManager (com.thoughtworks.go.plugin.infra.PluginManager)16 PluggableInstanceSettings (com.thoughtworks.go.server.ui.plugins.PluggableInstanceSettings)14 AuthorizationPluginInfo (com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo)12 Capabilities (com.thoughtworks.go.plugin.domain.elastic.Capabilities)12 Before (org.junit.Before)12 AnalyticsPluginInfo (com.thoughtworks.go.plugin.domain.analytics.AnalyticsPluginInfo)11 GoPluginBundleDescriptor (com.thoughtworks.go.plugin.infra.plugininfo.GoPluginBundleDescriptor)11 PluginView (com.thoughtworks.go.server.ui.plugins.PluginView)11 Bundle (org.osgi.framework.Bundle)10 GoPlugin (com.thoughtworks.go.plugin.api.GoPlugin)9 PluginInfo (com.thoughtworks.go.server.ui.plugins.PluginInfo)9 TaskPreference (com.thoughtworks.go.plugin.access.pluggabletask.TaskPreference)8 TaskView (com.thoughtworks.go.plugin.api.task.TaskView)8 ArrayList (java.util.ArrayList)8 InvocationOnMock (org.mockito.invocation.InvocationOnMock)8