[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/replicated ...

Manik Surtani msurtani at jboss.com
Tue Jul 18 06:50:47 EDT 2006


  User: msurtani
  Date: 06/07/18 06:50:47

  Modified:    tests/functional/org/jboss/cache/replicated  
                        SyncCacheListenerTest.java SyncReplTxTest.java
  Log:
  Checked in new Habanero interfaces
  Updated codebase to deal with new interfaces
  
  Revision  Changes    Path
  1.7       +9 -72     JBossCache/tests/functional/org/jboss/cache/replicated/SyncCacheListenerTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: SyncCacheListenerTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/replicated/SyncCacheListenerTest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -b -r1.6 -r1.7
  --- SyncCacheListenerTest.java	5 May 2006 12:06:59 -0000	1.6
  +++ SyncCacheListenerTest.java	18 Jul 2006 10:50:47 -0000	1.7
  @@ -13,13 +13,12 @@
   import junit.framework.TestSuite;
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  -import org.jboss.cache.AbstractTreeCacheListener;
  +import org.jboss.cache.AbstractCacheListener;
   import org.jboss.cache.CacheException;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.TreeCache;
   import org.jboss.cache.lock.IsolationLevel;
   import org.jboss.cache.transaction.DummyTransactionManager;
  -import org.jgroups.View;
   
   import javax.naming.Context;
   import javax.transaction.NotSupportedException;
  @@ -32,7 +31,7 @@
   /**
    * Test out the TreeCacheListener
    *
  - * @version $Revision: 1.6 $
  + * @version $Revision: 1.7 $
    */
   public class SyncCacheListenerTest extends TestCase {
      TreeCache cache1, cache2;
  @@ -236,7 +235,7 @@
      }
   
   
  -   class Listener extends AbstractTreeCacheListener
  +   class Listener extends AbstractCacheListener
      {
         Object key_ = null;
         public void put(String fqn, Object key, Object val) throws Exception
  @@ -254,24 +253,9 @@
         }
   
   
  -      public void nodeCreated(Fqn fqn) {
  -         //To change body of implemented methods use File | Settings | File Templates.
  -      }
  -
  -      public void nodeRemoved(Fqn fqn) {
  -         //To change body of implemented methods use File | Settings | File Templates.
  -      }
  -
  -      public void nodeLoaded(Fqn fqn) {
  -         //To change body of implemented methods use File | Settings | File Templates.
  -      }
  -      
  -      public void nodeEvicted(Fqn fqn) {
  -         //To change body of implemented methods use File | Settings | File Templates.
  -      }
  -
  -      public void nodeModified(Fqn fqn)
  +      public void nodeModified(Fqn fqn, boolean pre, boolean isLocal, Map data)
         {
  +          if (!pre) {
            log_.debug("nodeModified visited with fqn: " +fqn);
            try {
               // test out if we can get the read lock since there is a write lock going as well.
  @@ -281,74 +265,27 @@
               fail("nodeModified: test failed with exception: " +e);
            }
         }
  -
  -      public void nodeVisited(Fqn fqn) {
  -         //To change body of implemented methods use File | Settings | File Templates.
  -      }
  -
  -      public void cacheStarted(TreeCache cache) {
  -         //To change body of implemented methods use File | Settings | File Templates.
         }
   
  -      public void cacheStopped(TreeCache cache) {
  -         //To change body of implemented methods use File | Settings | File Templates.
         }
   
  -      public void viewChange(View new_view)  // might be MergeView after merging
  +   class RemoteListener extends AbstractCacheListener
         {
  -         //To change body of implemented methods use File | Settings | File Templates.
  -      }
  -   }
   
  -   class RemoteListener extends AbstractTreeCacheListener
  -   {
  -
  -      public void nodeCreated(Fqn fqn) {
  -         //To change body of implemented methods use File | Settings | File Templates.
  -      }
  -
  -      public void nodeRemoved(Fqn fqn) {
  -         //To change body of implemented methods use File | Settings | File Templates.
  -      }
  -
  -      public void nodeLoaded(Fqn fqn) {
  -         //To change body of implemented methods use File | Settings | File Templates.
  -      }
  -      
  -      public void nodeEvicted(Fqn fqn) {
  -         //To change body of implemented methods use File | Settings | File Templates.
  -      }
  -
  -      public void nodeRemove(Fqn fqn, boolean isPre, boolean isLocal)
  +      public void nodeRemoved(Fqn fqn, boolean isPre, boolean isLocal, Map data)
         {
   System.out.println("nodeRemove visited with fqn: " +fqn + ", isPre: "+ isPre + ", isLocal "+isLocal);
            log_.debug("nodeRemove visited with fqn: " +fqn + ", isPre: "+ isPre + ", isLocal "+isLocal);
   	 assertFalse("node was removed on remote cache so isLocal should be false", isLocal);
         }
   
  -      public void nodeModify(Fqn fqn, boolean isPre, boolean isLocal)
  +      public void nodeModified(Fqn fqn, boolean isPre, boolean isLocal, Map data)
         {
   System.out.println("nodeModify visited with fqn: " +fqn + ", isPre: "+ isPre + ", isLocal "+isLocal);
            log_.debug("nodeModify visited with fqn: " +fqn + ", isPre: "+ isPre + ", isLocal "+isLocal);
   	 assertFalse("node was modified on remote cache so isLocal should be false", isLocal);
         }
   
  -      public void nodeVisited(Fqn fqn) {
  -         //To change body of implemented methods use File | Settings | File Templates.
  -      }
  -
  -      public void cacheStarted(TreeCache cache) {
  -         //To change body of implemented methods use File | Settings | File Templates.
  -      }
  -
  -      public void cacheStopped(TreeCache cache) {
  -         //To change body of implemented methods use File | Settings | File Templates.
  -      }
  -
  -      public void viewChange(View new_view)  // might be MergeView after merging
  -      {
  -         //To change body of implemented methods use File | Settings | File Templates.
  -      }
      }
   
       public static Test suite() throws Exception {
  
  
  
  1.10      +17 -9     JBossCache/tests/functional/org/jboss/cache/replicated/SyncReplTxTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: SyncReplTxTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/replicated/SyncReplTxTest.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -b -r1.9 -r1.10
  --- SyncReplTxTest.java	5 May 2006 10:04:48 -0000	1.9
  +++ SyncReplTxTest.java	18 Jul 2006 10:50:47 -0000	1.10
  @@ -13,23 +13,24 @@
   import junit.framework.TestSuite;
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  -import org.jboss.cache.AbstractTreeCacheListener;
   import org.jboss.cache.CacheException;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.TreeCache;
  +import org.jboss.cache.AbstractCacheListener;
   import org.jboss.cache.aop.AOPInstance;
   import org.jboss.cache.lock.IsolationLevel;
   import org.jboss.cache.transaction.DummyTransactionManager;
   
   import javax.naming.Context;
   import javax.transaction.*;
  +import java.util.Map;
   
   /**
    * Replicated unit test for sync transactional TreeCache
    * Note: we use DummyTransactionManager for Tx purpose instead of relying on
    * jta.
    *
  - * @version $Revision: 1.9 $
  + * @version $Revision: 1.10 $
    */
   public class SyncReplTxTest extends TestCase {
       private static Log log = LogFactory.getLog(SyncReplTxTest.class);
  @@ -1110,7 +1111,7 @@
         }
      }
   
  -   static class CallbackListener extends AbstractTreeCacheListener {
  +   static class CallbackListener extends AbstractCacheListener {
   
         TreeCache callbackCache;
         Object    callbackKey;
  @@ -1123,7 +1124,9 @@
            cache.addTreeCacheListener(this);
         }
   
  -      public void nodeModified(Fqn fqn)
  +      public void nodeModified(Fqn fqn, boolean pre, boolean isLocal, Map data)
  +      {
  +          if (!pre)
         {
            // Lock on a mutex so test can't check for an exception
            // until the get call completes
  @@ -1139,6 +1142,7 @@
               }
            }
         }
  +      }
   
         Exception getCallbackException() {
            synchronized(mutex) {
  @@ -1157,7 +1161,9 @@
            callbackTM = callbackCache.getTransactionManager();
         }
   
  -      public void nodeModified(Fqn fqn)
  +      public void nodeModified(Fqn fqn, boolean pre, boolean isLocal, Map data)
  +      {
  +          if (!pre)
         {
            try
            {
  @@ -1167,7 +1173,7 @@
                  tx.registerSynchronization(new TransactionAborter(tx));
               }
               else {
  -               super.nodeModified(fqn);
  +               super.nodeModified(fqn, pre, isLocal, data);
               }
   
            }
  @@ -1178,10 +1184,11 @@
                  ex = e;
            }
         }
  +      }
   
      }
   
  -   static class TransactionAborterListener extends AbstractTreeCacheListener {
  +   static class TransactionAborterListener extends AbstractCacheListener {
   
         TransactionManager callbackTM;
         Object mutex = new Object();
  @@ -1192,8 +1199,9 @@
            cache.addTreeCacheListener(this);
         }
   
  -      public void nodeModified(Fqn fqn)
  +      public void nodeModified(Fqn fqn, boolean pre, boolean isLocal, Map data)
         {
  +          if (!pre) {
            synchronized(mutex) {
               try
               {
  @@ -1209,7 +1217,7 @@
                  if (ex == null)
                     ex = e;
               }
  -         }
  +         } }
         }
   
         Exception getCallbackException() {
  
  
  



More information about the jboss-cvs-commits mailing list