use of org.pentaho.platform.plugin.action.mondrian.catalog.MondrianCatalogHelper in project pentaho-platform by pentaho.
the class UserRoleMapperIT method testReadRolesInSchema.
@Test
public void testReadRolesInSchema() throws Exception {
final MondrianCatalogHelper helper = (MondrianCatalogHelper) PentahoSystem.get(IMondrianCatalogService.class);
Assert.assertNotNull(helper);
MondrianCatalog mc = SecurityHelper.getInstance().runAsUser("admin", new Callable<MondrianCatalog>() {
@Override
public MondrianCatalog call() throws Exception {
return helper.getCatalog("SteelWheelsRoles", PentahoSessionHolder.getSession());
}
});
Assert.assertNotNull(mc);
MondrianSchema ms = mc.getSchema();
Assert.assertNotNull(ms);
String[] roleNames = ms.getRoleNames();
Assert.assertNotNull(roleNames);
Assert.assertEquals(2, roleNames.length);
Assert.assertEquals("Role1", roleNames[0]);
Assert.assertEquals("Role2", roleNames[1]);
}
use of org.pentaho.platform.plugin.action.mondrian.catalog.MondrianCatalogHelper 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