Examples of ReplicationListener


Examples of org.jboss.cache.util.internals.replicationlisteners.ReplicationListener

         Fqn fqn = Fqn.fromString("/a/b/c");

         assert  null == cache0.get(fqn, "k");
         cache0.put(fqn, "key", "val");

         ReplicationListener replicationListener = ReplicationListener.getReplicationListener(cache0);
         replicationListener.expect(DataGravitationCleanupCommand.class);
         TransactionManager transactionManager = cache1.getTransactionManager();

         transactionManager.begin();
         assert cache1.get(fqn, "key").equals("val");
         transactionManager.commit();
         replicationListener.waitForReplicationToOccur(1000);

         assert !cache0.exists(fqn);

      } finally
      {
View Full Code Here

Examples of org.jboss.cache.util.internals.replicationlisteners.ReplicationListener

   public void createCaches() throws Exception
   {
      caches = createCaches(3, false, false);
      for (Cache c : caches)
      {
        ReplicationListener listener = ReplicationListener.getReplicationListener(c);
        replListener.add(listener);
      }
   }
View Full Code Here

Examples of org.jboss.cache.util.internals.replicationlisteners.ReplicationListener

   private void dataGravitationEvictionTest(boolean autoGravitate) throws Exception
   {
      // create 3 cachePool
      List<CacheSPI<Object, Object>> caches = createCachesWithCacheLoader(3, autoGravitate, false, passivation);
      ReplicationListener replListener0 = ReplicationListener.getReplicationListener(caches.get(0));
      ReplicationListener replListener1 = ReplicationListener.getReplicationListener(caches.get(1));
      ReplicationListener replListener2 = ReplicationListener.getReplicationListener(caches.get(2));

      cachesTL.set(caches);
      CacheLoader[] loaders = getLoaders(caches);
      Fqn b1 = fqnTransformer.getBackupFqn(caches.get(0).getLocalAddress(), fqn);
      Fqn b2 = fqnTransformer.getBackupFqn(caches.get(2).getLocalAddress(), fqn);
View Full Code Here

Examples of org.jboss.cache.util.internals.replicationlisteners.ReplicationListener

      cache2 = null;
   }

   public void testTransactionalReplication() throws Exception
   {
      ReplicationListener cache1Listener = ReplicationListener.getReplicationListener(cache);
      ReplicationListener cache2Listener = ReplicationListener.getReplicationListener(cache2);

      cache2Listener.expect(PutKeyValueCommand.class);
      // outside of tx scope
      cache.put("/a", "k", "v");
      cache2Listener.waitForReplicationToOccur(5000);

      assert cache2.get("/a", "k").equals("v");

      // now, a transactional call
      cache1Listener.expect(PrepareCommand.class);
View Full Code Here

Examples of org.jboss.cache.util.internals.replicationlisteners.ReplicationListener

         {
            BuddyReplicationTestsBase.waitForSingleBuddy(cache1, cache2);
            Set backupNameSet = new HashSet(nameSet);
            backupNameSet.remove(BuddyFqnTransformer.BUDDY_BACKUP_SUBTREE);

            ReplicationListener replListener1 = ReplicationListener.getReplicationListener(cache1);
            replListener1.expect(DataGravitationCleanupCommand.class);
            cache2.getInvocationContext().getOptionOverrides().setForceDataGravitation(true);
            Node backupNode = cache2.getNode(fqn);
            replListener1.waitForReplicationToOccur();

           assert backupNode.getChildrenNames().equals(backupNameSet) : "Expecting " + backupNameSet + " but got " + backupNode.getChildrenNames();
         }
         else
         {
View Full Code Here

Examples of org.jboss.cache.util.internals.replicationlisteners.ReplicationListener

   }


   public void testEvictionOfBackupRegions() throws Exception
   {
      ReplicationListener replicationListener2 = ReplicationListener.getReplicationListener(cache2);
      replicationListener2.expect(PutKeyValueCommand.class);
      cache1.put(fqn, "k", "v");
      replicationListener2.waitForReplicationToOccur();

      assert cache1.peek(fqn, false, false) != null : "Node should exist";
      assert cache2.peek(fqnTransformer.getBackupFqn(cache1.getLocalAddress(), fqn), false, false) != null : "Node should exist on backup";

      // now wait for eviction to kick in - for up to 2 secs
View Full Code Here

Examples of org.jboss.cache.util.internals.replicationlisteners.ReplicationListener

   public void testTxCompletion() throws Exception
   {
      AsyncReplTestTL tl = threadLocal.get();
      CacheSPI<Object, Object> cache1 = tl.cache1;
      CacheSPI<Object, Object> cache2 = tl.cache2;
      ReplicationListener replListener1 = tl.replListener1;
      ReplicationListener replListener2 = tl.replListener2;
     
      // test a very simple replication.
      Fqn fqn = Fqn.fromString("/a");
      String key = "key";

      replListener2.expect(PutKeyValueCommand.class);
      cache1.put(fqn, key, "value1");
      // allow for replication
      replListener2.waitForReplicationToOccur();
      assertEquals("value1", cache1.get(fqn, key));
      assertEquals("value1", cache2.get(fqn, key));

      TransactionManager mgr = cache1.getTransactionManager();
      mgr.begin();

      replListener2.expect(PutKeyValueCommand.class);
      cache1.put(fqn, key, "value2");
      assertEquals("value2", cache1.get(fqn, key));
      assertEquals("value1", cache2.get(fqn, key));

      mgr.commit();
      replListener2.waitForReplicationToOccur();

      assertEquals("value2", cache1.get(fqn, key));
      assertEquals("value2", cache2.get(fqn, key));

      mgr.begin();
View Full Code Here

Examples of org.jboss.cache.util.internals.replicationlisteners.ReplicationListener

   public void testPutShouldNotReplicateToDifferentCluster()
   {
      AsyncReplTestTL tl = threadLocal.get();
      CacheSPI<Object, Object> cache1 = tl.cache1;
      CacheSPI<Object, Object> cache2 = tl.cache2;
      ReplicationListener replListener1 = tl.replListener1;
      ReplicationListener replListener2 = tl.replListener2;

      CacheSPI<Object, Object> cache3 = null, cache4 = null;
      try
      {
         cache3 = createCache("DifferentGroup");
         cache4 = createCache("DifferentGroup");
         replListener2.expect(PutKeyValueCommand.class);
         cache1.put("/a/b/c", "age", 38);
         // because we use async repl, modfication may not yet have been propagated to cache2, so
         // we have to wait a little
         replListener2.waitForReplicationToOccur(500);
         assertNull("Should not have replicated", cache3.get("/a/b/c", "age"));
      }
      catch (Exception e)
      {
         fail(e.toString());
View Full Code Here

Examples of org.jboss.cache.util.internals.replicationlisteners.ReplicationListener

   public void testStateTransfer()
   {
      AsyncReplTestTL tl = threadLocal.get();
      CacheSPI<Object, Object> cache1 = tl.cache1;
      CacheSPI<Object, Object> cache2 = tl.cache2;
      ReplicationListener replListener1 = tl.replListener1;
      ReplicationListener replListener2 = tl.replListener2;

      CacheSPI<Object, Object> cache4 = null;
      try
      {
         cache1.put("a/b/c", "age", 38);
View Full Code Here

Examples of org.jboss.cache.util.internals.replicationlisteners.ReplicationListener

   {
      Integer age;
      AsyncReplTestTL tl = threadLocal.get();
      CacheSPI<Object, Object> cache1 = tl.cache1;
      CacheSPI<Object, Object> cache2 = tl.cache2;
      ReplicationListener replListener1 = tl.replListener1;
      ReplicationListener replListener2 = tl.replListener2;

      try
      {
         cache1.put("/a/b/c", "age", 38);
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.