beginSessionTransaction();
}
List taskInstances = taskMgmtSession.findTaskInstances("victim");
assertEquals(1, taskInstances.size());
TaskInstance taskInstance = (TaskInstance) taskInstances.get(0);
taskInstance.setVariable("a", "value a updated");
taskInstance.setVariable("b", "value b updated");
taskInstance.end();
jbpmContext.save(taskInstance);
long taskInstanceId = taskInstance.getId();
long tokenId = taskInstance.getToken().getId();
newTransaction();
taskInstance = jbpmContext.loadTaskInstance(taskInstanceId);
assertEquals("value a updated", taskInstance.getVariable("a"));
assertEquals("value b updated", taskInstance.getVariable("b"));
Token token = jbpmContext.loadToken(tokenId);
ContextInstance subContextInstance = token.getProcessInstance().getContextInstance();
assertEquals("value a", subContextInstance.getVariable("a"));
assertEquals("value b updated", subContextInstance.getVariable("b"));