}
@Test
public void testCompleteWorkitem1() {
currentProcessInstance = (IProcessInstance) transactionTemplate.execute(new TransactionCallback() {
public Object doInTransaction(TransactionStatus arg0) {
try {
IWorkflowSession workflowSession = runtimeContext.getWorkflowSession();
//��"/workflowdefinition/example_workflow.xml"�еġ��ͻ���̡�
IProcessInstance processInstance = workflowSession.createProcessInstance("MultiTasksPerActivity",CurrentUserAssignmentHandlerMock.ACTOR_ID);
processInstance.run();
return processInstance;
} 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;
}
});
assertNotNull(currentProcessInstance);
IPersistenceService persistenceService = runtimeContext.getPersistenceService();
List<ITaskInstance> taskInstanceList = persistenceService.findTaskInstancesForProcessInstance(currentProcessInstance.getId(), "MultiTasksPerActivity.Activity1");
assertNotNull(taskInstanceList);
assertEquals(1, taskInstanceList.size());
assertEquals(new Integer(ITaskInstance.RUNNING), ((ITaskInstance) taskInstanceList.get(0)).getState());
assertEquals(1,((ITaskInstance) taskInstanceList.get(0)).getStepNumber().intValue());
List<IToken> tokenList = persistenceService.findTokensForProcessInstance(currentProcessInstance.getId(), null);
assertNotNull(tokenList);
assertEquals(1,tokenList.size());
IToken token = (IToken)tokenList.get(0);
assertEquals(1,token.getStepNumber().intValue());
List<IWorkItem> workItemList = persistenceService.findTodoWorkItems(CurrentUserAssignmentHandlerMock.ACTOR_ID, "MultiTasksPerActivity", "MultiTasksPerActivity.Activity1.Task1");
assertNotNull(workItemList);
assertEquals(1, workItemList.size());
assertEquals(new Integer(ITaskInstance.RUNNING), ((IWorkItem) workItemList.get(0)).getState());
workItemId_1 = ((IWorkItem) workItemList.get(0)).getId();
//-------------------------------------------
transactionTemplate.execute(new TransactionCallback() {
public Object doInTransaction(TransactionStatus arg0) {
try {
IWorkflowSession workflowSession = runtimeContext.getWorkflowSession();