use of org.pentaho.platform.plugin.services.pluginmgr.PluginClassLoader in project pentaho-platform by pentaho.
the class RepositoryResourceIT method beforeTest.
@Before
public void beforeTest() throws Exception {
repositoryBase.setUp();
repositoryBase.getMp().define(IPluginManager.class, DefaultPluginManager.class, Scope.GLOBAL);
repositoryBase.getMp().defineInstance(IPluginResourceLoader.class, new PluginResourceLoader() {
protected PluginClassLoader getOverrideClassloader() {
return new PluginClassLoader(new File(TestResourceLocation.TEST_RESOURCES + "/PluginResourceTest/system/test-plugin"), this);
}
});
repositoryBase.getMp().define(IPluginProvider.class, TestPlugin.class, Scope.GLOBAL);
PentahoSystem.get(IPluginManager.class).reload();
SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_GLOBAL);
repositoryBase.loginAsRepositoryAdmin();
mainTenant_1 = repositoryBase.createTenant(repositoryBase.getSystemTenant(), MAIN_TENANT_1);
repositoryBase.createUser(mainTenant_1, "admin", "password", new String[] { repositoryBase.getTenantAdminRoleName() });
repositoryBase.login("admin", mainTenant_1, new String[] { repositoryBase.getTenantAdminRoleName() });
publicFolderPath = ClientRepositoryPaths.getPublicFolderPath().replaceAll("/", ":");
}
use of org.pentaho.platform.plugin.services.pluginmgr.PluginClassLoader in project pentaho-platform by pentaho.
the class DefaultSpringWadlResourceDocumentTest method setUp.
@Before
public void setUp() throws Exception {
File plugin = mock(File.class);
doReturn(pluginName).when(plugin).getName();
pluginClassLoader = mock(PluginClassLoader.class);
doReturn(plugin).when(pluginClassLoader).getPluginDir();
classPathResourcePlugin = new ClassPathResource(pluginName, pluginClassLoader);
wadlResourceDocumentPlugin = new DefaultSpringWadlResourceDocument(classPathResourcePlugin);
wadlResourceDocumentPluginSpy = spy(wadlResourceDocumentPlugin);
webAppClassLoader = mock(WebAppClassLoader.class);
classPathResourceWebapp = new ClassPathResource(pluginName, webAppClassLoader);
wadlResourceDocumentWebapp = new DefaultSpringWadlResourceDocument(classPathResourceWebapp);
wadlResourceDocumentWebappSpy = spy(wadlResourceDocumentWebapp);
}
use of org.pentaho.platform.plugin.services.pluginmgr.PluginClassLoader in project pentaho-platform by pentaho.
the class PluginResourceLoaderTest method init.
@Before
public void init() throws ClassNotFoundException {
resLoader = new PluginResourceLoader();
classLoader = new PluginClassLoader(new File("./" + TEST_RES + "PluginResourceLoaderTest"), getClass().getClassLoader());
pluginClass = classLoader.loadClass("PluginResLoaderDummyClass");
}
use of org.pentaho.platform.plugin.services.pluginmgr.PluginClassLoader in project data-access by pentaho.
the class ConnectionServiceImplIT method setUpClass.
@BeforeClass
public static void setUpClass() throws PlatformInitializationException, DuplicateDatasourceException, DatasourceMgmtServiceException {
MockDataSourceService dataSourceService = new MockDataSourceService(false);
IAuthorizationPolicy mockAuthorizationPolicy = mock(IAuthorizationPolicy.class);
when(mockAuthorizationPolicy.isAllowed(anyString())).thenReturn(true);
booter = new MicroPlatform("target/test-classes/solution1");
booter.define(IPentahoConnection.class, SQLConnection.class);
booter.defineInstance(IDBDatasourceService.class, dataSourceService);
booter.defineInstance(IAuthorizationPolicy.class, mockAuthorizationPolicy);
booter.defineInstance(IPluginResourceLoader.class, new PluginResourceLoader() {
protected PluginClassLoader getOverrideClassloader() {
return new PluginClassLoader(new File(".", "target/test-classes/solution1/system/simple-jndi"), this);
}
});
booter.defineInstance(IDatasourceMgmtService.class, mgmtService);
booter.start();
PentahoSessionHolder.setStrategyName(PentahoSessionHolder.MODE_GLOBAL);
SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_GLOBAL);
connectionServiceImpl = new ConnectionServiceImpl();
}
use of org.pentaho.platform.plugin.services.pluginmgr.PluginClassLoader in project data-access by pentaho.
the class DatasourceResourceIT method setUp.
@BeforeClass
public static void setUp() throws Exception {
// $NON-NLS-1$ //$NON-NLS-2$
System.setProperty("org.osjava.sj.root", "target/test-classes/solution1/system/simple-jndi");
mp = new MicroPlatform("target/test-classes/solution1");
IAuthorizationPolicy mockAuthorizationPolicy = mock(IAuthorizationPolicy.class);
when(mockAuthorizationPolicy.isAllowed(anyString())).thenReturn(true);
IUserRoleListService mockUserRoleListService = mock(IUserRoleListService.class);
IDataAccessPermissionHandler mockDataAccessPermHandler = mock(IDataAccessPermissionHandler.class);
when(mockDataAccessPermHandler.hasDataAccessPermission(any(IPentahoSession.class))).thenReturn(true);
mp.define(ISolutionEngine.class, SolutionEngine.class, IPentahoDefinableObjectFactory.Scope.GLOBAL);
mp.define(IUnifiedRepository.class, TestFileSystemBackedUnifiedRepository.class, IPentahoDefinableObjectFactory.Scope.GLOBAL);
mp.define(IMondrianCatalogService.class, MondrianCatalogHelper.class, IPentahoDefinableObjectFactory.Scope.GLOBAL);
mp.define("connection-SQL", SQLConnection.class);
mp.define("connection-MDX", MDXConnection.class);
mp.define("connection-MDXOlap4j", MDXOlap4jConnection.class);
mp.define(IDBDatasourceService.class, JndiDatasourceService.class, IPentahoDefinableObjectFactory.Scope.GLOBAL);
mp.define(MDXConnection.MDX_CONNECTION_MAPPER_KEY, MondrianOneToOneUserRoleListMapper.class, IPentahoDefinableObjectFactory.Scope.GLOBAL);
mp.define(IDatasourceMgmtService.class, MockDatasourceMgmtService.class);
mp.define(IClientRepositoryPathsStrategy.class, MockClientRepositoryPathsStrategy.class);
mp.define(ISecurityHelper.class, MockSecurityHelper.class);
mp.define(UserDetailsService.class, MockUserDetailService.class);
mp.define("singleTenantAdminUserName", "admin");
mp.defineInstance(IMetadataDomainRepository.class, createMetadataDomainRepository());
mp.defineInstance(IAuthorizationPolicy.class, mockAuthorizationPolicy);
mp.defineInstance(IPluginResourceLoader.class, new PluginResourceLoader() {
protected PluginClassLoader getOverrideClassloader() {
return new PluginClassLoader(new File(".", "target/test-classes/solution1/system/simple-jndi"), this);
}
});
mp.defineInstance(IUserRoleListService.class, mockUserRoleListService);
mp.defineInstance(IDataAccessPermissionHandler.class, mockDataAccessPermHandler);
mp.setSettingsProvider(new SystemSettings());
mp.start();
PentahoSessionHolder.setStrategyName(PentahoSessionHolder.MODE_GLOBAL);
SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_GLOBAL);
}
Aggregations