use of org.pentaho.platform.plugin.boot.PentahoBoot in project pentaho-platform by pentaho.
the class BootIT method testBoot.
public void testBoot() throws PlatformInitializationException {
PentahoBoot boot = new PentahoBoot();
boot.setFilePath(TestResourceLocation.TEST_RESOURCES + "/solution");
boot.enableReporting();
// create a user session
IPentahoSession session = new StandaloneSession("test");
PentahoSessionHolder.setSession(session);
FileSystemBackedUnifiedRepository repo = (FileSystemBackedUnifiedRepository) PentahoSystem.get(IUnifiedRepository.class);
repo.setRootDir(new File(TestResourceLocation.TEST_RESOURCES + "/solution"));
boolean ok = boot.start();
assertTrue(ok);
String outputType = "pdf";
OutputStream outputStream = null;
try {
// create an output stream to write the report into
File outputFile = new File("report." + outputType);
outputStream = new FileOutputStream(outputFile);
// pass the outputType parameter
Map parameters = new HashMap();
parameters.put("output-type", outputType);
SolutionHelper.execute("test report", session, "boot/report.xaction", parameters, outputStream);
} catch (FileNotFoundException e) {
e.printStackTrace();
return;
} finally {
if (outputStream != null) {
try {
// close the output stream
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
boot.stop();
}
Aggregations