@SuppressWarnings( "nls" ) public void printActionExecutionStack( PrintWriter s ) { if ( actionDefinition != null ) { _printStack( actionDefinition, s, "" ); } }
.getMessage() == null ? "" : exception.getMessage() ) ); //$NON-NLS-1$ templateFile = StringUtils.replace( templateFile, "%EXCEPTION_MSG_LABEL%", Messages.getInstance() //$NON-NLS-1$ .getString( "MessageFormatter.RESPONSE_EXCEPTION_MSG_LABEL" ) ); //$NON-NLS-1$ .format( exception.getDate() ) ) ); templateFile = StringUtils.replace( templateFile, "%EXCEPTION_TIME_LABEL%", Messages.getInstance() //$NON-NLS-1$ .getString( "MessageFormatter.RESPONSE_EXCEPTION_TIME_LABEL" ) ); //$NON-NLS-1$ .getSessionId() == null ? "" : exception.getSessionId() ) ); //$NON-NLS-1$ templateFile = StringUtils.replace( templateFile, "%SESSION_ID_LABEL%", Messages.getInstance() //$NON-NLS-1$ .getString( "MessageFormatter.RESPONSE_EXCEPTION_SESSION_ID_LABEL" ) ); //$NON-NLS-1$ .getInstanceId() == null ? "" : exception.getInstanceId() ) ); //$NON-NLS-1$ templateFile = StringUtils.replace( templateFile, "%INSTANCE_ID_LABEL%", Messages.getInstance() //$NON-NLS-1$ .getString( "MessageFormatter.RESPONSE_EXCEPTION_INSTANCE_ID_LABEL" ) ); //$NON-NLS-1$ .getActionSequenceName() == null ? "" : exception.getActionSequenceName() ) ); //$NON-NLS-1$ templateFile = StringUtils.replace( templateFile, "%ACTION_SEQUENCE_LABEL%", Messages.getInstance() //$NON-NLS-1$ .getString( "MessageFormatter.RESPONSE_EXCEPTION_ACTION_SEQUENCE_LABEL" ) ); //$NON-NLS-1$ exception.printActionExecutionStack( printWriter ); templateFile = StringUtils.replace( templateFile, .getActionClass() == null ? "" : exception.getActionClass() ) ); //$NON-NLS-1$ templateFile = StringUtils.replace( templateFile, "%ACTION_CLASS_LABEL%", Messages.getInstance() //$NON-NLS-1$ .getString( "MessageFormatter.RESPONSE_EXCEPTION_ACTION_CLASS_LABEL" ) ); //$NON-NLS-1$ .getStepDescription() == null ? "" : exception.getStepDescription() ) ); //$NON-NLS-1$
+ Messages.getInstance().getString( "MessageFormatter.ACTION_SEQUENCE_EXECUTION_FAILED" ) ); //$NON-NLS-1$ printWriter.println( Messages.getInstance().getString( "MessageFormatter.LOG_EXCEPTION_TIME", dateFormat.format( exception.getDate() ) ) ); //$NON-NLS-1$ printWriter .println( Messages .getInstance() .getString( "MessageFormatter.LOG_EXCEPTION_SESSION_ID", ( exception.getSessionId() == null ? "" : exception.getSessionId() ) ) ); //$NON-NLS-1$ //$NON-NLS-2$ printWriter .println( Messages .getInstance() .getString( "MessageFormatter.LOG_EXCEPTION_INSTANCE_ID", ( exception.getInstanceId() == null ? "" : exception.getInstanceId() ) ) ); //$NON-NLS-1$ //$NON-NLS-2$ printWriter .println( Messages .getInstance() .getString( "MessageFormatter.LOG_EXCEPTION_ACTION_SEQUENCE", ( exception.getActionSequenceName() == null ? "" : exception.getActionSequenceName() ) ) ); //$NON-NLS-1$ //$NON-NLS-2$ exception.printActionExecutionStack( printWriter ); .getInstance() .getString( "MessageFormatter.LOG_EXCEPTION_ACTION_CLASS", ( exception.getActionClass() == null ? Messages.getInstance().getString( "MessageFormatter.EXCEPTION_FIELD_NOT_APPLICABLE" ) : exception.getActionClass() ) ) ); //$NON-NLS-1$ //$NON-NLS-2$ printWriter .println( Messages .getInstance() .getString( "MessageFormatter.LOG_EXCEPTION_ACTION_DESC", ( exception.getStepDescription() == null ? "" : exception.getStepDescription() ) ) ); //$NON-NLS-1$ //$NON-NLS-2$
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!" ); } }
@SuppressWarnings( "nls" ) protected void _printStack( IActionSequenceExecutableStatement statement, PrintWriter s, String prefix ) { if ( statement instanceof IActionIfStatement ) { s.println( prefix + "IF STATEMENT: " + ( (IActionIfStatement) statement ).getCondition() ); } else if ( statement instanceof IActionLoop ) { s.println( prefix + "LOOP ON: " + ( (IActionLoop) statement ).getLoopOn() ); } else if ( statement instanceof IActionDefinition ) { String actionDesc = StringUtils.defaultString( ( (IActionDefinition) statement ).getDescription(), "" ); s.println( prefix + "EXECUTING ACTION: " + actionDesc + " (" + ( (IActionDefinition) statement ).getComponentName() + ")" ); } else if ( statement instanceof IActionControlStatement ) { s.println( prefix + "UNKNOWN CONTROL STATEMENT" ); } else { s.println( prefix + "UNKNOWN EXECUTABLE STATEMENT" ); } IActionSequenceExecutableStatement parent = statement.getParent(); if ( parent != null ) { _printStack( statement.getParent(), s, "\tin " ); } } }