Search in sources :

Example 11 with ActivitiActivityCancelledEvent

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)"));
}
Also used : Task(org.activiti.engine.task.Task) ActivitiEvent(org.activiti.engine.delegate.event.ActivitiEvent) PluggableActivitiTestCase(org.activiti.engine.impl.test.PluggableActivitiTestCase) Job(org.activiti.engine.runtime.Job) Assertions.tuple(org.assertj.core.api.Assertions.tuple) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) EventLogger(org.activiti.engine.impl.event.logger.EventLogger) ActivitiSignalEvent(org.activiti.engine.delegate.event.ActivitiSignalEvent) EventLogEntry(org.activiti.engine.event.EventLogEntry) ArrayList(java.util.ArrayList) ActivitiEventType(org.activiti.engine.delegate.event.ActivitiEventType) ActivitiActivityEventImpl(org.activiti.engine.delegate.event.impl.ActivitiActivityEventImpl) Collectors.toList(java.util.stream.Collectors.toList) List(java.util.List) Calendar(java.util.Calendar) ActivitiActivityCancelledEvent(org.activiti.engine.delegate.event.ActivitiActivityCancelledEvent) ActivitiActivityEvent(org.activiti.engine.delegate.event.ActivitiActivityEvent) ActivitiMessageEvent(org.activiti.engine.delegate.event.ActivitiMessageEvent) ActivitiErrorEvent(org.activiti.engine.delegate.event.ActivitiErrorEvent) ProcessInstance(org.activiti.engine.runtime.ProcessInstance) Collections.singletonMap(java.util.Collections.singletonMap) Execution(org.activiti.engine.runtime.Execution) Deployment(org.activiti.engine.test.Deployment) ActivitiSignalEventImpl(org.activiti.engine.delegate.event.impl.ActivitiSignalEventImpl) ActivitiActivityCancelledEvent(org.activiti.engine.delegate.event.ActivitiActivityCancelledEvent) Calendar(java.util.Calendar) ProcessInstance(org.activiti.engine.runtime.ProcessInstance) ActivitiEvent(org.activiti.engine.delegate.event.ActivitiEvent) Job(org.activiti.engine.runtime.Job) Deployment(org.activiti.engine.test.Deployment)

Aggregations

ActivitiActivityCancelledEvent (org.activiti.engine.delegate.event.ActivitiActivityCancelledEvent)11 ProcessInstance (org.activiti.engine.runtime.ProcessInstance)10 Deployment (org.activiti.engine.test.Deployment)10 ActivitiEvent (org.activiti.engine.delegate.event.ActivitiEvent)6 Execution (org.activiti.engine.runtime.Execution)5 Calendar (java.util.Calendar)3 ActivitiCancelledEvent (org.activiti.engine.delegate.event.ActivitiCancelledEvent)3 ActivitiMessageEvent (org.activiti.engine.delegate.event.ActivitiMessageEvent)3 ActivitiSignalEventImpl (org.activiti.engine.delegate.event.impl.ActivitiSignalEventImpl)3 Job (org.activiti.engine.runtime.Job)3 ArrayList (java.util.ArrayList)2 Task (org.activiti.engine.task.Task)2 IdmDelegationDefinitionDto (eu.bcvsolutions.idm.core.api.dto.IdmDelegationDefinitionDto)1 IdmDelegationDto (eu.bcvsolutions.idm.core.api.dto.IdmDelegationDto)1 OperationResultDto (eu.bcvsolutions.idm.core.api.dto.OperationResultDto)1 IdmDelegationFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmDelegationFilter)1 WorkflowTaskInstanceDto (eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowTaskInstanceDto)1 Collections.singletonMap (java.util.Collections.singletonMap)1 List (java.util.List)1 UUID (java.util.UUID)1