use of org.pentaho.platform.engine.core.system.StandaloneSession in project pentaho-platform by pentaho.
the class PluginAdapterIT method init0.
@SuppressWarnings("deprecation")
@Before
public void init0() {
microPlatform = new MicroPlatform(TestResourceLocation.TEST_RESOURCES + "/PluginManagerTest/");
microPlatform.define(ISolutionEngine.class, SolutionEngine.class);
microPlatform.define(IPluginManager.class, DefaultPluginManager.class);
microPlatform.define(IPluginProvider.class, SystemPathXmlPluginProvider.class);
microPlatform.define(IServiceManager.class, DefaultServiceManager.class);
session = new StandaloneSession();
pluginAdapter = new PluginAdapter();
microPlatform.addAdminAction(pluginAdapter);
microPlatform.init();
}
use of org.pentaho.platform.engine.core.system.StandaloneSession in project pentaho-platform by pentaho.
the class PluginManagerNotConfiguredIT method testPluginAdapterViaSystemListenerAPI.
@SuppressWarnings("cast")
public void testPluginAdapterViaSystemListenerAPI() throws Exception {
startTest();
// $NON-NLS-1$
IPentahoSession session = new StandaloneSession("test user");
PluginAdapter mgr = new PluginAdapter();
assertTrue(mgr instanceof IPentahoSystemListener);
IPentahoSystemListener listener = (IPentahoSystemListener) mgr;
assertFalse(listener.startup(session));
// this does not do anything but it shouldn't error
listener.shutdown();
finishTest();
}
use of org.pentaho.platform.engine.core.system.StandaloneSession in project pentaho-platform by pentaho.
the class SystemPathPluginProviderIT method tesLoadtLifecycleListener.
@SuppressWarnings("deprecation")
@Test
public void tesLoadtLifecycleListener() throws PlatformPluginRegistrationException {
microPlatform.init();
PluginMessageLogger.clear();
List<IPlatformPlugin> plugins = provider.getPlugins(new StandaloneSession());
// first make sure Plugin 1 was loaded, otherwise our check for lifcycle class will never happen
assertTrue("plugin1 was not found", CollectionUtils.exists(plugins, new PluginNameMatcherPredicate("Plugin 1")));
for (IPlatformPlugin plugin : plugins) {
if (plugin.getId().equals("Plugin 1")) {
assertEquals("org.pentaho.test.platform.plugin.pluginmgr.FooInitializer", plugin.getLifecycleListenerClassname());
}
if (plugin.getId().equals("Plugin 2")) {
// no listener defined to for Plugin 2
assertNull(plugin.getLifecycleListenerClassname());
}
}
}
use of org.pentaho.platform.engine.core.system.StandaloneSession in project pentaho-platform by pentaho.
the class SystemPathPluginProviderIT method testLoadLifeCycleListener.
@SuppressWarnings("deprecation")
@Test
public void testLoadLifeCycleListener() throws PlatformPluginRegistrationException {
microPlatform.init();
List<IPlatformPlugin> plugins = provider.getPlugins(new StandaloneSession());
IPlatformPlugin plugin = (IPlatformPlugin) CollectionUtils.find(plugins, new PluginNameMatcherPredicate("Plugin 1"));
assertNotNull("Plugin 1 should have been found", plugin);
assertEquals("org.pentaho.test.platform.plugin.pluginmgr.FooInitializer", plugin.getLifecycleListenerClassname());
}
use of org.pentaho.platform.engine.core.system.StandaloneSession in project pentaho-platform by pentaho.
the class SystemPathPluginProviderIT method testLoadWebservices.
@SuppressWarnings("deprecation")
@Test
public void testLoadWebservices() throws PlatformPluginRegistrationException {
microPlatform.init();
List<IPlatformPlugin> plugins = provider.getPlugins(new StandaloneSession());
System.out.println(PluginMessageLogger.getAll());
IPlatformPlugin plugin = (IPlatformPlugin) CollectionUtils.find(plugins, new PluginNameMatcherPredicate("Plugin 1"));
assertNotNull("Plugin 1 should have been found", plugin);
Collection<PluginServiceDefinition> webservices = plugin.getServices();
Object wsobj = CollectionUtils.find(webservices, new Predicate() {
public boolean evaluate(Object object) {
PluginServiceDefinition ws = (PluginServiceDefinition) object;
boolean ret = ws.getTitle().equals("%TestWS1.TITLE%");
return ret;
}
});
assertNotNull("Webservice \"%TestWS1.TITLE%\" should have been loaded", wsobj);
PluginServiceDefinition wsDfn = (PluginServiceDefinition) wsobj;
assertEquals("org.pentaho.test.platform.engine.core.EchoServiceBean", wsDfn.getServiceClass());
assertEquals("xml", wsDfn.getTypes()[0]);
assertEquals("gwt", wsDfn.getTypes()[1]);
assertEquals("A test webservice", wsDfn.getDescription());
assertEquals(1, wsDfn.getExtraClasses().size());
assertEquals("java.lang.String", wsDfn.getExtraClasses().iterator().next());
}
Aggregations