Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-1502

HistoricTasKInstanceQuery with processVariableValue filter fails on history level "AUDIT"

      The processVariableValue filter only woks with history level FULL as it joins on the ACT_HI_DETAIL table (but it should join on the ACT_HI_VARINST table),

      YOu can easily check that by adding a process variable to the existing test cases (or add a new one of course ):

      public class HistoricTaskInstanceTest extends PluggableProcessEngineTestCase {

      @Deployment
      public void testHistoricTaskInstance() throws Exception {
      Map<String, Object> variables = new HashMap<String, Object>();
      >> variables.put("hallo", "steffen");
      String processInstanceId = runtimeService.startProcessInstanceByKey("HistoricTaskInstanceTest", variables).getId();

      SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");

      // Set priority to non-default value
      Task runtimeTask = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult();
      runtimeTask.setPriority(1234);

      // Set due-date
      Date dueDate = sdf.parse("01/02/2003 04:05:06");
      runtimeTask.setDueDate(dueDate);
      taskService.saveTask(runtimeTask);

      String taskId = runtimeTask.getId();
      String taskDefinitionKey = runtimeTask.getTaskDefinitionKey();

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

      >> now historicTaskInstance is null

      Problem in HistoricTaskInstance.xml:

      <foreach collection="variables" index="index" item="var">
      and exists (
      select HD.ID_
      >> from ${prefix}ACT_HI_DETAIL HD

        This is the controller panel for Smart Panels app

            [CAM-1502] HistoricTasKInstanceQuery with processVariableValue filter fails on history level "AUDIT"

            Bernd Ruecker created issue -
            Daniel Meyer made changes -
            Labels New: AD

            Hi,
            it seems this issue is already corrected, please check file HistoricTaskInstance.xml line 312.
            The test case is passing with slight correction:

            • use ...processVariableValueEquals("hallo", "steffen").singleResult();
            • instead of ...processVariableValueEquals("test", "steffen").singleResult();

            If needed the mentioned test case can be added to HistoricTaskInstanceTest.java, but in this case the HISTORY_LEVEL_AUDIT should be set for setHistoryLevel in processEngineConfiguration.

            Br,
            Alexander

            Alexander Tyatenkov added a comment - Hi, it seems this issue is already corrected, please check file HistoricTaskInstance.xml line 312. The test case is passing with slight correction: use ...processVariableValueEquals(" hallo ", "steffen").singleResult(); instead of ...processVariableValueEquals(" test ", "steffen").singleResult(); If needed the mentioned test case can be added to HistoricTaskInstanceTest.java, but in this case the HISTORY_LEVEL_AUDIT should be set for setHistoryLevel in processEngineConfiguration . Br, Alexander

            Hi Alexander,

            I agree with your findings. It would be great if you could contribute the test case. Instead of changing the engine configuration, I suggest you add the test case either to org.camunda.bpm.engine.test.standalone.history.AuditHistoryTest or add it to HistoricTaskInstanceTest with a condition such that the test case is only executed when the level is AUDIT or higher (see https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/api/task/TaskServiceTest.java#L234 for an example).

            Cheers,
            Thorben

            Thorben Lindhauer added a comment - Hi Alexander, I agree with your findings. It would be great if you could contribute the test case. Instead of changing the engine configuration, I suggest you add the test case either to org.camunda.bpm.engine.test.standalone.history.AuditHistoryTest or add it to HistoricTaskInstanceTest with a condition such that the test case is only executed when the level is AUDIT or higher (see https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/api/task/TaskServiceTest.java#L234 for an example). Cheers, Thorben
            Thorben Lindhauer made changes -
            Fix Version/s New: 7.4.0 [ 13505 ]
            Fix Version/s New: 7.3.3 [ 13990 ]

            Thorben Lindhauer added a comment - Pull request with test case: https://github.com/camunda/camunda-bpm-platform/pull/161
            Thorben Lindhauer made changes -
            Fix Version/s New: 7.2.6 [ 13790 ]
            Resolution New: Fixed [ 1 ]
            Status Original: Open [ 1 ] New: Resolved [ 5 ]
            Remaining Estimate New: 0 minutes [ 0 ]
            Original Estimate New: 0 minutes [ 0 ]
            user-a6477 (Inactive) made changes -
            Assignee New: Thorben Lindhauer [ thorben.lindhauer ]
            Thorben Lindhauer made changes -
            Status Original: Resolved [ 5 ] New: Closed [ 6 ]
            Daniel Meyer made changes -
            Fix Version/s New: 7.4.0-alpha1 [ 14191 ]

              thorben.lindhauer Thorben Lindhauer
              ruecker Bernd Ruecker
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: