Search in sources :

Example 1 with BusinessProcessEvent

use of org.camunda.bpm.engine.cdi.BusinessProcessEvent in project camunda-bpm-platform by camunda.

the class EventNotificationTest method testMultiInstanceEventsAfterExternalTrigger.

@Test
@Deployment
public void testMultiInstanceEventsAfterExternalTrigger() {
    runtimeService.startProcessInstanceByKey("process");
    TestEventListener listenerBean = getBeanInstance(TestEventListener.class);
    listenerBean.reset();
    List<Task> tasks = taskService.createTaskQuery().list();
    assertEquals(3, tasks.size());
    for (Task task : tasks) {
        taskService.complete(task.getId());
    }
    // 6: three user task instances (complete + end)
    // 1: one mi body instance (end)
    // 1: one sequence flow instance (take)
    // 2: one end event instance (start + end)
    // = 5
    Set<BusinessProcessEvent> eventsReceived = listenerBean.getEventsReceived();
    assertThat(eventsReceived.size(), is(10));
}
Also used : Task(org.camunda.bpm.engine.task.Task) BusinessProcessEvent(org.camunda.bpm.engine.cdi.BusinessProcessEvent) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 2 with BusinessProcessEvent

use of org.camunda.bpm.engine.cdi.BusinessProcessEvent in project camunda-bpm-platform by camunda.

the class CdiEventListener method notify.

public void notify(DelegateExecution execution) throws Exception {
    // test whether cdi is setup correctly. (if not, just do not deliver the event)
    if (!testCdiSetup()) {
        return;
    }
    BusinessProcessEvent event = createEvent(execution);
    Annotation[] qualifiers = getQualifiers(event);
    getBeanManager().fireEvent(event, qualifiers);
}
Also used : BusinessProcessEvent(org.camunda.bpm.engine.cdi.BusinessProcessEvent) Annotation(java.lang.annotation.Annotation)

Example 3 with BusinessProcessEvent

use of org.camunda.bpm.engine.cdi.BusinessProcessEvent in project camunda-bpm-platform by camunda.

the class CdiEventListener method notify.

public void notify(DelegateTask task) {
    // test whether cdi is setup correctly. (if not, just do not deliver the event)
    if (!testCdiSetup()) {
        return;
    }
    BusinessProcessEvent event = createEvent(task);
    Annotation[] qualifiers = getQualifiers(event);
    getBeanManager().fireEvent(event, qualifiers);
}
Also used : BusinessProcessEvent(org.camunda.bpm.engine.cdi.BusinessProcessEvent) Annotation(java.lang.annotation.Annotation)

Aggregations

BusinessProcessEvent (org.camunda.bpm.engine.cdi.BusinessProcessEvent)3 Annotation (java.lang.annotation.Annotation)2 Task (org.camunda.bpm.engine.task.Task)1 Deployment (org.camunda.bpm.engine.test.Deployment)1 Test (org.junit.Test)1