Package org.infinispan.client.hotrod.event.CustomEventLogListener

Examples of org.infinispan.client.hotrod.event.CustomEventLogListener.StaticCustomEventLogListener


         remote.removeClientListener(eventListener);
      }
   }

   public void testCustomEvents() {
      StaticCustomEventLogListener eventListener = new StaticCustomEventLogListener();
      Cache<Integer, String> embedded = cacheFactory.getEmbeddedCache();
      RemoteCache<Integer, String> remote = cacheFactory.getHotRodCache();
      remote.addClientListener(eventListener);
      try {
         eventListener.expectNoEvents();
         remote.put(1, "one");
         assertEquals("one", embedded.get(1));
         eventListener.expectOnlyCreatedCustomEvent(1, "one");
         remote.put(1, "new-one");
         assertEquals("new-one", embedded.get(1));
         eventListener.expectOnlyModifiedCustomEvent(1, "new-one");
         remote.remove(1);
         assertNull(embedded.get(1));
         eventListener.expectOnlyRemovedCustomEvent(1, null);
      } finally {
         remote.removeClientListener(eventListener);
      }
   }
View Full Code Here


      server.addConverterFactory("dynamic-converter-factory", new DynamicConverterFactory());
      return server;
   }

   public void testCustomEvents() {
      final StaticCustomEventLogListener eventListener = new StaticCustomEventLogListener();
      withClientListener(eventListener, new RemoteCacheManagerCallable(remoteCacheManager) {
         @Override
         public void call() {
            RemoteCache<Integer, String> cache = rcm.getCache();
            eventListener.expectNoEvents();
            cache.put(1, "one");
            eventListener.expectOnlyCreatedCustomEvent(1, "one");
            cache.put(1, "newone");
            eventListener.expectOnlyModifiedCustomEvent(1, "newone");
            cache.remove(1);
            eventListener.expectOnlyRemovedCustomEvent(1, null);
         }
      });
   }
View Full Code Here

         }
      });
   }

   public void testConvertedEventsReplay() {
      final StaticCustomEventLogListener staticEventListener = new StaticCustomEventLogListener();
      RemoteCache<Integer, String> cache = remoteCacheManager.getCache();
      cache.put(1, "one");
      withClientListener(staticEventListener, new RemoteCacheManagerCallable(remoteCacheManager) {
         @Override
         public void call() {
            staticEventListener.expectOnlyCreatedCustomEvent(1, "one");
         }
      });
      final DynamicCustomEventLogListener dynamicEventListener = new DynamicCustomEventLogListener();
      cache.put(2, "two");
      withClientListener(dynamicEventListener, null, new Object[]{2}, new RemoteCacheManagerCallable(remoteCacheManager) {
View Full Code Here

         }
      });
   }

   public void testConversionInCluster() {
      final StaticCustomEventLogListener eventListener = new StaticCustomEventLogListener();
      withClientListener(eventListener, new RemoteCacheManagerCallable(client(0)) {
         @Override
         public void call() {
            RemoteCache<Integer, String> c3 = client(2).getCache();
            eventListener.expectNoEvents();
            c3.put(1, "one");
            eventListener.expectOnlyCreatedCustomEvent(1, "one");
            c3.put(2, "two");
            eventListener.expectOnlyCreatedCustomEvent(2, "two");
            c3.remove(1);
            eventListener.expectOnlyRemovedCustomEvent(1, null);
            c3.remove(2);
            eventListener.expectOnlyRemovedCustomEvent(2, null);
         }
      });
   }
View Full Code Here

      server.addCacheEventConverterFactory("dynamic-converter-factory", new DynamicConverterFactory(), null);
      return server;
   }

   public void testCustomEvents() {
      final StaticCustomEventLogListener eventListener = new StaticCustomEventLogListener();
      withClientListener(eventListener, new RemoteCacheManagerCallable(remoteCacheManager) {
         @Override
         public void call() {
            RemoteCache<Integer, String> cache = rcm.getCache();
            eventListener.expectNoEvents();
            cache.put(1, "one");
            eventListener.expectOnlyCreatedCustomEvent(1, "one");
            cache.put(1, "newone");
            eventListener.expectOnlyModifiedCustomEvent(1, "newone");
            cache.remove(1);
            eventListener.expectOnlyRemovedCustomEvent(1, null);
         }
      });
   }
View Full Code Here

         }
      });
   }

   public void testConvertedNoEventsReplay() {
      final StaticCustomEventLogListener staticEventListener = new StaticCustomEventLogListener();
      RemoteCache<Integer, String> cache = remoteCacheManager.getCache();
      cache.put(1, "one");
      withClientListener(staticEventListener, new RemoteCacheManagerCallable(remoteCacheManager) {
         @Override
         public void call() {
            staticEventListener.expectNoEvents();
         }
      });
      final DynamicCustomEventLogListener dynamicEventListener = new DynamicCustomEventLogListener();
      cache.put(2, "two");
      withClientListener(dynamicEventListener, null, new Object[]{2}, new RemoteCacheManagerCallable(remoteCacheManager) {
         @Override
         public void call() {
            staticEventListener.expectNoEvents();
         }
      });
   }
View Full Code Here

         }
      });
   }

   public void testConversionInCluster() {
      final StaticCustomEventLogListener eventListener = new StaticCustomEventLogListener();
      withClientListener(eventListener, new RemoteCacheManagerCallable(client(0)) {
         @Override
         public void call() {
            RemoteCache<Integer, String> c3 = client(2).getCache();
            eventListener.expectNoEvents();
            c3.put(1, "one");
            eventListener.expectOnlyCreatedCustomEvent(1, "one");
            c3.put(2, "two");
            eventListener.expectOnlyCreatedCustomEvent(2, "two");
            c3.remove(1);
            eventListener.expectOnlyRemovedCustomEvent(1, null);
            c3.remove(2);
            eventListener.expectOnlyRemovedCustomEvent(2, null);
         }
      });
   }
View Full Code Here

         remote.removeClientListener(eventListener);
      }
   }

   public void testCustomEvents() {
      StaticCustomEventLogListener eventListener = new StaticCustomEventLogListener();
      Cache<Integer, String> embedded = cacheFactory.getEmbeddedCache();
      RemoteCache<Integer, String> remote = cacheFactory.getHotRodCache();
      remote.addClientListener(eventListener);
      try {
         eventListener.expectNoEvents();
         remote.put(1, "one");
         assertEquals("one", embedded.get(1));
         eventListener.expectOnlyCreatedCustomEvent(1, "one");
         remote.put(1, "new-one");
         assertEquals("new-one", embedded.get(1));
         eventListener.expectOnlyModifiedCustomEvent(1, "new-one");
         remote.remove(1);
         assertNull(embedded.get(1));
         eventListener.expectOnlyRemovedCustomEvent(1, null);
      } finally {
         remote.removeClientListener(eventListener);
      }
   }
View Full Code Here

TOP

Related Classes of org.infinispan.client.hotrod.event.CustomEventLogListener.StaticCustomEventLogListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.