Search in sources :

Example 1 with PlatformInitializationException

use of org.pentaho.platform.engine.core.system.boot.PlatformInitializationException in project pentaho-platform by pentaho.

the class AgileBITests method init.

/**
 * Creates the files system that mimicks a BI Server solution. Also creates a LocaleTestUtility that is used to create
 * the files needed for the tests.
 * <p/>
 * A MicroPlatform is also created as it is needed for filtering the property files that may exist in the metadata
 * folder.
 *
 * @throws Exception
 */
@Before
public void init() throws Exception {
    // create the solution folder
    SOLUTION_PATH = System.getProperty("java.io.tmpdir") + "/" + SOLUTION_FOLDER_NAME;
    METADATA_PATH = RESOURCE_FOLDER_NAME + "/" + METADATA_FOLDER_NAME;
    File solutionFolder = new File(SOLUTION_PATH);
    if (!solutionFolder.exists()) {
        if (!solutionFolder.mkdir()) {
            throw new Exception("Unable to create " + SOLUTION_PATH);
        }
    }
    // Create the resource folder
    String resourcePath = SOLUTION_PATH + "/" + RESOURCE_FOLDER_NAME;
    File resourceFolder = new File(resourcePath);
    if (!resourceFolder.exists()) {
        if (!resourceFolder.mkdir()) {
            throw new Exception("Unable to create " + resourcePath);
        }
    }
    // Create the resource metadata folder
    String metadataPath = SOLUTION_PATH + "/" + RESOURCE_FOLDER_NAME + "/" + METADATA_FOLDER_NAME;
    File metadataFolder = new File(metadataPath);
    if (!metadataFolder.exists()) {
        if (!metadataFolder.mkdir()) {
            throw new Exception("Unable to create " + metadataPath);
        }
    }
    localeTestUtil = new LocaleTestUtil();
    MicroPlatform mp = new MicroPlatform(SOLUTION_PATH);
    try {
        mp.start();
    } catch (PlatformInitializationException pie) {
        pie.printStackTrace();
    }
}
Also used : PlatformInitializationException(org.pentaho.platform.engine.core.system.boot.PlatformInitializationException) MicroPlatform(org.pentaho.test.platform.engine.core.MicroPlatform) File(java.io.File) PlatformInitializationException(org.pentaho.platform.engine.core.system.boot.PlatformInitializationException) Before(org.junit.Before)

Example 2 with PlatformInitializationException

use of org.pentaho.platform.engine.core.system.boot.PlatformInitializationException in project pentaho-platform by pentaho.

the class SolutionFolderIT method init.

/**
 * Creates the files system that mimics a BI Server solution. Also creates a LocaleTestUtility that is used to create
 * the files needed for the tests.
 *
 * A MicroPlatform is also created as it is needed for filtering the property files that may exist in the metadata
 * folder.
 *
 * @throws Exception
 */
@Before
public void init() {
    // create solution paths
    SOLUTION_PATH = System.getProperty("java.io.tmpdir");
    BI_DEVELOPERS_FULL_PATH = SOLUTION_PATH + "/" + BI_DEVELOPERS_FOLDER_NAME;
    // BI_DEVELOPERS_FULL_PATH = SOLUTION_PATH + BI_DEVELOPERS_FOLDER_NAME;
    biDevelopersSolutionFolder = new File(BI_DEVELOPERS_FULL_PATH);
    if (!biDevelopersSolutionFolder.exists()) {
        biDevelopersSolutionFolder.delete();
        biDevelopersSolutionFolder.mkdir();
    }
    // utility to make this testing a bit easier
    localeTestUtil = new LocaleTestUtil();
    // create a platform
    MicroPlatform mp = new MicroPlatform(SOLUTION_PATH);
    try {
        mp.start();
    } catch (PlatformInitializationException pie) {
        pie.printStackTrace();
    }
}
Also used : PlatformInitializationException(org.pentaho.platform.engine.core.system.boot.PlatformInitializationException) MicroPlatform(org.pentaho.test.platform.engine.core.MicroPlatform) File(java.io.File) Before(org.junit.Before)

Example 3 with PlatformInitializationException

use of org.pentaho.platform.engine.core.system.boot.PlatformInitializationException 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", "/");
}
Also used : MondrianCatalogHelper(org.pentaho.platform.plugin.action.mondrian.catalog.MondrianCatalogHelper) IAclNodeHelper(org.pentaho.platform.api.repository2.unified.IAclNodeHelper) PlatformInitializationException(org.pentaho.platform.engine.core.system.boot.PlatformInitializationException) EnumSet(java.util.EnumSet) MicroPlatform(org.pentaho.test.platform.engine.core.MicroPlatform) RepositoryFile(org.pentaho.platform.api.repository2.unified.RepositoryFile) RepositoryFile(org.pentaho.platform.api.repository2.unified.RepositoryFile) File(java.io.File) FileSystemBackedUnifiedRepository(org.pentaho.platform.repository2.unified.fs.FileSystemBackedUnifiedRepository) IUnifiedRepository(org.pentaho.platform.api.repository2.unified.IUnifiedRepository) Before(org.junit.Before)

Aggregations

File (java.io.File)3 Before (org.junit.Before)3 PlatformInitializationException (org.pentaho.platform.engine.core.system.boot.PlatformInitializationException)3 MicroPlatform (org.pentaho.test.platform.engine.core.MicroPlatform)3 EnumSet (java.util.EnumSet)1 IAclNodeHelper (org.pentaho.platform.api.repository2.unified.IAclNodeHelper)1 IUnifiedRepository (org.pentaho.platform.api.repository2.unified.IUnifiedRepository)1 RepositoryFile (org.pentaho.platform.api.repository2.unified.RepositoryFile)1 MondrianCatalogHelper (org.pentaho.platform.plugin.action.mondrian.catalog.MondrianCatalogHelper)1 FileSystemBackedUnifiedRepository (org.pentaho.platform.repository2.unified.fs.FileSystemBackedUnifiedRepository)1