Package org.pentaho.platform.api.engine

Examples of org.pentaho.platform.api.engine.IRuntimeContext


    ISolutionEngine solutionEngine = PentahoSystem.get( ISolutionEngine.class, session );
    solutionEngine.setLoggingLevel( ILogger.ERROR );
    solutionEngine.init( session );
    HashMap parameterProviderMap = new HashMap();
    IPentahoUrlFactory urlFactory = new SimpleUrlFactory( "" );
    IRuntimeContext runtimeContext = null;
    Reader reader = null;
    try {
      File file = new File( actionSequencePath + actionSequence );
      StringBuilder str = new StringBuilder();
      reader = new FileReader( file );
View Full Code Here


        IPentahoUrlFactory urlFactory = new SimpleUrlFactory( baseUrl );

        ArrayList messages = new ArrayList();

        IRuntimeContext context = null;
        try {
          context =
              solutionEngine.execute( sessionStartupAction.getActionPath(), "Session startup actions", false, true,
                  instanceId, false, parameterProviderMap, outputHandler, null, urlFactory, messages ); //$NON-NLS-1$

          // if context is null, then we cannot check the status
          if ( null == context ) {
            return;
          }

          if ( context.getStatus() == IRuntimeContext.RUNTIME_STATUS_SUCCESS ) {
            // now grab any outputs
            Iterator outputNameIterator = context.getOutputNames().iterator();
            while ( outputNameIterator.hasNext() ) {

              String attributeName = (String) outputNameIterator.next();
              IActionParameter output = context.getOutputParameter( attributeName );

              Object data = output.getValue();
              if ( data != null ) {
                session.removeAttribute( attributeName );
                session.setAttribute( attributeName, data );
              }
            }
          }
        } catch ( Throwable th ) {
          Logger.warn( PentahoSystem.class.getName(), Messages.getInstance().getString(
              "PentahoSystem.WARN_UNABLE_TO_EXECUTE_SESSION_ACTION", th.getLocalizedMessage() ), th ); //$NON-NLS-1$
        } finally {
          if ( context != null ) {
            context.dispose();
          }
        }
      }
    }
  }
View Full Code Here

        HashMap parameterProviderMap = new HashMap();
        IPentahoUrlFactory urlFactory = new SimpleUrlFactory( baseUrl );

        ArrayList messages = new ArrayList();

        IRuntimeContext context = null;
        try {
          context =
              solutionEngine.execute( globalStartupAction.getActionPath(), "Global startup actions", false, true,
                  instanceId, false, parameterProviderMap, outputHandler, null, urlFactory, messages ); //$NON-NLS-1$

          // if context is null, then we cannot check the status
          if ( null == context ) {
            return;
          }

          if ( context.getStatus() == IRuntimeContext.RUNTIME_STATUS_SUCCESS ) {
            // now grab any outputs
            Iterator outputNameIterator = context.getOutputNames().iterator();
            while ( outputNameIterator.hasNext() ) {

              String attributeName = (String) outputNameIterator.next();
              IActionParameter output = context.getOutputParameter( attributeName );

              Object data = output.getValue();
              if ( data != null ) {
                PentahoSystem.globalAttributes.remove( attributeName );
                PentahoSystem.globalAttributes.put( attributeName, data );
              }
            }
          }
        } catch ( Throwable th ) {
          Logger.warn( PentahoSystem.class.getName(), Messages.getInstance().getString(
              "PentahoSystem.WARN_UNABLE_TO_EXECUTE_GLOBAL_ACTION", th.getLocalizedMessage() ), th ); //$NON-NLS-1$
        } finally {
          if ( context != null ) {
            context.dispose();
          }
        }

      }
    }
View Full Code Here

    final ServletOutputStream outputStream = mock( ServletOutputStream.class );
    when( response.getOutputStream() ).thenReturn( outputStream );

    final ISolutionEngine solutionEngine = mock( ISolutionEngine.class );
    final IRuntimeContext runtime = mock( IRuntimeContext.class );
    when( runtime.getStatus() ).thenReturn( IRuntimeContext.RUNTIME_STATUS_SUCCESS );
    when( solutionEngine.execute( eq( actionPath ), eq( servlet.getClass().getName() ), eq( false ), eq( true ),
      eq( instanceID ), eq( true ), any( Map.class ), any( IOutputHandler.class ), any( IActionCompleteListener.class ),
      any( IPentahoUrlFactory.class ), any( List.class ) ) ).thenReturn( runtime );
    mp.defineInstance( ISolutionEngine.class, solutionEngine );
    final IMessageFormatter messageFormatter = mock( IMessageFormatter.class );
View Full Code Here

  }

  public void testRSCompareOK() {
    startTest();
    IRuntimeContext context = run( "/samples/rules/ResultSetTest.xaction" );
    assertEquals( IRuntimeContext.RUNTIME_STATUS_SUCCESS, context.getStatus() );
    IActionParameter rtn = context.getOutputParameter( "COMPARERESULT" );
    assertNotNull( rtn );
    String compareResult = rtn.getStringValue();
    assertEquals( compareResult, "No Mismatches" );
    finishTest();
  }
View Full Code Here

    finishTest();
  }

  public void testRSCompareNotOK1() {
    startTest();
    IRuntimeContext context = run( "/samples/rules/ResultSetCompareTest_error1.xaction" );
    assertEquals( IRuntimeContext.RUNTIME_STATUS_SUCCESS, context.getStatus() );
    finishTest();
  }
View Full Code Here

    finishTest();
  }

  public void testRSCompareNotOK2() {
    startTest();
    IRuntimeContext context = run( "/samples/rules/ResultSetCompareTest_error2.xaction" );
    assertEquals( context.getStatus(), IRuntimeContext.RUNTIME_STATUS_FAILURE );
    finishTest();
  }
View Full Code Here

    finishTest();
  }

  public void testRSCompareNotOK3() {
    startTest();
    IRuntimeContext context = run( "/samples/rules/ResultSetCompareTest_error3.xaction" );
    assertEquals( context.getStatus(), IRuntimeContext.RUNTIME_CONTEXT_VALIDATE_FAIL );

    finishTest();

  }
View Full Code Here

  }

  public void testRSCompareNotOK4() {
    startTest();
    IRuntimeContext context = run( "/samples/rules/ResultSetCompareTest_error4.xaction" );
    assertEquals( context.getStatus(), IRuntimeContext.RUNTIME_CONTEXT_VALIDATE_FAIL );

    finishTest();

  }
View Full Code Here

  }

  public void testRSCompareNotOK5() {
    startTest();
    IRuntimeContext context = run( "/samples/rules/ResultSetCompareTest_error5.xaction" );
    assertEquals( context.getStatus(), IRuntimeContext.RUNTIME_STATUS_FAILURE );
    finishTest();
  }
View Full Code Here

TOP

Related Classes of org.pentaho.platform.api.engine.IRuntimeContext

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.