Search in sources :

Example 1 with PlatformPlugin

use of org.pentaho.platform.plugin.services.pluginmgr.PlatformPlugin in project pentaho-platform by pentaho.

the class DefaultPluginManagerIT method test17_getPluginIdForType.

@Test
public void test17_getPluginIdForType() throws PlatformInitializationException, PluginBeanException {
    IPluginProvider provider = new IPluginProvider() {

        public List<IPlatformPlugin> getPlugins(IPentahoSession session) throws PlatformPluginRegistrationException {
            PlatformPlugin p = new PlatformPlugin(new DefaultListableBeanFactory());
            p.setId("testPlugin");
            ContentGeneratorInfo cg1 = new ContentGeneratorInfo();
            cg1.setDescription("test 9 plugin description");
            cg1.setId("oldworldCGid");
            cg1.setType("oldworldCGtype");
            cg1.setTitle("test");
            cg1.setClassname("org.pentaho.test.platform.plugin.pluginmgr.ContentGenerator1");
            // cg1.setFileInfoGeneratorClassname("org.pentaho.test.platform.plugin.pluginmgr.FileInfoGenerator");
            p.addContentGenerator(cg1);
            BeanDefinition beanDef = BeanDefinitionBuilder.rootBeanDefinition("org.pentaho.test.platform.plugin.pluginmgr.ContentGenerator1").setScope(BeanDefinition.SCOPE_PROTOTYPE).getBeanDefinition();
            p.getBeanFactory().registerBeanDefinition("springDefinedCGid", beanDef);
            p.getBeanFactory().registerAlias("springDefinedCGid", "springDefinedCGtype");
            return Arrays.asList((IPlatformPlugin) p);
        }
    };
    microPlatform.defineInstance(IPluginProvider.class, provider).start();
    pluginManager.reload();
    assertEquals("testPlugin", pluginManager.getPluginIdForType("oldworldCGtype"));
    assertEquals("testPlugin", pluginManager.getPluginIdForType("springDefinedCGtype"));
}
Also used : IPentahoSession(org.pentaho.platform.api.engine.IPentahoSession) DefaultListableBeanFactory(org.springframework.beans.factory.support.DefaultListableBeanFactory) PlatformPlugin(org.pentaho.platform.plugin.services.pluginmgr.PlatformPlugin) IPlatformPlugin(org.pentaho.platform.api.engine.IPlatformPlugin) ContentGeneratorInfo(org.pentaho.platform.engine.core.solution.ContentGeneratorInfo) IPluginProvider(org.pentaho.platform.api.engine.IPluginProvider) PluginBeanDefinition(org.pentaho.platform.api.engine.PluginBeanDefinition) BeanDefinition(org.springframework.beans.factory.config.BeanDefinition) IPlatformPlugin(org.pentaho.platform.api.engine.IPlatformPlugin) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 IPentahoSession (org.pentaho.platform.api.engine.IPentahoSession)1 IPlatformPlugin (org.pentaho.platform.api.engine.IPlatformPlugin)1 IPluginProvider (org.pentaho.platform.api.engine.IPluginProvider)1 PluginBeanDefinition (org.pentaho.platform.api.engine.PluginBeanDefinition)1 ContentGeneratorInfo (org.pentaho.platform.engine.core.solution.ContentGeneratorInfo)1 PlatformPlugin (org.pentaho.platform.plugin.services.pluginmgr.PlatformPlugin)1 BeanDefinition (org.springframework.beans.factory.config.BeanDefinition)1 DefaultListableBeanFactory (org.springframework.beans.factory.support.DefaultListableBeanFactory)1