*/
public void findByKey () throws Exception {
ProcessDefinitionDirectory procDefDir = null;
ProcessDirectory procDir = null;
try {
SimpleApplicationDirectory ad
= (SimpleApplicationDirectory)workflowService
.executeBatch(new SimpleApplicationDirectoryLookup());
assertTrue (ad.infosByKey
("unittests.Test1", "ToolTest").size() == 0);
procDefDir = workflowService.processDefinitionDirectory();
procDir = workflowService.processDirectory();
ProcessMgr pmgr = procDefDir
.processMgr ("simpleApplDirTests", "test1");
WfProcess process
= pmgr.createProcess(new DefaultRequester (workflowService));
process.start();
WfActivity act = null;
for (Iterator i = process.steps().iterator(); i.hasNext();) {
act = (WfActivity)i.next ();
if (act.name().equals("invokeTool")) {
break;
}
}
assertTrue (act != null);
assertTrue (stateReached(act, "open.running"));
Thread.sleep(1000);
assertTrue (ad.infosByApplication("unittests.Test1").size() == 1);
Collection infos
= ad.infosByKey("unittests.Test1", "ToolTest");
assertTrue (infos.size() == 1);
SimpleApplicationInfo info
= (SimpleApplicationInfo)infos.iterator().next();
assertTrue (info.state() instanceof Object[]);
WfActivity actFound = workflowService.processDirectory()
.lookupActivity(info.activityUniqueKey());
actFound.complete ();
ad.removeInstance(info.id());
assertTrue (stateReached (process, "closed.completed"));
procDir.removeProcess(process);
} finally {
workflowService.release (procDefDir);