int resultIndex =0;
int stepNum=0;
{
//first step result
final StepExecutionResult interpreterResult = test1.get(resultIndex);
final DispatcherResult dr = NodeDispatchStepExecutor.extractDispatcherResult(interpreterResult);
assertEquals(1, dr.getResults().size());
final NodeStepResult nrs = dr.getResults().values().iterator().next();
assertTrue("unexpected class: " + nrs.getClass(),
nrs instanceof testResult);
testResult val = (testResult) nrs;
assertEquals(0, val.flag);
assertFalse(val.isSuccess());
final StepExecutionItem executionItem1 = interpreterMock.executionItemList.get(stepNum);
assertTrue("wrong class: " + executionItem1.getClass().getName(),
executionItem1 instanceof ExecCommandExecutionItem);
ExecCommandExecutionItem execItem = (ExecCommandExecutionItem) executionItem1;
assertNotNull(execItem.getCommand());
assertEquals(3, execItem.getCommand().length);
assertEquals("a", execItem.getCommand()[0]);
assertEquals("2", execItem.getCommand()[1]);
assertEquals("command", execItem.getCommand()[2]);
final ExecutionContext executionContext = interpreterMock.executionContextList.get(stepNum);
assertEquals(TEST_PROJECT, executionContext.getFrameworkProject());
assertNotNull(executionContext.getDataContext());
assertNotNull(executionContext.getDataContext().get("node"));
assertEquals(0, executionContext.getLoglevel());
assertEquals("user1", executionContext.getUser());
assertEquals(nodeset, executionContext.getNodeSelector());
}
resultIndex=1;
//
// {
// //failure handler result
// final StepExecutionResult interpreterResult = test1.get(resultIndex);
// final DispatcherResult dr = NodeDispatchStepExecutor.extractDispatcherResult(interpreterResult);
// assertEquals(1, dr.getResults().size());
// final NodeStepResult nrs = dr.getResults().values().iterator().next();
// assertTrue("unexpected class: " + nrs.getClass(),
// nrs instanceof testResult);
// testResult val = (testResult) nrs;
// assertEquals(0, val.flag);
// assertFalse(val.isSuccess());
//
// final StepExecutionItem executionItemX = handlerInterpreterMock.executionItemList.get(stepNum);
// assertTrue("wrong class: " + executionItemX.getClass().getName(),
// executionItemX instanceof ScriptFileCommandExecutionItem);
// ScriptFileCommandExecutionItem execItemX = (ScriptFileCommandExecutionItem) executionItemX;
// assertNotNull(execItemX.getScript());
// assertNotNull(execItemX.getArgs());
// assertEquals("failure handler script", execItemX.getScript());
// assertEquals(3, execItemX.getArgs().length);
// assertEquals("failure", execItemX.getArgs()[0]);
// assertEquals("script", execItemX.getArgs()[1]);
// assertEquals("args", execItemX.getArgs()[2]);
//
//
// final ExecutionContext executionContextX = handlerInterpreterMock.executionContextList.get(stepNum);
// assertEquals(TEST_PROJECT, executionContextX.getFrameworkProject());
// assertNull(executionContextX.getDataContext());
// assertEquals(0, executionContextX.getLoglevel());
// assertEquals("user1", executionContextX.getUser());
// assertEquals(nodeset, executionContextX.getNodeSelector());
// assertNull(executionContextX.getArgs());
// }
// resultIndex=2;
stepNum = 1;
{
//second step result
final StepExecutionResult interpreterResult = test1.get(resultIndex);
final DispatcherResult dr = NodeDispatchStepExecutor.extractDispatcherResult(interpreterResult);
assertEquals(1, dr.getResults().size());
final NodeStepResult nrs = dr.getResults().values().iterator().next();
assertTrue("unexpected class: " + nrs.getClass(),
nrs instanceof testResult);