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

Elias Ross genman at noderunner.net
Sun Nov 19 22:53:56 EST 2006


  User: genman  
  Date: 06/11/19 22:53:56

  Modified:    tests/functional/org/jboss/cache/lock   AcquireAllTest.java
                        IdentityLockTest.java
  Log:
  JBCACHE-867, Move methods from the ProxyImpl to Node, refactor Node classes as well
  
  Revision  Changes    Path
  1.7       +15 -12    JBossCache/tests/functional/org/jboss/cache/lock/AcquireAllTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: AcquireAllTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/lock/AcquireAllTest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -b -r1.6 -r1.7
  --- AcquireAllTest.java	6 Sep 2006 15:30:58 -0000	1.6
  +++ AcquireAllTest.java	20 Nov 2006 03:53:56 -0000	1.7
  @@ -5,6 +5,8 @@
   import junit.framework.TestSuite;
   import org.jboss.cache.DataNode;
   import org.jboss.cache.Fqn;
  +import org.jboss.cache.Node;
  +import org.jboss.cache.NodeImpl;
   import org.jboss.cache.TreeCache;
   import org.jboss.cache.config.Configuration;
   import org.jboss.cache.transaction.DummyTransactionManager;
  @@ -13,7 +15,7 @@
   
   /**
    * @author Bela Ban
  - * @version $Id: AcquireAllTest.java,v 1.6 2006/09/06 15:30:58 msurtani Exp $
  + * @version $Id: AcquireAllTest.java,v 1.7 2006/11/20 03:53:56 genman Exp $
    */
   public class AcquireAllTest extends TestCase
   {
  @@ -48,23 +50,23 @@
   
      public void testAcquireAll() throws Exception
      {
  -      DataNode root;
  +      NodeImpl root;
         Object owner = Thread.currentThread();
   
         cache = createCache(Configuration.CacheMode.LOCAL, IsolationLevel.SERIALIZABLE);
         cache.put("/a/b/c", null);
         cache.put("/1/2/3", null);
   
  -      root = cache.getRoot();
  -
  +      root = (NodeImpl)cache.getRoot();
  +      NodeLock lock = root.getNodeSPI().getLock();
   
  -      root.acquireAll(owner, 2000, DataNode.LockType.READ);
  -      root.releaseAll(owner);
  +      lock.acquireAll(owner, 2000, NodeLock.LockType.READ);
  +      lock.releaseAll(owner);
   
         assertEquals(0, cache.getNumberOfLocksHeld());
   
  -      root.acquireAll(owner, 2000, DataNode.LockType.WRITE);
  -      root.releaseAll(owner);
  +      lock.acquireAll(owner, 2000, NodeLock.LockType.WRITE);
  +      lock.releaseAll(owner);
   
         assertEquals(0, cache.getNumberOfLocksHeld());
      }
  @@ -81,14 +83,15 @@
   
         cache = createCache(Configuration.CacheMode.REPL_ASYNC, IsolationLevel.SERIALIZABLE);
         root = cache.getRoot();
  +      NodeLock lock = root.getNodeSPI().getLock();
   
  -      root.acquireAll(owner, 2000, DataNode.LockType.READ);
  -      root.releaseAll(owner);
  +      lock.acquireAll(owner, 2000, NodeLock.LockType.READ);
  +      lock.releaseAll(owner);
   
         assertEquals(0, cache.getNumberOfLocksHeld());
   
  -      root.acquireAll(owner, 2000, DataNode.LockType.WRITE);
  -      root.releaseAll(owner);
  +      lock.acquireAll(owner, 2000, NodeLock.LockType.WRITE);
  +      lock.releaseAll(owner);
   
         assertEquals(0, cache.getNumberOfLocksHeld());
      }
  
  
  
  1.7       +7 -6      JBossCache/tests/functional/org/jboss/cache/lock/IdentityLockTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: IdentityLockTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/lock/IdentityLockTest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -b -r1.6 -r1.7
  --- IdentityLockTest.java	30 Aug 2006 19:09:56 -0000	1.6
  +++ IdentityLockTest.java	20 Nov 2006 03:53:56 -0000	1.7
  @@ -14,6 +14,7 @@
   import org.apache.commons.logging.LogFactory;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.GlobalTransaction;
  +import org.jboss.cache.Node;
   import org.jboss.cache.misc.TestingUtil;
   
   
  @@ -22,15 +23,15 @@
    *
    * @author Bela Ban
    * @author Ben Wang
  - * @version $Revision: 1.6 $
  + * @version $Revision: 1.7 $
    */
   public class IdentityLockTest extends TestCase
   {
  -   IdentityLock lock_;
  +   NodeLock lock_;
      Object other_ = new Object();
      Log logger_ = LogFactory.getLog(IdentityLockTest.class);
      static Throwable thread_ex = null;
  -   final Fqn FQN = Fqn.fromString("/dummyfqn");
  +   final Node NODE = null;
   
   
      public IdentityLockTest(String name)
  @@ -41,7 +42,7 @@
      protected void setUp() throws Exception
      {
         super.setUp();
  -      lock_ = new IdentityLock(FQN);
  +      lock_ = new IdentityLock(NODE);
   
   //        try { Thread.TestingUtil.sleepThread(10000); } catch (Exception e) {
   //        }
  @@ -59,14 +60,14 @@
      {
         log("set lock level to RWUpgrade ...");
         LockStrategyFactory.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
  -      lock_ = new IdentityLock(FQN);
  +      lock_ = new IdentityLock(NODE);
      }
   
      protected void setLevelSerial()
      {
         log("set lock level to SimpleLock ...");
         LockStrategyFactory.setIsolationLevel(IsolationLevel.SERIALIZABLE);
  -      lock_ = new IdentityLock(FQN);
  +      lock_ = new IdentityLock(NODE);
      }
   
      protected GlobalTransaction getGlobalTransactionFromThread()
  
  
  



More information about the jboss-cvs-commits mailing list