Package org.activiti.engine.delegate.event

Examples of org.activiti.engine.delegate.event.ActivitiEvent


   
    // Clear any events received (eg. engine initialisation)
    listener.clearEventsReceived();
   
    // Dispath a custom event
    ActivitiEvent event = new ActivitiEventImpl(ActivitiEventType.CUSTOM);
    processEngineConfiguration.getEventDispatcher().dispatchEvent(event);
   
    assertEquals(1, listener.getEventsReceived().size());
    assertEquals(event, listener.getEventsReceived().get(0));
  }
View Full Code Here


   
    // Clear any events received (eg. engine initialisation)
    listener.clearEventsReceived();
   
    // Dispath a custom event
    ActivitiEvent event = new ActivitiEventImpl(ActivitiEventType.CUSTOM);
    processEngineConfiguration.getEventDispatcher().dispatchEvent(event);
   
    assertEquals(1, listener.getEventsReceived().size());
    assertEquals(event, listener.getEventsReceived().get(0));
    listener.clearEventsReceived();
View Full Code Here

    processEngineConfiguration.getClock().setCurrentTime(tomorrow.getTime());
    waitForJobExecutorToProcessAllJobs(2000, 100);

    // Check timeout has been dispatched
    assertEquals(1, listener.getEventsReceived().size());
    ActivitiEvent timeOutEvent = listener.getEventsReceived().get(0);
    assertEquals("ACTIVITY_TIMEOUT evet expected", ActivitiEventType.ACTIVITY_TIMEOUT, timeOutEvent.getType());
  }
View Full Code Here

    Job theJob = managementService.createJobQuery().processInstanceId(processInstance.getId()).singleResult();
    assertNotNull(theJob);

    // Check if create-event has been dispatched
    assertEquals(2, listener.getEventsReceived().size());
    ActivitiEvent event = listener.getEventsReceived().get(0);
    assertEquals(ActivitiEventType.ENTITY_CREATED, event.getType());
    checkEventContext(event, theJob, false);

    event = listener.getEventsReceived().get(1);
    assertEquals(ActivitiEventType.ENTITY_INITIALIZED, event.getType());
    checkEventContext(event, theJob, false);

    listener.clearEventsReceived();

    // fire timer for the first time
View Full Code Here

   
    // Check delete-event has been dispatched
    assertEquals(5, listener.getEventsReceived().size());

    // First, the timer was fired
    ActivitiEvent event = listener.getEventsReceived().get(0);
    assertEquals(ActivitiEventType.TIMER_FIRED, event.getType());
    checkEventContext(event, theJob, true);

    // Second, the job-entity was deleted, as the job was executed
    event = listener.getEventsReceived().get(1);
    assertEquals(ActivitiEventType.ENTITY_DELETED, event.getType());
    checkEventContext(event, theJob, true);
   
    // Next, a job failed event is dispatched
    event = listener.getEventsReceived().get(2);
    assertEquals(ActivitiEventType.JOB_EXECUTION_FAILURE, event.getType());
    checkEventContext(event, theJob, true);
   
    // Finally, an update-event is received and the job count is decremented
    event = listener.getEventsReceived().get(3);
    assertEquals(ActivitiEventType.ENTITY_UPDATED, event.getType());
    checkEventContext(event, theJob, true);
   
    event = listener.getEventsReceived().get(4);
    assertEquals(ActivitiEventType.JOB_RETRIES_DECREMENTED, event.getType());
    assertEquals(0, ((Job) ((ActivitiEntityEvent) event).getEntity()).getRetries());
    checkEventContext(event, theJob, true);
  }
View Full Code Here

    Job theJob = managementService.createJobQuery().processInstanceId(processInstance.getId()).singleResult();
    assertNotNull(theJob);
   
    // Check if create-event has been dispatched
    assertEquals(2, listener.getEventsReceived().size());
    ActivitiEvent event = listener.getEventsReceived().get(0);
    assertEquals(ActivitiEventType.ENTITY_CREATED, event.getType());
    checkEventContext(event, theJob, false);
   
    event = listener.getEventsReceived().get(1);
    assertEquals(ActivitiEventType.ENTITY_INITIALIZED, event.getType());
    checkEventContext(event, theJob, false);
   
    listener.clearEventsReceived();

    // Update the job-entity. Check if update event is dispatched with update job entity
    managementService.setJobRetries(theJob.getId(), 5);
    assertEquals(1, listener.getEventsReceived().size());
    event = listener.getEventsReceived().get(0);
    assertEquals(ActivitiEventType.ENTITY_UPDATED, event.getType());
    Job updatedJob = (Job) ((ActivitiEntityEvent) event).getEntity();
    assertEquals(5, updatedJob.getRetries());
    checkEventContext(event, theJob, true);
   
    listener.clearEventsReceived();
   
    // Force timer to fire
    Calendar tomorrow = Calendar.getInstance();
    tomorrow.add(Calendar.DAY_OF_YEAR, 1);
    processEngineConfiguration.getClock().setCurrentTime(tomorrow.getTime());
    waitForJobExecutorToProcessAllJobs(2000, 100);
   
    // Check delete-event has been dispatched
    assertEquals(3, listener.getEventsReceived().size());
   
    // First, a timer fired event has been dispatched
    event = listener.getEventsReceived().get(0);
    assertEquals(ActivitiEventType.TIMER_FIRED, event.getType());
    checkEventContext(event, theJob, true);
   
    // Next, a delete event has been dispatched
    event = listener.getEventsReceived().get(1);
    assertEquals(ActivitiEventType.ENTITY_DELETED, event.getType());
    checkEventContext(event, theJob, true);
   
    // Finally, a complete event has been dispatched
    event = listener.getEventsReceived().get(2);
    assertEquals(ActivitiEventType.JOB_EXECUTION_SUCCESS, event.getType());
    checkEventContext(event, theJob, true);
  }
View Full Code Here

  private void assertSequence(ActivitiEntityEvent before, ActivitiEntityEvent after) {
    int beforeIndex = 0;
    int afterIndex = 0;
    for (int index = 0; index < listener.getEventsReceived().size(); index++) {
      ActivitiEvent activitiEvent = listener.getEventsReceived().get(index);

      if (isEqual(before, activitiEvent))
        beforeIndex = index;
      if (isEqual(after, activitiEvent))
        afterIndex = index;
View Full Code Here

TOP

Related Classes of org.activiti.engine.delegate.event.ActivitiEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.