use of org.activiti.engine.history.HistoricActivityInstance in project Activiti by Activiti.
the class HistoricActivityInstanceTest method testHistoricActivityInstanceForEventsQuery.
@Deployment
public void testHistoricActivityInstanceForEventsQuery() {
ProcessInstance pi = runtimeService.startProcessInstanceByKey("eventProcess");
assertEquals(1, taskService.createTaskQuery().count());
runtimeService.signalEventReceived("signal");
assertProcessEnded(pi.getId());
assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityId("noop").list().size());
assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityId("userTask").list().size());
assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityId("intermediate-event").list().size());
assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityId("start").list().size());
assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityId("end").list().size());
// TODO: Discuss if boundary events will occur in the log!
// assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityId("boundaryEvent").list().size());
HistoricActivityInstance intermediateEvent = historyService.createHistoricActivityInstanceQuery().activityId("intermediate-event").singleResult();
assertNotNull(intermediateEvent.getStartTime());
assertNotNull(intermediateEvent.getEndTime());
HistoricActivityInstance startEvent = historyService.createHistoricActivityInstanceQuery().activityId("start").singleResult();
assertNotNull(startEvent.getStartTime());
assertNotNull(startEvent.getEndTime());
HistoricActivityInstance endEvent = historyService.createHistoricActivityInstanceQuery().activityId("end").singleResult();
assertNotNull(endEvent.getStartTime());
assertNotNull(endEvent.getEndTime());
}
use of org.activiti.engine.history.HistoricActivityInstance in project Activiti by Activiti.
the class HistoricActivityInstanceTest method testHistoricActivityInstanceCalledProcessId.
@Deployment(resources = { "org/activiti/engine/test/history/calledProcess.bpmn20.xml", "org/activiti/engine/test/history/HistoricActivityInstanceTest.testCallSimpleSubProcess.bpmn20.xml" })
public void testHistoricActivityInstanceCalledProcessId() {
runtimeService.startProcessInstanceByKey("callSimpleSubProcess");
HistoricActivityInstance historicActivityInstance = historyService.createHistoricActivityInstanceQuery().activityId("callSubProcess").singleResult();
HistoricProcessInstance oldInstance = historyService.createHistoricProcessInstanceQuery().processDefinitionKey("calledProcess").singleResult();
assertEquals(oldInstance.getId(), historicActivityInstance.getCalledProcessInstanceId());
}
use of org.activiti.engine.history.HistoricActivityInstance in project Activiti by Activiti.
the class HistoricActivityInstanceTest method testEventBasedGateway.
/**
* Test to validate fix for ACT-1399: Boundary-event and event-based auditing
*/
@Deployment
public void testEventBasedGateway() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("catchSignal");
Execution waitingExecution = runtimeService.createExecutionQuery().signalEventSubscriptionName("alert").singleResult();
assertNotNull(waitingExecution);
runtimeService.signalEventReceived("alert", waitingExecution.getId());
assertEquals(0L, runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId()).count());
HistoricActivityInstance historicActivityInstance = historyService.createHistoricActivityInstanceQuery().activityId("eventBasedgateway").processInstanceId(processInstance.getId()).singleResult();
assertNotNull(historicActivityInstance);
}
use of org.activiti.engine.history.HistoricActivityInstance in project Activiti by Activiti.
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.activiti.engine.history.HistoricActivityInstance in project Activiti by Activiti.
the class HistoricActivityInstanceTest method testBoundaryEvent.
/**
* Test to validate fix for ACT-1399: Boundary-event and event-based auditing
*/
@Deployment
public void testBoundaryEvent() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("boundaryEventProcess");
// Complete the task with the boundary-event on it
Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
assertNotNull(task);
taskService.complete(task.getId());
assertEquals(0L, runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId()).count());
// Check if there is NO historic activity instance for a boundary-event that has not triggered
HistoricActivityInstance historicActivityInstance = historyService.createHistoricActivityInstanceQuery().activityId("boundary").processInstanceId(processInstance.getId()).singleResult();
assertNull(historicActivityInstance);
// Now check the history when the boundary-event is fired
processInstance = runtimeService.startProcessInstanceByKey("boundaryEventProcess");
task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
runtimeService.signalEventReceived("alert", task.getExecutionId());
assertEquals(0L, runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId()).count());
historicActivityInstance = historyService.createHistoricActivityInstanceQuery().activityId("boundary").processInstanceId(processInstance.getId()).singleResult();
assertNotNull(historicActivityInstance);
}
Aggregations