use of org.activiti.engine.delegate.event.ActivitiActivityCancelledEvent in project Activiti by Activiti.
the class ActivityEventsTest method testActivityTimeOutEventInCallActivity.
@Deployment
public void testActivityTimeOutEventInCallActivity() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("timerOnCallActivity");
Job theJob = managementService.createTimerJobQuery().processInstanceId(processInstance.getId()).singleResult();
assertThat(theJob).isNotNull();
// Force timer to fire
Calendar timeToFire = Calendar.getInstance();
timeToFire.add(Calendar.HOUR, 2);
timeToFire.add(Calendar.MINUTE, 5);
processEngineConfiguration.getClock().setCurrentTime(timeToFire.getTime());
waitForJobExecutorToProcessAllJobs(5000, 500);
// Check timeout-events have been dispatched
assertThat(listener.getEventsReceived()).extracting(ActivitiEvent::getType).containsOnly(ActivitiEventType.ACTIVITY_CANCELLED).hasSize(4);
assertThat(listener.getEventsReceived()).extracting(event -> ((ActivitiActivityCancelledEvent) event).getActivityId(), event -> ((ActivitiActivityCancelledEvent) event).getCause()).containsExactlyInAnyOrder(tuple("innerTask1", "boundary event (boundaryTimer)"), tuple("innerTask2", "boundary event (boundaryTimer)"), tuple("callActivity", "boundary event (boundaryTimer)"), tuple("innerSubprocess", "boundary event (boundaryTimer)"));
}
Aggregations