use of org.camunda.bpm.engine.history.HistoricActivityInstance in project camunda-bpm-platform by camunda.
the class MessageBoundaryEventTest method testBoundaryMessageEventOnSubprocessWithIntermediateMessageCatch.
@Deployment
public void testBoundaryMessageEventOnSubprocessWithIntermediateMessageCatch() {
// given
// a process instance waiting inside the intermediate message catch inside the subprocess
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testProcess");
// when
// I cancel the subprocess
runtimeService.correlateMessage("cancelMessage");
// then
// the process instance is ended
assertProcessEnded(processInstance.getId());
if (processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) {
// and all activity instances in history have an end time set
List<HistoricActivityInstance> hais = historyService.createHistoricActivityInstanceQuery().list();
for (HistoricActivityInstance historicActivityInstance : hais) {
assertNotNull(historicActivityInstance.getEndTime());
}
}
}
use of org.camunda.bpm.engine.history.HistoricActivityInstance in project camunda-bpm-platform by camunda.
the class HistoricActivityInstanceSequenceCounterTest method testNonInterruptingBoundaryEvent.
@Deployment(resources = { "org/camunda/bpm/engine/test/standalone/entity/ExecutionSequenceCounterTest.testNonInterruptingBoundaryEvent.bpmn20.xml" })
public void testNonInterruptingBoundaryEvent() {
// given
HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery().orderPartiallyByOccurrence().asc();
// when
String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId();
runtimeService.correlateMessage("newMessage");
runtimeService.correlateMessage("newMessage");
String taskId = taskService.createTaskQuery().singleResult().getId();
taskService.complete(taskId);
// then
query.executionId(processInstanceId);
verifyOrder(query, "theStart", "theService1", "theEnd1");
String taskExecutionId = historyService.createHistoricActivityInstanceQuery().activityId("theTask").singleResult().getExecutionId();
query.executionId(taskExecutionId);
verifyOrder(query, "theTask");
List<HistoricActivityInstance> activityInstances = historyService.createHistoricActivityInstanceQuery().activityId("messageBoundary").list();
for (HistoricActivityInstance historicActivityInstance : activityInstances) {
query.executionId(historicActivityInstance.getExecutionId());
verifyOrder(query, "messageBoundary", "theServiceAfterMessage", "theEnd2");
}
query = historyService.createHistoricActivityInstanceQuery().orderPartiallyByOccurrence().asc().orderByActivityId().asc();
verifyOrder(query, "theStart", "theService1", "messageBoundary", "theTask", "theServiceAfterMessage", "theEnd2", "messageBoundary", "theServiceAfterMessage", "theEnd2", "theEnd1");
}
use of org.camunda.bpm.engine.history.HistoricActivityInstance in project camunda-bpm-platform by camunda.
the class HistoricActivityInstanceSequenceCounterTest method testParallelMultiInstance.
@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");
}
use of org.camunda.bpm.engine.history.HistoricActivityInstance in project camunda-bpm-platform by camunda.
the class HistoricActivityInstanceTest method testEndParallelJoin.
@Deployment
public void testEndParallelJoin() {
ProcessInstance pi = runtimeService.startProcessInstanceByKey("process");
List<HistoricActivityInstance> activityInstance = historyService.createHistoricActivityInstanceQuery().processInstanceId(pi.getId()).activityId("parallelJoinEnd").list();
assertThat(activityInstance.size(), is(2));
assertThat(pi.isEnded(), is(true));
}
use of org.camunda.bpm.engine.history.HistoricActivityInstance in project camunda-bpm-platform by camunda.
the class HistoricActivityInstanceTest method testHistoricActivityInstanceQueryByCanceled.
@Deployment(resources = "org/camunda/bpm/engine/test/history/HistoricActivityInstanceTest.testHistoricActivityInstanceQueryByCompleteScope.bpmn")
public void testHistoricActivityInstanceQueryByCanceled() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process");
runtimeService.deleteProcessInstance(processInstance.getId(), "test");
HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery().canceled();
assertEquals(3, query.count());
List<HistoricActivityInstance> instances = query.list();
for (HistoricActivityInstance instance : instances) {
if (!instance.getActivityId().equals("subprocess") && !instance.getActivityId().equals("userTask1") && !instance.getActivityId().equals("userTask2")) {
fail("Unexpected instance with activity id " + instance.getActivityId() + " found.");
}
}
assertProcessEnded(processInstance.getId());
}
Aggregations