Package org.jboss.cache.util.internals.replicationlisteners

Examples of org.jboss.cache.util.internals.replicationlisteners.ReplicationListener.expect()


      sas = new SetAttributesServlet(Collections.singletonMap(KEY, getAttributeValue(attr++)));
      InvalidationServlet invs = new InvalidationServlet();
      MultipleActionServlet mas = new MultipleActionServlet(sas, invs);
      ReplicationListener replListener1 = replListeners[1];
      replListener1.expectWithTx(PutDataMapCommand.class, RemoveNodeCommand.class);
      replListener1.expect(DataGravitationCleanupCommand.class);

      req = new Request(mgr0, sessionId, mas);
      req.execute();     
      replListener1.waitForReplicationToOccur();
View Full Code Here


      // gravitate to 2:
      ReplicationListener replListener0 = ReplicationListener.getReplicationListener(caches.get(0));
      ReplicationListener replListener1 = ReplicationListener.getReplicationListener(caches.get(1));
      replListener0.expect(DataGravitationCleanupCommand.class);
      replListener1.expect(DataGravitationCleanupCommand.class);
      caches.get(2).getNode(fqn)// expectWithTx entire subtree to gravitate.
      replListener0.waitForReplicationToOccur(); // cleanup commands are async
      replListener1.waitForReplicationToOccur(); // also wait untill the backup is cleaned

      Fqn newBackupFqn = fqnTransformer.getBackupFqn(caches.get(2).getLocalAddress(), fqn);
View Full Code Here

      TestingUtil.dumpCacheContents(caches);

      ReplicationListener replListener0 = ReplicationListener.getReplicationListener(caches.get(0));

      replListener0.expect(PutKeyValueCommand.class);
      caches.get(2).put(fqn, key, value);
      replListener0.waitForReplicationToOccur();


      TestingUtil.dumpCacheContents(caches);
View Full Code Here

      assert caches.get(1).peek(fqnTransformer.getBackupRoot(caches.get(0).getLocalAddress()), false) != null : "Should have new buddy's backup root.";
      assert caches.get(1).peek(fqnTransformer.getBackupRoot(cache2Addr), false) == null : "Should not have dead node as a backup root.";
      assert caches.get(1).peek(Fqn.fromRelativeElements(fqnTransformer.getDeadBackupRoot(cache2Addr), 1), false) == null : "Should not have dead node as a defunct backup root.";


      replListener0.expect(DataGravitationCleanupCommand.class);

      // according to data gravitation, a call to *any* cache should retrieve the data, and move the data to the new cache.
      assertEquals("Value should have gravitated", value, caches.get(1).get(fqn, key));
      replListener0.waitForReplicationToOccur();

View Full Code Here

         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();
View Full Code Here

   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");
View Full Code Here

            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();
View Full Code Here


   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";
View Full Code Here

     
      // 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));
View Full Code Here

      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();
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.