/**
* Test.
*/
public void suspendMapping2 () throws Exception {
ProcessDefinitionDirectory procDefDir = null;
ProcessDirectory procDir = null;
try {
procDefDir = workflowService.processDefinitionDirectory();
procDir = workflowService.processDirectory();
ProcessMgr pmgr = procDefDir
.processMgr ("ExceptionTests", "suspendMapping");
WfProcess process
= pmgr.createProcess(new DefaultRequester (workflowService));
process.start();
Activity toolAct = null;
for (Iterator i = process.steps().iterator(); i.hasNext();) {
Activity act = (Activity)i.next();
if (act.name().equals("Get stock quote")) {
toolAct = act;
break;
}
}
assertTrue(toolAct != null);
stateReached(toolAct, "open.not_running.suspended.abandoning");
toolAct.changeState("open.not_running.suspended.clearing_exception");
toolAct.resume();
assertTrue (stateReached (process, "closed.completed"));
boolean found = false;
for (Iterator i = process.steps().iterator(); i.hasNext();) {
WfActivity act = (WfActivity)i.next ();
if (act.name().equals("Generic")) {
found = true;
assertTrue (act.state().startsWith("open.not_running.not_started"));
}
}
assertTrue (found);
found = false;
for (Iterator i = process.steps().iterator(); i.hasNext();) {
WfActivity act = (WfActivity)i.next ();
if (act.name().equals("Normal")) {
found = true;
assertTrue (act.state().startsWith("closed.completed"));
}
}
assertTrue (found);
procDir.removeProcess(process);
} finally {
workflowService.release (procDefDir);
workflowService.release (procDir);
}
}