Search in sources :

Example 1 with DynamicCustomEventLogListener

use of org.infinispan.client.hotrod.event.CustomEventLogListener.DynamicCustomEventLogListener in project infinispan by infinispan.

the class ClientCustomEventsTest method testParameterBasedConversion.

public void testParameterBasedConversion() {
    final DynamicCustomEventLogListener<Integer> l = new DynamicCustomEventLogListener<>(remoteCacheManager.getCache());
    withClientListener(l, null, new Object[] { 2 }, remote -> {
        l.expectNoEvents();
        remote.put(1, "one");
        l.expectCreatedEvent(new CustomEvent(1, "one", 0));
        remote.put(2, "two");
        l.expectCreatedEvent(new CustomEvent(2, null, 0));
    });
}
Also used : CustomEvent(org.infinispan.client.hotrod.event.CustomEventLogListener.CustomEvent) DynamicCustomEventLogListener(org.infinispan.client.hotrod.event.CustomEventLogListener.DynamicCustomEventLogListener)

Example 2 with DynamicCustomEventLogListener

use of org.infinispan.client.hotrod.event.CustomEventLogListener.DynamicCustomEventLogListener in project infinispan by infinispan.

the class EmbeddedHotRodTest method testCustomEventsDynamic.

public void testCustomEventsDynamic() {
    DynamicCustomEventLogListener<Integer> l = new DynamicCustomEventLogListener<>(cacheFactory.getHotRodCache());
    withClientListener(l, null, new Object[] { 2 }, remote -> {
        l.expectNoEvents();
        remote.put(1, "one");
        Cache<Integer, String> embedded = getEmbeddedCache();
        assertEquals("one", embedded.get(1));
        l.expectCreatedEvent(new CustomEvent(1, "one", 0));
        remote.put(2, "two");
        assertEquals("two", embedded.get(2));
        l.expectCreatedEvent(new CustomEvent(2, null, 0));
        remote.remove(1);
        assertNull(embedded.get(1));
        l.expectRemovedEvent(new CustomEvent(1, null, 0));
        remote.remove(2);
        assertNull(embedded.get(2));
        l.expectRemovedEvent(new CustomEvent(2, null, 0));
    });
}
Also used : CustomEvent(org.infinispan.client.hotrod.event.CustomEventLogListener.CustomEvent) DynamicCustomEventLogListener(org.infinispan.client.hotrod.event.CustomEventLogListener.DynamicCustomEventLogListener)

Example 3 with DynamicCustomEventLogListener

use of org.infinispan.client.hotrod.event.CustomEventLogListener.DynamicCustomEventLogListener in project infinispan by infinispan.

the class ClientCustomEventsTest method testConvertedNoEventsReplay.

public void testConvertedNoEventsReplay() {
    RemoteCache<Integer, String> cache = remoteCacheManager.getCache();
    StaticCustomEventLogListener staticEventListener = new StaticCustomEventLogListener<>(cache);
    cache.put(1, "one");
    withClientListener(staticEventListener, remote -> staticEventListener.expectNoEvents());
    DynamicCustomEventLogListener dynamicEventListener = new DynamicCustomEventLogListener<>(cache);
    cache.put(2, "two");
    withClientListener(dynamicEventListener, null, new Object[] { 2 }, remote -> staticEventListener.expectNoEvents());
}
Also used : StaticCustomEventLogListener(org.infinispan.client.hotrod.event.CustomEventLogListener.StaticCustomEventLogListener) RawStaticCustomEventLogListener(org.infinispan.client.hotrod.event.CustomEventLogListener.RawStaticCustomEventLogListener) DynamicCustomEventLogListener(org.infinispan.client.hotrod.event.CustomEventLogListener.DynamicCustomEventLogListener)

Aggregations

DynamicCustomEventLogListener (org.infinispan.client.hotrod.event.CustomEventLogListener.DynamicCustomEventLogListener)3 CustomEvent (org.infinispan.client.hotrod.event.CustomEventLogListener.CustomEvent)2 RawStaticCustomEventLogListener (org.infinispan.client.hotrod.event.CustomEventLogListener.RawStaticCustomEventLogListener)1 StaticCustomEventLogListener (org.infinispan.client.hotrod.event.CustomEventLogListener.StaticCustomEventLogListener)1