assertNotNull(process);
assertNotNull(process.getEventListeners());
assertEquals(8, process.getEventListeners().size());
// Listener with class
EventListener listener = process.getEventListeners().get(0);
assertEquals("ENTITY_CREATE", listener.getEvents());
assertEquals("org.activiti.test.MyListener", listener.getImplementation());
assertEquals(ImplementationType.IMPLEMENTATION_TYPE_CLASS, listener.getImplementationType());
// Listener with class, but no specific event (== all events)
listener = process.getEventListeners().get(1);
assertNull(listener.getEvents());
assertEquals("org.activiti.test.AllEventTypesListener", listener.getImplementation());
assertEquals(ImplementationType.IMPLEMENTATION_TYPE_CLASS, listener.getImplementationType());
// Listener with delegate expression
listener = process.getEventListeners().get(2);
assertEquals("ENTITY_DELETE", listener.getEvents());
assertEquals("${myListener}", listener.getImplementation());
assertEquals(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION, listener.getImplementationType());
// Listener that throws a signal-event
listener = process.getEventListeners().get(3);
assertEquals("ENTITY_DELETE", listener.getEvents());
assertEquals("theSignal", listener.getImplementation());
assertEquals(ImplementationType.IMPLEMENTATION_TYPE_THROW_SIGNAL_EVENT, listener.getImplementationType());
// Listener that throws a global signal-event
listener = process.getEventListeners().get(4);
assertEquals("ENTITY_DELETE", listener.getEvents());
assertEquals("theSignal", listener.getImplementation());
assertEquals(ImplementationType.IMPLEMENTATION_TYPE_THROW_GLOBAL_SIGNAL_EVENT, listener.getImplementationType());
// Listener that throws a message-event
listener = process.getEventListeners().get(5);
assertEquals("ENTITY_DELETE", listener.getEvents());
assertEquals("theMessage", listener.getImplementation());
assertEquals(ImplementationType.IMPLEMENTATION_TYPE_THROW_MESSAGE_EVENT, listener.getImplementationType());
// Listener that throws an error-event
listener = process.getEventListeners().get(6);
assertEquals("ENTITY_DELETE", listener.getEvents());
assertEquals("123", listener.getImplementation());
assertEquals(ImplementationType.IMPLEMENTATION_TYPE_THROW_ERROR_EVENT, listener.getImplementationType());
// Listener restricted to a specific entity
listener = process.getEventListeners().get(7);
assertEquals("ENTITY_DELETE", listener.getEvents());
assertEquals("123", listener.getImplementation());
assertEquals(ImplementationType.IMPLEMENTATION_TYPE_THROW_ERROR_EVENT, listener.getImplementationType());
assertEquals("job", listener.getEntityType());
}