use of org.camunda.bpm.engine.history.HistoricActivityInstance in project camunda-bpm-platform by camunda.
the class HistoricActivityInstanceTest method testHistoricActivityInstanceNoop.
@Deployment
public void testHistoricActivityInstanceNoop() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("noopProcess");
HistoricActivityInstance historicActivityInstance = historyService.createHistoricActivityInstanceQuery().activityId("noop").singleResult();
assertEquals("noop", historicActivityInstance.getActivityId());
assertEquals("serviceTask", historicActivityInstance.getActivityType());
assertNotNull(historicActivityInstance.getProcessDefinitionId());
assertEquals(processInstance.getId(), historicActivityInstance.getProcessInstanceId());
assertEquals(processInstance.getId(), historicActivityInstance.getExecutionId());
assertNotNull(historicActivityInstance.getStartTime());
assertNotNull(historicActivityInstance.getEndTime());
assertTrue(historicActivityInstance.getDurationInMillis() >= 0);
}
use of org.camunda.bpm.engine.history.HistoricActivityInstance 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.HistoricActivityInstance in project camunda-bpm-platform by camunda.
the class HistoricActivityInstanceStateTest method testEventSubprocessSignalCancel.
@Deployment
public void testEventSubprocessSignalCancel() {
ProcessInstance processInstance = startProcess();
runtimeService.correlateMessage("continue");
assertProcessEnded(processInstance.getId());
List<HistoricActivityInstance> allInstances = getAllActivityInstances();
assertIsCanceledActivityInstances(allInstances, "userTask", 1);
assertNonCompletingActivityInstance(allInstances, "userTask");
// fails due to CAM-4527: end execution listeners are executed twice for the signal end event
// assertIsCanceledActivityInstances(allInstances, "signalEnd", 1);
// assertNonCompletingActivityInstance(allInstances, "signalEnd");
assertNonCanceledActivityInstance(allInstances, "eventSubprocessStart");
assertNonCompletingActivityInstance(allInstances, "eventSubprocessStart");
assertNonCanceledActivityInstance(allInstances, "eventSubprocessEnd");
assertIsCompletingActivityInstances(allInstances, "eventSubprocessEnd", 1);
}
use of org.camunda.bpm.engine.history.HistoricActivityInstance in project camunda-bpm-platform by camunda.
the class HistoricActivityInstanceStateTest method assertCorrectCompletingState.
private void assertCorrectCompletingState(List<HistoricActivityInstance> allInstances, String activityId, int expectedCount, boolean completing) {
int found = 0;
for (HistoricActivityInstance instance : allInstances) {
if (instance.getActivityId().equals(activityId)) {
found++;
assertEquals(String.format("expect <%s> to be %scompleting", activityId, (completing ? "" : "non-")), completing, instance.isCompleteScope());
}
}
assertTrue("contains entry for activity <" + activityId + ">", found > 0);
if (expectedCount != -1) {
assertTrue("contains <" + expectedCount + "> entries for activity <" + activityId + ">", found == expectedCount);
}
}
use of org.camunda.bpm.engine.history.HistoricActivityInstance in project camunda-bpm-platform by camunda.
the class HistoricActivityInstanceStateTest method assertCorrectCanceledState.
private void assertCorrectCanceledState(List<HistoricActivityInstance> allInstances, String activityId, int expectedCount, boolean canceled) {
int found = 0;
for (HistoricActivityInstance instance : allInstances) {
if (instance.getActivityId().equals(activityId)) {
found++;
assertEquals(String.format("expect <%s> to be %scanceled", activityId, (canceled ? "" : "non-")), canceled, instance.isCanceled());
}
}
assertTrue("contains entry for activity <" + activityId + ">", found > 0);
if (expectedCount != -1) {
assertTrue("contains <" + expectedCount + "> entries for activity <" + activityId + ">", found == expectedCount);
}
}
Aggregations