use of org.pentaho.platform.engine.core.system.SystemSettings in project pentaho-platform by pentaho.
the class SystemSettingsConfigurationTest method testGetProperties.
@Test
public void testGetProperties() throws Exception {
SystemSettings settings = new SystemSettings();
IApplicationContext appContext = mock(IApplicationContext.class);
PentahoSystem.setApplicationContext(appContext);
when(appContext.getSolutionPath(anyString())).thenReturn(TestResourceLocation.TEST_RESOURCES + "/solution/system/pentaho.xml");
config = new SystemSettingsConfiguration("system", settings);
Properties properties = config.getProperties();
assertNotNull(properties);
assertEquals("DEBUG", properties.getProperty("log-level"));
}
use of org.pentaho.platform.engine.core.system.SystemSettings in project pentaho-platform by pentaho.
the class BootTest method testBootSettings.
@Test
public void testBootSettings() throws Exception {
PentahoSystemBoot boot = new PentahoSystemBoot();
boot.setFilePath("src/test/resources/solution");
IPentahoObjectFactory factory = boot.getFactory();
assertNotNull("object factory is null", factory);
SystemSettings settings = new SystemSettings();
boot.setSettingsProvider(settings);
assertEquals(settings, boot.getSettingsProvider());
}
use of org.pentaho.platform.engine.core.system.SystemSettings in project pentaho-platform by pentaho.
the class MondrianCatalogHelperIT method setUp.
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
when(olapService.getConnection(any(String.class), any(IPentahoSession.class))).thenReturn(olapConn);
when(rolapConn.getSchema()).thenReturn(mondrianSchema);
when(rolapConn.getCacheControl(any(PrintWriter.class))).thenReturn(mondrianCacheControl);
when(olapConn.unwrap(Connection.class)).thenReturn(rolapConn);
booter = new MicroPlatform(TestResourceLocation.TEST_RESOURCES + "/solution");
booter.define(IPasswordService.class, KettlePasswordService.class, Scope.GLOBAL);
booter.define(IDatabaseConnection.class, DatabaseConnection.class, Scope.GLOBAL);
booter.define(IDatabaseDialectService.class, DatabaseDialectService.class, Scope.GLOBAL);
booter.define(IAclAwareMondrianCatalogService.class, MondrianCatalogHelper.class, Scope.GLOBAL);
booter.define(ICacheManager.class, CacheManager.class, Scope.GLOBAL);
booter.define(IUserRoleListService.class, TestUserRoleListService.class, Scope.GLOBAL);
booter.defineInstance(IUnifiedRepository.class, repo);
booter.defineInstance(IOlapService.class, olapService);
booter.defineInstance("inlineModeling", new MondrianSchemaAnnotator() {
@Override
public InputStream getInputStream(final InputStream schemaInputStream, final InputStream annotationsInputStream) {
return schemaInputStream;
}
});
booter.setSettingsProvider(new SystemSettings());
booter.start();
cacheMgr = PentahoSystem.getCacheManager(null);
helper = (MondrianCatalogHelper) PentahoSystem.get(IAclAwareMondrianCatalogService.class);
}
use of org.pentaho.platform.engine.core.system.SystemSettings 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);
}
use of org.pentaho.platform.engine.core.system.SystemSettings in project data-access by pentaho.
the class SerializeMultiTableServiceIT method setUp.
@Before
public void setUp() throws Exception {
manager = new MockBackingRepositoryLifecycleManager(new MockSecurityHelper());
IAuthorizationPolicy mockAuthorizationPolicy = mock(IAuthorizationPolicy.class);
when(mockAuthorizationPolicy.isAllowed(anyString())).thenReturn(true);
IUserRoleListService mockUserRoleListService = mock(IUserRoleListService.class);
// $NON-NLS-1$ //$NON-NLS-2$
System.setProperty("org.osjava.sj.root", "target/test-classes/solution1/system/simple-jndi");
booter = new MicroPlatform("target/test-classes/solution1");
booter.define(ISolutionEngine.class, SolutionEngine.class, Scope.GLOBAL);
booter.define(IUnifiedRepository.class, TestFileSystemBackedUnifiedRepository.class, Scope.GLOBAL);
booter.define(IMondrianCatalogService.class, MondrianCatalogHelper.class, Scope.GLOBAL);
booter.define("connection-SQL", SQLConnection.class);
booter.define("connection-MDX", MDXConnection.class);
booter.define("connection-MDXOlap4j", MDXOlap4jConnection.class);
booter.define(IDBDatasourceService.class, JndiDatasourceService.class, Scope.GLOBAL);
booter.define(MDXConnection.MDX_CONNECTION_MAPPER_KEY, MondrianOneToOneUserRoleListMapper.class, Scope.GLOBAL);
booter.define(IDatasourceMgmtService.class, MockDatasourceMgmtService.class);
booter.define(IClientRepositoryPathsStrategy.class, MockClientRepositoryPathsStrategy.class);
booter.defineInstance(IMetadataDomainRepository.class, createMetadataDomainRepository());
booter.define(ISecurityHelper.class, MockSecurityHelper.class);
booter.define(UserDetailsService.class, MockUserDetailService.class);
booter.define("singleTenantAdminUserName", new String("admin"));
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(IUserRoleListService.class, mockUserRoleListService);
booter.setSettingsProvider(new SystemSettings());
booter.start();
PentahoSessionHolder.setStrategyName(PentahoSessionHolder.MODE_GLOBAL);
SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_GLOBAL);
}
Aggregations