public void testOnParentAbortAllSubTasksEndStrategy() throws Exception {
TestWorkItemManager manager = new TestWorkItemManager();
//Create the parent task
WorkItemImpl workItem = new WorkItemImpl();
workItem.setName("Human Task");
workItem.setParameter("TaskName", "TaskNameParent");
workItem.setParameter("Comment", "CommentParent");
workItem.setParameter("Priority", "10");
workItem.setParameter("ActorId", "Darth Vader");
//Set the subtask policy
workItem.setParameter("SubTaskStrategies", "OnParentAbortAllSubTasksEnd");
handler.executeWorkItem(workItem, manager);
Thread.sleep(500);
//Test if the task is succesfully created
BlockingTaskSummaryResponseHandler responseHandler = new BlockingTaskSummaryResponseHandler();
client.getTasksAssignedAsPotentialOwner("Darth Vader", "en-UK", responseHandler);
List<TaskSummary> tasks = responseHandler.getResults();
assertEquals(1, tasks.size());
TaskSummary task = tasks.get(0);
assertEquals("TaskNameParent", task.getName());
assertEquals(10, task.getPriority());
assertEquals("CommentParent", task.getDescription());
assertEquals(Status.Reserved, task.getStatus());
assertEquals("Darth Vader", task.getActualOwner().getId());
//Create the child task
workItem = new WorkItemImpl();
workItem.setName("Human Task");
workItem.setParameter("TaskName", "TaskNameChild1");
workItem.setParameter("Comment", "CommentChild1");
workItem.setParameter("Priority", "10");
workItem.setParameter("ActorId", "Darth Vader");
workItem.setParameter("ParentId", task.getId());
handler.executeWorkItem(workItem, manager);
Thread.sleep(500);
//Create the child task2
workItem = new WorkItemImpl();
workItem.setName("Human Task2");
workItem.setParameter("TaskName", "TaskNameChild2");
workItem.setParameter("Comment", "CommentChild2");
workItem.setParameter("Priority", "10");
workItem.setParameter("ActorId", "Darth Vader");
workItem.setParameter("ParentId", task.getId());
handler.executeWorkItem(workItem, manager);
Thread.sleep(500);
//Start the parent task