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

Manik Surtani msurtani at jboss.com
Thu Jul 20 05:03:53 EDT 2006


  User: msurtani
  Date: 06/07/20 05:03:53

  Modified:    tests/functional/org/jboss/cache/lock   AcquireAllTest.java
                        BreakDeadMemberLocksTest.java
  Log:
  Fixed some broken UTs to use the new xml parsers, cache factories, etc.
  
  Revision  Changes    Path
  1.4       +9 -8      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.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- AcquireAllTest.java	11 Aug 2005 15:25:42 -0000	1.3
  +++ AcquireAllTest.java	20 Jul 2006 09:03:53 -0000	1.4
  @@ -6,13 +6,14 @@
   import org.jboss.cache.DataNode;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.TreeCache;
  +import org.jboss.cache.config.Configuration;
   import org.jboss.cache.transaction.DummyTransactionManager;
   
   import javax.transaction.Transaction;
   
   /**
    * @author Bela Ban
  - * @version $Id: AcquireAllTest.java,v 1.3 2005/08/11 15:25:42 msurtani Exp $
  + * @version $Id: AcquireAllTest.java,v 1.4 2006/07/20 09:03:53 msurtani Exp $
    */
   public class AcquireAllTest extends TestCase {
      TreeCache cache=null, cache2;
  @@ -47,7 +48,7 @@
         DataNode root;
         Object owner=Thread.currentThread();
   
  -      cache=createCache(TreeCache.LOCAL, IsolationLevel.SERIALIZABLE);
  +      cache=createCache(Configuration.CacheMode.LOCAL, IsolationLevel.SERIALIZABLE);
         cache.put("/a/b/c", null);
         cache.put("/1/2/3", null);
   
  @@ -70,11 +71,11 @@
         DataNode root;
         Object owner=Thread.currentThread();
   
  -      cache2=createCache(TreeCache.REPL_ASYNC, IsolationLevel.SERIALIZABLE);
  +      cache2=createCache(Configuration.CacheMode.REPL_ASYNC, IsolationLevel.SERIALIZABLE);
         cache2.put("/a/b/c", null);
         cache2.put("/1/2/3", null);
   
  -      cache=createCache(TreeCache.REPL_ASYNC, IsolationLevel.SERIALIZABLE);
  +      cache=createCache(Configuration.CacheMode.REPL_ASYNC, IsolationLevel.SERIALIZABLE);
         root=cache.getRoot();
   
         root.acquireAll(owner, 2000, DataNode.LOCK_TYPE_READ);
  @@ -90,11 +91,11 @@
   
   
   
  -   TreeCache createCache(int mode, IsolationLevel level) throws Exception {
  +   TreeCache createCache(Configuration.CacheMode mode, IsolationLevel level) throws Exception {
         TreeCache c=new TreeCache();
  -      c.setCacheMode(mode);
  -      c.setIsolationLevel(level);
  -      c.setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
  +      c.getConfiguration().setCacheMode(mode);
  +      c.getConfiguration().setIsolationLevel(level);
  +      c.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
         c.createService();
         c.startService();
         return c;
  
  
  
  1.2       +14 -21    JBossCache/tests/functional/org/jboss/cache/lock/BreakDeadMemberLocksTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: BreakDeadMemberLocksTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/lock/BreakDeadMemberLocksTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- BreakDeadMemberLocksTest.java	23 Feb 2006 08:05:35 -0000	1.1
  +++ BreakDeadMemberLocksTest.java	20 Jul 2006 09:03:53 -0000	1.2
  @@ -22,23 +22,17 @@
   
   package org.jboss.cache.lock;
   
  -import java.util.HashMap;
  -import java.util.Map;
  -import java.util.Set;
  +import junit.framework.TestCase;
  +import org.jboss.cache.TreeCache;
  +import org.jboss.cache.factories.XmlConfigurationParser;
  +import org.jboss.cache.misc.TestingUtil;
   
   import javax.transaction.Synchronization;
   import javax.transaction.Transaction;
   import javax.transaction.TransactionManager;
  -
  -import org.jboss.cache.PropertyConfigurator;
  -import org.jboss.cache.TreeCache;
  -import org.jboss.cache.TreeCacheMBean;
  -import org.jboss.cache.misc.TestingUtil;
  -import org.jgroups.Address;
  -import org.jgroups.MembershipListener;
  -import org.jgroups.View;
  -
  -import junit.framework.TestCase;
  +import java.util.HashMap;
  +import java.util.Map;
  +import java.util.Set;
   
   /**
    * Tests the breaking of locks held by dead members.
  @@ -60,7 +54,7 @@
      
      public void testBreakDeadMemberLocks() throws Exception
      {
  -      TreeCacheMBean cacheA = createCache("A");
  +      TreeCache cacheA = createCache("A");
         
         cacheA.put("/1/A", "1", "A");
         cacheA.put("/1/A", "2", "A");
  @@ -69,10 +63,10 @@
         cacheA.put("/1/A/I", "1", "A");
         cacheA.put("/1/A/I", "2", "A");
         
  -      TreeCacheMBean cacheB = createCache("B");
  +      TreeCache cacheB = createCache("B");
         
         // Pause to give caches time to see each other
  -      TestingUtil.blockUntilViewsReceived(new TreeCacheMBean[] { cacheA, cacheB }, 60000);
  +      TestingUtil.blockUntilViewsReceived(new TreeCache[] { cacheA, cacheB }, 60000);
         
         final TransactionManager tm = cacheB.getTransactionManager();
         tm.begin();
  @@ -139,14 +133,13 @@
         }
      }
      
  -   protected TreeCacheMBean createCache(String cacheID) throws Exception
  +   protected TreeCache createCache(String cacheID) throws Exception
      {
         if (caches.get(cacheID) != null)
         throw new IllegalStateException(cacheID + " already created");
         
  -      TreeCacheMBean tree=new TreeCache();
  -      PropertyConfigurator config=new PropertyConfigurator();
  -      config.configure(tree, "META-INF/replSync-service.xml");
  +      TreeCache tree=new TreeCache();
  +      tree.setConfiguration(new XmlConfigurationParser().parseFile("META-INF/replSync-service.xml"));
         
         tree.createService();
         tree.startService();
  
  
  



More information about the jboss-cvs-commits mailing list