private void verifyStringParameterQueryInvocations() { Map<String, String> stringQueryParameters = getCompleteStringQueryParameters(); verify(mockedQuery).activityInstanceId(stringQueryParameters.get("activityInstanceId")); verify(mockedQuery).processInstanceId(stringQueryParameters.get("processInstanceId")); verify(mockedQuery).processDefinitionId(stringQueryParameters.get("processDefinitionId")); verify(mockedQuery).executionId(stringQueryParameters.get("executionId")); verify(mockedQuery).activityId(stringQueryParameters.get("activityId")); verify(mockedQuery).activityName(stringQueryParameters.get("activityName")); verify(mockedQuery).activityType(stringQueryParameters.get("activityType")); verify(mockedQuery).taskAssignee(stringQueryParameters.get("taskAssignee")); verify(mockedQuery).list(); }
query.executionId(executionId);
query.executionId(executionId);
@Deployment(resources = {"org/camunda/bpm/engine/test/standalone/entity/ExecutionSequenceCounterTest.testLoop.bpmn20.xml"}) public void testLoop() { // given HistoricActivityInstanceQuery query = historyService .createHistoricActivityInstanceQuery() .orderPartiallyByOccurrence() .asc(); // when String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId(); // then query.executionId(processInstanceId); verifyOrder(query, "theStart", "theService1", "join", "theScript", "fork", "join", "theScript", "fork", "theService2", "theEnd"); }
@Deployment(resources = {"org/camunda/bpm/engine/test/standalone/entity/ExecutionSequenceCounterTest.testInterruptingBoundaryEvent.bpmn20.xml"}) public void testInterruptingBoundaryEvent() { // given HistoricActivityInstanceQuery query = historyService .createHistoricActivityInstanceQuery() .orderPartiallyByOccurrence() .asc(); // when String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId(); runtimeService.correlateMessage("newMessage"); // then verifyOrder(query, "theStart", "theService1", "theTask", "messageBoundary", "theServiceAfterMessage", "theEnd2"); query.executionId(processInstanceId); verifyOrder(query, "theStart", "theService1", "messageBoundary", "theServiceAfterMessage", "theEnd2"); String taskExecutionId = historyService .createHistoricActivityInstanceQuery() .activityId("theTask") .singleResult() .getExecutionId(); query.executionId(taskExecutionId); verifyOrder(query, "theTask"); }
@Deployment(resources = {"org/camunda/bpm/engine/test/standalone/entity/ExecutionSequenceCounterTest.testSequentialMultiInstance.bpmn20.xml"}) public void testSequentialMultiInstance() { // given HistoricActivityInstanceQuery query = historyService .createHistoricActivityInstanceQuery() .orderPartiallyByOccurrence() .asc(); // when String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId(); // then query.executionId(processInstanceId); verifyOrder(query, "theStart", "theService1", "theService3", "theEnd"); String taskExecutionId = historyService .createHistoricActivityInstanceQuery() .activityId("theService2") .list() .get(0) .getExecutionId(); query.executionId(taskExecutionId); verifyOrder(query, "theService2#multiInstanceBody", "theService2", "theService2"); query = historyService .createHistoricActivityInstanceQuery() .orderPartiallyByOccurrence() .asc(); verifyOrder(query, "theStart", "theService1", "theService2#multiInstanceBody", "theService2", "theService2", "theService3", "theEnd"); }
@Deployment(resources = {"org/camunda/bpm/engine/test/standalone/entity/ExecutionSequenceCounterTest.testForkSameSequenceLengthWithoutWaitStates.bpmn20.xml"}) public void testFork() { // given String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId(); HistoricActivityInstanceQuery query = historyService .createHistoricActivityInstanceQuery() .orderPartiallyByOccurrence() .asc(); // when // then query.executionId(processInstanceId); verifyOrder(query, "theStart", "theService", "fork", "theService2", "theEnd2"); String firstExecutionId = historyService.createHistoricActivityInstanceQuery().activityId("theService1").singleResult().getExecutionId(); query.executionId(firstExecutionId); verifyOrder(query, "theService1", "theEnd1"); query = historyService .createHistoricActivityInstanceQuery() .orderPartiallyByOccurrence() .asc(); verifyOrder(query, "theStart", "theService", "fork", "theService1", "theEnd1", "theService2", "theEnd2"); }
@Deployment(resources = {"org/camunda/bpm/engine/test/standalone/entity/ExecutionSequenceCounterTest.testSequenceInsideSubProcess.bpmn20.xml"}) public void testSequenceInsideSubProcess() { // given HistoricActivityInstanceQuery query = historyService .createHistoricActivityInstanceQuery() .orderPartiallyByOccurrence() .asc(); // when String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId(); // then query.executionId(processInstanceId); verifyOrder(query, "theStart", "theService1", "theService2", "theEnd"); String subProcessExecutionId = historyService .createHistoricActivityInstanceQuery() .activityId("subProcess") .singleResult() .getExecutionId(); query.executionId(subProcessExecutionId); verifyOrder(query, "subProcess", "innerStart", "innerService", "innerEnd"); query = historyService .createHistoricActivityInstanceQuery() .orderPartiallyByOccurrence() .asc(); verifyOrder(query, "theStart", "theService1", "subProcess", "innerStart", "innerService", "innerEnd", "theService2", "theEnd"); }
@Deployment(resources = {"org/camunda/bpm/engine/test/standalone/entity/ExecutionSequenceCounterTest.testParallelMultiInstance.bpmn20.xml"}) public void testParallelMultiInstance() { // given HistoricActivityInstanceQuery query = historyService .createHistoricActivityInstanceQuery() .orderPartiallyByOccurrence() .asc(); // when String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId(); // then query.executionId(processInstanceId); verifyOrder(query, "theStart", "theService1", "theService3", "theEnd"); List<HistoricActivityInstance> taskActivityInstances = historyService .createHistoricActivityInstanceQuery() .activityId("theService2") .list(); for (HistoricActivityInstance activityInstance : taskActivityInstances) { query.executionId(activityInstance.getExecutionId()); verifyOrder(query, "theService2"); } query = historyService .createHistoricActivityInstanceQuery() .orderPartiallyByOccurrence() .asc(); verifyOrder(query, "theStart", "theService1", "theService2#multiInstanceBody", "theService2", "theService2", "theService3", "theEnd"); }
query.executionId(processInstanceId); verifyOrder(query, "theStart", "theService", "fork", "join", "theService4", "theEnd"); .getExecutionId(); query.executionId(firstExecutionId); verifyOrder(query, "theService1", "join"); query.executionId(secondExecutionId); verifyOrder(query, "theService2", "theService3");
assertEquals(0, historyService.createHistoricActivityInstanceQuery().executionId("nonExistingExecutionId").list().size()); assertEquals(3, historyService.createHistoricActivityInstanceQuery().executionId(processInstance.getId()).list().size()); } else { assertEquals(0, historyService.createHistoricActivityInstanceQuery().executionId(processInstance.getId()).list().size());
query.executionId(processInstanceId); verifyOrder(query, "theStart", "theService1", "theEnd1"); .getExecutionId(); query.executionId(taskExecutionId); verifyOrder(query, "theTask"); .list(); for (HistoricActivityInstance historicActivityInstance : activityInstances) { query.executionId(historicActivityInstance.getExecutionId()); verifyOrder(query, "messageBoundary", "theServiceAfterMessage", "theEnd2");
@Deployment(resources = {"org/camunda/bpm/engine/test/standalone/entity/ExecutionSequenceCounterTest.testLoop.bpmn20.xml"}) public void testLoop() { // given HistoricActivityInstanceQuery query = historyService .createHistoricActivityInstanceQuery() .orderPartiallyByOccurrence() .asc(); // when String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId(); // then query.executionId(processInstanceId); verifyOrder(query, "theStart", "theService1", "join", "theScript", "fork", "join", "theScript", "fork", "theService2", "theEnd"); }
@Deployment(resources = {"org/camunda/bpm/engine/test/standalone/entity/ExecutionSequenceCounterTest.testSequentialMultiInstance.bpmn20.xml"}) public void testSequentialMultiInstance() { // given HistoricActivityInstanceQuery query = historyService .createHistoricActivityInstanceQuery() .orderPartiallyByOccurrence() .asc(); // when String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId(); // then query.executionId(processInstanceId); verifyOrder(query, "theStart", "theService1", "theService3", "theEnd"); String taskExecutionId = historyService .createHistoricActivityInstanceQuery() .activityId("theService2") .list() .get(0) .getExecutionId(); query.executionId(taskExecutionId); verifyOrder(query, "theService2#multiInstanceBody", "theService2", "theService2"); query = historyService .createHistoricActivityInstanceQuery() .orderPartiallyByOccurrence() .asc(); verifyOrder(query, "theStart", "theService1", "theService2#multiInstanceBody", "theService2", "theService2", "theService3", "theEnd"); }
@Deployment(resources = {"org/camunda/bpm/engine/test/standalone/entity/ExecutionSequenceCounterTest.testInterruptingBoundaryEvent.bpmn20.xml"}) public void testInterruptingBoundaryEvent() { // given HistoricActivityInstanceQuery query = historyService .createHistoricActivityInstanceQuery() .orderPartiallyByOccurrence() .asc(); // when String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId(); runtimeService.correlateMessage("newMessage"); // then verifyOrder(query, "theStart", "theService1", "theTask", "messageBoundary", "theServiceAfterMessage", "theEnd2"); query.executionId(processInstanceId); verifyOrder(query, "theStart", "theService1", "messageBoundary", "theServiceAfterMessage", "theEnd2"); String taskExecutionId = historyService .createHistoricActivityInstanceQuery() .activityId("theTask") .singleResult() .getExecutionId(); query.executionId(taskExecutionId); verifyOrder(query, "theTask"); }
@Deployment(resources = {"org/camunda/bpm/engine/test/standalone/entity/ExecutionSequenceCounterTest.testForkSameSequenceLengthWithoutWaitStates.bpmn20.xml"}) public void testFork() { // given String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId(); HistoricActivityInstanceQuery query = historyService .createHistoricActivityInstanceQuery() .orderPartiallyByOccurrence() .asc(); // when // then query.executionId(processInstanceId); verifyOrder(query, "theStart", "theService", "fork", "theService2", "theEnd2"); String firstExecutionId = historyService.createHistoricActivityInstanceQuery().activityId("theService1").singleResult().getExecutionId(); query.executionId(firstExecutionId); verifyOrder(query, "theService1", "theEnd1"); query = historyService .createHistoricActivityInstanceQuery() .orderPartiallyByOccurrence() .asc(); verifyOrder(query, "theStart", "theService", "fork", "theService1", "theEnd1", "theService2", "theEnd2"); }
@Deployment(resources = {"org/camunda/bpm/engine/test/standalone/entity/ExecutionSequenceCounterTest.testSequenceInsideSubProcess.bpmn20.xml"}) public void testSequenceInsideSubProcess() { // given HistoricActivityInstanceQuery query = historyService .createHistoricActivityInstanceQuery() .orderPartiallyByOccurrence() .asc(); // when String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId(); // then query.executionId(processInstanceId); verifyOrder(query, "theStart", "theService1", "theService2", "theEnd"); String subProcessExecutionId = historyService .createHistoricActivityInstanceQuery() .activityId("subProcess") .singleResult() .getExecutionId(); query.executionId(subProcessExecutionId); verifyOrder(query, "subProcess", "innerStart", "innerService", "innerEnd"); query = historyService .createHistoricActivityInstanceQuery() .orderPartiallyByOccurrence() .asc(); verifyOrder(query, "theStart", "theService1", "subProcess", "innerStart", "innerService", "innerEnd", "theService2", "theEnd"); }
@Deployment(resources = {"org/camunda/bpm/engine/test/standalone/entity/ExecutionSequenceCounterTest.testParallelMultiInstance.bpmn20.xml"}) public void testParallelMultiInstance() { // given HistoricActivityInstanceQuery query = historyService .createHistoricActivityInstanceQuery() .orderPartiallyByOccurrence() .asc(); // when String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId(); // then query.executionId(processInstanceId); verifyOrder(query, "theStart", "theService1", "theService3", "theEnd"); List<HistoricActivityInstance> taskActivityInstances = historyService .createHistoricActivityInstanceQuery() .activityId("theService2") .list(); for (HistoricActivityInstance activityInstance : taskActivityInstances) { query.executionId(activityInstance.getExecutionId()); verifyOrder(query, "theService2"); } query = historyService .createHistoricActivityInstanceQuery() .orderPartiallyByOccurrence() .asc(); verifyOrder(query, "theStart", "theService1", "theService2#multiInstanceBody", "theService2", "theService2", "theService3", "theEnd"); }
query.executionId(processInstanceId); verifyOrder(query, "theStart", "theService", "fork", "join", "theService4", "theEnd"); .getExecutionId(); query.executionId(firstExecutionId); verifyOrder(query, "theService1", "join"); query.executionId(secondExecutionId); verifyOrder(query, "theService2", "theService3");
query.executionId(processInstanceId); verifyOrder(query, "theStart", "theService1", "theEnd1"); .getExecutionId(); query.executionId(taskExecutionId); verifyOrder(query, "theTask"); .list(); for (HistoricActivityInstance historicActivityInstance : activityInstances) { query.executionId(historicActivityInstance.getExecutionId()); verifyOrder(query, "messageBoundary", "theServiceAfterMessage", "theEnd2");