use of org.camunda.bpm.engine.history.HistoricActivityInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricActivityInstanceTest method testTransaction.
@Deployment(resources = "org/camunda/bpm/engine/test/history/HistoricActivityInstanceTest.testBoundaryCancelEvent.bpmn20.xml")
public void testTransaction() {
ProcessInstance pi = runtimeService.startProcessInstanceByKey("process");
HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery();
query.activityId("transaction");
assertEquals(1, query.count());
assertNotNull(query.singleResult().getEndTime());
Task task = taskService.createTaskQuery().singleResult();
taskService.complete(task.getId());
assertProcessEnded(pi.getId());
}
use of org.camunda.bpm.engine.history.HistoricActivityInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricActivityInstanceTest method testHistoricActivityInstanceMessageEvent.
@Deployment(resources = { "org/camunda/bpm/engine/test/history/HistoricActivityInstanceTest.testHistoricActivityInstanceTimerEvent.bpmn20.xml" })
public void testHistoricActivityInstanceMessageEvent() {
runtimeService.startProcessInstanceByKey("catchSignal");
JobQuery jobQuery = managementService.createJobQuery();
assertEquals(1, jobQuery.count());
EventSubscriptionQuery eventSubscriptionQuery = runtimeService.createEventSubscriptionQuery();
assertEquals(1, eventSubscriptionQuery.count());
runtimeService.correlateMessage("newInvoice");
TaskQuery taskQuery = taskService.createTaskQuery();
Task task = taskQuery.singleResult();
assertEquals("afterMessage", task.getName());
HistoricActivityInstanceQuery historicActivityInstanceQuery = historyService.createHistoricActivityInstanceQuery().activityId("gw1");
assertEquals(1, historicActivityInstanceQuery.count());
assertNotNull(historicActivityInstanceQuery.singleResult().getEndTime());
historicActivityInstanceQuery = historyService.createHistoricActivityInstanceQuery().activityId("messageEvent");
assertEquals(1, historicActivityInstanceQuery.count());
assertNotNull(historicActivityInstanceQuery.singleResult().getEndTime());
assertEquals("intermediateMessageCatch", historicActivityInstanceQuery.singleResult().getActivityType());
}
use of org.camunda.bpm.engine.history.HistoricActivityInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricActivityInstanceTest method testMultiInstanceScopeActivity.
@Deployment
public void testMultiInstanceScopeActivity() {
ProcessInstance pi = runtimeService.startProcessInstanceByKey("process");
HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery();
HistoricActivityInstance miBodyInstance = query.activityId("userTask#multiInstanceBody").singleResult();
query.activityId("userTask");
assertEquals(5, query.count());
List<HistoricActivityInstance> result = query.list();
for (HistoricActivityInstance instance : result) {
assertEquals(miBodyInstance.getId(), instance.getParentActivityInstanceId());
}
List<Task> tasks = taskService.createTaskQuery().list();
for (Task task : tasks) {
taskService.complete(task.getId());
}
assertProcessEnded(pi.getId());
}
use of org.camunda.bpm.engine.history.HistoricActivityInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricActivityInstanceTest method testHistoricActivityInstanceTimerEvent.
@Deployment
public void testHistoricActivityInstanceTimerEvent() {
runtimeService.startProcessInstanceByKey("catchSignal");
assertEquals(1, runtimeService.createEventSubscriptionQuery().count());
JobQuery jobQuery = managementService.createJobQuery();
assertEquals(1, jobQuery.count());
Job timer = jobQuery.singleResult();
managementService.executeJob(timer.getId());
TaskQuery taskQuery = taskService.createTaskQuery();
Task task = taskQuery.singleResult();
assertEquals("afterTimer", task.getName());
HistoricActivityInstanceQuery historicActivityInstanceQuery = historyService.createHistoricActivityInstanceQuery().activityId("gw1");
assertEquals(1, historicActivityInstanceQuery.count());
assertNotNull(historicActivityInstanceQuery.singleResult().getEndTime());
historicActivityInstanceQuery = historyService.createHistoricActivityInstanceQuery().activityId("timerEvent");
assertEquals(1, historicActivityInstanceQuery.count());
assertNotNull(historicActivityInstanceQuery.singleResult().getEndTime());
assertEquals("intermediateTimer", historicActivityInstanceQuery.singleResult().getActivityType());
}
use of org.camunda.bpm.engine.history.HistoricActivityInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricActivityInstanceTest method testBoundaryCompensateEvent.
@Deployment
public void testBoundaryCompensateEvent() {
ProcessInstance pi = runtimeService.startProcessInstanceByKey("process");
HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery();
// the compensation boundary event should not appear in history!
query.activityId("compensate");
assertEquals(0, query.count());
assertProcessEnded(pi.getId());
}
Aggregations