Search in sources :

Example 1 with CacheEntryCreatedEvent

use of org.infinispan.notifications.cachelistener.event.CacheEntryCreatedEvent in project infinispan by infinispan.

the class MultipleListenerConverterTest method insertKeyValueAndVerifyListenerNotifications.

private void insertKeyValueAndVerifyListenerNotifications(Collection<CacheListener> listeners) {
    cache.put("key", "value");
    int i = 1;
    for (CacheListener listener : listeners) {
        assertEquals("Listener" + i + "failed", 2, listener.getEvents().size());
        Event event = listener.getEvents().get(0);
        assertEquals("Listener" + i + "failed", Event.Type.CACHE_ENTRY_CREATED, event.getType());
        CacheEntryCreatedEvent createdEvent = (CacheEntryCreatedEvent) event;
        assertTrue("Listener" + i + "failed", createdEvent.isPre());
        assertEquals("Listener" + i + "failed", "key", createdEvent.getKey());
        assertEquals("Listener" + i + "failed", "null-listener-" + i, createdEvent.getValue());
        event = listener.getEvents().get(1);
        assertEquals("Listener" + i + "failed", Event.Type.CACHE_ENTRY_CREATED, event.getType());
        createdEvent = (CacheEntryCreatedEvent) event;
        assertFalse("Listener" + i + "failed", createdEvent.isPre());
        assertEquals("Listener" + i + "failed", "key", createdEvent.getKey());
        assertEquals("Listener" + i + "failed", "value-listener-" + i, createdEvent.getValue());
        ++i;
    }
}
Also used : Event(org.infinispan.notifications.cachelistener.event.Event) CacheEntryCreatedEvent(org.infinispan.notifications.cachelistener.event.CacheEntryCreatedEvent) CacheEntryCreatedEvent(org.infinispan.notifications.cachelistener.event.CacheEntryCreatedEvent)

Aggregations

CacheEntryCreatedEvent (org.infinispan.notifications.cachelistener.event.CacheEntryCreatedEvent)1 Event (org.infinispan.notifications.cachelistener.event.Event)1