assertEquals(new Integer(IWorkItem.RUNNING), ((IWorkItem) workItemList.get(0)).getState());
List<IToken> tokensList = persistenceService.findTokensForProcessInstance(currentProcessInstance.getId(), null);
assertNotNull(tokensList);
assertEquals(1, tokensList.size());
IToken token = (IToken)tokensList.get(0);
assertEquals(1,token.getStepNumber().intValue());
workItem1Id = ((IWorkItem) workItemList.get(0)).getId();
//-------------------------------------------------------
transactionTemplate.execute(new TransactionCallback() {
public Object doInTransaction(TransactionStatus arg0) {
try {
IWorkflowSession workflowSession = runtimeContext.getWorkflowSession();
IWorkItem workItem = workflowSession.findWorkItemById(workItem1Id);
workItem.complete();
} catch (EngineException ex) {
Logger.getLogger(FireWorkflowEngineTest.class.getName()).log(Level.SEVERE, null, ex);
} catch (KernelException ex) {
Logger.getLogger(FireWorkflowEngineTest.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
});
taskInstanceList = persistenceService.findTaskInstancesForProcessInstance(currentProcessInstance.getId(), "skip2.Activity2");
if (taskInstanceList==null){taskInstanceList = new ArrayList();}
assertEquals(0,taskInstanceList.size());
taskInstanceList = persistenceService.findTaskInstancesForProcessInstance(currentProcessInstance.getId(), "skip2.Activity4");
if (taskInstanceList==null){taskInstanceList = new ArrayList();}
assertEquals(0,taskInstanceList.size());
taskInstanceList = persistenceService.findTaskInstancesForProcessInstance(currentProcessInstance.getId(), "skip2.Activity3");
assertNotNull(taskInstanceList);
assertEquals(1, taskInstanceList.size());
taskInst = ((ITaskInstance) taskInstanceList.get(0));
assertEquals(new Integer(ITaskInstance.RUNNING),taskInst .getState());
assertEquals(3,taskInst.getStepNumber().intValue());
workItemList = persistenceService.findTodoWorkItems(CurrentUserAssignmentHandlerMock.ACTOR_ID, "skip2", "skip2.Activity3.Task3");
assertNotNull(workItemList);
assertEquals(1, workItemList.size());
assertEquals(new Integer(IWorkItem.INITIALIZED), ((IWorkItem) workItemList.get(0)).getState());
tokensList = persistenceService.findTokensForProcessInstance(currentProcessInstance.getId(), null);
assertNotNull(tokensList);
assertEquals(1, tokensList.size());
token = (IToken)tokensList.get(0);
assertEquals(3,token.getStepNumber().intValue());
}