db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: db-ojb/src/test/org/apache/ojb repository_internal.xml
Date Sat, 18 Sep 2004 13:06:41 GMT
arminw      2004/09/18 06:06:41

  Modified:    src/test/org/apache/ojb/odmg Tag: OJB_1_0_RELEASE
                        AllTests.java LockingTest.java
                        LockTestCommitedReads.java
                        LockTestRepeatableReads.java
                        LockTestSerializable.java
                        LockTestUncommitedReads.java
               src/test/org/apache/ojb Tag: OJB_1_0_RELEASE
                        repository_internal.xml
  Log:
  adpat classes for use with new locking package
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.18.2.1  +1 -0      db-ojb/src/test/org/apache/ojb/odmg/AllTests.java
  
  Index: AllTests.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/AllTests.java,v
  retrieving revision 1.18
  retrieving revision 1.18.2.1
  diff -u -r1.18 -r1.18.2.1
  --- AllTests.java	22 Jun 2004 18:16:22 -0000	1.18
  +++ AllTests.java	18 Sep 2004 13:06:40 -0000	1.18.2.1
  @@ -52,6 +52,7 @@
           suite.addTestSuite(CollectionsTest.class);
   		suite.addTestSuite(PersonWithArrayTest.class);
   		suite.addTestSuite(M2NTest.class);
  +        // suite.addTestSuite(InheritanceMultipleTableTest.class);
           return suite;
       }
   }
  
  
  
  1.13.2.1  +8 -6      db-ojb/src/test/org/apache/ojb/odmg/LockingTest.java
  
  Index: LockingTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/LockingTest.java,v
  retrieving revision 1.13
  retrieving revision 1.13.2.1
  diff -u -r1.13 -r1.13.2.1
  --- LockingTest.java	22 Jun 2004 18:16:22 -0000	1.13
  +++ LockingTest.java	18 Sep 2004 13:06:40 -0000	1.13.2.1
  @@ -4,13 +4,13 @@
   import java.util.Collection;
   import java.util.List;
   
  -import junit.framework.TestCase;
   import org.apache.ojb.broker.LockedByVersion;
   import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.PersistenceBrokerFactory;
   import org.apache.ojb.broker.TestHelper;
   import org.apache.ojb.broker.query.Criteria;
   import org.apache.ojb.broker.query.QueryFactory;
  +import org.apache.ojb.junit.OJBTestCase;
   import org.apache.ojb.odmg.locking.LockManager;
   import org.apache.ojb.odmg.locking.LockManagerFactory;
   import org.apache.ojb.odmg.shared.Article;
  @@ -23,7 +23,7 @@
   /**
    * Test optimistic and pessimistic locking mechanisms
    */
  -public class LockingTest extends TestCase
  +public class LockingTest extends OJBTestCase
   {
       public static void main(String[] args)
       {
  @@ -33,11 +33,11 @@
   
       private static String PRE = "LockingTest_" + System.currentTimeMillis() + "_";
   
  -    private Implementation odmg1 = OJB.getInstance();
  -    private Database db1 = odmg1.newDatabase();
  +    private Implementation odmg1 ;
  +    private Database db1;
   
  -    private Implementation odmg2 = OJB.getInstance();
  -    private Database db2 = odmg2.newDatabase();
  +    private Implementation odmg2;
  +    private Database db2;
   
       /**
        * Insert the method's description here.
  @@ -55,6 +55,7 @@
        */
       public void setUp() throws Exception
       {
  +        super.setUp();
           String databaseName = TestHelper.DEF_DATABASE_NAME;
   
           odmg1 = OJB.getInstance();
  @@ -78,6 +79,7 @@
   
           if (odmg2.currentTransaction() != null) odmg2.currentTransaction().abort();
           db2.close();
  +        super.tearDown();
       }
   
       /**
  
  
  
  1.7.2.1   +87 -89    db-ojb/src/test/org/apache/ojb/odmg/LockTestCommitedReads.java
  
  Index: LockTestCommitedReads.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/LockTestCommitedReads.java,v
  retrieving revision 1.7
  retrieving revision 1.7.2.1
  diff -u -r1.7 -r1.7.2.1
  --- LockTestCommitedReads.java	22 Jun 2004 18:16:22 -0000	1.7
  +++ LockTestCommitedReads.java	18 Sep 2004 13:06:40 -0000	1.7.2.1
  @@ -7,73 +7,91 @@
    * @author Thomas Mahler
    */
   
  -import junit.framework.TestCase;
   import org.apache.ojb.broker.TestHelper;
  -import org.apache.ojb.odmg.locking.LockStrategy;
  -import org.apache.ojb.odmg.locking.ReadCommittedStrategy;
  +import org.apache.ojb.broker.locking.ReadCommittedStrategy;
  +import org.apache.ojb.broker.metadata.ClassDescriptor;
  +import org.apache.ojb.broker.metadata.MetadataManager;
  +import org.apache.ojb.junit.OJBTestCase;
  +import org.apache.ojb.odmg.locking.LockManager;
  +import org.apache.ojb.odmg.locking.LockManagerFactory;
   import org.apache.ojb.odmg.shared.Article;
   import org.odmg.Database;
   import org.odmg.Implementation;
  -import org.odmg.ODMGException;
   
  -public class LockTestCommitedReads extends TestCase
  +public class LockTestCommitedReads extends OJBTestCase
   {
       TransactionImpl tx1;
       TransactionImpl tx2;
       String databaseName;
       Article obj;
  -    LockStrategy ls;
  +    LockManager lockManager;
       Database db;
  +    int oldIsolationLevel;
  +    final int testingIsolationLevel = ReadCommittedStrategy.ISOLATION_LEVEL;
   
       public static void main(String[] args)
       {
  -        String[] arr = { CLASS.getName()};
  +        String[] arr = {LockTestCommitedReads.class.getName()};
           junit.textui.TestRunner.main(arr);
       }
   
  -    private static Class CLASS = LockTestCommitedReads.class;
  -
       public LockTestCommitedReads(String name)
  -
       {
           super(name);
  -        ls = new ReadCommittedStrategy();
       }
   
  -    public void setUp()
  +    public void setUp() throws Exception
       {
  -        try
  -        {
  -            databaseName = TestHelper.DEF_DATABASE_NAME;
  +        super.setUp();
   
  -            // get facade instance
  -            Implementation odmg = OJB.getInstance();
  -            db = odmg.newDatabase();
  -            //open database
  -            db.open(databaseName, Database.OPEN_READ_WRITE);
  +        ClassDescriptor cld = MetadataManager.getInstance().getRepository().getDescriptorFor(Article.class);
  +        oldIsolationLevel = cld.getIsolationLevel();
  +        cld.setIsolationLevel(testingIsolationLevel);
   
  -            tx2 = (TransactionImpl) odmg.newTransaction();
  -            tx1 = (TransactionImpl) odmg.newTransaction();
  +        lockManager = LockManagerFactory.getLockManager();
   
  -            tx1.begin();
  -            tx2.begin();
  +        databaseName = TestHelper.DEF_DATABASE_NAME;
  +        // get facade instance
  +        Implementation odmg = OJB.getInstance();
  +        db = odmg.newDatabase();
  +        //open database
  +        db.open(databaseName, Database.OPEN_READ_WRITE);
   
  -            obj = new Article();
  -            obj.setArticleId(333);
  +        tx2 = (TransactionImpl) odmg.newTransaction();
  +        tx1 = (TransactionImpl) odmg.newTransaction();
   
  +        tx1.begin();
  +        tx2.begin();
  +
  +        obj = new Article();
  +        obj.setArticleId(333);
  +    }
  +
  +    public void tearDown() throws Exception
  +    {
  +        try
  +        {
  +            lockManager.releaseLock(tx1, obj);
  +            lockManager.releaseLock(tx2, obj);
  +            tx1.abort();
  +            tx2.abort();
  +            db.close();
  +            databaseName = null;
           }
  -        catch (ODMGException e)
  +        finally
           {
  +            super.tearDown();
           }
  -
       }
   
  +
  +
       /**
        * Test 1
        */
       public void testSingleReadLock()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
       }
   
       /**
  @@ -81,8 +99,8 @@
        */
       public void testUpgradeReadLock()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.upgradeLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.upgradeLock(tx1, obj));
       }
   
       /**
  @@ -90,8 +108,8 @@
        */
       public void testReadThenWrite()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.writeLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.writeLock(tx1, obj));
       }
   
       /**
  @@ -99,7 +117,7 @@
        */
       public void testSingleWriteLock()
       {
  -        assertTrue(ls.writeLock(tx1, obj));
  +        assertTrue(lockManager.writeLock(tx1, obj));
       }
   
       /**
  @@ -107,8 +125,8 @@
        */
       public void testWriteThenRead()
       {
  -        assertTrue(ls.writeLock(tx1, obj));
  -        assertTrue(ls.readLock(tx1, obj));
  +        assertTrue(lockManager.writeLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
       }
   
       /**
  @@ -116,8 +134,8 @@
        */
       public void testMultipleReadLock()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.readLock(tx2, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx2, obj));
       }
   
       /**
  @@ -125,8 +143,8 @@
        */
       public void testUpgradeWithExistingReader()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.upgradeLock(tx2, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.upgradeLock(tx2, obj));
       }
   
       /**
  @@ -134,8 +152,8 @@
        */
       public void testWriteWithExistingReader()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.writeLock(tx2, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.writeLock(tx2, obj));
       }
   
       /**
  @@ -143,9 +161,9 @@
        */
       public void testUpgradeWithMultipleReaders()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.readLock(tx2, obj));
  -        assertTrue(ls.upgradeLock(tx2, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx2, obj));
  +        assertTrue(lockManager.upgradeLock(tx2, obj));
       }
   
       /**
  @@ -153,9 +171,9 @@
        */
       public void testWriteWithMultipleReaders()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.readLock(tx2, obj));
  -        assertTrue(ls.writeLock(tx2, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx2, obj));
  +        assertTrue(lockManager.writeLock(tx2, obj));
       }
   
       /**
  @@ -163,9 +181,9 @@
        */
       public void testUpgradeWithMultipleReadersOn1()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.readLock(tx2, obj));
  -        assertTrue(ls.upgradeLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx2, obj));
  +        assertTrue(lockManager.upgradeLock(tx1, obj));
       }
   
       /**
  @@ -173,9 +191,9 @@
        */
       public void testWriteWithMultipleReadersOn1()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.readLock(tx2, obj));
  -        assertTrue(ls.writeLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx2, obj));
  +        assertTrue(lockManager.writeLock(tx1, obj));
       }
   
       /**
  @@ -183,8 +201,8 @@
        */
       public void testReadWithExistingWriter()
       {
  -        assertTrue(ls.writeLock(tx1, obj));
  -        assertTrue(!ls.readLock(tx2, obj));
  +        assertTrue(lockManager.writeLock(tx1, obj));
  +        assertTrue(!lockManager.readLock(tx2, obj));
       }
   
       /**
  @@ -192,8 +210,8 @@
        */
       public void testMultipleWriteLock()
       {
  -        assertTrue(ls.writeLock(tx1, obj));
  -        assertTrue(!ls.writeLock(tx2, obj));
  +        assertTrue(lockManager.writeLock(tx1, obj));
  +        assertTrue(!lockManager.writeLock(tx2, obj));
       }
   
       /**
  @@ -201,9 +219,9 @@
        */
       public void testReleaseReadLock()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.releaseLock(tx1, obj));
  -        assertTrue(ls.writeLock(tx2, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.releaseLock(tx1, obj));
  +        assertTrue(lockManager.writeLock(tx2, obj));
       }
   
       /**
  @@ -211,9 +229,9 @@
        */
       public void testReleaseUpgradeLock()
       {
  -        assertTrue(ls.upgradeLock(tx1, obj));
  -        assertTrue(ls.releaseLock(tx1, obj));
  -        assertTrue(ls.writeLock(tx2, obj));
  +        assertTrue(lockManager.upgradeLock(tx1, obj));
  +        assertTrue(lockManager.releaseLock(tx1, obj));
  +        assertTrue(lockManager.writeLock(tx2, obj));
       }
   
       /**
  @@ -221,9 +239,9 @@
        */
       public void testReleaseWriteLock()
       {
  -        assertTrue(ls.writeLock(tx1, obj));
  -        assertTrue(ls.releaseLock(tx1, obj));
  -        assertTrue(ls.writeLock(tx2, obj));
  +        assertTrue(lockManager.writeLock(tx1, obj));
  +        assertTrue(lockManager.releaseLock(tx1, obj));
  +        assertTrue(lockManager.writeLock(tx2, obj));
       }
   
       /**
  @@ -231,27 +249,7 @@
        */
       public void testReadThenRead()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.readLock(tx1, obj));
  -    }
  -
  -    /**
  -     * Insert the method's description here.
  -     * Creation date: (06.12.2000 21:59:14)
  -     */
  -    public void tearDown()
  -    {
  -        try
  -        {
  -            ls.releaseLock(tx1, obj);
  -            ls.releaseLock(tx2, obj);
  -            tx1.abort();
  -            tx2.abort();
  -            db.close();
  -            databaseName = null;
  -        }
  -        catch (Throwable t)
  -        {
  -        }
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
       }
   }
  
  
  
  1.7.2.1   +87 -89    db-ojb/src/test/org/apache/ojb/odmg/LockTestRepeatableReads.java
  
  Index: LockTestRepeatableReads.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/LockTestRepeatableReads.java,v
  retrieving revision 1.7
  retrieving revision 1.7.2.1
  diff -u -r1.7 -r1.7.2.1
  --- LockTestRepeatableReads.java	22 Jun 2004 18:16:22 -0000	1.7
  +++ LockTestRepeatableReads.java	18 Sep 2004 13:06:40 -0000	1.7.2.1
  @@ -9,12 +9,14 @@
   
   import junit.framework.TestCase;
   import org.apache.ojb.broker.TestHelper;
  -import org.apache.ojb.odmg.locking.LockStrategy;
  -import org.apache.ojb.odmg.locking.RepeatableReadStrategy;
  +import org.apache.ojb.broker.locking.RepeatableReadStrategy;
  +import org.apache.ojb.broker.metadata.ClassDescriptor;
  +import org.apache.ojb.broker.metadata.MetadataManager;
  +import org.apache.ojb.odmg.locking.LockManager;
  +import org.apache.ojb.odmg.locking.LockManagerFactory;
   import org.apache.ojb.odmg.shared.Article;
   import org.odmg.Database;
   import org.odmg.Implementation;
  -import org.odmg.ODMGException;
   
   public class LockTestRepeatableReads extends TestCase
   {
  @@ -22,48 +24,65 @@
       TransactionImpl tx2;
       String databaseName;
       Article obj;
  -    LockStrategy ls;
  +    LockManager lockManager;
  +    Database db;
  +    int oldIsolationLevel;
  +    final int testingIsolationLevel = RepeatableReadStrategy.ISOLATION_LEVEL;
   
       public static void main(String[] args)
       {
  -        String[] arr = { CLASS.getName()};
  +        String[] arr = {LockTestCommitedReads.class.getName()};
           junit.textui.TestRunner.main(arr);
       }
   
  -    private static Class CLASS = LockTestRepeatableReads.class;
  -
       public LockTestRepeatableReads(String name)
  -
       {
           super(name);
  -        ls = new RepeatableReadStrategy();
       }
   
  -    public void setUp()
  +    public void setUp() throws Exception
       {
  -        try
  -        {
  -            databaseName = TestHelper.DEF_DATABASE_NAME;
  +        super.setUp();
  +
  +        ClassDescriptor cld = MetadataManager.getInstance().getRepository().getDescriptorFor(Article.class);
  +        oldIsolationLevel = cld.getIsolationLevel();
  +        cld.setIsolationLevel(testingIsolationLevel);
  +
  +        lockManager = LockManagerFactory.getLockManager();
  +
  +        databaseName = TestHelper.DEF_DATABASE_NAME;
  +
  +        // get facade instance
  +        Implementation odmg = OJB.getInstance();
  +        db = odmg.newDatabase();
  +        //open database
  +        db.open(databaseName, Database.OPEN_READ_WRITE);
   
  -            // get facade instance
  -            Implementation odmg = OJB.getInstance();
  -            Database db = odmg.newDatabase();
  -            //open database
  -            db.open(databaseName, Database.OPEN_READ_WRITE);
  -
  -            tx1 = (TransactionImpl) odmg.newTransaction();
  -            tx2 = (TransactionImpl) odmg.newTransaction();
  -            tx1.begin();
  -            tx2.begin();
  +        tx2 = (TransactionImpl) odmg.newTransaction();
  +        tx1 = (TransactionImpl) odmg.newTransaction();
   
  -            obj = new Article();
  -            obj.setArticleId(333);
  +        tx1.begin();
  +        tx2.begin();
   
  +        obj = new Article();
  +        obj.setArticleId(333);
  +    }
  +
  +    public void tearDown() throws Exception
  +    {
  +        try
  +        {
  +            lockManager.releaseLock(tx1, obj);
  +            lockManager.releaseLock(tx2, obj);
  +            tx1.abort();
  +            tx2.abort();
  +            db.close();
  +            databaseName = null;
           }
  -        catch (ODMGException e)
  +        finally
           {
  +            super.tearDown();
           }
  -
       }
   
       /**
  @@ -71,7 +90,7 @@
        */
       public void testSingleReadLock()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
       }
   
       /**
  @@ -79,8 +98,8 @@
        */
       public void testUpgradeReadLock()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.upgradeLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.upgradeLock(tx1, obj));
       }
   
       /**
  @@ -88,8 +107,8 @@
        */
       public void testReadThenWrite()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.writeLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.writeLock(tx1, obj));
       }
   
       /**
  @@ -97,7 +116,7 @@
        */
       public void testSingleWriteLock()
       {
  -        assertTrue(ls.writeLock(tx1, obj));
  +        assertTrue(lockManager.writeLock(tx1, obj));
       }
   
       /**
  @@ -105,8 +124,8 @@
        */
       public void testWriteThenRead()
       {
  -        assertTrue(ls.writeLock(tx1, obj));
  -        assertTrue(ls.readLock(tx1, obj));
  +        assertTrue(lockManager.writeLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
       }
   
       /**
  @@ -114,8 +133,8 @@
        */
       public void testMultipleReadLock()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.readLock(tx2, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx2, obj));
       }
   
       /**
  @@ -123,8 +142,8 @@
        */
       public void testUpgradeWithExistingReader()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(!ls.upgradeLock(tx2, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(!lockManager.upgradeLock(tx2, obj));
       }
   
       /**
  @@ -132,8 +151,8 @@
        */
       public void testWriteWithExistingReader()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(!ls.writeLock(tx2, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(!lockManager.writeLock(tx2, obj));
       }
   
       /**
  @@ -141,9 +160,9 @@
        */
       public void testUpgradeWithMultipleReaders()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.readLock(tx2, obj));
  -        assertTrue(!ls.upgradeLock(tx2, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx2, obj));
  +        assertTrue(!lockManager.upgradeLock(tx2, obj));
       }
   
       /**
  @@ -151,9 +170,9 @@
        */
       public void testWriteWithMultipleReaders()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.readLock(tx2, obj));
  -        assertTrue(!ls.writeLock(tx2, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx2, obj));
  +        assertTrue(!lockManager.writeLock(tx2, obj));
       }
   
       /**
  @@ -161,9 +180,9 @@
        */
       public void testUpgradeWithMultipleReadersOn1()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.readLock(tx2, obj));
  -        assertTrue(!ls.upgradeLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx2, obj));
  +        assertTrue(!lockManager.upgradeLock(tx1, obj));
       }
   
       /**
  @@ -171,9 +190,9 @@
        */
       public void testWriteWithMultipleReadersOn1()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.readLock(tx2, obj));
  -        assertTrue(!ls.writeLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx2, obj));
  +        assertTrue(!lockManager.writeLock(tx1, obj));
       }
   
       /**
  @@ -181,8 +200,8 @@
        */
       public void testReadWithExistingWriter()
       {
  -        assertTrue(ls.writeLock(tx1, obj));
  -        assertTrue(!ls.readLock(tx2, obj));
  +        assertTrue(lockManager.writeLock(tx1, obj));
  +        assertTrue(!lockManager.readLock(tx2, obj));
       }
   
       /**
  @@ -190,8 +209,8 @@
        */
       public void testMultipleWriteLock()
       {
  -        assertTrue(ls.writeLock(tx1, obj));
  -        assertTrue(!ls.writeLock(tx2, obj));
  +        assertTrue(lockManager.writeLock(tx1, obj));
  +        assertTrue(!lockManager.writeLock(tx2, obj));
       }
   
       /**
  @@ -199,9 +218,9 @@
        */
       public void testReleaseReadLock()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.releaseLock(tx1, obj));
  -        assertTrue(ls.writeLock(tx2, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.releaseLock(tx1, obj));
  +        assertTrue(lockManager.writeLock(tx2, obj));
       }
   
       /**
  @@ -209,9 +228,9 @@
        */
       public void testReleaseUpgradeLock()
       {
  -        assertTrue(ls.upgradeLock(tx1, obj));
  -        assertTrue(ls.releaseLock(tx1, obj));
  -        assertTrue(ls.writeLock(tx2, obj));
  +        assertTrue(lockManager.upgradeLock(tx1, obj));
  +        assertTrue(lockManager.releaseLock(tx1, obj));
  +        assertTrue(lockManager.writeLock(tx2, obj));
       }
   
       /**
  @@ -219,9 +238,9 @@
        */
       public void testReleaseWriteLock()
       {
  -        assertTrue(ls.writeLock(tx1, obj));
  -        assertTrue(ls.releaseLock(tx1, obj));
  -        assertTrue(ls.writeLock(tx2, obj));
  +        assertTrue(lockManager.writeLock(tx1, obj));
  +        assertTrue(lockManager.releaseLock(tx1, obj));
  +        assertTrue(lockManager.writeLock(tx2, obj));
       }
   
       /**
  @@ -229,28 +248,7 @@
        */
       public void testReadThenRead()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.readLock(tx1, obj));
  -    }
  -
  -    /**
  -     * Insert the method's description here.
  -     * Creation date: (06.12.2000 21:59:14)
  -     */
  -    public void tearDown()
  -    {
  -        try
  -        {
  -            ls.releaseLock(tx1, obj);
  -            ls.releaseLock(tx2, obj);
  -            tx1.abort();
  -            tx2.abort();
  -
  -            OJB.getInstance().getDatabase(null).close();
  -            databaseName = null;
  -        }
  -        catch (Throwable t)
  -        {
  -        }
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
       }
   }
  
  
  
  1.7.2.1   +88 -89    db-ojb/src/test/org/apache/ojb/odmg/LockTestSerializable.java
  
  Index: LockTestSerializable.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/LockTestSerializable.java,v
  retrieving revision 1.7
  retrieving revision 1.7.2.1
  diff -u -r1.7 -r1.7.2.1
  --- LockTestSerializable.java	22 Jun 2004 18:16:22 -0000	1.7
  +++ LockTestSerializable.java	18 Sep 2004 13:06:40 -0000	1.7.2.1
  @@ -9,12 +9,14 @@
   
   import junit.framework.TestCase;
   import org.apache.ojb.broker.TestHelper;
  -import org.apache.ojb.odmg.locking.LockStrategy;
  -import org.apache.ojb.odmg.locking.SerializableStrategy;
  +import org.apache.ojb.broker.locking.SerializableStrategy;
  +import org.apache.ojb.broker.metadata.ClassDescriptor;
  +import org.apache.ojb.broker.metadata.MetadataManager;
  +import org.apache.ojb.odmg.locking.LockManager;
  +import org.apache.ojb.odmg.locking.LockManagerFactory;
   import org.apache.ojb.odmg.shared.Article;
   import org.odmg.Database;
   import org.odmg.Implementation;
  -import org.odmg.ODMGException;
   
   public class LockTestSerializable extends TestCase
   {
  @@ -22,47 +24,65 @@
       TransactionImpl tx2;
       String databaseName;
       Article obj;
  -    LockStrategy ls;
  +    LockManager lockManager;
  +    Database db;
  +    int oldIsolationLevel;
  +    final int testingIsolationLevel = SerializableStrategy.ISOLATION_LEVEL;
   
       public static void main(String[] args)
       {
  -        String[] arr = { CLASS.getName()};
  +        String[] arr = {LockTestCommitedReads.class.getName()};
           junit.textui.TestRunner.main(arr);
       }
   
  -    private static Class CLASS = LockTestSerializable.class;
  -
       public LockTestSerializable(String name)
  -
       {
           super(name);
  -        ls = new SerializableStrategy();
       }
   
  -    public void setUp()
  +    public void setUp() throws Exception
       {
  -        try
  -        {
  -            databaseName = TestHelper.DEF_DATABASE_NAME;
  +        super.setUp();
  +
  +        ClassDescriptor cld = MetadataManager.getInstance().getRepository().getDescriptorFor(Article.class);
  +        oldIsolationLevel = cld.getIsolationLevel();
  +        cld.setIsolationLevel(testingIsolationLevel);
  +
  +        lockManager = LockManagerFactory.getLockManager();
  +
  +        databaseName = TestHelper.DEF_DATABASE_NAME;
  +
  +        // get facade instance
  +        Implementation odmg = OJB.getInstance();
  +        db = odmg.newDatabase();
  +        //open database
  +        db.open(databaseName, Database.OPEN_READ_WRITE);
   
  -            // get facade instance
  -            Implementation odmg = OJB.getInstance();
  -            Database db = odmg.newDatabase();
  -            //open database
  -            db.open(databaseName, Database.OPEN_READ_WRITE);
  -
  -            tx1 = (TransactionImpl) odmg.newTransaction();
  -            tx2 = (TransactionImpl) odmg.newTransaction();
  -            tx1.begin();
  -            tx2.begin();
  -            obj = new Article();
  -            obj.setArticleId(333);
  +        tx2 = (TransactionImpl) odmg.newTransaction();
  +        tx1 = (TransactionImpl) odmg.newTransaction();
   
  +        tx1.begin();
  +        tx2.begin();
  +
  +        obj = new Article();
  +        obj.setArticleId(333);
  +    }
  +
  +    public void tearDown() throws Exception
  +    {
  +        try
  +        {
  +            lockManager.releaseLock(tx1, obj);
  +            lockManager.releaseLock(tx2, obj);
  +            tx1.abort();
  +            tx2.abort();
  +            db.close();
  +            databaseName = null;
           }
  -        catch (ODMGException e)
  +        finally
           {
  +            super.tearDown();
           }
  -
       }
   
       /**
  @@ -70,7 +90,7 @@
        */
       public void testSingleReadLock()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
       }
   
       /**
  @@ -78,8 +98,8 @@
        */
       public void testUpgradeReadLock()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.upgradeLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.upgradeLock(tx1, obj));
       }
   
       /**
  @@ -87,8 +107,8 @@
        */
       public void testReadThenWrite()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.writeLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.writeLock(tx1, obj));
       }
   
       /**
  @@ -96,7 +116,7 @@
        */
       public void testSingleWriteLock()
       {
  -        assertTrue(ls.writeLock(tx1, obj));
  +        assertTrue(lockManager.writeLock(tx1, obj));
       }
   
       /**
  @@ -104,8 +124,8 @@
        */
       public void testWriteThenRead()
       {
  -        assertTrue(ls.writeLock(tx1, obj));
  -        assertTrue(ls.readLock(tx1, obj));
  +        assertTrue(lockManager.writeLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
       }
   
       /**
  @@ -113,8 +133,8 @@
        */
       public void testMultipleReadLock()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(!ls.readLock(tx2, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(!lockManager.readLock(tx2, obj));
       }
   
       /**
  @@ -122,8 +142,8 @@
        */
       public void testUpgradeWithExistingReader()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(!ls.upgradeLock(tx2, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(!lockManager.upgradeLock(tx2, obj));
       }
   
       /**
  @@ -131,8 +151,8 @@
        */
       public void testWriteWithExistingReader()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(!ls.writeLock(tx2, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(!lockManager.writeLock(tx2, obj));
       }
   
       /**
  @@ -140,9 +160,9 @@
        */
       public void testUpgradeWithMultipleReaders()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(!ls.readLock(tx2, obj));
  -        assertTrue(!ls.upgradeLock(tx2, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(!lockManager.readLock(tx2, obj));
  +        assertTrue(!lockManager.upgradeLock(tx2, obj));
       }
   
       /**
  @@ -150,9 +170,9 @@
        */
       public void testWriteWithMultipleReaders()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(!ls.readLock(tx2, obj));
  -        assertTrue(!ls.writeLock(tx2, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(!lockManager.readLock(tx2, obj));
  +        assertTrue(!lockManager.writeLock(tx2, obj));
       }
   
       /**
  @@ -160,9 +180,9 @@
        */
       public void testUpgradeWithMultipleReadersOn1()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(!ls.readLock(tx2, obj));
  -        assertTrue(ls.upgradeLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(!lockManager.readLock(tx2, obj));
  +        assertTrue(lockManager.upgradeLock(tx1, obj));
       }
   
       /**
  @@ -170,9 +190,9 @@
        */
       public void testWriteWithMultipleReadersOn1()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(!ls.readLock(tx2, obj));
  -        assertTrue(ls.writeLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(!lockManager.readLock(tx2, obj));
  +        assertTrue(lockManager.writeLock(tx1, obj));
       }
   
       /**
  @@ -180,8 +200,8 @@
        */
       public void testReadWithExistingWriter()
       {
  -        assertTrue(ls.writeLock(tx1, obj));
  -        assertTrue(!ls.readLock(tx2, obj));
  +        assertTrue(lockManager.writeLock(tx1, obj));
  +        assertTrue(!lockManager.readLock(tx2, obj));
       }
   
       /**
  @@ -189,8 +209,8 @@
        */
       public void testMultipleWriteLock()
       {
  -        assertTrue(ls.writeLock(tx1, obj));
  -        assertTrue(!ls.writeLock(tx2, obj));
  +        assertTrue(lockManager.writeLock(tx1, obj));
  +        assertTrue(!lockManager.writeLock(tx2, obj));
       }
   
       /**
  @@ -198,9 +218,9 @@
        */
       public void testReleaseReadLock()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.releaseLock(tx1, obj));
  -        assertTrue(ls.writeLock(tx2, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.releaseLock(tx1, obj));
  +        assertTrue(lockManager.writeLock(tx2, obj));
       }
   
       /**
  @@ -208,9 +228,9 @@
        */
       public void testReleaseUpgradeLock()
       {
  -        assertTrue(ls.upgradeLock(tx1, obj));
  -        assertTrue(ls.releaseLock(tx1, obj));
  -        assertTrue(ls.writeLock(tx2, obj));
  +        assertTrue(lockManager.upgradeLock(tx1, obj));
  +        assertTrue(lockManager.releaseLock(tx1, obj));
  +        assertTrue(lockManager.writeLock(tx2, obj));
       }
   
       /**
  @@ -218,9 +238,9 @@
        */
       public void testReleaseWriteLock()
       {
  -        assertTrue(ls.writeLock(tx1, obj));
  -        assertTrue(ls.releaseLock(tx1, obj));
  -        assertTrue(ls.writeLock(tx2, obj));
  +        assertTrue(lockManager.writeLock(tx1, obj));
  +        assertTrue(lockManager.releaseLock(tx1, obj));
  +        assertTrue(lockManager.writeLock(tx2, obj));
       }
   
       /**
  @@ -228,28 +248,7 @@
        */
       public void testReadThenRead()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.readLock(tx1, obj));
  -    }
  -
  -    /**
  -     * Insert the method's description here.
  -     * Creation date: (06.12.2000 21:59:14)
  -     */
  -    public void tearDown()
  -    {
  -        try
  -        {
  -            ls.releaseLock(tx1, obj);
  -            ls.releaseLock(tx2, obj);
  -            tx1.abort();
  -            tx2.abort();
  -
  -            OJB.getInstance().getDatabase(null).close();
  -            databaseName = null;
  -        }
  -        catch (Throwable t)
  -        {
  -        }
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
       }
   }
  
  
  
  1.7.2.1   +88 -89    db-ojb/src/test/org/apache/ojb/odmg/LockTestUncommitedReads.java
  
  Index: LockTestUncommitedReads.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/LockTestUncommitedReads.java,v
  retrieving revision 1.7
  retrieving revision 1.7.2.1
  diff -u -r1.7 -r1.7.2.1
  --- LockTestUncommitedReads.java	22 Jun 2004 18:16:22 -0000	1.7
  +++ LockTestUncommitedReads.java	18 Sep 2004 13:06:40 -0000	1.7.2.1
  @@ -9,12 +9,14 @@
   
   import junit.framework.TestCase;
   import org.apache.ojb.broker.TestHelper;
  -import org.apache.ojb.odmg.locking.LockStrategy;
  -import org.apache.ojb.odmg.locking.ReadUncommittedStrategy;
  +import org.apache.ojb.broker.locking.ReadUncommittedStrategy;
  +import org.apache.ojb.broker.metadata.ClassDescriptor;
  +import org.apache.ojb.broker.metadata.MetadataManager;
  +import org.apache.ojb.odmg.locking.LockManager;
  +import org.apache.ojb.odmg.locking.LockManagerFactory;
   import org.apache.ojb.odmg.shared.Article;
   import org.odmg.Database;
   import org.odmg.Implementation;
  -import org.odmg.ODMGException;
   
   public class LockTestUncommitedReads extends TestCase
   {
  @@ -22,47 +24,65 @@
       TransactionImpl tx2;
       String databaseName;
       Article obj;
  -    LockStrategy ls;
  +    LockManager lockManager;
  +    Database db;
  +    int oldIsolationLevel;
  +    final int testingIsolationLevel = ReadUncommittedStrategy.ISOLATION_LEVEL;
   
       public static void main(String[] args)
       {
  -        String[] arr = { CLASS.getName()};
  +        String[] arr = {LockTestCommitedReads.class.getName()};
           junit.textui.TestRunner.main(arr);
       }
   
  -    private static Class CLASS = LockTestUncommitedReads.class;
  -
       public LockTestUncommitedReads(String name)
  -
       {
           super(name);
  -        ls = new ReadUncommittedStrategy();
       }
   
  -    public void setUp()
  +    public void setUp() throws Exception
       {
  -        try
  -        {
  -            databaseName = TestHelper.DEF_DATABASE_NAME;
  +        super.setUp();
  +
  +        ClassDescriptor cld = MetadataManager.getInstance().getRepository().getDescriptorFor(Article.class);
  +        oldIsolationLevel = cld.getIsolationLevel();
  +        cld.setIsolationLevel(testingIsolationLevel);
  +
  +        lockManager = LockManagerFactory.getLockManager();
  +
  +        databaseName = TestHelper.DEF_DATABASE_NAME;
  +
  +        // get facade instance
  +        Implementation odmg = OJB.getInstance();
  +        db = odmg.newDatabase();
  +        //open database
  +        db.open(databaseName, Database.OPEN_READ_WRITE);
   
  -            // get facade instance
  -            Implementation odmg = OJB.getInstance();
  -            Database db = odmg.newDatabase();
  -            //open database
  -            db.open(databaseName, Database.OPEN_READ_WRITE);
  -
  -            tx1 = (TransactionImpl) odmg.newTransaction();
  -            tx2 = (TransactionImpl) odmg.newTransaction();
  -            tx1.begin();
  -            tx2.begin();
  -            obj = new Article();
  -            obj.setArticleId(333);
  +        tx2 = (TransactionImpl) odmg.newTransaction();
  +        tx1 = (TransactionImpl) odmg.newTransaction();
   
  +        tx1.begin();
  +        tx2.begin();
  +
  +        obj = new Article();
  +        obj.setArticleId(333);
  +    }
  +
  +    public void tearDown() throws Exception
  +    {
  +        try
  +        {
  +            lockManager.releaseLock(tx1, obj);
  +            lockManager.releaseLock(tx2, obj);
  +            tx1.abort();
  +            tx2.abort();
  +            db.close();
  +            databaseName = null;
           }
  -        catch (ODMGException e)
  +        finally
           {
  +            super.tearDown();
           }
  -
       }
   
       /**
  @@ -70,7 +90,7 @@
        */
       public void testSingleReadLock()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
       }
   
       /**
  @@ -78,8 +98,8 @@
        */
       public void testUpgradeReadLock()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.upgradeLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.upgradeLock(tx1, obj));
       }
   
       /**
  @@ -87,8 +107,8 @@
        */
       public void testReadThenWrite()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.writeLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.writeLock(tx1, obj));
       }
   
       /**
  @@ -96,7 +116,7 @@
        */
       public void testSingleWriteLock()
       {
  -        assertTrue(ls.writeLock(tx1, obj));
  +        assertTrue(lockManager.writeLock(tx1, obj));
       }
   
       /**
  @@ -104,8 +124,8 @@
        */
       public void testWriteThenRead()
       {
  -        assertTrue(ls.writeLock(tx1, obj));
  -        assertTrue(ls.readLock(tx1, obj));
  +        assertTrue(lockManager.writeLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
       }
   
       /**
  @@ -113,8 +133,8 @@
        */
       public void testMultipleReadLock()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.readLock(tx2, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx2, obj));
       }
   
       /**
  @@ -122,8 +142,8 @@
        */
       public void testUpgradeWithExistingReader()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.upgradeLock(tx2, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.upgradeLock(tx2, obj));
       }
   
       /**
  @@ -131,8 +151,8 @@
        */
       public void testWriteWithExistingReader()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.writeLock(tx2, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.writeLock(tx2, obj));
       }
   
       /**
  @@ -140,9 +160,9 @@
        */
       public void testUpgradeWithMultipleReaders()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.readLock(tx2, obj));
  -        assertTrue(ls.upgradeLock(tx2, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx2, obj));
  +        assertTrue(lockManager.upgradeLock(tx2, obj));
       }
   
       /**
  @@ -150,9 +170,9 @@
        */
       public void testWriteWithMultipleReaders()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.readLock(tx2, obj));
  -        assertTrue(ls.writeLock(tx2, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx2, obj));
  +        assertTrue(lockManager.writeLock(tx2, obj));
       }
   
       /**
  @@ -160,9 +180,9 @@
        */
       public void testUpgradeWithMultipleReadersOn1()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.readLock(tx2, obj));
  -        assertTrue(ls.upgradeLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx2, obj));
  +        assertTrue(lockManager.upgradeLock(tx1, obj));
       }
   
       /**
  @@ -170,9 +190,9 @@
        */
       public void testWriteWithMultipleReadersOn1()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.readLock(tx2, obj));
  -        assertTrue(ls.writeLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx2, obj));
  +        assertTrue(lockManager.writeLock(tx1, obj));
       }
   
       /**
  @@ -180,8 +200,8 @@
        */
       public void testReadWithExistingWriter()
       {
  -        assertTrue(ls.writeLock(tx1, obj));
  -        assertTrue(ls.readLock(tx2, obj));
  +        assertTrue(lockManager.writeLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx2, obj));
       }
   
       /**
  @@ -189,8 +209,8 @@
        */
       public void testMultipleWriteLock()
       {
  -        assertTrue(ls.writeLock(tx1, obj));
  -        assertTrue(!ls.writeLock(tx2, obj));
  +        assertTrue(lockManager.writeLock(tx1, obj));
  +        assertTrue(!lockManager.writeLock(tx2, obj));
       }
   
       /**
  @@ -198,9 +218,9 @@
        */
       public void testReleaseReadLock()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.releaseLock(tx1, obj));
  -        assertTrue(ls.writeLock(tx2, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.releaseLock(tx1, obj));
  +        assertTrue(lockManager.writeLock(tx2, obj));
       }
   
       /**
  @@ -208,9 +228,9 @@
        */
       public void testReleaseUpgradeLock()
       {
  -        assertTrue(ls.upgradeLock(tx1, obj));
  -        assertTrue(ls.releaseLock(tx1, obj));
  -        assertTrue(ls.writeLock(tx2, obj));
  +        assertTrue(lockManager.upgradeLock(tx1, obj));
  +        assertTrue(lockManager.releaseLock(tx1, obj));
  +        assertTrue(lockManager.writeLock(tx2, obj));
       }
   
       /**
  @@ -218,9 +238,9 @@
        */
       public void testReleaseWriteLock()
       {
  -        assertTrue(ls.writeLock(tx1, obj));
  -        assertTrue(ls.releaseLock(tx1, obj));
  -        assertTrue(ls.writeLock(tx2, obj));
  +        assertTrue(lockManager.writeLock(tx1, obj));
  +        assertTrue(lockManager.releaseLock(tx1, obj));
  +        assertTrue(lockManager.writeLock(tx2, obj));
       }
   
       /**
  @@ -228,28 +248,7 @@
        */
       public void testReadThenRead()
       {
  -        assertTrue(ls.readLock(tx1, obj));
  -        assertTrue(ls.readLock(tx1, obj));
  -    }
  -
  -    /**
  -     * Insert the method's description here.
  -     * Creation date: (06.12.2000 21:59:14)
  -     */
  -    public void tearDown()
  -    {
  -        try
  -        {
  -            ls.releaseLock(tx1, obj);
  -            ls.releaseLock(tx2, obj);
  -            tx1.abort();
  -            tx2.abort();
  -
  -            OJB.getInstance().getDatabase(null).close();
  -            databaseName = null;
  -        }
  -        catch (Throwable t)
  -        {
  -        }
  +        assertTrue(lockManager.readLock(tx1, obj));
  +        assertTrue(lockManager.readLock(tx1, obj));
       }
   }
  
  
  
  No                   revision
  No                   revision
  1.13.2.1  +0 -35     db-ojb/src/test/org/apache/ojb/repository_internal.xml
  
  Index: repository_internal.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/repository_internal.xml,v
  retrieving revision 1.13
  retrieving revision 1.13.2.1
  diff -u -r1.13 -r1.13.2.1
  --- repository_internal.xml	5 Apr 2004 13:58:59 -0000	1.13
  +++ repository_internal.xml	18 Sep 2004 13:06:40 -0000	1.13.2.1
  @@ -55,41 +55,6 @@
      </class-descriptor>
   
   
  -<!-- The OJB Lock Table -->
  -   <class-descriptor
  -   	  class="org.apache.ojb.odmg.locking.LockEntry"
  -   	  table="OJB_LOCKENTRY"
  -   >
  -      <field-descriptor
  -         name="oidString"
  -         column="OID_"
  -         jdbc-type="VARCHAR"
  -         primarykey="true"
  -      />
  -      <field-descriptor
  -         name="transactionId"
  -         column="TX_ID"
  -         jdbc-type="VARCHAR"
  -         primarykey="true"
  -      />
  -      <field-descriptor
  -         name="timestamp"
  -         column="TIMESTAMP_"
  -         jdbc-type="BIGINT"
  -      />
  -      <field-descriptor
  -         name="isolationLevel"
  -         column="ISOLATIONLEVEL"
  -         jdbc-type="INTEGER"
  -      />
  -      <field-descriptor
  -         name="lockType"
  -         column="LOCKTYPE"
  -         jdbc-type="INTEGER"
  -      />
  -   </class-descriptor>
  -
  -
   <!-- THIS IS THE OJB NAMED ROOTS TABLE, DO NOT EDIT-->
      <class-descriptor
      	  class="org.apache.ojb.odmg.NamedRootsEntry"
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message