Examples of MagicKey


Examples of org.infinispan.distribution.MagicKey

      assert !recoveryOps(0).showInDoubtTransactions().isEmpty();
      assert !recoveryOps(1).showInDoubtTransactions().isEmpty();
   }

   protected Object getKey() {
      return new MagicKey(cache(2));
   }
View Full Code Here

Examples of org.infinispan.distribution.MagicKey

      createCluster(dcc, 4);
      waitForClusterToForm();
   }

   public void testPutOnNonOwner() {
      MagicKey mk = new MagicKey("key", cache(0));
      cache(3).getAdvancedCache().withFlags(Flag.SKIP_REMOTE_LOOKUP).put(mk, "value");

      assert cache(0).getAdvancedCache().withFlags(Flag.SKIP_REMOTE_LOOKUP).get(mk) != null;
      assert cache(1).getAdvancedCache().withFlags(Flag.SKIP_REMOTE_LOOKUP).get(mk) == null;
      assert cache(2).getAdvancedCache().withFlags(Flag.SKIP_REMOTE_LOOKUP).get(mk) == null;
View Full Code Here

Examples of org.infinispan.distribution.MagicKey

   @Test
   public void testFilter() {
      for (int i = 0; i < 10; ++i) {
         Cache<Object, Person> cache = cache(i % NUM_NODES, CACHE_NAME);
         Object key = new MagicKey(cache);
         Person value = new Person();
         value.setName("John");
         value.setAge(i + 30);
         cache.put(key, value);
      }
View Full Code Here

Examples of org.infinispan.distribution.MagicKey

      addClusterEnabledCacheManager(getConfigurationBuilder());
      waitForClusterToForm("replication");
      final AdvancedCache<Object, String> cache1 = advancedCache(0, "replication");
      final AdvancedCache<Object, String> cache2 = advancedCache(1, "replication");
      final AdvancedCache<Object, String> cache3 = advancedCache(2, "replication");
      final Object key = new MagicKey("k-no", cache1);

      cache3.withFlags(CACHE_MODE_LOCAL).put(key, "value");

      assertEquals("Cache '" + cache3 + "' should have the key.", "value", cache3.get(key));
      assertNull("Cache '" + cache1 + "' should *not* have the key.", cache1.get(key));
View Full Code Here

Examples of org.infinispan.distribution.MagicKey

   }

   public void testCacheLocalInPrimaryOwner() {
      final AdvancedCache<Object, String> cache1 =advancedCache(0, "replication");
      final AdvancedCache<Object, String> cache2 =advancedCache(1, "replication");
      final Object key = new MagicKey("k-po", cache1);

      cache1.withFlags(CACHE_MODE_LOCAL).put(key, "value");

      assertEquals("Cache '" + cache1 + "' should have the key.", "value", cache1.get(key));
      assertNull("Cache '" + cache2 + "' should *not* have the key.", cache2.get(key));
View Full Code Here

Examples of org.infinispan.distribution.MagicKey

   }

   public void testCacheLocalInBackupOwner() {
      final AdvancedCache<Object, String> cache1 =advancedCache(0, "replication");
      final AdvancedCache<Object, String> cache2 =advancedCache(1, "replication");
      final Object key = new MagicKey("k-bo", cache1);

      cache2.withFlags(CACHE_MODE_LOCAL).put(key, "value");

      assertEquals("Cache '" + cache2 + "' should have the key.", "value", cache2.get(key));
      assertNull("Cache '" + cache1 + "' should *not* have the key.", cache1.get(key));
View Full Code Here

Examples of org.infinispan.distribution.MagicKey

      final Cache<Object, Object> cache = cache(nodeIndex, cacheName);
      return getKeyForCache(cache);
   }

   protected Object getKeyForCache(Cache cache) {
      return new MagicKey(cache);
   }
View Full Code Here

Examples of org.infinispan.distribution.MagicKey

      final Cache<Object, Object> cache = cache(nodeIndex, cacheName);
      return getKeyForCache(cache);
   }

   protected Object getKeyForCache(Cache cache) {
      return new MagicKey(cache);
   }
View Full Code Here

Examples of org.infinispan.distribution.MagicKey

      return replicated ? address(0).equals(address(cache)) : DistributionTestHelper.isFirstOwner(cache, key);
   }

   private Object getKey(int i) {
      if (i < 0) {
         return replicated ? "KEY_" + i : new MagicKey("KEY_" + i, cache(0));
      }
      for (int j = keys.size(); j < i; ++j) {
         keys.add(replicated ? "KEY_" + (j + 1) : new MagicKey("KEY_" + (j + 1), cache(0)));
      }
      return keys.get(i - 1);
   }
View Full Code Here

Examples of org.infinispan.distribution.MagicKey

      FailInterceptor interceptor = new FailInterceptor();
      interceptor.failFor(PrepareCommand.class);
      InterceptorChain ic = TestingUtil.extractComponent(c2, InterceptorChain.class);
      ic.addInterceptorBefore(interceptor, TxDistributionInterceptor.class);

      MagicKey k1 = new MagicKey("k1", c1);

      tm(c1).begin();
      c1.put(k1, "v1");

      try {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.