use of org.pentaho.actionsequence.dom.IActionControlStatement in project pentaho-platform by pentaho.
the class ActionSequenceExceptionTest method testPrintStackRecursion.
@Test
public void testPrintStackRecursion() {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
PrintWriter writer = new PrintWriter(stream, true);
ActionSequenceException exception = new ActionSequenceException(MSG);
IActionSequenceExecutableStatement statement = mock(IActionSequenceExecutableStatement.class);
IActionControlStatement parent = mock(IActionControlStatement.class);
Mockito.when(statement.getParent()).thenReturn(parent);
exception._printStack(statement, writer, "");
assertNotEquals("", stream.toString());
}
use of org.pentaho.actionsequence.dom.IActionControlStatement in project pentaho-platform by pentaho.
the class ActionSequenceException method _printStack.
/*
* We are not i18n-ing these stack trace messages. This can be thought of as Throwable.printStackTrace()
*/
@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 ");
}
}
Aggregations