use of org.motechproject.event.listener.SampleEventListener in project motech by motech.
the class EventListenerRegistryTest method testRegisterForSameEventTwice.
@Test
public void testRegisterForSameEventTwice() {
List<String> et = new ArrayList<String>();
et.add("org.motechproject.server.someevent");
et.add("org.motechproject.server.someevent");
EventListener sel = new SampleEventListener();
registry.registerListener(sel, et);
Set<EventListener> el = registry.getListeners(et.get(0));
assertNotNull(el);
assertTrue(el.size() == 1);
assertTrue(el.contains(sel));
el = registry.getListeners(et.get(1));
assertNotNull(el);
assertTrue(el.size() == 1);
assertTrue(el.contains(sel));
}
use of org.motechproject.event.listener.SampleEventListener in project motech by motech.
the class EventListenerRegistryTest method testAddThenRemoveListener.
@Test
public void testAddThenRemoveListener() {
List<String> et = new ArrayList<String>();
et.add("org.motechproject.server.someevent");
EventListener sel = new SampleEventListener();
registry.registerListener(sel, et);
Set<EventListener> el = registry.getListeners("org.motechproject.server.someevent");
assertEquals(1, el.size());
registry.clearListenersForBean("TestEventListener");
el = registry.getListeners("org.motechproject.server.someevent");
assertEquals(0, el.size());
}
use of org.motechproject.event.listener.SampleEventListener in project motech by motech.
the class EventListenerRegistryTest method testHasListener_Yes.
@Test
public void testHasListener_Yes() {
registry.registerListener(new SampleEventListener(), "org.motechproject.server.someevent");
assertTrue(registry.hasListener("org.motechproject.server.someevent"));
}
use of org.motechproject.event.listener.SampleEventListener in project motech by motech.
the class EventListenerRegistryTest method testRegisterMultipleListener.
@Test
public void testRegisterMultipleListener() {
EventListener sel = new SampleEventListener();
EventListener sel2 = new FooEventListener();
registry.registerListener(sel, "org.motechproject.server.someevent");
registry.registerListener(sel2, "org.motechproject.server.someevent");
Set<EventListener> el = registry.getListeners("org.motechproject.server.someevent");
assertNotNull(el);
assertTrue(el.size() == 2);
assertTrue(el.contains(sel));
assertTrue(el.contains(sel2));
}
use of org.motechproject.event.listener.SampleEventListener in project motech by motech.
the class EventListenerRegistryTest method testAddingWildCardListenerThenRemoving.
@Test
public void testAddingWildCardListenerThenRemoving() {
List<String> et = new ArrayList<String>();
et.add("org.motechproject.server.*");
EventListener sel = new SampleEventListener();
registry.registerListener(sel, et);
Set<EventListener> el = registry.getListeners("org.motechproject.server.someevent.test");
assertEquals(1, el.size());
registry.clearListenersForBean("TestEventListener");
el = registry.getListeners("org.motechproject.server.someevent");
assertEquals(0, el.size());
}
Aggregations