Package org.infinispan.util

Examples of org.infinispan.util.CountingRpcManager


   public void testWithoutReading() throws Exception {
      final Object key = new MagicKey("key", cache(0));
      final Cache<Object, Object> cache = cache(1);
      final TransactionManager tm = tm(1);
      final CountingRpcManager rpcManager = replaceRpcManager(cache);

      cache(0).put(key, "v0");

      tm.begin();
      rpcManager.resetStats();
      cache.getAdvancedCache().withFlags(Flag.IGNORE_RETURN_VALUES).put(key, "v1");
      AssertJUnit.assertEquals("Wrong number of gets after put.", 0, rpcManager.clusterGet);

      AssertJUnit.assertEquals("Wrong value read.", "v1", cache.get(key));
      AssertJUnit.assertEquals("Wrong number of gets after read.", 0, rpcManager.clusterGet);
View Full Code Here


   private void doTest(boolean initialized) throws Exception {
      final Object key = new MagicKey("key", cache(0));
      final Cache<Object, Object> cache = cache(1);
      final TransactionManager tm = tm(1);
      final CountingRpcManager rpcManager = replaceRpcManager(cache);

      if (initialized) {
         cache(0).put(key, "v1");
      }

      tm.begin();
      rpcManager.resetStats();
      AssertJUnit.assertEquals("Wrong value read.", initialized ? "v1" : null, cache.get(key));
      AssertJUnit.assertEquals("Wrong number of gets after read.", 1, rpcManager.clusterGet);

      AssertJUnit.assertEquals("Wrong put return value.", initialized ? "v1" : null, cache.put(key, "v2"));
      AssertJUnit.assertEquals("Wrong number of gets after put.", 1, rpcManager.clusterGet);
View Full Code Here

   private CountingRpcManager replaceRpcManager(Cache cache) {
      RpcManager current = TestingUtil.extractComponent(cache, RpcManager.class);
      if (current instanceof CountingRpcManager) {
         return (CountingRpcManager) current;
      }
      CountingRpcManager countingRpcManager = new CountingRpcManager(current);
      TestingUtil.replaceComponent(cache, RpcManager.class, countingRpcManager, true);
      return countingRpcManager;
   }
View Full Code Here

TOP

Related Classes of org.infinispan.util.CountingRpcManager

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.