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

Manik Surtani msurtani at jboss.com
Thu Jan 11 08:49:06 EST 2007


  User: msurtani
  Date: 07/01/11 08:49:06

  Modified:    tests/functional/org/jboss/cache/transaction              
                        IsolationLevelNoneTest.java
                        InvocationContextCleanupTest.java
                        IsolationLevelReadCommittedNodeCreationRollbackTest.java
                        TransactionTest.java
                        IsolationLevelSerializableTest.java
                        AsyncRollbackTxTest.java ConcurrentBankTest.java
                        IsolationLevelReadCommittedTest.java
                        DeadlockTest.java
                        ReplicatedTransactionDeadlockTest.java
                        ConcurrentTransactionalTest.java PrepareTxTest.java
                        IsolationLevelRepeatableReadTest.java
                        SuspendTxTest.java
  Log:
  Changed CacheImpl ctor to be protected, and changed cache factories accordingly
  
  Revision  Changes    Path
  1.7       +5 -4      JBossCache/tests/functional/org/jboss/cache/transaction/IsolationLevelNoneTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: IsolationLevelNoneTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/transaction/IsolationLevelNoneTest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -b -r1.6 -r1.7
  --- IsolationLevelNoneTest.java	30 Dec 2006 17:49:53 -0000	1.6
  +++ IsolationLevelNoneTest.java	11 Jan 2007 13:49:06 -0000	1.7
  @@ -4,6 +4,7 @@
   import junit.framework.TestCase;
   import junit.framework.TestSuite;
   import org.jboss.cache.CacheImpl;
  +import org.jboss.cache.DefaultCacheFactory;
   import org.jboss.cache.DummyTransactionManagerLookup;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.config.Configuration;
  @@ -17,7 +18,7 @@
    * Tests whether modifications within callbacks (TreeCacheListener) are handled correctly
    *
    * @author Bela Ban
  - * @version $Id: IsolationLevelNoneTest.java,v 1.6 2006/12/30 17:49:53 msurtani Exp $
  + * @version $Id: IsolationLevelNoneTest.java,v 1.7 2007/01/11 13:49:06 msurtani Exp $
    */
   public class IsolationLevelNoneTest extends TestCase
   {
  @@ -47,7 +48,7 @@
   
      public void testWithoutTransactions() throws Exception
      {
  -      cache = new CacheImpl();
  +      cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
         cache.getConfiguration().setIsolationLevel(IsolationLevel.NONE);
         cache.start();
  @@ -61,7 +62,7 @@
   
      public void testWithTransactions() throws Exception
      {
  -      cache = new CacheImpl();
  +      cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
         cache.getConfiguration().setIsolationLevel(IsolationLevel.NONE);
         cache.setTransactionManagerLookup(new DummyTransactionManagerLookup());
  @@ -79,7 +80,7 @@
   
      public void testWithTransactionsRepeatableRead() throws Exception
      {
  -      cache = new CacheImpl();
  +      cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
         cache.getConfiguration().setIsolationLevel(IsolationLevel.REPEATABLE_READ);
         cache.setTransactionManagerLookup(new DummyTransactionManagerLookup());
  
  
  
  1.6       +10 -6     JBossCache/tests/functional/org/jboss/cache/transaction/InvocationContextCleanupTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: InvocationContextCleanupTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/transaction/InvocationContextCleanupTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -b -r1.5 -r1.6
  --- InvocationContextCleanupTest.java	30 Dec 2006 17:49:53 -0000	1.5
  +++ InvocationContextCleanupTest.java	11 Jan 2007 13:49:06 -0000	1.6
  @@ -8,6 +8,7 @@
   
   import junit.framework.TestCase;
   import org.jboss.cache.CacheImpl;
  +import org.jboss.cache.DefaultCacheFactory;
   import org.jboss.cache.config.Configuration;
   import org.jboss.cache.interceptors.OrderedSynchronizationHandler;
   import org.jboss.cache.misc.TestingUtil;
  @@ -28,7 +29,7 @@
   
      private CacheImpl createCache(boolean optimistic) throws Exception
      {
  -      CacheImpl cache = new CacheImpl();
  +      CacheImpl cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         cache.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
         if (optimistic) cache.getConfiguration().setNodeLockingScheme("OPTIMISTIC");
         cache.getConfiguration().setClusterName("InvocationContextCleanupTest");
  @@ -124,7 +125,9 @@
            }
            finally
            {
  -            if (tx != null) try
  +            if (tx != null)
  +            {
  +               try
               {
                  mgr.resume(tx);
               }
  @@ -133,6 +136,7 @@
               }
            }
         }
  +      }
   
         public void afterCompletion(int i)
         {
  
  
  
  1.5       +3 -2      JBossCache/tests/functional/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: IsolationLevelReadCommittedNodeCreationRollbackTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- IsolationLevelReadCommittedNodeCreationRollbackTest.java	30 Dec 2006 17:49:53 -0000	1.4
  +++ IsolationLevelReadCommittedNodeCreationRollbackTest.java	11 Jan 2007 13:49:06 -0000	1.5
  @@ -12,6 +12,7 @@
   import junit.framework.TestCase;
   import junit.framework.TestSuite;
   import org.jboss.cache.CacheImpl;
  +import org.jboss.cache.DefaultCacheFactory;
   import org.jboss.cache.DummyTransactionManagerLookup;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.config.Configuration;
  @@ -26,7 +27,7 @@
    * Tests READ_COMMITED isolation level.
    *
    * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
  - * @version $Id: IsolationLevelReadCommittedNodeCreationRollbackTest.java,v 1.4 2006/12/30 17:49:53 msurtani Exp $
  + * @version $Id: IsolationLevelReadCommittedNodeCreationRollbackTest.java,v 1.5 2007/01/11 13:49:06 msurtani Exp $
    */
   
   public class IsolationLevelReadCommittedNodeCreationRollbackTest extends TestCase
  @@ -52,7 +53,7 @@
         writerError = null;
         readerError = null;
   
  -      cache = new CacheImpl();
  +      cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
         cache.getConfiguration().setIsolationLevel(IsolationLevel.READ_COMMITTED);
         cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
  
  
  
  1.24      +3 -2      JBossCache/tests/functional/org/jboss/cache/transaction/TransactionTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: TransactionTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/transaction/TransactionTest.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -b -r1.23 -r1.24
  --- TransactionTest.java	4 Jan 2007 05:35:41 -0000	1.23
  +++ TransactionTest.java	11 Jan 2007 13:49:06 -0000	1.24
  @@ -13,6 +13,7 @@
   import junit.framework.TestSuite;
   import org.jboss.cache.CacheException;
   import org.jboss.cache.CacheImpl;
  +import org.jboss.cache.DefaultCacheFactory;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.GlobalTransaction;
   import org.jboss.cache.Node;
  @@ -38,7 +39,7 @@
    * Tests transactional access to a local CacheImpl.
    * Note: we use DummpyTranasctionManager to replace jta
    *
  - * @version $Id: TransactionTest.java,v 1.23 2007/01/04 05:35:41 msurtani Exp $
  + * @version $Id: TransactionTest.java,v 1.24 2007/01/11 13:49:06 msurtani Exp $
    */
   public class TransactionTest extends TestCase
   {
  @@ -68,7 +69,7 @@
         }
   
         tx = (UserTransaction) new InitialContext(p).lookup("UserTransaction");
  -      cache = new CacheImpl();
  +      cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         cache.getConfiguration().setClusterName("test");
         cache.getConfiguration().setInitialStateRetrievalTimeout(10000);
         cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
  
  
  
  1.5       +2 -2      JBossCache/tests/functional/org/jboss/cache/transaction/IsolationLevelSerializableTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: IsolationLevelSerializableTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/transaction/IsolationLevelSerializableTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- IsolationLevelSerializableTest.java	2 Jan 2007 18:26:05 -0000	1.4
  +++ IsolationLevelSerializableTest.java	11 Jan 2007 13:49:06 -0000	1.5
  @@ -8,11 +8,11 @@
   import junit.framework.TestSuite;
   import org.jboss.cache.Cache;
   import org.jboss.cache.CacheImpl;
  +import org.jboss.cache.DefaultCacheFactory;
   import org.jboss.cache.DummyTransactionManagerLookup;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.config.Configuration;
   import org.jboss.cache.config.Configuration.CacheMode;
  -import org.jboss.cache.factories.DefaultCacheFactory;
   import org.jboss.cache.lock.IsolationLevel;
   import org.jboss.cache.lock.TimeoutException;
   
  @@ -25,7 +25,7 @@
    * Tests READ_COMMITED isolation level.
    *
    * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
  - * @version $Id: IsolationLevelSerializableTest.java,v 1.4 2007/01/02 18:26:05 msurtani Exp $
  + * @version $Id: IsolationLevelSerializableTest.java,v 1.5 2007/01/11 13:49:06 msurtani Exp $
    */
   
   public class IsolationLevelSerializableTest extends TestCase
  
  
  
  1.3       +1 -1      JBossCache/tests/functional/org/jboss/cache/transaction/AsyncRollbackTxTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: AsyncRollbackTxTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/transaction/AsyncRollbackTxTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- AsyncRollbackTxTest.java	9 Jan 2007 01:43:10 -0000	1.2
  +++ AsyncRollbackTxTest.java	11 Jan 2007 13:49:06 -0000	1.3
  @@ -2,9 +2,9 @@
   
   import junit.framework.TestCase;
   import org.jboss.cache.CacheImpl;
  +import org.jboss.cache.DefaultCacheFactory;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.config.Configuration;
  -import org.jboss.cache.factories.DefaultCacheFactory;
   
   import javax.transaction.SystemException;
   import javax.transaction.TransactionManager;
  
  
  
  1.9       +10 -9     JBossCache/tests/functional/org/jboss/cache/transaction/ConcurrentBankTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ConcurrentBankTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/transaction/ConcurrentBankTest.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -b -r1.8 -r1.9
  --- ConcurrentBankTest.java	30 Dec 2006 19:48:45 -0000	1.8
  +++ ConcurrentBankTest.java	11 Jan 2007 13:49:06 -0000	1.9
  @@ -7,6 +7,7 @@
   import org.apache.commons.logging.LogFactory;
   import org.jboss.cache.CacheException;
   import org.jboss.cache.CacheImpl;
  +import org.jboss.cache.DefaultCacheFactory;
   import org.jboss.cache.factories.XmlConfigurationParser;
   import org.jboss.cache.lock.IsolationLevel;
   import org.jboss.cache.lock.TimeoutException;
  @@ -26,7 +27,7 @@
    *
    * @author <a href="mailto:spohl at users.sourceforge.net">Stefan Pohl</a>
    * @author Ben Wang
  - * @version $Revision: 1.8 $
  + * @version $Revision: 1.9 $
    */
   public class ConcurrentBankTest extends TestCase
   {
  @@ -64,7 +65,7 @@
            p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.cache.transaction.DummyContextFactory");
         }
   
  -      cache = new CacheImpl();
  +      cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
   
         cache.setConfiguration(new XmlConfigurationParser().parseFile("META-INF/local-lru-eviction-service.xml"));
   
  @@ -132,7 +133,7 @@
   
      static void log(String msg)
      {
  -//      System.out.println("-- [" + Thread.currentThread() + "]: " + msg);
  +      //      System.out.println("-- [" + Thread.currentThread() + "]: " + msg);
         logger_.info("-- [" + Thread.currentThread() + "]: " + msg);
      }
   
  @@ -180,8 +181,8 @@
                  }
   
                  tx.begin();
  -               HashMap accounts = getAccounts(); // read lock on NODE
  -               tx.commit();  // releases read lock
  +               HashMap accounts = getAccounts();// read lock on NODE
  +               tx.commit();// releases read lock
   
                  int sum = sumAccounts(accounts);
                  log(anz + ": " + accounts + " Summe: " + sum);
  @@ -189,15 +190,15 @@
                  if (sum != 3000)
                  {
                     failMain();
  -                  return; // terminate thread
  +                  return;// terminate thread
                  }
                  assertEquals("the sum of all accounts always has to be 3000", 3000, sum);
   
                  try
                  {
                     tx.begin();
  -                  deposit(customer[src], customer[dst], amo, tx);  // gets write lock
  -                  tx.commit(); // releases write lock
  +                  deposit(customer[src], customer[dst], amo, tx);// gets write lock
  +                  tx.commit();// releases write lock
                     again = false;
                  }
                  catch (TimeoutException timeout_ex)
  @@ -259,7 +260,7 @@
            HashMap result = new HashMap();
            try
            {
  -            Set set = cache.getKeys(NODE);  // gets read lock
  +            Set set = cache.getKeys(NODE);// gets read lock
               Iterator iter = set.iterator();
               while (iter.hasNext())
               {
  
  
  
  1.14      +2 -2      JBossCache/tests/functional/org/jboss/cache/transaction/IsolationLevelReadCommittedTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: IsolationLevelReadCommittedTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/transaction/IsolationLevelReadCommittedTest.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -b -r1.13 -r1.14
  --- IsolationLevelReadCommittedTest.java	2 Jan 2007 18:26:05 -0000	1.13
  +++ IsolationLevelReadCommittedTest.java	11 Jan 2007 13:49:06 -0000	1.14
  @@ -8,11 +8,11 @@
   import junit.framework.TestSuite;
   import org.jboss.cache.Cache;
   import org.jboss.cache.CacheImpl;
  +import org.jboss.cache.DefaultCacheFactory;
   import org.jboss.cache.DummyTransactionManagerLookup;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.config.Configuration;
   import org.jboss.cache.config.Configuration.CacheMode;
  -import org.jboss.cache.factories.DefaultCacheFactory;
   import org.jboss.cache.lock.IsolationLevel;
   import org.jboss.cache.lock.TimeoutException;
   
  @@ -25,7 +25,7 @@
    * Tests READ_COMMITED isolation level.
    *
    * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
  - * @version $Id: IsolationLevelReadCommittedTest.java,v 1.13 2007/01/02 18:26:05 msurtani Exp $
  + * @version $Id: IsolationLevelReadCommittedTest.java,v 1.14 2007/01/11 13:49:06 msurtani Exp $
    */
   
   public class IsolationLevelReadCommittedTest extends TestCase
  
  
  
  1.9       +3 -2      JBossCache/tests/functional/org/jboss/cache/transaction/DeadlockTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: DeadlockTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/transaction/DeadlockTest.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -b -r1.8 -r1.9
  --- DeadlockTest.java	30 Dec 2006 17:49:53 -0000	1.8
  +++ DeadlockTest.java	11 Jan 2007 13:49:06 -0000	1.9
  @@ -15,6 +15,7 @@
   import org.apache.commons.logging.LogFactory;
   import org.jboss.cache.CacheException;
   import org.jboss.cache.CacheImpl;
  +import org.jboss.cache.DefaultCacheFactory;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.config.Configuration;
   import org.jboss.cache.lock.IsolationLevel;
  @@ -30,7 +31,7 @@
    * Tests transactional access to a local CacheImpl, with concurrent (deadlock-prone) access.
    * Note: we use DummpyTranasctionManager to replace jta
    *
  - * @version $Id: DeadlockTest.java,v 1.8 2006/12/30 17:49:53 msurtani Exp $
  + * @version $Id: DeadlockTest.java,v 1.9 2007/01/11 13:49:06 msurtani Exp $
    */
   public class DeadlockTest extends TestCase
   {
  @@ -53,7 +54,7 @@
      {
         super.setUp();
         DummyTransactionManager.getInstance();
  -      cache = new CacheImpl();
  +      cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         cache.getConfiguration().setInitialStateRetrievalTimeout(10000);
         cache.getConfiguration().setClusterName("test");
         cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
  
  
  
  1.8       +7 -7      JBossCache/tests/functional/org/jboss/cache/transaction/ReplicatedTransactionDeadlockTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ReplicatedTransactionDeadlockTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/transaction/ReplicatedTransactionDeadlockTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -b -r1.7 -r1.8
  --- ReplicatedTransactionDeadlockTest.java	10 Jan 2007 15:39:52 -0000	1.7
  +++ ReplicatedTransactionDeadlockTest.java	11 Jan 2007 13:49:06 -0000	1.8
  @@ -6,11 +6,11 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   import org.jboss.cache.CacheImpl;
  +import org.jboss.cache.DefaultCacheFactory;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.config.Configuration;
   import org.jboss.cache.config.Configuration.CacheMode;
   import org.jboss.cache.factories.UnitTestCacheFactory;
  -import org.jboss.cache.factories.XmlConfigurationParser;
   
   import javax.naming.Context;
   import javax.naming.InitialContext;
  @@ -58,8 +58,8 @@
    * </ul>
    *
    * @author Marian Nikolov
  - * @author $Author: vblagojevic $
  - * @version $Date: 2007/01/10 15:39:52 $
  + * @author $Author: msurtani $
  + * @version $Date: 2007/01/11 13:49:06 $
    */
   public class ReplicatedTransactionDeadlockTest extends TestCase
   {
  @@ -131,7 +131,7 @@
         System.setProperty(Context.INITIAL_CONTEXT_FACTORY, CONTEXT_FACTORY);
         DummyTransactionManager.getInstance();
         // setup and start the source cache
  -      srcCache = new CacheImpl();
  +      srcCache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         srcCache.setConfiguration(UnitTestCacheFactory.createConfiguration(CacheMode.REPL_SYNC));
         srcCache.getConfiguration().setTransactionManagerLookupClass(
                 "org.jboss.cache.DummyTransactionManagerLookup");
  @@ -142,7 +142,7 @@
         srcCache.create();
         srcCache.start();
         // setup and start the destination cache
  -      dstCache = new CacheImpl();
  +      dstCache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         dstCache.setConfiguration(UnitTestCacheFactory.createConfiguration(CacheMode.REPL_SYNC));
         dstCache.getConfiguration().setTransactionManagerLookupClass(
                 "org.jboss.cache.DummyTransactionManagerLookup");
  @@ -228,8 +228,8 @@
       * A worker thread that applies the concurrent modifications.
       *
       * @author Marian Nikolov
  -    * @author $Author: vblagojevic $
  -    * @version $Date: 2007/01/10 15:39:52 $
  +    * @author $Author: msurtani $
  +    * @version $Date: 2007/01/11 13:49:06 $
       */
      private class Worker extends Thread
      {
  
  
  
  1.8       +13 -2     JBossCache/tests/functional/org/jboss/cache/transaction/ConcurrentTransactionalTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ConcurrentTransactionalTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/transaction/ConcurrentTransactionalTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -b -r1.7 -r1.8
  --- ConcurrentTransactionalTest.java	30 Dec 2006 19:48:45 -0000	1.7
  +++ ConcurrentTransactionalTest.java	11 Jan 2007 13:49:06 -0000	1.8
  @@ -13,6 +13,7 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   import org.jboss.cache.CacheImpl;
  +import org.jboss.cache.DefaultCacheFactory;
   import org.jboss.cache.config.Configuration;
   import org.jboss.cache.factories.XmlConfigurationParser;
   import org.jboss.cache.lock.IsolationLevel;
  @@ -32,7 +33,7 @@
    * Unit test for local CacheImpl. Use locking and multiple threads to test
    * concurrent access to the tree.
    *
  - * @version $Id: ConcurrentTransactionalTest.java,v 1.7 2006/12/30 19:48:45 msurtani Exp $
  + * @version $Id: ConcurrentTransactionalTest.java,v 1.8 2007/01/11 13:49:06 msurtani Exp $
    */
   public class ConcurrentTransactionalTest extends TestCase
   {
  @@ -64,7 +65,7 @@
   
      private void createCache(IsolationLevel level) throws Exception
      {
  -      cache = new CacheImpl();
  +      cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         cache.setConfiguration(new XmlConfigurationParser().parseFile("META-INF/local-service.xml"));
   
         cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
  @@ -86,7 +87,9 @@
         }
   
         if (tx == null)
  +      {
            throw new RuntimeException("Tx is null");
  +      }
   
         return tx;
      }
  @@ -129,7 +132,9 @@
            one.join();
            two.join();
            if (thread_ex != null)
  +         {
               throw thread_ex;
  +         }
   
            long now = System.currentTimeMillis();
            log("*** Time elapsed: " + (now - current));
  @@ -151,8 +156,10 @@
                  for (int i = 0; i < NUM; i++)
                  {
                     if (!l.contains(new Integer(i)))
  +                  {
                        System.out.println("missing: " + i);
                  }
  +               }
   
                  LinkedList duplicates = new LinkedList();
                  for (Iterator it = l.iterator(); it.hasNext();)
  @@ -163,9 +170,11 @@
                        System.out.println(integer + " is a duplicate");
                     }
                     else
  +                  {
                        duplicates.add(integer);
                  }
               }
  +            }
               catch (Exception e1)
               {
                  e1.printStackTrace();
  @@ -189,9 +198,11 @@
         {
            Object o = it.next();
            if (o == null)
  +         {
               System.err.println("found a null value in keys");
         }
      }
  +   }
   
      void log(String msg)
      {
  
  
  
  1.6       +2 -1      JBossCache/tests/functional/org/jboss/cache/transaction/PrepareTxTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: PrepareTxTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/transaction/PrepareTxTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -b -r1.5 -r1.6
  --- PrepareTxTest.java	30 Dec 2006 17:49:53 -0000	1.5
  +++ PrepareTxTest.java	11 Jan 2007 13:49:06 -0000	1.6
  @@ -5,6 +5,7 @@
   import junit.framework.TestSuite;
   import org.jboss.cache.CacheException;
   import org.jboss.cache.CacheImpl;
  +import org.jboss.cache.DefaultCacheFactory;
   import org.jboss.cache.TransactionTable;
   
   import javax.transaction.NotSupportedException;
  @@ -24,7 +25,7 @@
      protected void setUp() throws Exception
      {
         super.setUp();
  -      cache = new CacheImpl();
  +      cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         cache.getConfiguration().setCacheMode("local");
         cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
         cache.create();
  
  
  
  1.4       +3 -2      JBossCache/tests/functional/org/jboss/cache/transaction/IsolationLevelRepeatableReadTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: IsolationLevelRepeatableReadTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/transaction/IsolationLevelRepeatableReadTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- IsolationLevelRepeatableReadTest.java	30 Dec 2006 17:49:53 -0000	1.3
  +++ IsolationLevelRepeatableReadTest.java	11 Jan 2007 13:49:06 -0000	1.4
  @@ -6,6 +6,7 @@
   import junit.framework.TestCase;
   import junit.framework.TestSuite;
   import org.jboss.cache.CacheImpl;
  +import org.jboss.cache.DefaultCacheFactory;
   import org.jboss.cache.DummyTransactionManagerLookup;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.lock.IsolationLevel;
  @@ -19,7 +20,7 @@
    * Tests READ_COMMITED isolation level.
    *
    * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
  - * @version $Id: IsolationLevelRepeatableReadTest.java,v 1.3 2006/12/30 17:49:53 msurtani Exp $
  + * @version $Id: IsolationLevelRepeatableReadTest.java,v 1.4 2007/01/11 13:49:06 msurtani Exp $
    */
   
   public class IsolationLevelRepeatableReadTest extends TestCase
  @@ -40,7 +41,7 @@
         writerFailed = false;
         writerError = null;
   
  -      cache = new CacheImpl();
  +      cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         cache.getConfiguration().setCacheMode("LOCAL");
         cache.getConfiguration().setIsolationLevel(IsolationLevel.REPEATABLE_READ);
         cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
  
  
  
  1.5       +2 -1      JBossCache/tests/functional/org/jboss/cache/transaction/SuspendTxTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: SuspendTxTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/transaction/SuspendTxTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- SuspendTxTest.java	30 Dec 2006 17:49:53 -0000	1.4
  +++ SuspendTxTest.java	11 Jan 2007 13:49:06 -0000	1.5
  @@ -4,6 +4,7 @@
   import junit.framework.TestCase;
   import junit.framework.TestSuite;
   import org.jboss.cache.CacheImpl;
  +import org.jboss.cache.DefaultCacheFactory;
   import org.jboss.cache.Fqn;
   
   import javax.transaction.Transaction;
  @@ -23,7 +24,7 @@
      protected void setUp() throws Exception
      {
         super.setUp();
  -      cache = new CacheImpl();
  +      cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
         cache.getConfiguration().setCacheMode("local");
         cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
         cache.start();
  
  
  



More information about the jboss-cvs-commits mailing list