List<Task> undoBookFlight = taskService.createTaskQuery().taskDefinitionKey("undoBookFlight").list();
assertEquals(5,undoBookHotel.size());
assertEquals(1,undoBookFlight.size());
ActivityInstance rootActivityInstance = runtimeService.getActivityInstance(processInstance.getId());
List<ActivityInstance> undoBookHotelInstances = getInstancesForActivitiyId(rootActivityInstance, "undoBookHotel");
List<ActivityInstance> undoBookFlightInstances = getInstancesForActivitiyId(rootActivityInstance, "undoBookFlight");
assertEquals(5, undoBookHotelInstances.size());
assertEquals(1, undoBookFlightInstances.size());
ActivityInstance txActivityInstance = rootActivityInstance.getChildActivityInstances()[0];
assertEquals("tx", txActivityInstance.getActivityId());
assertEquals(7, txActivityInstance.getChildActivityInstances().length);
for (Task t : undoBookHotel) {
taskService.complete(t.getId());
}
taskService.complete(undoBookFlight.get(0).getId());