Search in sources :

Example 36 with HistoricTaskInstance

use of org.camunda.bpm.engine.history.HistoricTaskInstance in project camunda-bpm-platform by camunda.

the class HistoricTaskInstanceUpdateTest method testHistoricTaskInstanceUpdate.

@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());
}
Also used : Task(org.camunda.bpm.engine.task.Task) HistoricTaskInstance(org.camunda.bpm.engine.history.HistoricTaskInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

HistoricTaskInstance (org.camunda.bpm.engine.history.HistoricTaskInstance)36 Deployment (org.camunda.bpm.engine.test.Deployment)20 Task (org.camunda.bpm.engine.task.Task)18 HistoricTaskInstanceQuery (org.camunda.bpm.engine.history.HistoricTaskInstanceQuery)10 RequiredHistoryLevel (org.camunda.bpm.engine.test.RequiredHistoryLevel)6 Test (org.junit.Test)6 HistoricActivityInstance (org.camunda.bpm.engine.history.HistoricActivityInstance)4 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)4 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)3 SimpleDateFormat (java.text.SimpleDateFormat)2 ArrayList (java.util.ArrayList)2 Calendar (java.util.Calendar)2 Date (java.util.Date)2 HashMap (java.util.HashMap)2 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)2 MigrationPlan (org.camunda.bpm.engine.migration.MigrationPlan)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 HashSet (java.util.HashSet)1 ProcessApplicationService (org.camunda.bpm.ProcessApplicationService)1