RuntimeEngine engine = manager.getRuntimeEngine(ProcessInstanceIdContext.get());
KieSession ksession = engine.getKieSession();
TaskService taskService = engine.getTaskService();
AuditLogService logService = (AuditLogService) context.getBean("logService");
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
TransactionStatus status = aptm.getTransaction(def);
ProcessInstance processInstance = ksession.startProcess("com.sample.bpmn.hello");
long processInstanceId = processInstance.getId();
aptm.rollback(status);
processInstance = ksession.getProcessInstance(processInstanceId);
if (processInstance == null) {
System.out.println("Process instance rolled back");
} else {
throw new IllegalArgumentException("Process instance not rolled back");
}
List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("john", "en-UK");
System.out.println("Found " + tasks.size() + " task(s) for user 'john'");
assertEquals(0, tasks.size());
def = new DefaultTransactionDefinition();
status = aptm.getTransaction(def);
ProcessInstanceLog log = logService.findProcessInstance(processInstanceId);
aptm.commit(status);
assertNull(log);
}