Package org.pentaho.platform.plugin.boot

Examples of org.pentaho.platform.plugin.boot.PentahoBoot


@SuppressWarnings( { "all" } )
public class BootTest extends TestCase {

  public void testBoot() throws PlatformInitializationException {
    PentahoBoot boot = new PentahoBoot();
    boot.setFilePath( "test-src/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( "test-src/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();
  }
View Full Code Here

TOP

Related Classes of org.pentaho.platform.plugin.boot.PentahoBoot

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.