Java Code Examples for org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl#HISTORYLEVEL_AUDIT

The following examples show how to use org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl#HISTORYLEVEL_AUDIT . 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: TaskServiceTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Test
public void testResolveTaskWithParametersNullParameters() {
  Task task = taskService.newTask();
  task.setDelegationState(DelegationState.PENDING);
  taskService.saveTask(task);

  String taskId = task.getId();
  taskService.resolveTask(taskId, null);

  if (processEngineConfiguration.getHistoryLevel().getId()>= ProcessEngineConfigurationImpl.HISTORYLEVEL_AUDIT) {
    historyService.deleteHistoricTaskInstance(taskId);
  }

  // Fetch the task again
  task = taskService.createTaskQuery().taskId(taskId).singleResult();
  assertEquals(DelegationState.RESOLVED, task.getDelegationState());

  taskService.deleteTask(taskId, true);
}
 
Example 2
Source File: TaskServiceTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Test
public void testResolveTaskWithParametersEmptyParameters() {
  Task task = taskService.newTask();
  task.setDelegationState(DelegationState.PENDING);
  taskService.saveTask(task);

  String taskId = task.getId();
  taskService.resolveTask(taskId, Collections.EMPTY_MAP);

  if (processEngineConfiguration.getHistoryLevel().getId()>= ProcessEngineConfigurationImpl.HISTORYLEVEL_AUDIT) {
    historyService.deleteHistoricTaskInstance(taskId);
  }

  // Fetch the task again
  task = taskService.createTaskQuery().taskId(taskId).singleResult();
  assertEquals(DelegationState.RESOLVED, task.getDelegationState());

  taskService.deleteTask(taskId, true);
}
 
Example 3
Source File: CompensateEventTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Deployment(resources = {
    "org/camunda/bpm/engine/test/bpmn/event/compensate/CompensateEventTest.testCompensationTriggeredByEventSubProcessActivityRef.bpmn20.xml" })
public void testCompensateActivityRefTriggeredByEventSubprocess() {
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("compensateProcess");
  assertProcessEnded(processInstance.getId());

  HistoricVariableInstanceQuery historicVariableInstanceQuery = historyService.createHistoricVariableInstanceQuery()
      .processInstanceId(processInstance.getId()).variableName("undoBookHotel");

  if (processEngineConfiguration.getHistoryLevel().getId() >= ProcessEngineConfigurationImpl.HISTORYLEVEL_AUDIT) {
    assertEquals(1, historicVariableInstanceQuery.count());
    assertEquals("undoBookHotel", historicVariableInstanceQuery.list().get(0).getVariableName());
    assertEquals(5, historicVariableInstanceQuery.list().get(0).getValue());

    assertEquals(0, historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId()).variableName("undoBookFlight").count());
  }
}
 
Example 4
Source File: CompensateEventTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Deployment(resources = {
    "org/camunda/bpm/engine/test/bpmn/event/compensate/CompensateEventTest.testCompensationTriggeredByEventSubProcessInSubProcessActivityRef.bpmn20.xml" })
public void testCompensateActivityRefTriggeredByEventSubprocessInSubProcess() {
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("compensateProcess");
  assertProcessEnded(processInstance.getId());

  HistoricVariableInstanceQuery historicVariableInstanceQuery = historyService.createHistoricVariableInstanceQuery()
      .processInstanceId(processInstance.getId()).variableName("undoBookHotel");

  if (processEngineConfiguration.getHistoryLevel().getId() >= ProcessEngineConfigurationImpl.HISTORYLEVEL_AUDIT) {
    assertEquals(1, historicVariableInstanceQuery.count());
    assertEquals("undoBookHotel", historicVariableInstanceQuery.list().get(0).getVariableName());
    assertEquals(5, historicVariableInstanceQuery.list().get(0).getValue());

    assertEquals(0, historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId()).variableName("undoBookFlight").count());
  }
}
 
Example 5
Source File: CompensateEventTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/event/compensate/CompensateEventTest.testCompensationInEventSubProcessActivityRef.bpmn20.xml" })
public void testCompensateActivityRefInEventSubprocess() {
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("compensateProcess");
  assertProcessEnded(processInstance.getId());

  HistoricVariableInstanceQuery historicVariableInstanceQuery = historyService.createHistoricVariableInstanceQuery().variableName("undoBookSecondHotel");

  if (processEngineConfiguration.getHistoryLevel().getId() >= ProcessEngineConfigurationImpl.HISTORYLEVEL_AUDIT) {
    assertEquals(1, historicVariableInstanceQuery.count());
    assertEquals("undoBookSecondHotel", historicVariableInstanceQuery.list().get(0).getVariableName());
    assertEquals(5, historicVariableInstanceQuery.list().get(0).getValue());

    assertEquals(0, historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId()).variableName("undoBookFlight").count());

    assertEquals(0, historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId()).variableName("undoBookHotel").count());
  }
}
 
Example 6
Source File: CompensateEventTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
/**
 * enable test case when bug is fixed
 *
 * @see https://app.camunda.com/jira/browse/CAM-4304
 */
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/event/compensate/CompensateEventTest.testCompensationInEventSubProcess.bpmn20.xml" })
public void testCompensateInEventSubprocess() {
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("compensateProcess");
  assertProcessEnded(processInstance.getId());

  HistoricVariableInstanceQuery historicVariableInstanceQuery = historyService.createHistoricVariableInstanceQuery().variableName("undoBookSecondHotel");

  if (processEngineConfiguration.getHistoryLevel().getId() >= ProcessEngineConfigurationImpl.HISTORYLEVEL_AUDIT) {
    assertEquals(1, historicVariableInstanceQuery.count());
    assertEquals("undoBookSecondHotel", historicVariableInstanceQuery.list().get(0).getVariableName());
    assertEquals(5, historicVariableInstanceQuery.list().get(0).getValue());

    historicVariableInstanceQuery = historyService.createHistoricVariableInstanceQuery().variableName("undoBookFlight");

    assertEquals(1, historicVariableInstanceQuery.count());
    assertEquals(5, historicVariableInstanceQuery.list().get(0).getValue());

    historicVariableInstanceQuery = historyService.createHistoricVariableInstanceQuery().variableName("undoBookHotel");

    assertEquals(1, historicVariableInstanceQuery.count());
    assertEquals(5, historicVariableInstanceQuery.list().get(0).getValue());
  }
}
 
Example 7
Source File: CompensateEventTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Deployment
public void testConcurrentScopeCompensation() {
  // given a process instance with two concurrent tasks, one of which is waiting
  // before throwing compensation
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("concurrentScopeCompensation");
  Task beforeCompensationTask = taskService.createTaskQuery().taskDefinitionKey("beforeCompensationTask").singleResult();
  Task concurrentTask = taskService.createTaskQuery().taskDefinitionKey("concurrentTask").singleResult();

  // when throwing compensation such that two subprocesses are compensated
  taskService.complete(beforeCompensationTask.getId());

  // then both compensation handlers have been executed
  if (processEngineConfiguration.getHistoryLevel().getId() >= ProcessEngineConfigurationImpl.HISTORYLEVEL_AUDIT) {
    HistoricVariableInstanceQuery historicVariableInstanceQuery = historyService
        .createHistoricVariableInstanceQuery().variableName("compensateScope1Task");

    assertEquals(1, historicVariableInstanceQuery.count());
    assertEquals(1, historicVariableInstanceQuery.list().get(0).getValue());

    historicVariableInstanceQuery = historyService
        .createHistoricVariableInstanceQuery().variableName("compensateScope2Task");

    assertEquals(1, historicVariableInstanceQuery.count());
    assertEquals(1, historicVariableInstanceQuery.list().get(0).getValue());
  }

  // and after completing the concurrent task, the process instance ends successfully
  taskService.complete(concurrentTask.getId());
  assertProcessEnded(processInstance.getId());
}
 
Example 8
Source File: HistoricVariableInstanceTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
/**
 * CAM-2828
 */
@Deployment(resources = "org/camunda/bpm/engine/test/bpmn/async/AsyncStartEventTest.testAsyncStartEvent.bpmn20.xml")
public void FAILING_testSubmitFormHistoricUpdates() {

  String processDefinitionId = repositoryService
    .createProcessDefinitionQuery()
    .processDefinitionKey("asyncStartEvent")
    .singleResult()
    .getId();

  Map<String, Object> properties = new HashMap<String, Object>();
  properties.put("foo", "bar");

  formService.submitStartForm(processDefinitionId, properties);
  executeAvailableJobs();

  if(processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_AUDIT) {

    String theStartActivityInstanceId = historyService
      .createHistoricActivityInstanceQuery()
      .activityId("startEvent")
      .singleResult()
      .getId();

    HistoricDetail historicFormUpdate = historyService
      .createHistoricDetailQuery()
      .formFields()
      .singleResult();

    assertNotNull(historicFormUpdate);
    assertEquals(theStartActivityInstanceId, historicFormUpdate.getActivityInstanceId());

  }
}
 
Example 9
Source File: HistoricVariableInstanceScopeTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Deployment(resources = {"org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn"})
public void testCmmnActivityInstanceIdOnCaseInstance() {

  // given
  CaseInstance caseInstance = caseService.createCaseInstanceByKey("oneTaskCase");

  String taskExecutionId = caseService
      .createCaseExecutionQuery()
      .activityId("PI_HumanTask_1")
      .singleResult()
      .getId();

  // when
  caseService
    .withCaseExecution(taskExecutionId)
    .setVariable("foo", "bar")
    .execute();

  // then
  HistoricVariableInstance variable = historyService
      .createHistoricVariableInstanceQuery()
      .variableName("foo")
      .singleResult();

  assertNotNull(variable);
  assertEquals(caseInstance.getId(), variable.getActivityInstanceId());

  if(processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_AUDIT) {
    HistoricDetail variableDetail = historyService
      .createHistoricDetailQuery()
      .variableUpdates()
      .variableInstanceId(variable.getId())
      .singleResult();
    assertEquals(taskExecutionId, variableDetail.getActivityInstanceId());
  }

}
 
Example 10
Source File: HistoricVariableInstanceScopeTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Deployment(resources = {"org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn"})
public void testCmmnActivityInstanceIdOnCaseExecution() {

  // given
  caseService.createCaseInstanceByKey("oneTaskCase");

  String taskExecutionId = caseService
      .createCaseExecutionQuery()
      .activityId("PI_HumanTask_1")
      .singleResult()
      .getId();

  // when
  caseService
    .withCaseExecution(taskExecutionId)
    .setVariableLocal("foo", "bar")
    .execute();

  // then
  HistoricVariableInstance variable = historyService
      .createHistoricVariableInstanceQuery()
      .variableName("foo")
      .singleResult();

  assertNotNull(variable);
  assertEquals(taskExecutionId, variable.getActivityInstanceId());

  if(processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_AUDIT) {
    HistoricDetail variableDetail = historyService
      .createHistoricDetailQuery()
      .variableUpdates()
      .variableInstanceId(variable.getId())
      .singleResult();
    assertEquals(taskExecutionId, variableDetail.getActivityInstanceId());
  }

}
 
Example 11
Source File: HistoricVariableInstanceScopeTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Deployment(resources = {"org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn"})
public void testCmmnActivityInstanceIdOnTask() {

  // given
  CaseInstance caseInstance = caseService.createCaseInstanceByKey("oneTaskCase");

  String taskExecutionId = caseService
      .createCaseExecutionQuery()
      .activityId("PI_HumanTask_1")
      .singleResult()
      .getId();

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

  // when
  taskService.setVariable(task.getId(), "foo", "bar");

  // then
  HistoricVariableInstance variable = historyService
      .createHistoricVariableInstanceQuery()
      .variableName("foo")
      .singleResult();

  assertNotNull(variable);
  assertEquals(caseInstance.getId(), variable.getActivityInstanceId());

  if(processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_AUDIT) {
    HistoricDetail variableDetail = historyService
      .createHistoricDetailQuery()
      .variableUpdates()
      .variableInstanceId(variable.getId())
      .singleResult();
    assertEquals(taskExecutionId, variableDetail.getActivityInstanceId());
  }

}
 
Example 12
Source File: HistoricTaskInstanceTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Deployment
public void testHistoricTaskInstanceQueryByProcessVariableValue() throws Exception {
  int historyLevel = processEngineConfiguration.getHistoryLevel().getId();
  if (historyLevel >= ProcessEngineConfigurationImpl.HISTORYLEVEL_AUDIT) {
    Map<String, Object> variables = new HashMap<String, Object>();
    variables.put("hallo", "steffen");

    String processInstanceId = runtimeService.startProcessInstanceByKey("HistoricTaskInstanceTest", variables).getId();

    Task runtimeTask = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult();
    String taskId = runtimeTask.getId();

    HistoricTaskInstance historicTaskInstance = historyService
        .createHistoricTaskInstanceQuery()
        .processVariableValueEquals("hallo", "steffen")
        .singleResult();

    assertNotNull(historicTaskInstance);
    assertEquals(taskId, historicTaskInstance.getId());

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

    historyService.deleteHistoricTaskInstance(taskId);
    assertEquals(0, historyService.createHistoricTaskInstanceQuery().count());
  }
}
 
Example 13
Source File: HistoricVariableInstanceTest.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Deployment(resources = "org/camunda/bpm/engine/test/bpmn/async/AsyncStartEventTest.testAsyncStartEvent.bpmn20.xml")
public void testAsyncStartEventVariableHistory() {
  Map<String, Object> variables = new HashMap<String, Object>();
  variables.put("foo", "bar");
  String processInstanceId = runtimeService.startProcessInstanceByKey("asyncStartEvent", variables).getId();

  VariableInstance variableFoo = runtimeService.createVariableInstanceQuery().singleResult();
  assertNotNull(variableFoo);
  assertEquals("foo", variableFoo.getName());
  assertEquals("bar", variableFoo.getValue());

  assertEquals(1, runtimeService.createProcessInstanceQuery().count());

  executeAvailableJobs();

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

  taskService.complete(task.getId());

  // assert process instance is ended
  assertEquals(0, runtimeService.createProcessInstanceQuery().count());

  if(processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) {
    HistoricVariableInstance variable = historyService.createHistoricVariableInstanceQuery().singleResult();
    assertNotNull(variable);
    assertEquals("foo", variable.getName());
    assertEquals("bar", variable.getValue());
    assertEquals(processInstanceId, variable.getActivityInstanceId());

    if(processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_AUDIT) {

      HistoricDetail historicDetail = historyService
        .createHistoricDetailQuery()
        .singleResult();

      assertNotNull(historicDetail);
      assertEquals(historicDetail.getProcessInstanceId(), historicDetail.getActivityInstanceId());
    }
  }
}
 
Example 14
Source File: HistoricVariableInstanceTest.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Deployment(resources = {"org/camunda/bpm/engine/test/bpmn/async/AsyncStartEventTest.testMultipleAsyncStartEvents.bpmn20.xml"})
public void testMultipleAsyncStartEventsVariableHistory() {
  Map<String, Object> variables = new HashMap<String, Object>();
  variables.put("foo", "bar");
  runtimeService.correlateMessage("newInvoiceMessage", new HashMap<String, Object>(), variables);

  VariableInstance variableFoo = runtimeService.createVariableInstanceQuery().singleResult();
  assertNotNull(variableFoo);
  assertEquals("foo", variableFoo.getName());
  assertEquals("bar", variableFoo.getValue());

  assertEquals(1, runtimeService.createProcessInstanceQuery().count());

  executeAvailableJobs();

  Task task = taskService.createTaskQuery().singleResult();
  assertNotNull(task);
  taskService.complete(task.getId());

  // assert process instance is ended
  assertEquals(0, runtimeService.createProcessInstanceQuery().count());

  if(processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) {

    String processInstanceId = historyService
      .createHistoricProcessInstanceQuery()
      .singleResult()
      .getId();

    HistoricVariableInstance variable = historyService.createHistoricVariableInstanceQuery().singleResult();
    assertNotNull(variable);
    assertEquals("foo", variable.getName());
    assertEquals("bar", variable.getValue());
    assertEquals(processInstanceId, variable.getActivityInstanceId());

    if(processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_AUDIT) {
      HistoricDetail historicDetail = historyService
        .createHistoricDetailQuery()
        .singleResult();

      assertNotNull(historicDetail);
      assertEquals(historicDetail.getProcessInstanceId(), historicDetail.getActivityInstanceId());
    }
  }
}
 
Example 15
Source File: HistoricVariableInstanceTest.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Deployment(resources = "org/camunda/bpm/engine/test/bpmn/async/AsyncStartEventTest.testAsyncStartEvent.bpmn20.xml")
public void testSubmitForm() {

  String processDefinitionId = repositoryService
    .createProcessDefinitionQuery()
    .processDefinitionKey("asyncStartEvent")
    .singleResult()
    .getId();

  Map<String, Object> properties = new HashMap<String, Object>();
  properties.put("foo", "bar");

  formService.submitStartForm(processDefinitionId, properties);

  VariableInstance variableFoo = runtimeService.createVariableInstanceQuery().singleResult();
  assertNotNull(variableFoo);
  assertEquals("foo", variableFoo.getName());
  assertEquals("bar", variableFoo.getValue());

  assertEquals(1, runtimeService.createProcessInstanceQuery().count());

  executeAvailableJobs();

  Task task = taskService.createTaskQuery().singleResult();
  assertNotNull(task);
  taskService.complete(task.getId());

  // assert process instance is ended
  assertEquals(0, runtimeService.createProcessInstanceQuery().count());

  if(processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) {

    String processInstanceId = historyService
      .createHistoricProcessInstanceQuery()
      .singleResult()
      .getId();

    HistoricVariableInstance variable = historyService.createHistoricVariableInstanceQuery().singleResult();
    assertNotNull(variable);
    assertEquals("foo", variable.getName());
    assertEquals("bar", variable.getValue());
    assertEquals(processInstanceId, variable.getActivityInstanceId());

    if(processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_AUDIT) {

      HistoricFormField historicFormUpdate = (HistoricFormField) historyService
        .createHistoricDetailQuery()
        .formFields()
        .singleResult();

      assertNotNull(historicFormUpdate);
      assertEquals("bar", historicFormUpdate.getFieldValue());

      HistoricVariableUpdate historicVariableUpdate = (HistoricVariableUpdate) historyService
        .createHistoricDetailQuery()
        .variableUpdates()
        .singleResult();

      assertNotNull(historicVariableUpdate);
      assertEquals(historicVariableUpdate.getProcessInstanceId(), historicVariableUpdate.getActivityInstanceId());
      assertEquals("bar", historicVariableUpdate.getValue());

    }
  }
}
 
Example 16
Source File: HistoricVariableInstanceScopeTest.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Deployment
public void testInputMappings() {
  // given
  String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId();

  HistoricActivityInstanceQuery activityInstanceQuery = historyService
      .createHistoricActivityInstanceQuery()
      .processInstanceId(processInstanceId);

  String theService1Id = activityInstanceQuery.activityId("theService1").singleResult().getId();
  String theService2Id = activityInstanceQuery.activityId("theService2").singleResult().getId();
  String theTaskId = activityInstanceQuery.activityId("theTask").singleResult().getId();

  // when (1)
  HistoricVariableInstance firstVariable = historyService
    .createHistoricVariableInstanceQuery()
    .variableName("firstInputVariable")
    .singleResult();

  // then (1)
  assertEquals(theService1Id, firstVariable.getActivityInstanceId());

  if(processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_AUDIT) {
    HistoricDetail firstVariableDetail = historyService
      .createHistoricDetailQuery()
      .variableUpdates()
      .variableInstanceId(firstVariable.getId())
      .singleResult();
    assertEquals(theService1Id, firstVariableDetail.getActivityInstanceId());
  }

  // when (2)
  HistoricVariableInstance secondVariable = historyService
    .createHistoricVariableInstanceQuery()
    .variableName("secondInputVariable")
    .singleResult();

  // then (2)
  assertEquals(theService2Id, secondVariable.getActivityInstanceId());

  if(processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_AUDIT) {
    HistoricDetail secondVariableDetail = historyService
      .createHistoricDetailQuery()
      .variableUpdates()
      .variableInstanceId(secondVariable.getId())
      .singleResult();
    assertEquals(theService2Id, secondVariableDetail.getActivityInstanceId());
  }

  // when (3)
  HistoricVariableInstance thirdVariable = historyService
    .createHistoricVariableInstanceQuery()
    .variableName("thirdInputVariable")
    .singleResult();

  // then (3)
  assertEquals(theTaskId, thirdVariable.getActivityInstanceId());

  if(processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_AUDIT) {
    HistoricDetail thirdVariableDetail = historyService
      .createHistoricDetailQuery()
      .variableUpdates()
      .variableInstanceId(thirdVariable.getId())
      .singleResult();
    assertEquals(theTaskId, thirdVariableDetail.getActivityInstanceId());
  }
}