use of org.mule.runtime.core.api.context.notification.ServerNotificationsTestCase.DummyNotification.EVENT_RECEIVED in project mule by mulesoft.
the class ServerNotificationsTestCase method testCustomNotifications.
@Test
public void testCustomNotifications() throws Exception {
final CountDownLatch latch = new CountDownLatch(2);
getNotificationListenerRegistry().registerListener((DummyNotificationListener) notification -> {
if (new IntegerAction(EVENT_RECEIVED).equals(notification.getAction())) {
customNotificationCount.incrementAndGet();
assertEquals("hello", ((EventObject) notification).getSource());
latch.countDown();
}
});
getNotificationDispatcher().dispatch(new DummyNotification("hello", EVENT_RECEIVED));
getNotificationDispatcher().dispatch(new DummyNotification("hello", EVENT_RECEIVED));
// Wait for the notifcation event to be fired as they are queued
latch.await(2000, MILLISECONDS);
assertEquals(2, customNotificationCount.get());
}
Aggregations