Java Code Examples for org.activiti.engine.task.Task#setDescription()

The following examples show how to use org.activiti.engine.task.Task#setDescription() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TasksResource.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
@RequestMapping(value = "/rest/tasks", method = RequestMethod.POST)
public TaskRepresentation createNewTask(@RequestBody CreateTaskRepresentation taskRepresentation, HttpServletRequest request) {
  if (StringUtils.isEmpty(taskRepresentation.getName())) {
    throw new BadRequestException("Task name is required");
  }

  Task task = taskService.newTask();
  task.setName(taskRepresentation.getName());
  task.setDescription(taskRepresentation.getDescription());
  if (StringUtils.isNotEmpty(taskRepresentation.getCategory())) {
    task.setCategory(taskRepresentation.getCategory());
  }
  task.setAssignee(SecurityUtils.getCurrentUserId());
  taskService.saveTask(task);
  return new TaskRepresentation(taskService.createTaskQuery().taskId(task.getId()).singleResult());
}
 
Example 2
Source File: StandaloneTaskTest.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
public void testOptimisticLockingThrownOnMultipleUpdates() {
  Task task = taskService.newTask();
  taskService.saveTask(task);
  String taskId = task.getId();

  // first modification
  Task task1 = taskService.createTaskQuery().taskId(taskId).singleResult();
  Task task2 = taskService.createTaskQuery().taskId(taskId).singleResult();

  task1.setDescription("first modification");
  taskService.saveTask(task1);

  // second modification on the initial instance
  task2.setDescription("second modification");
  try {
    taskService.saveTask(task2);
    fail("should get an exception here as the task was modified by someone else.");
  } catch (ActivitiOptimisticLockingException expected) {
    // exception was thrown as expected
  }

  taskService.deleteTask(taskId, true);
}
 
Example 3
Source File: TaskAndVariablesQueryTest.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
/**
 * Generates 100 test tasks.
 */
private List<String> generateMultipleTestTasks() throws Exception {
  List<String> ids = new ArrayList<String>();
  
  SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss.SSS");
  processEngineConfiguration.getClock().setCurrentTime(sdf.parse("01/01/2001 01:01:01.000"));
  for (int i = 0; i < 100; i++) {
    Task task = taskService.newTask();
    task.setName("testTask");
    task.setDescription("testTask description");
    task.setPriority(3);
    taskService.saveTask(task);
    ids.add(task.getId());
    taskService.setVariableLocal(task.getId(), "test", "test");
    taskService.setVariableLocal(task.getId(), "testBinary", "This is a binary variable".getBytes());
    taskService.addCandidateUser(task.getId(), "kermit");
  }
  return ids;
}
 
Example 4
Source File: StandaloneTaskTest.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
public void testOptimisticLockingThrownOnMultipleUpdates() {
  Task task = taskService.newTask();
  taskService.saveTask(task);
  String taskId = task.getId();
  
  // first modification
  Task task1 = taskService.createTaskQuery().taskId(taskId).singleResult();
  Task task2 = taskService.createTaskQuery().taskId(taskId).singleResult();
  
  task1.setDescription("first modification");
  taskService.saveTask(task1);

  // second modification on the initial instance
  task2.setDescription("second modification");
  try {
    taskService.saveTask(task2);
    fail("should get an exception here as the task was modified by someone else.");
  } catch (ActivitiOptimisticLockingException expected) {
    //  exception was thrown as expected
  }
  
  taskService.deleteTask(taskId, true);
}
 
Example 5
Source File: TaskServiceTest.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
@Deployment(resources = { "org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testUserTaskOptimisticLocking() {
  runtimeService.startProcessInstanceByKey("oneTaskProcess");

  Task task1 = taskService.createTaskQuery().singleResult();
  Task task2 = taskService.createTaskQuery().singleResult();

  task1.setDescription("test description one");
  taskService.saveTask(task1);

  try {
    task2.setDescription("test description two");
    taskService.saveTask(task2);

    fail("Expecting exception");
  } catch (ActivitiOptimisticLockingException e) {
    // Expected exception
  }
}
 
Example 6
Source File: TaskAndVariablesQueryTest.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
/**
 * Generates 100 test tasks.
 */
private List<String> generateMultipleTestTasks() throws Exception {
  List<String> ids = new ArrayList<String>();
  
  SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss.SSS");
  processEngineConfiguration.getClock().setCurrentTime(sdf.parse("01/01/2001 01:01:01.000"));
  for (int i = 0; i < 100; i++) {
    Task task = taskService.newTask();
    task.setName("testTask");
    task.setDescription("testTask description");
    task.setPriority(3);
    taskService.saveTask(task);
    ids.add(task.getId());
    taskService.setVariableLocal(task.getId(), "test", "test");
    taskService.setVariableLocal(task.getId(), "testBinary", "This is a binary variable".getBytes());
    taskService.addCandidateUser(task.getId(), "kermit");
  }
  return ids;
}
 
Example 7
Source File: TaskQueryTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public void testQueryByCandidateOrAssigned() {
  TaskQuery query = taskService.createTaskQuery().taskCandidateOrAssigned("kermit");
  assertEquals(11, query.count());
  List<Task> tasks = query.list();
  assertEquals(11, tasks.size());

  // if dbIdentityUsed set false in process engine configuration of using custom session factory of GroupIdentityManager
  ArrayList<String> candidateGroups = new ArrayList<String>();
  candidateGroups.add("management");
  candidateGroups.add("accountancy");
  candidateGroups.add("noexist");
  query = taskService.createTaskQuery().taskCandidateGroupIn(candidateGroups).taskCandidateOrAssigned("kermit");
  assertEquals(11, query.count());
  tasks = query.list();
  assertEquals(11, tasks.size());

  query = taskService.createTaskQuery().taskCandidateOrAssigned("fozzie");
  assertEquals(3, query.count());
  assertEquals(3, query.list().size());

  // create a new task that no identity link and assignee to kermit
  Task task = taskService.newTask();
  task.setName("assigneeToKermit");
  task.setDescription("testTask description");
  task.setPriority(3);
  task.setAssignee("kermit");
  taskService.saveTask(task);

  query = taskService.createTaskQuery().taskCandidateOrAssigned("kermit");
  assertEquals(12, query.count());
  tasks = query.list();
  assertEquals(12, tasks.size());

  Task assigneeToKermit = taskService.createTaskQuery().taskName("assigneeToKermit").singleResult();
  taskService.deleteTask(assigneeToKermit.getId());
  if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) {
    historyService.deleteHistoricTaskInstance(assigneeToKermit.getId());
  }
}
 
Example 8
Source File: TaskRepresentation.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public void fillTask(Task task) {
  task.setName(name);
  task.setDescription(description);
  if (assignee != null && assignee.getId() != null) {
    task.setAssignee(String.valueOf(assignee.getId()));
  }
  task.setDueDate(dueDate);
  if (priority != null) {
    task.setPriority(priority);
  }
  task.setCategory(category);
}
 
Example 9
Source File: TaskController.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
/**
 * 添加子任务
 */
@RequestMapping("task/subtask/add/{taskId}")
public String addSubTask(@PathVariable("taskId") String parentTaskId, @RequestParam("taskName") String taskName,
                         @RequestParam(value = "description", required = false) String description, HttpSession session) {
    Task newTask = taskService.newTask();
    newTask.setParentTaskId(parentTaskId);
    String userId = UserUtil.getUserFromSession(session).getId();
    newTask.setOwner(userId);
    newTask.setAssignee(userId);
    newTask.setName(taskName);
    newTask.setDescription(description);

    taskService.saveTask(newTask);
    return "redirect:/chapter6/task/getform/" + parentTaskId;
}
 
Example 10
Source File: TaskController.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
/**
 * 添加子任务
 */
@RequestMapping("task/subtask/add/{taskId}")
public String addSubTask(@PathVariable("taskId") String parentTaskId, @RequestParam("taskName") String taskName,
                         @RequestParam(value = "description", required = false) String description, HttpSession session) {
    Task newTask = taskService.newTask();
    newTask.setParentTaskId(parentTaskId);
    String userId = UserUtil.getUserFromSession(session).getId();
    newTask.setOwner(userId);
    newTask.setAssignee(userId);
    newTask.setName(taskName);
    newTask.setDescription(description);

    taskService.saveTask(newTask);
    return "redirect:/chapter6/task/getform/" + parentTaskId;
}
 
Example 11
Source File: TaskBaseResource.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
/**
 * Populate the task based on the values that are present in the given {@link TaskRequest}.
 */
protected void populateTaskFromRequest(Task task, TaskRequest taskRequest) {
  if (taskRequest.isNameSet()) {
    task.setName(taskRequest.getName());
  }
  if (taskRequest.isAssigneeSet()) {
    task.setAssignee(taskRequest.getAssignee());
  }
  if (taskRequest.isDescriptionSet()) {
    task.setDescription(taskRequest.getDescription());
  }
  if (taskRequest.isDuedateSet()) {
    task.setDueDate(taskRequest.getDueDate());
  }
  if (taskRequest.isOwnerSet()) {
    task.setOwner(taskRequest.getOwner());
  }
  if (taskRequest.isParentTaskIdSet()) {
    task.setParentTaskId(taskRequest.getParentTaskId());
  }
  if (taskRequest.isPrioritySet()) {
    task.setPriority(taskRequest.getPriority());
  }
  if (taskRequest.isCategorySet()) {
    task.setCategory(taskRequest.getCategory());
  }
  if (taskRequest.isTenantIdSet()) {
    task.setTenantId(taskRequest.getTenantId());
  }
  if (taskRequest.isFormKeySet()) {
    task.setFormKey(taskRequest.getFormKey());
  }

  if (taskRequest.isDelegationStateSet()) {
    DelegationState delegationState = getDelegationState(taskRequest.getDelegationState());
    task.setDelegationState(delegationState);
  }
}
 
Example 12
Source File: TaskQueryTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public void testQueryByCandidateOrAssignedOr() {
  TaskQuery query = taskService.createTaskQuery().or().taskId("invalid").taskCandidateOrAssigned("kermit");
  assertEquals(11, query.count());
  List<Task> tasks = query.list();
  assertEquals(11, tasks.size());

  // if dbIdentityUsed set false in process engine configuration of using
  // custom session factory of GroupIdentityManager
  ArrayList<String> candidateGroups = new ArrayList<String>();
  candidateGroups.add("management");
  candidateGroups.add("accountancy");
  candidateGroups.add("noexist");
  query = taskService.createTaskQuery().or().taskId("invalid").taskCandidateGroupIn(candidateGroups).taskCandidateOrAssigned("kermit");
  assertEquals(11, query.count());
  tasks = query.list();
  assertEquals(11, tasks.size());

  query = taskService.createTaskQuery().or().taskId("invalid").taskCandidateOrAssigned("fozzie");
  assertEquals(3, query.count());
  assertEquals(3, query.list().size());

  // create a new task that no identity link and assignee to kermit
  Task task = taskService.newTask();
  task.setName("assigneeToKermit");
  task.setDescription("testTask description");
  task.setPriority(3);
  task.setAssignee("kermit");
  taskService.saveTask(task);

  query = taskService.createTaskQuery().or().taskId("invalid").taskCandidateOrAssigned("kermit");
  assertEquals(12, query.count());
  tasks = query.list();
  assertEquals(12, tasks.size());

  Task assigneeToKermit = taskService.createTaskQuery().or().taskId("invalid").taskName("assigneeToKermit").singleResult();
  taskService.deleteTask(assigneeToKermit.getId());
  if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) {
    historyService.deleteHistoricTaskInstance(assigneeToKermit.getId());
  }
}
 
Example 13
Source File: TaskController.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
/**
 * 添加子任务
 */
@RequestMapping("task/subtask/add/{taskId}")
public String addSubTask(@PathVariable("taskId") String parentTaskId, @RequestParam("taskName") String taskName,
                         @RequestParam(value = "description", required = false) String description, HttpSession session) {
    Task newTask = taskService.newTask();
    newTask.setParentTaskId(parentTaskId);
    String userId = UserUtil.getUserFromSession(session).getId();
    newTask.setOwner(userId);
    newTask.setAssignee(userId);
    newTask.setName(taskName);
    newTask.setDescription(description);

    taskService.saveTask(newTask);
    return "redirect:/chapter6/task/getform/" + parentTaskId;
}
 
Example 14
Source File: ActivitiDescriptionPropertyHandler.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
* {@inheritDoc}
*/   
@Override
protected Object handleTaskProperty(Task task, TypeDefinition type, QName key, Serializable value)
{
    checkType(key, value, String.class);
    task.setDescription((String) value);
    return DO_NOT_ADD;
}
 
Example 15
Source File: ActivitiTestBase.java    From crnk-framework with Apache License 2.0 5 votes vote down vote up
protected Task addTask(String name, int priority) {
    TaskService taskService = processEngine.getTaskService();
    Task task = taskService.newTask();
    task.setName(name);
    task.setPriority(priority);
    task.setAssignee("john");
    task.setCategory("testCategory");
    task.setDueDate(new Date());
    task.setOwner("jane");
    task.setDescription("testDescription");
    task.setTenantId("testTenant");
    taskService.saveTask(task);
    return task;

}
 
Example 16
Source File: HistoricTaskInstanceUpdateTest.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
@Deployment
public void testHistoricTaskInstanceUpdate() {
  runtimeService.startProcessInstanceByKey("HistoricTaskInstanceTest").getId();

  Task task = taskService.createTaskQuery().singleResult();

  // Update and save the task's fields before it is finished
  task.setPriority(12345);
  task.setDescription("Updated description");
  task.setName("Updated name");
  task.setAssignee("gonzo");
  taskService.saveTask(task);

  taskService.complete(task.getId());
  assertEquals(1, historyService.createHistoricTaskInstanceQuery().count());

  HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().singleResult();
  assertEquals("Updated name", historicTaskInstance.getName());
  assertEquals("Updated description", historicTaskInstance.getDescription());
  assertEquals("gonzo", historicTaskInstance.getAssignee());
  assertEquals("task", historicTaskInstance.getTaskDefinitionKey());

  // Validate fix of ACT-1923: updating assignee to null should be
  // reflected in history
  ProcessInstance secondInstance = runtimeService.startProcessInstanceByKey("HistoricTaskInstanceTest");

  task = taskService.createTaskQuery().singleResult();

  task.setDescription(null);
  task.setName(null);
  task.setAssignee(null);
  taskService.saveTask(task);

  taskService.complete(task.getId());
  assertEquals(1, historyService.createHistoricTaskInstanceQuery().processInstanceId(secondInstance.getId()).count());

  historicTaskInstance = historyService.createHistoricTaskInstanceQuery().processInstanceId(secondInstance.getId()).singleResult();
  assertNull(historicTaskInstance.getName());
  assertNull(historicTaskInstance.getDescription());
  assertNull(historicTaskInstance.getAssignee());
}
 
Example 17
Source File: TaskServiceTest.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
public void testSaveTaskUpdate() throws Exception {

    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
    Task task = taskService.newTask();
    task.setDescription("description");
    task.setName("taskname");
    task.setPriority(0);
    task.setAssignee("taskassignee");
    task.setOwner("taskowner");
    Date dueDate = sdf.parse("01/02/2003 04:05:06");
    task.setDueDate(dueDate);
    taskService.saveTask(task);

    // Fetch the task again and update
    task = taskService.createTaskQuery().taskId(task.getId()).singleResult();
    assertEquals("description", task.getDescription());
    assertEquals("taskname", task.getName());
    assertEquals("taskassignee", task.getAssignee());
    assertEquals("taskowner", task.getOwner());
    assertEquals(dueDate, task.getDueDate());
    assertEquals(0, task.getPriority());

    task.setName("updatedtaskname");
    task.setDescription("updateddescription");
    task.setPriority(1);
    task.setAssignee("updatedassignee");
    task.setOwner("updatedowner");
    dueDate = sdf.parse("01/02/2003 04:05:06");
    task.setDueDate(dueDate);
    taskService.saveTask(task);

    task = taskService.createTaskQuery().taskId(task.getId()).singleResult();
    assertEquals("updatedtaskname", task.getName());
    assertEquals("updateddescription", task.getDescription());
    assertEquals("updatedassignee", task.getAssignee());
    assertEquals("updatedowner", task.getOwner());
    assertEquals(dueDate, task.getDueDate());
    assertEquals(1, task.getPriority());

    if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) {
      HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().taskId(task.getId()).singleResult();
      assertEquals("updatedtaskname", historicTaskInstance.getName());
      assertEquals("updateddescription", historicTaskInstance.getDescription());
      assertEquals("updatedassignee", historicTaskInstance.getAssignee());
      assertEquals("updatedowner", historicTaskInstance.getOwner());
      assertEquals(dueDate, historicTaskInstance.getDueDate());
      assertEquals(1, historicTaskInstance.getPriority());
    }

    // Finally, delete task
    taskService.deleteTask(task.getId(), true);
  }
 
Example 18
Source File: TaskQueryTest.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
public void testQueryByCandidateOrAssignedOr() {
  TaskQuery query = taskService.createTaskQuery()
      .or()
      .taskId("invalid")
      .taskCandidateOrAssigned("kermit");
  assertEquals(11, query.count());
  List<Task> tasks = query.list();
  assertEquals(11, tasks.size());
  
  // if dbIdentityUsed set false in process engine configuration of using custom session factory of GroupIdentityManager
  ArrayList<String> candidateGroups = new ArrayList<String>();
  candidateGroups.add("management");
  candidateGroups.add("accountancy");
  candidateGroups.add("noexist");
  query = taskService.createTaskQuery()
      .or()
      .taskId("invalid")
      .taskCandidateGroupIn(candidateGroups)
      .taskCandidateOrAssigned("kermit");
  assertEquals(11, query.count());
  tasks = query.list();
  assertEquals(11, tasks.size());
  
  query = taskService.createTaskQuery()
      .or()
      .taskId("invalid")
      .taskCandidateOrAssigned("fozzie");
  assertEquals(3, query.count());
  assertEquals(3, query.list().size());
  
  // create a new task that no identity link and assignee to kermit
  Task task = taskService.newTask();
  task.setName("assigneeToKermit");
  task.setDescription("testTask description");
  task.setPriority(3);
  task.setAssignee("kermit");
  taskService.saveTask(task);
  
  query = taskService.createTaskQuery()
      .or()
      .taskId("invalid")
      .taskCandidateOrAssigned("kermit");
  assertEquals(12, query.count());
  tasks = query.list();
  assertEquals(12, tasks.size());
  
  Task assigneeToKermit = taskService.createTaskQuery()
      .or()
      .taskId("invalid")
      .taskName("assigneeToKermit").singleResult();
  taskService.deleteTask(assigneeToKermit.getId());
  if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) {
    historyService.deleteHistoricTaskInstance(assigneeToKermit.getId());
  }
}
 
Example 19
Source File: TaskListenerTest.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
/**
 * Validate fix for ACT-1627: Not throwing assignment event on every update
 */
@Deployment(resources = {"org/activiti5/examples/bpmn/tasklistener/TaskListenerTest.bpmn20.xml"})
public void testTaskAssignmentListenerNotCalledWhenAssigneeNotUpdated() {
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("taskListenerProcess");
  Task task = taskService.createTaskQuery().singleResult();
  assertEquals("TaskCreateListener is listening!", task.getDescription());
  
  // Set assignee and check if event is received
  taskService.setAssignee(task.getId(), "kermit");
  task = taskService.createTaskQuery().singleResult();
  
  assertEquals("TaskAssignmentListener is listening: kermit", task.getDescription());
  
  // Reset description and assign to same person. This should NOT trigger an assignment
  task.setDescription("Clear");
  taskService.saveTask(task);
  taskService.setAssignee(task.getId(), "kermit");
  task = taskService.createTaskQuery().singleResult();
  assertEquals("Clear", task.getDescription());
  
  // Set assignee through task-update
  task.setAssignee("kermit");
  taskService.saveTask(task);
  
  task = taskService.createTaskQuery().singleResult();
  assertEquals("Clear", task.getDescription());
  
  // Update another property should not trigger assignment
  task.setName("test");
  taskService.saveTask(task);
  
  task = taskService.createTaskQuery().singleResult();
  assertEquals("Clear", task.getDescription());
  
  // Update to different
  task.setAssignee("john");
  taskService.saveTask(task);
  
  task = taskService.createTaskQuery().singleResult();
  assertEquals("TaskAssignmentListener is listening: john", task.getDescription());
  

  //Manually cleanup the process instance.
  runtimeService.deleteProcessInstance(processInstance.getProcessInstanceId(), "");
}
 
Example 20
Source File: TaskServiceTest.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
public void testSaveTaskUpdate() throws Exception{
  
  SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
  Task task = taskService.newTask();
  task.setDescription("description");
  task.setName("taskname");
  task.setPriority(0);
  task.setAssignee("taskassignee");
  task.setOwner("taskowner");
  Date dueDate = sdf.parse("01/02/2003 04:05:06");
  task.setDueDate(dueDate);
  taskService.saveTask(task);

  // Fetch the task again and update
  task = taskService.createTaskQuery().taskId(task.getId()).singleResult();
  assertEquals("description", task.getDescription());
  assertEquals("taskname", task.getName());
  assertEquals("taskassignee", task.getAssignee());
  assertEquals("taskowner", task.getOwner());
  assertEquals(dueDate, task.getDueDate());
  assertEquals(0, task.getPriority());

  task.setName("updatedtaskname");
  task.setDescription("updateddescription");
  task.setPriority(1);
  task.setAssignee("updatedassignee");
  task.setOwner("updatedowner");
  dueDate = sdf.parse("01/02/2003 04:05:06");
  task.setDueDate(dueDate);
  taskService.saveTask(task);

  task = taskService.createTaskQuery().taskId(task.getId()).singleResult();
  assertEquals("updatedtaskname", task.getName());
  assertEquals("updateddescription", task.getDescription());
  assertEquals("updatedassignee", task.getAssignee());
  assertEquals("updatedowner", task.getOwner());
  assertEquals(dueDate, task.getDueDate());
  assertEquals(1, task.getPriority());
  
  if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) {
    HistoricTaskInstance historicTaskInstance = historyService
      .createHistoricTaskInstanceQuery()
      .taskId(task.getId())
      .singleResult();
    assertEquals("updatedtaskname", historicTaskInstance.getName());
    assertEquals("updateddescription", historicTaskInstance.getDescription());
    assertEquals("updatedassignee", historicTaskInstance.getAssignee());
    assertEquals("updatedowner", historicTaskInstance.getOwner());
    assertEquals(dueDate, historicTaskInstance.getDueDate());
    assertEquals(1, historicTaskInstance.getPriority());
  }
  
  // Finally, delete task
  taskService.deleteTask(task.getId(), true);
}