Search in sources :

Example 1 with TestEventListenerOsgi

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));
}
Also used : TestEventListenerOsgi(org.motechproject.event.osgi.TestEventListenerOsgi) MotechEvent(org.motechproject.event.MotechEvent) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 MotechEvent (org.motechproject.event.MotechEvent)1 TestEventListenerOsgi (org.motechproject.event.osgi.TestEventListenerOsgi)1