Search in sources :

Example 6 with PluginManager

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

the class PackageRepositoryPluginInfoBuilderTest method pluginInfoFor_ShouldReturnNullWhenPluginIsNotFound.

@Test
public void pluginInfoFor_ShouldReturnNullWhenPluginIsNotFound() throws Exception {
    PluginManager pluginManager = mock(PluginManager.class);
    PackageMetadataStore packageMetadataStore = mock(PackageMetadataStore.class);
    RepositoryMetadataStore repositoryMetadataStore = mock(RepositoryMetadataStore.class);
    PackageRepositoryPluginInfoBuilder builder = new PackageRepositoryPluginInfoBuilder(pluginManager, packageMetadataStore, repositoryMetadataStore);
    PackageRepositoryPluginInfo pluginInfo = builder.pluginInfoFor("docker-plugin");
    assertEquals(null, pluginInfo);
}
Also used : PluginManager(com.thoughtworks.go.plugin.infra.PluginManager) PackageMetadataStore(com.thoughtworks.go.plugin.access.packagematerial.PackageMetadataStore) PackageRepositoryPluginInfo(com.thoughtworks.go.server.ui.plugins.PackageRepositoryPluginInfo) RepositoryMetadataStore(com.thoughtworks.go.plugin.access.packagematerial.RepositoryMetadataStore) Test(org.junit.Test)

Example 7 with PluginManager

use of com.thoughtworks.go.plugin.infra.PluginManager 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 8 with PluginManager

use of com.thoughtworks.go.plugin.infra.PluginManager 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 9 with PluginManager

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

the class SCMMetadataLoaderTest method setUp.

@Before
public void setUp() throws Exception {
    pluginDescriptor = new GoPluginDescriptor("plugin-id", "1.0", null, null, null, true);
    pluginManager = mock(PluginManager.class);
    scmExtension = mock(SCMExtension.class);
    metadataLoader = new SCMMetadataLoader(scmExtension, pluginManager);
    SCMMetadataStore.getInstance().removeMetadata(pluginDescriptor.id());
}
Also used : PluginManager(com.thoughtworks.go.plugin.infra.PluginManager) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) Before(org.junit.Before)

Example 10 with PluginManager

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

the class PluginsInitializerTest method setUp.

@BeforeEach
public void setUp() throws Exception {
    systemEnvironment = mock(SystemEnvironment.class);
    when(systemEnvironment.get(SystemEnvironment.PLUGIN_GO_PROVIDED_PATH)).thenReturn(goPluginsDir.toFile().getAbsolutePath());
    pluginManager = mock(PluginManager.class);
    pluginExtensionsAndVersionValidator = mock(PluginExtensionsAndVersionValidator.class);
    elasticAgentInformationMigrator = mock(ElasticAgentInformationMigrator.class);
    pluginsInitializer = new PluginsInitializer(pluginManager, systemEnvironment, new ZipUtil(), pluginExtensionsAndVersionValidator, elasticAgentInformationMigrator) {

        @Override
        public void startDaemon() {
        }

        @Override
        ZipInputStream getPluginsZipStream() {
            return new ZipInputStream(getClass().getResourceAsStream("/dummy-plugins.zip"));
        }
    };
}
Also used : SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) PluginManager(com.thoughtworks.go.plugin.infra.PluginManager) ZipInputStream(java.util.zip.ZipInputStream) ZipUtil(com.thoughtworks.go.util.ZipUtil) PluginExtensionsAndVersionValidator(com.thoughtworks.go.plugin.infra.PluginExtensionsAndVersionValidator) ElasticAgentInformationMigrator(com.thoughtworks.go.plugin.infra.ElasticAgentInformationMigrator) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

PluginManager (com.thoughtworks.go.plugin.infra.PluginManager)27 Test (org.junit.Test)17 GoPluginDescriptor (com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)16 PluggableInstanceSettings (com.thoughtworks.go.server.ui.plugins.PluggableInstanceSettings)6 TaskConfig (com.thoughtworks.go.plugin.api.task.TaskConfig)5 TaskView (com.thoughtworks.go.plugin.api.task.TaskView)5 PluginView (com.thoughtworks.go.server.ui.plugins.PluginView)4 Test (org.junit.jupiter.api.Test)4 AuthenticationPluginRegistry (com.thoughtworks.go.plugin.access.authentication.AuthenticationPluginRegistry)3 NotificationPluginRegistry (com.thoughtworks.go.plugin.access.notification.NotificationPluginRegistry)3 PackageMetadataStore (com.thoughtworks.go.plugin.access.packagematerial.PackageMetadataStore)3 RepositoryMetadataStore (com.thoughtworks.go.plugin.access.packagematerial.RepositoryMetadataStore)3 PluggableTaskConfigStore (com.thoughtworks.go.plugin.access.pluggabletask.PluggableTaskConfigStore)3 Task (com.thoughtworks.go.plugin.api.task.Task)3 AuthenticationPluginInfo (com.thoughtworks.go.server.ui.plugins.AuthenticationPluginInfo)3 NotificationPluginInfo (com.thoughtworks.go.server.ui.plugins.NotificationPluginInfo)3 PackageRepositoryPluginInfo (com.thoughtworks.go.server.ui.plugins.PackageRepositoryPluginInfo)3 PluggableTaskPluginInfo (com.thoughtworks.go.server.ui.plugins.PluggableTaskPluginInfo)3 SCMPluginInfo (com.thoughtworks.go.server.ui.plugins.SCMPluginInfo)3 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)3