use of org.pentaho.test.platform.engine.core.MicroPlatform in project pentaho-platform by pentaho.
the class SystemPathPluginProviderIT method testLoad_BadSolutionPath.
@SuppressWarnings("deprecation")
@Test(expected = PlatformPluginRegistrationException.class)
public void testLoad_BadSolutionPath() throws PlatformPluginRegistrationException {
MicroPlatform mp = new MicroPlatform(TestResourceLocation.TEST_RESOURCES + "/SystemPathPluginProviderTest/system");
mp.define(ISolutionEngine.class, SolutionEngine.class);
mp.init();
provider.getPlugins(new StandaloneSession());
}
use of org.pentaho.test.platform.engine.core.MicroPlatform in project pentaho-platform by pentaho.
the class AxisWebServiceManagerIT method init0.
/*
* Wire up an in-memory platform to register and expose plug-in web services.
*/
@SuppressWarnings("deprecation")
@Before
public void init0() throws ServiceInitializationException {
// set solution path to a place that hosts an axis config file
microPlatform = new MicroPlatform(TestResourceLocation.TEST_RESOURCES + "/AxisWebServiceManagerTest/", "http://test/");
assertNotNull(PentahoSystem.getObjectFactory());
microPlatform.define(ISolutionEngine.class, SolutionEngine.class);
assertNotNull(PentahoSystem.getObjectFactory());
microPlatform.define(IPluginManager.class, DefaultPluginManager.class, Scope.GLOBAL);
microPlatform.define(IServiceManager.class, DefaultServiceManager.class, Scope.GLOBAL);
microPlatform.define(IPluginProvider.class, TstPluginProvider.class);
microPlatform.define(IThemeManager.class, DefaultThemeManager.class);
IServiceTypeManager axisManager = new AxisWebServiceManager();
DefaultServiceManager sm = (DefaultServiceManager) PentahoSystem.get(IServiceManager.class);
sm.setServiceTypeManagers(Arrays.asList(axisManager));
microPlatform.init();
new StandaloneSession();
PentahoSystem.get(IPluginManager.class).reload(PentahoSessionHolder.getSession());
}
use of org.pentaho.test.platform.engine.core.MicroPlatform in project pentaho-platform by pentaho.
the class DefaultPluginManagerIT method test8b_getBeanFromPluginClassloader_altSolutionPath.
@Test
public void test8b_getBeanFromPluginClassloader_altSolutionPath() throws PluginBeanException, PlatformInitializationException {
// This test is to validate a bug that had existed where a solution path ending in '/' was causing
// the PluginClassLoader to not be able to open plugin jars, thus you would get ClassNotFound exceptions
// when accessing plugin classes.
MicroPlatform mp = new MicroPlatform(getSolutionPath() + "/");
mp.define(ISolutionEngine.class, SolutionEngine.class);
mp.define(IServiceManager.class, DefaultServiceManager.class);
mp.define(IPluginProvider.class, Tst8PluginProvider.class).start();
// reload should register the beans
pluginManager.reload();
try {
Class.forName("org.pentaho.nowhere.PluginOnlyClass");
fail("PluginOnlyClass needs to be available only through " + "the plugin lib dir in order for this test to be valid");
} catch (ClassNotFoundException e) {
// ignore
}
assertTrue("PluginOnlyClass should have been registered", pluginManager.isBeanRegistered("PluginOnlyClass"));
assertNotNull("PluginOnlyClass bean should have been loaded from test-jar.jar in the plugin lib directory", pluginManager.getBean("PluginOnlyClass"));
}
use of org.pentaho.test.platform.engine.core.MicroPlatform in project pentaho-platform by pentaho.
the class DefaultPluginManagerIT method test8c_loadClass.
@Test
public void test8c_loadClass() throws PlatformInitializationException, PluginBeanException {
MicroPlatform mp = new MicroPlatform(getSolutionPath() + "/");
mp.define(IPluginProvider.class, Tst8PluginProvider.class).start();
pluginManager.reload();
pluginManager.loadClass("PluginOnlyClass");
pluginManager.loadClass("PluginOnlyClassSpringFile");
}
use of org.pentaho.test.platform.engine.core.MicroPlatform in project pentaho-platform by pentaho.
the class UserRoleMapperIT method init0.
@Before
public void init0() {
IAclNodeHelper aclHelper = mock(IAclNodeHelper.class);
when(aclHelper.canAccess(any(RepositoryFile.class), any(EnumSet.class))).thenReturn(true);
MondrianCatalogHelper catalogService = new MondrianCatalogHelper(aclHelper);
microPlatform = new MicroPlatform(TestResourceLocation.TEST_RESOURCES + "/solution");
microPlatform.define(ISolutionEngine.class, SolutionEngine.class);
microPlatform.define(IUnifiedRepository.class, FileSystemBackedUnifiedRepository.class, Scope.GLOBAL);
microPlatform.defineInstance(IMondrianCatalogService.class, catalogService);
microPlatform.define("connection-SQL", SQLConnection.class);
microPlatform.define("connection-MDX", MDXConnection.class);
microPlatform.define(IDBDatasourceService.class, JndiDatasourceService.class, Scope.GLOBAL);
microPlatform.define(IUserRoleListService.class, TestUserRoleListService.class, Scope.GLOBAL);
microPlatform.define(UserDetailsService.class, TestUserDetailsService.class, Scope.GLOBAL);
FileSystemBackedUnifiedRepository repo = (FileSystemBackedUnifiedRepository) PentahoSystem.get(IUnifiedRepository.class);
repo.setRootDir(new File(TestResourceLocation.TEST_RESOURCES + "/solution"));
try {
microPlatform.start();
} catch (PlatformInitializationException ex) {
Assert.fail();
}
catalogService.setDataSourcesConfig("file:" + PentahoSystem.getApplicationContext().getSolutionPath("test/analysis/test-datasources.xml"));
// JNDI
System.setProperty("java.naming.factory.initial", "org.osjava.sj.SimpleContextFactory");
System.setProperty("org.osjava.sj.root", TestResourceLocation.TEST_RESOURCES + "/solution/system/simple-jndi");
System.setProperty("org.osjava.sj.delimiter", "/");
}
Aggregations