*/
@Test
public void testSaveOrUpdateTaskInstance() {
System.out.println("--------saveOrUpdateTaskInstance--------");
ITaskInstance taskInstance1 = (ITaskInstance) transactionTemplate.execute(new TransactionCallback() {
public Object doInTransaction(TransactionStatus arg0) {
TaskInstance taskInstance = new TaskInstance();
taskInstance.setActivityId(activityId);
taskInstance.setAssignmentStrategy(assignmentStrategy);
taskInstance.setCreatedTime(createdTime);
taskInstance.setDisplayName(displayName);
taskInstance.setEndTime(endTime);
taskInstance.setExpiredTime(expiredTime);
taskInstance.setName(name);
taskInstance.setProcessId(processId);
taskInstance.setProcessInstanceId(aliveProcessInstanceId);
taskInstance.setStartedTime(startedTime);
taskInstance.setState(state);
taskInstance.setTargetActivityId(activityId);
taskInstance.setTaskId(taskId);
taskInstance.setTaskType(taskType);
taskInstance.setVersion(version);
// taskInstance.setTokenId(tokenId);
persistenceService.saveOrUpdateTaskInstance(taskInstance);
return taskInstance;
}
});
System.out.println("The new task instance id = " + taskInstance1.getId());
aliveTaskInstanceId = taskInstance1.getId();
ITaskInstance taskInstance2 = persistenceService.findTaskInstanceById(aliveTaskInstanceId);
taskInstance = taskInstance2;
assertFalse(taskInstance1.hashCode() == taskInstance2.hashCode());
assertEquals(taskInstance1.getId(), taskInstance2.getId());
assertEquals(taskInstance2.getName(), name);
assertEquals(taskInstance2.getDisplayName(), displayName);
assertEquals(taskInstance2.getProcessId(), processId);
assertEquals(dFormat.format(taskInstance2.getCreatedTime()), dFormat.format(createdTime));
assertEquals(dFormat.format(taskInstance2.getStartedTime()), dFormat.format(startedTime));
assertEquals(dFormat.format(taskInstance2.getExpiredTime()), dFormat.format(expiredTime));
assertEquals(dFormat.format(taskInstance2.getEndTime()), dFormat.format(endTime));
assertEquals(taskInstance2.getState(), state);
assertEquals(taskInstance2.getVersion(), version);
assertEquals(taskInstance2.getActivityId(), activityId);
assertEquals(taskInstance2.getAssignmentStrategy(), assignmentStrategy);
assertEquals(taskInstance2.getProcessInstanceId(), aliveProcessInstanceId);
assertEquals(taskInstance2.getTargetActivityId(), activityId);
assertEquals(taskInstance2.getTaskId(), taskId);
assertEquals(taskInstance2.getTaskType(), taskType);
}