use of org.pentaho.platform.plugin.services.pluginmgr.PluginResourceLoader 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.PluginResourceLoader 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.PluginResourceLoader in project data-access by pentaho.
the class DataSourcePublishIT method setUp.
@Before
public void setUp() throws Exception {
repositoryBase.setUp();
repositoryBase.loginAsRepositoryAdmin();
defaultTenant = repositoryBase.createTenant(repositoryBase.getSystemTenant(), TenantUtils.getDefaultTenant());
singleTenantAdminUserName = (String) applicationContext.getBean("singleTenantAdminUserName");
repositoryBase.createUser(defaultTenant, singleTenantAdminUserName, PASSWORD, new String[] { repositoryBase.getTenantAdminRoleName() });
final String singleTenantAuthenticatedAuthorityName = (String) applicationContext.getBean("singleTenantAuthenticatedAuthorityName");
repositoryBase.createUser(defaultTenant, USERNAME_SUZY, PASSWORD, new String[] { singleTenantAuthenticatedAuthorityName });
repositoryBase.createUser(defaultTenant, USERNAME_TIFFANY, PASSWORD, new String[] { singleTenantAuthenticatedAuthorityName });
repositoryBase.login(singleTenantAdminUserName, defaultTenant, new String[] { repositoryBase.getTenantAdminRoleName() });
final IUnifiedRepository repo = PentahoSystem.get(IUnifiedRepository.class);
String etcID = String.valueOf(repo.getFile(ClientRepositoryPaths.getEtcFolderPath()).getId());
repo.createFolder(etcID, new RepositoryFile.Builder(MondrianCatalogHelper.MONDRIAN_DATASOURCE_FOLDER).folder(true).build(), "initialization");
repo.createFolder(etcID, new RepositoryFile.Builder(PentahoMetadataDomainRepositoryInfo.getMetadataFolderName()).folder(true).build(), "initialization");
final MicroPlatform mp = repositoryBase.getMp();
mp.define(IMondrianCatalogService.class, MondrianCatalogHelper.class);
mp.define(ISystemConfig.class, SystemConfig.class);
mp.defineInstance(IPlatformMimeResolver.class, applicationContext.getBean("IPlatformImportMimeResolver"));
mp.defineInstance(IPlatformImporter.class, applicationContext.getBean("IPlatformImporter"));
mp.defineInstance(ICacheManager.class, applicationContext.getBean("ICacheManager"));
mp.defineInstance(IMetadataDomainRepository.class, applicationContext.getBean("IMetadataDomainRepository"));
final PluginResourceLoader pluginResourceLoader = (PluginResourceLoader) applicationContext.getBean("IPluginResourceLoader");
pluginResourceLoader.setRootDir(new File("target/test-classes/solutionACL/system/data-access"));
mp.defineInstance(IPluginResourceLoader.class, pluginResourceLoader);
mp.define(IDataAccessPermissionHandler.class, SimpleDataAccessPermissionHandler.class);
mp.define(IDataAccessViewPermissionHandler.class, SimpleDataAccessViewPermissionHandler.class);
mp.defineInstance(IAclVoter.class, new PentahoAllowAllAclVoter());
SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_GLOBAL);
super.setUp();
}
use of org.pentaho.platform.plugin.services.pluginmgr.PluginResourceLoader 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.PluginResourceLoader 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