Search in sources :

Example 1 with SystemSettings

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"));
}
Also used : IApplicationContext(org.pentaho.platform.api.engine.IApplicationContext) ISystemSettings(org.pentaho.platform.api.engine.ISystemSettings) SystemSettings(org.pentaho.platform.engine.core.system.SystemSettings) Properties(java.util.Properties) Test(org.junit.Test)

Example 2 with SystemSettings

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());
}
Also used : PentahoSystemBoot(org.pentaho.platform.engine.core.system.boot.PentahoSystemBoot) IPentahoObjectFactory(org.pentaho.platform.api.engine.IPentahoObjectFactory) SystemSettings(org.pentaho.platform.engine.core.system.SystemSettings) Test(org.junit.Test)

Example 3 with SystemSettings

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);
}
Also used : MondrianSchemaAnnotator(org.pentaho.platform.api.repository2.unified.MondrianSchemaAnnotator) IPentahoSession(org.pentaho.platform.api.engine.IPentahoSession) ByteArrayInputStream(java.io.ByteArrayInputStream) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) MicroPlatform(org.pentaho.test.platform.engine.core.MicroPlatform) Matchers.anyString(org.mockito.Matchers.anyString) SystemSettings(org.pentaho.platform.engine.core.system.SystemSettings) PrintWriter(java.io.PrintWriter) Before(org.junit.Before)

Example 4 with SystemSettings

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);
}
Also used : PluginResourceLoader(org.pentaho.platform.plugin.services.pluginmgr.PluginResourceLoader) IPluginResourceLoader(org.pentaho.platform.api.engine.IPluginResourceLoader) IAuthorizationPolicy(org.pentaho.platform.api.engine.IAuthorizationPolicy) IPentahoSession(org.pentaho.platform.api.engine.IPentahoSession) MicroPlatform(org.pentaho.test.platform.engine.core.MicroPlatform) IUserRoleListService(org.pentaho.platform.api.engine.IUserRoleListService) SystemSettings(org.pentaho.platform.engine.core.system.SystemSettings) ZipFile(java.util.zip.ZipFile) RepositoryFile(org.pentaho.platform.api.repository2.unified.RepositoryFile) File(java.io.File) PluginClassLoader(org.pentaho.platform.plugin.services.pluginmgr.PluginClassLoader) BeforeClass(org.junit.BeforeClass)

Example 5 with SystemSettings

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);
}
Also used : MockSecurityHelper(org.pentaho.test.platform.engine.security.MockSecurityHelper) PluginResourceLoader(org.pentaho.platform.plugin.services.pluginmgr.PluginResourceLoader) IPluginResourceLoader(org.pentaho.platform.api.engine.IPluginResourceLoader) IAuthorizationPolicy(org.pentaho.platform.api.engine.IAuthorizationPolicy) MicroPlatform(org.pentaho.test.platform.engine.core.MicroPlatform) Matchers.anyString(org.mockito.Matchers.anyString) IUserRoleListService(org.pentaho.platform.api.engine.IUserRoleListService) SystemSettings(org.pentaho.platform.engine.core.system.SystemSettings) RepositoryFile(org.pentaho.platform.api.repository2.unified.RepositoryFile) File(java.io.File) PluginClassLoader(org.pentaho.platform.plugin.services.pluginmgr.PluginClassLoader) Before(org.junit.Before)

Aggregations

SystemSettings (org.pentaho.platform.engine.core.system.SystemSettings)7 MicroPlatform (org.pentaho.test.platform.engine.core.MicroPlatform)5 Before (org.junit.Before)4 IAuthorizationPolicy (org.pentaho.platform.api.engine.IAuthorizationPolicy)4 IUserRoleListService (org.pentaho.platform.api.engine.IUserRoleListService)4 File (java.io.File)3 Matchers.anyString (org.mockito.Matchers.anyString)3 IPluginResourceLoader (org.pentaho.platform.api.engine.IPluginResourceLoader)3 RepositoryFile (org.pentaho.platform.api.repository2.unified.RepositoryFile)3 PluginClassLoader (org.pentaho.platform.plugin.services.pluginmgr.PluginClassLoader)3 PluginResourceLoader (org.pentaho.platform.plugin.services.pluginmgr.PluginResourceLoader)3 MockSecurityHelper (org.pentaho.test.platform.engine.security.MockSecurityHelper)3 Test (org.junit.Test)2 IPentahoSession (org.pentaho.platform.api.engine.IPentahoSession)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 FileInputStream (java.io.FileInputStream)1 InputStream (java.io.InputStream)1 PrintWriter (java.io.PrintWriter)1 Properties (java.util.Properties)1 ZipFile (java.util.zip.ZipFile)1