status = IRuntimeContext.RUNTIME_STATUS_FAILURE; audit( MessageTypes.ACTION_SEQUENCE_FAILED, MessageTypes.EXECUTION, "", (int) ( new Date().getTime() - start ) ); //$NON-NLS-1$ throw new ActionSequenceException( ex );
@SuppressWarnings( "unchecked" ) private void execute( String actionSequenceFile, boolean exceptionOnError, IAction... actions ) throws ActionSequenceException { TestPluginManager pm = (TestPluginManager) PentahoSystem.get( IPluginManager.class ); for ( IAction action : actions ) { pm.addAction( action ); } // content outputs will write to this stream out = new ByteArrayOutputStream(); // create SimpleOutputHandler (to handle outputs of type "response.content") outputHandler = new SimpleOutputHandler( out, false ); outputHandler.setOutputPreference( IOutputHandler.OUTPUT_TYPE_DEFAULT ); IPentahoSession session = new StandaloneSession( "system" ); ISolutionEngine solutionEngine = ServiceTestHelper.getSolutionEngine(); outputHandler.setSession( session ); String xactionStr = ServiceTestHelper.getXAction( "src/test/resources/solution/test/ActionDelegateTest", actionSequenceFile ); // execute the action sequence, providing the outputHandler created above IRuntimeContext rc = solutionEngine.execute( xactionStr, actionSequenceFile, "action sequence to test the TestAction", false, true, null, false, new HashMap(), outputHandler, null, new SimpleUrlFactory( "" ), new ArrayList() ); int status = rc.getStatus(); if ( status == IRuntimeContext.PARAMETERS_FAIL || status == IRuntimeContext.RUNTIME_CONTEXT_RESOLVE_FAIL || status == IRuntimeContext.RUNTIME_STATUS_FAILURE || status == IRuntimeContext.RUNTIME_STATUS_INITIALIZE_FAIL || status == IRuntimeContext.RUNTIME_STATUS_SETUP_FAIL ) { throw new ActionSequenceException( "Action sequence failed!" ); } }