use of org.motechproject.event.osgi.TestEventListenerOsgi in project motech by motech.
the class EventBundleIT method testEventListenerWithAnnotation.
@Test
public void testEventListenerWithAnnotation() throws Exception {
final TestEventListenerOsgi testEventListenerOsgi = (TestEventListenerOsgi) ServiceRetriever.getWebAppContext(bundleContext, bundleContext.getBundle().getSymbolicName()).getBean("testEventListenerOsgi");
eventRelay.sendEventMessage(new MotechEvent(TestEventListenerOsgi.TEST_SUBJECT_OSGI));
final List<String> receivedEvents = testEventListenerOsgi.getReceivedEvents();
synchronized (receivedEvents) {
receivedEvents.wait(2000);
}
assertEquals(1, receivedEvents.size());
assertEquals(TestEventListenerOsgi.TEST_SUBJECT_OSGI, receivedEvents.get(0));
}
Aggregations