Java Code Examples for org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl#HISTORYLEVEL_ACTIVITY
The following examples show how to use
org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl#HISTORYLEVEL_ACTIVITY .
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 |
@SuppressWarnings("unchecked") @Test public void testCompleteTaskWithParametersEmptyParameters() { Task task = taskService.newTask(); taskService.saveTask(task); String taskId = task.getId(); taskService.complete(taskId, Collections.EMPTY_MAP); if (processEngineConfiguration.getHistoryLevel().getId() >= ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) { historyService.deleteHistoricTaskInstance(taskId); } // Fetch the task again task = taskService.createTaskQuery().taskId(taskId).singleResult(); assertNull(task); }
Example 2
Source File: AsyncEndEventTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment public void testAsyncEndEventListeners() { ProcessInstance pi = runtimeService.startProcessInstanceByKey("asyncEndEvent"); long count = runtimeService.createProcessInstanceQuery().processInstanceId(pi.getId()).active().count(); Assert.assertNull(runtimeService.getVariable(pi.getId(), "listener")); Assert.assertEquals(1, runtimeService.createExecutionQuery().activityId("endEvent").count()); Assert.assertEquals(1, count); // as we are standing at the end event, we execute it. executeAvailableJobs(); count = runtimeService.createProcessInstanceQuery().processInstanceId(pi.getId()).active().count(); Assert.assertEquals(0, count); if(processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) { // after the end event we have a event listener HistoricVariableInstanceQuery name = historyService.createHistoricVariableInstanceQuery() .processInstanceId(pi.getId()) .variableName("listener"); Assert.assertNotNull(name); Assert.assertEquals("listener invoked", name.singleResult().getValue()); } }
Example 3
Source File: LinkEventTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment public void testEventLinkMultipleSources() { ProcessInstance pi = runtimeService.startProcessInstanceByKey("linkEventValid"); List<String> activeActivities = runtimeService.getActiveActivityIds(pi.getId()); // assert that the link event was triggered and that we are assertEquals(Arrays.asList(new String []{"WaitAfterLink", "WaitAfterLink"}), activeActivities); runtimeService.deleteProcessInstance(pi.getId(), "test done"); // validate history if(processEngineConfiguration.getHistoryLevel().getId() >= ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) { List<HistoricActivityInstance> activities = historyService.createHistoricActivityInstanceQuery().processInstanceId(pi.getId()).orderByActivityId().asc().list(); assertEquals(5, activities.size()); assertEquals("ManualTask_1", activities.get(0).getActivityId()); assertEquals("ParallelGateway_1", activities.get(1).getActivityId()); assertEquals("StartEvent_1", activities.get(2).getActivityId()); assertEquals("WaitAfterLink", activities.get(3).getActivityId()); assertEquals("WaitAfterLink", activities.get(4).getActivityId()); } }
Example 4
Source File: UserTaskTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment public void testTaskPropertiesNotNull() { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess"); List<String> activeActivityIds = runtimeService.getActiveActivityIds(processInstance.getId()); Task task = taskService.createTaskQuery().singleResult(); assertNotNull(task.getId()); assertEquals("my task", task.getName()); assertEquals("Very important", task.getDescription()); assertTrue(task.getPriority() > 0); assertEquals("kermit", task.getAssignee()); assertEquals(processInstance.getId(), task.getProcessInstanceId()); assertEquals(processInstance.getId(), task.getExecutionId()); assertNotNull(task.getProcessDefinitionId()); assertNotNull(task.getTaskDefinitionKey()); assertNotNull(task.getCreateTime()); // the next test verifies that if an execution creates a task, that no events are created during creation of the task. if (processEngineConfiguration.getHistoryLevel().getId() >= ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) { assertEquals(0, taskService.getTaskEvents(task.getId()).size()); } }
Example 5
Source File: TaskServiceTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void testDeleteTaskWithDeleteReason() { // ACT-900: deleteReason can be manually specified - can only be validated when historyLevel > ACTIVITY if (processEngineConfiguration.getHistoryLevel().getId() >= ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) { Task task = taskService.newTask(); task.setName("test task"); taskService.saveTask(task); assertNotNull(task.getId()); taskService.deleteTask(task.getId(), "deleted for testing purposes"); HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery() .taskId(task.getId()).singleResult(); assertNotNull(historicTaskInstance); assertEquals("deleted for testing purposes", historicTaskInstance.getDeleteReason()); // Delete historic task that is left behind, will not be cleaned up because this is not part of a process taskService.deleteTask(task.getId(), true); } }
Example 6
Source File: TaskServiceTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void testCompleteTaskWithParametersNullParameters() { Task task = taskService.newTask(); taskService.saveTask(task); String taskId = task.getId(); taskService.complete(taskId, null); if (processEngineConfiguration.getHistoryLevel().getId() >= ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) { historyService.deleteHistoricTaskInstance(taskId); } // Fetch the task again task = taskService.createTaskQuery().taskId(taskId).singleResult(); assertNull(task); }
Example 7
Source File: MultiInstanceTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Deployment(resources = {"org/camunda/bpm/engine/test/bpmn/multiinstance/MultiInstanceTest.sequentialUserTasks.bpmn20.xml"}) public void testSequentialUserTasksHistory() { runtimeService.startProcessInstanceByKey("miSequentialUserTasks", CollectionUtil.singletonMap("nrOfLoops", 4)).getId(); for (int i=0; i<4; i++) { taskService.complete(taskService.createTaskQuery().singleResult().getId()); } if (processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) { List<HistoricActivityInstance> historicActivityInstances = historyService.createHistoricActivityInstanceQuery().activityType("userTask").list(); assertEquals(4, historicActivityInstances.size()); for (HistoricActivityInstance hai : historicActivityInstances) { assertNotNull(hai.getActivityId()); assertNotNull(hai.getActivityName()); assertNotNull(hai.getStartTime()); assertNotNull(hai.getEndTime()); assertNotNull(hai.getAssignee()); } } if (processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) { List<HistoricTaskInstance> historicTaskInstances = historyService.createHistoricTaskInstanceQuery().list(); assertEquals(4, historicTaskInstances.size()); for (HistoricTaskInstance ht : historicTaskInstances) { assertNotNull(ht.getAssignee()); assertNotNull(ht.getStartTime()); assertNotNull(ht.getEndTime()); } } }
Example 8
Source File: MultiInstanceTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/multiinstance/MultiInstanceTest.testParallelCallActivity.bpmn20.xml", "org/camunda/bpm/engine/test/bpmn/multiinstance/MultiInstanceTest.externalSubProcess.bpmn20.xml" }) public void testParallelCallActivityHistory() { runtimeService.startProcessInstanceByKey("miParallelCallActivity"); List<Task> tasks = taskService.createTaskQuery().list(); assertEquals(12, tasks.size()); for (int i = 0; i < tasks.size(); i++) { taskService.complete(tasks.get(i).getId()); } if (processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) { // Validate historic processes List<HistoricProcessInstance> historicProcessInstances = historyService.createHistoricProcessInstanceQuery().list(); assertEquals(7, historicProcessInstances.size()); // 6 subprocesses + main process for (HistoricProcessInstance hpi : historicProcessInstances) { assertNotNull(hpi.getStartTime()); assertNotNull(hpi.getEndTime()); } // Validate historic activities List<HistoricActivityInstance> historicActivityInstances = historyService.createHistoricActivityInstanceQuery().activityType("callActivity").list(); assertEquals(6, historicActivityInstances.size()); for (HistoricActivityInstance hai : historicActivityInstances) { assertNotNull(hai.getStartTime()); assertNotNull(hai.getEndTime()); } } if (processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) { // Validate historic tasks List<HistoricTaskInstance> historicTaskInstances = historyService.createHistoricTaskInstanceQuery().list(); assertEquals(12, historicTaskInstances.size()); for (HistoricTaskInstance hti : historicTaskInstances) { assertNotNull(hti.getStartTime()); assertNotNull(hti.getEndTime()); assertNotNull(hti.getAssignee()); assertEquals("completed", hti.getDeleteReason()); } } }
Example 9
Source File: LinkEventTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Deployment public void testValidEventLink() { ProcessInstance pi = runtimeService.startProcessInstanceByKey("linkEventValid"); List<String> activeActivities = runtimeService.getActiveActivityIds(pi.getId()); // assert that now the first receive task is active assertEquals(Arrays.asList(new String []{"waitAfterLink1"}), activeActivities); runtimeService.signal(pi.getId()); activeActivities = runtimeService.getActiveActivityIds(pi.getId()); // assert that now the second receive task is active assertEquals(Arrays.asList(new String []{"waitAfterLink2"}), activeActivities); runtimeService.signal(pi.getId()); assertProcessEnded(pi.getId()); // validate history if(processEngineConfiguration.getHistoryLevel().getId() >= ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) { List<HistoricActivityInstance> activities = historyService.createHistoricActivityInstanceQuery().processInstanceId(pi.getId()).orderByActivityId().asc().list(); assertEquals(4, activities.size()); assertEquals("EndEvent_1", activities.get(0).getActivityId()); assertEquals("StartEvent_1", activities.get(1).getActivityId()); assertEquals("waitAfterLink1", activities.get(2).getActivityId()); assertEquals("waitAfterLink2", activities.get(3).getActivityId()); } }
Example 10
Source File: AsyncEndEventTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Deployment public void testMultipleAsyncEndEvents() { ProcessInstance pi = runtimeService.startProcessInstanceByKey("multipleAsyncEndEvent"); assertEquals(1, runtimeService.createProcessInstanceQuery().count()); // should stop at both end events List<Job> jobs = managementService.createJobQuery().withRetriesLeft().list(); assertEquals(2, jobs.size()); // execute one of the end events managementService.executeJob(jobs.get(0).getId()); jobs = managementService.createJobQuery().withRetriesLeft().list(); assertEquals(1, jobs.size()); // execute the second one managementService.executeJob(jobs.get(0).getId()); // assert that we have finished our instance now assertEquals(0, runtimeService.createProcessInstanceQuery().count()); if(processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) { // after the end event we have a event listener HistoricVariableInstanceQuery name = historyService.createHistoricVariableInstanceQuery() .processInstanceId(pi.getId()) .variableName("message"); Assert.assertNotNull(name); Assert.assertEquals(true, name.singleResult().getValue()); } }
Example 11
Source File: HistoricVariableInstanceTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public void testAsyncStartEventWithAddedVariable() { // given a process definition with asynchronous start event deployment(Bpmn.createExecutableProcess("testProcess") .startEvent() .camundaAsyncBefore() .endEvent() .done()); // when create an instance with a variable ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testProcess", Variables.putValue("var1", "foo")); // and add a variable before the instance is created runtimeService.setVariable(processInstance.getId(), "var2", "bar"); executeAvailableJobs(); assertProcessEnded(processInstance.getId()); if (processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) { // then the history contains one entry for each variable HistoricVariableInstanceQuery query = historyService.createHistoricVariableInstanceQuery(); assertEquals(query.count(), 2); HistoricVariableInstance firstVariable = query.variableName("var1").singleResult(); assertNotNull(firstVariable); assertEquals(firstVariable.getValue(), "foo"); assertNotNull(firstVariable.getActivityInstanceId()); HistoricVariableInstance secondVariable = query.variableName("var2").singleResult(); assertNotNull(secondVariable); assertEquals(secondVariable.getValue(), "bar"); assertNotNull(secondVariable.getActivityInstanceId()); } }
Example 12
Source File: HistoricVariableInstanceTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public void testAsyncStartEventWithChangedVariable() { // given a process definition with asynchronous start event deployment(Bpmn.createExecutableProcess("testProcess") .startEvent() .camundaAsyncBefore() .endEvent() .done()); // when create an instance with a variable ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testProcess", Variables.putValue("var", "foo")); // and update this variable before the instance is created runtimeService.setVariable(processInstance.getId(), "var", "bar"); executeAvailableJobs(); assertProcessEnded(processInstance.getId()); if (processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) { // then the history contains only one entry for the latest update (value = "bar") // - the entry for the initial value (value = "foo") is lost because of current limitations HistoricVariableInstanceQuery query = historyService.createHistoricVariableInstanceQuery(); assertEquals(query.count(), 1); HistoricVariableInstance variable = query.singleResult(); assertEquals(variable.getValue(), "bar"); assertNotNull(variable.getActivityInstanceId()); } }
Example 13
Source File: HistoricVariableInstanceTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@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 |
@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 |
@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: HistoricActivityInstanceTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Deployment public void testHistoricActivityInstanceQuery() { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("noopProcess"); assertEquals(0, historyService.createHistoricActivityInstanceQuery().activityId("nonExistingActivityId").list().size()); assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityId("noop").list().size()); assertEquals(0, historyService.createHistoricActivityInstanceQuery().activityType("nonExistingActivityType").list().size()); assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityType("serviceTask").list().size()); assertEquals(0, historyService.createHistoricActivityInstanceQuery().activityName("nonExistingActivityName").list().size()); assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityName("No operation").list().size()); assertEquals(0, historyService.createHistoricActivityInstanceQuery().activityNameLike("operation").list().size()); assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityNameLike("%operation").list().size()); assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityNameLike("%oper%").list().size()); assertEquals(0, historyService.createHistoricActivityInstanceQuery().taskAssignee("nonExistingAssignee").list().size()); assertEquals(0, historyService.createHistoricActivityInstanceQuery().executionId("nonExistingExecutionId").list().size()); if (processEngineConfiguration.getHistoryLevel().getId() >= ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) { assertEquals(3, historyService.createHistoricActivityInstanceQuery().executionId(processInstance.getId()).list().size()); } else { assertEquals(0, historyService.createHistoricActivityInstanceQuery().executionId(processInstance.getId()).list().size()); } assertEquals(0, historyService.createHistoricActivityInstanceQuery().processInstanceId("nonExistingProcessInstanceId").list().size()); if (processEngineConfiguration.getHistoryLevel().getId() >= ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) { assertEquals(3, historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstance.getId()).list().size()); } else { assertEquals(0, historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstance.getId()).list().size()); } assertEquals(0, historyService.createHistoricActivityInstanceQuery().processDefinitionId("nonExistingProcessDefinitionId").list().size()); if (processEngineConfiguration.getHistoryLevel().getId() >= ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) { assertEquals(3, historyService.createHistoricActivityInstanceQuery().processDefinitionId(processInstance.getProcessDefinitionId()).list().size()); } else { assertEquals(0, historyService.createHistoricActivityInstanceQuery().processDefinitionId(processInstance.getProcessDefinitionId()).list().size()); } assertEquals(0, historyService.createHistoricActivityInstanceQuery().unfinished().list().size()); if (processEngineConfiguration.getHistoryLevel().getId() >= ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) { assertEquals(3, historyService.createHistoricActivityInstanceQuery().finished().list().size()); } else { assertEquals(0, historyService.createHistoricActivityInstanceQuery().finished().list().size()); } if (processEngineConfiguration.getHistoryLevel().getId() >= ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) { HistoricActivityInstance historicActivityInstance = historyService.createHistoricActivityInstanceQuery().list().get(0); assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityInstanceId(historicActivityInstance.getId()).list().size()); } }
Example 17
Source File: HistoricActivityInstanceTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Deployment public void testSorting() { runtimeService.startProcessInstanceByKey("process"); int expectedActivityInstances = -1; if (processEngineConfiguration.getHistoryLevel().getId() >= ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) { expectedActivityInstances = 2; } else { expectedActivityInstances = 0; } assertEquals(expectedActivityInstances, historyService.createHistoricActivityInstanceQuery().orderByHistoricActivityInstanceId().asc().list().size()); assertEquals(expectedActivityInstances, historyService.createHistoricActivityInstanceQuery().orderByHistoricActivityInstanceStartTime().asc().list().size()); assertEquals(expectedActivityInstances, historyService.createHistoricActivityInstanceQuery().orderByHistoricActivityInstanceEndTime().asc().list().size()); assertEquals(expectedActivityInstances, historyService.createHistoricActivityInstanceQuery().orderByHistoricActivityInstanceDuration().asc().list().size()); assertEquals(expectedActivityInstances, historyService.createHistoricActivityInstanceQuery().orderByExecutionId().asc().list().size()); assertEquals(expectedActivityInstances, historyService.createHistoricActivityInstanceQuery().orderByProcessDefinitionId().asc().list().size()); assertEquals(expectedActivityInstances, historyService.createHistoricActivityInstanceQuery().orderByProcessInstanceId().asc().list().size()); assertEquals(expectedActivityInstances, historyService.createHistoricActivityInstanceQuery().orderByHistoricActivityInstanceId().desc().list().size()); assertEquals(expectedActivityInstances, historyService.createHistoricActivityInstanceQuery().orderByHistoricActivityInstanceStartTime().desc().list() .size()); assertEquals(expectedActivityInstances, historyService.createHistoricActivityInstanceQuery().orderByHistoricActivityInstanceEndTime().desc().list().size()); assertEquals(expectedActivityInstances, historyService.createHistoricActivityInstanceQuery().orderByHistoricActivityInstanceDuration().desc().list().size()); assertEquals(expectedActivityInstances, historyService.createHistoricActivityInstanceQuery().orderByExecutionId().desc().list().size()); assertEquals(expectedActivityInstances, historyService.createHistoricActivityInstanceQuery().orderByProcessDefinitionId().desc().list().size()); assertEquals(expectedActivityInstances, historyService.createHistoricActivityInstanceQuery().orderByProcessInstanceId().desc().list().size()); assertEquals(expectedActivityInstances, historyService.createHistoricActivityInstanceQuery().orderByHistoricActivityInstanceId().asc().count()); assertEquals(expectedActivityInstances, historyService.createHistoricActivityInstanceQuery().orderByHistoricActivityInstanceStartTime().asc().count()); assertEquals(expectedActivityInstances, historyService.createHistoricActivityInstanceQuery().orderByHistoricActivityInstanceEndTime().asc().count()); assertEquals(expectedActivityInstances, historyService.createHistoricActivityInstanceQuery().orderByHistoricActivityInstanceDuration().asc().count()); assertEquals(expectedActivityInstances, historyService.createHistoricActivityInstanceQuery().orderByExecutionId().asc().count()); assertEquals(expectedActivityInstances, historyService.createHistoricActivityInstanceQuery().orderByProcessDefinitionId().asc().count()); assertEquals(expectedActivityInstances, historyService.createHistoricActivityInstanceQuery().orderByProcessInstanceId().asc().count()); assertEquals(expectedActivityInstances, historyService.createHistoricActivityInstanceQuery().orderByHistoricActivityInstanceId().desc().count()); assertEquals(expectedActivityInstances, historyService.createHistoricActivityInstanceQuery().orderByHistoricActivityInstanceStartTime().desc().count()); assertEquals(expectedActivityInstances, historyService.createHistoricActivityInstanceQuery().orderByHistoricActivityInstanceEndTime().desc().count()); assertEquals(expectedActivityInstances, historyService.createHistoricActivityInstanceQuery().orderByHistoricActivityInstanceDuration().desc().count()); assertEquals(expectedActivityInstances, historyService.createHistoricActivityInstanceQuery().orderByExecutionId().desc().count()); assertEquals(expectedActivityInstances, historyService.createHistoricActivityInstanceQuery().orderByProcessDefinitionId().desc().count()); assertEquals(expectedActivityInstances, historyService.createHistoricActivityInstanceQuery().orderByProcessInstanceId().desc().count()); }