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();
}
}
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();
}
}
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", "/");
}
Aggregations