ojb-dev@db.apache.org
[Top] [All Lists]

cvs commit: db-ojb/src/test/org/apache/ojb/broker/sqlcount TwoLevelSimpl

Subject: cvs commit: db-ojb/src/test/org/apache/ojb/broker/sqlcount TwoLevelSimpleTest.java EmptyCacheCountTest.java
From:
Date: 14 Nov 2004 09:42:55 -0000
tomdz       2004/11/14 01:42:55

  Modified:    src/test/org/apache/ojb/odmg LockTestCommitedReads.java
                        LockTestUncommitedReads.java LockingTest.java
                        ManyToManyTest.java LockTestRepeatableReads.java
                        UserTestCases.java LockTestSerializable.java
                        MultiDBUsageTest.java
               src/test/org/apache/ojb/junit PBTestCase.java
                        OJBTestCase.java ODMGTestCase.java
               src/test/org/apache/ojb/broker/sequence
                        SequenceManagerHandle.java
                        NativeIdentifierTest.java SequenceManagerTest.java
               src/test/org/apache/ojb/odmg/shared ODMGGourmet.java
                        Article.java
               src/test/org/apache/ojb/broker/sqlcount
                        TwoLevelSimpleTest.java EmptyCacheCountTest.java
  Log:
  Reworked the OJB core:
  - replaced the factories/configuration concept with the ComponentContainer
  - removal of most static calls within OJB
  - removed the old "D" collection implementations and renamed the new ones
  - moved StatementForClassIF handling to the PersistenceConfiguration
  - moved RowReader caching from the ClassDescriptor to the 
PersistenceConfiguration
  and other changes (see mail on the dev list for more details)
  
  Revision  Changes    Path
  1.10      +2 -5      
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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- LockTestCommitedReads.java        20 Sep 2004 14:30:59 -0000      1.9
  +++ LockTestCommitedReads.java        14 Nov 2004 09:42:54 -0000      1.10
  @@ -13,10 +13,8 @@
   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;
   
   public class LockTestCommitedReads extends OJBTestCase
   {
  @@ -48,12 +46,11 @@
           oldIsolationLevel = cld.getIsolationLevel();
           cld.setIsolationLevel(testingIsolationLevel);
   
  -        lockManager = LockManagerFactory.getLockManager();
  -
           databaseName = TestHelper.DEF_DATABASE_NAME;
           // get facade instance
  -        Implementation odmg = OJB.getInstance();
  +        ImplementationInternal odmg = 
(ImplementationInternal)OJB.getInstance();
           db = odmg.newDatabase();
  +        lockManager = odmg.getLockManager();
           //open database
           db.open(databaseName, Database.OPEN_READ_WRITE);
   
  
  
  
  1.11      +2 -5      
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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- LockTestUncommitedReads.java      20 Sep 2004 14:30:59 -0000      1.10
  +++ LockTestUncommitedReads.java      14 Nov 2004 09:42:54 -0000      1.11
  @@ -13,10 +13,8 @@
   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;
   
   public class LockTestUncommitedReads extends TestCase
   {
  @@ -48,13 +46,12 @@
           oldIsolationLevel = cld.getIsolationLevel();
           cld.setIsolationLevel(testingIsolationLevel);
   
  -        lockManager = LockManagerFactory.getLockManager();
  -
           databaseName = TestHelper.DEF_DATABASE_NAME;
   
           // get facade instance
  -        Implementation odmg = OJB.getInstance();
  +        ImplementationInternal odmg = 
(ImplementationInternal)OJB.getInstance();
           db = odmg.newDatabase();
  +        lockManager = odmg.getLockManager();
           //open database
           db.open(databaseName, Database.OPEN_READ_WRITE);
   
  
  
  
  1.16      +13 -17    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.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- LockingTest.java  14 Sep 2004 16:50:02 -0000      1.15
  +++ LockingTest.java  14 Nov 2004 09:42:54 -0000      1.16
  @@ -11,11 +11,9 @@
   import org.apache.ojb.broker.query.Criteria;
   import org.apache.ojb.broker.query.QueryFactory;
   import org.apache.ojb.odmg.locking.LockManager;
  -import org.apache.ojb.odmg.locking.LockManagerFactory;
   import org.apache.ojb.odmg.shared.Article;
   import org.apache.ojb.junit.OJBTestCase;
   import org.odmg.Database;
  -import org.odmg.Implementation;
   import org.odmg.LockNotGrantedException;
   import org.odmg.OQLQuery;
   import org.odmg.Transaction;
  @@ -33,11 +31,10 @@
   
       private static String PRE = "LockingTest_" + System.currentTimeMillis() 
+ "_";
   
  -    private Implementation odmg1 = OJB.getInstance();
  -    private Database db1 = odmg1.newDatabase();
  -
  -    private Implementation odmg2 = OJB.getInstance();
  -    private Database db2 = odmg2.newDatabase();
  +    private ImplementationInternal odmg1;
  +    private Database db1;
  +    private ImplementationInternal odmg2;
  +    private Database db2;
   
       public LockingTest(String name)
       {
  @@ -49,12 +46,12 @@
           super.setUp();
           String databaseName = TestHelper.DEF_DATABASE_NAME;
   
  -        odmg1 = OJB.getInstance();
  -        db1 = odmg1.newDatabase();
  +        odmg1 = (ImplementationInternal)OJB.getInstance();
  +        db1   = odmg1.newDatabase();
           db1.open(databaseName, Database.OPEN_READ_WRITE);
   
  -        odmg2 = OJB.getInstance();
  -        db2 = odmg2.newDatabase();
  +        odmg2 = (ImplementationInternal)OJB.getInstance();
  +        db2   = odmg2.newDatabase();
           db2.open(databaseName, Database.OPEN_READ_WRITE);
   
       }
  @@ -119,11 +116,10 @@
   
           tx1.begin();
           tx2.begin();
  -        LockManager lm = LockManagerFactory.getLockManager();
  -        boolean success1 = lm.writeLock(tx1, a);
  -        boolean success2 = lm.writeLock(tx2, a);
  +        boolean success1 = odmg1.getLockManager().writeLock(tx1, a);
  +        boolean success2 = odmg2.getLockManager().writeLock(tx2, a);
   
  -        boolean success3 = lm.releaseLock(tx1, a);
  +        boolean success3 = odmg1.getLockManager().releaseLock(tx1, a);
   
           assertTrue("1st lock should succeed", success1);
           assertTrue("2nd lock should not succeed", !success2);
  @@ -152,7 +148,7 @@
   
           tx1.begin();
           tx2.begin();
  -        LockManager lm = LockManagerFactory.getLockManager();
  +        LockManager lm = odmg1.getLockManager();
   
           assertFalse(tx1.getGUID().equals(tx2.getGUID()));
   
  @@ -253,7 +249,7 @@
           {
               tx.lock(arr[i], Transaction.WRITE);
           }
  -        LockManager lm = LockManagerFactory.getLockManager();
  +        LockManager lm = odmg1.getLockManager();
           boolean success = lm.writeLock(tx, arr[(loops - 2)]);
           assertTrue("lock should succeed", success);
           tx.commit();
  
  
  
  1.13      +18 -18    db-ojb/src/test/org/apache/ojb/odmg/ManyToManyTest.java
  
  Index: ManyToManyTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/ManyToManyTest.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ManyToManyTest.java       22 Jun 2004 18:16:22 -0000      1.12
  +++ ManyToManyTest.java       14 Nov 2004 09:42:54 -0000      1.13
  @@ -30,8 +30,8 @@
        */
       public void testPolymorphMToN() throws Exception
       {
  -        ODMGGourmet james = new ODMGGourmet("james");
  -        ODMGGourmet doris = new ODMGGourmet("doris");
  +        ODMGGourmet james = new ODMGGourmet(odmg.newDList(), "james");
  +        ODMGGourmet doris = new ODMGGourmet(odmg.newDList(), "doris");
   
           Fish tuna = new Fish("tuna", 242, "salt");
           Fish trout = new Fish("trout", 52, "fresh water");
  @@ -107,8 +107,8 @@
   
       public void testMtoNSeparate_I() throws Exception
       {
  -        ODMGGourmet paula = new ODMGGourmet("a_testMtoNSeparate_I");
  -        ODMGGourmet candy = new ODMGGourmet("b_testMtoNSeparate_I");
  +        ODMGGourmet paula = new ODMGGourmet(odmg.newDList(), 
"a_testMtoNSeparate_I");
  +        ODMGGourmet candy = new ODMGGourmet(odmg.newDList(), 
"b_testMtoNSeparate_I");
   
           long timestamp = System.currentTimeMillis();
           Fish tuna = new Fish("tuna_" + timestamp, 242, "salt");
  @@ -137,8 +137,8 @@
   
       public void testMtoNSeparate_II() throws Exception
       {
  -        ODMGGourmet james = new ODMGGourmet("a_testMtoNSeparate_II");
  -        ODMGGourmet doris = new ODMGGourmet("b_testMtoNSeparate_II");
  +        ODMGGourmet james = new ODMGGourmet(odmg.newDList(), 
"a_testMtoNSeparate_II");
  +        ODMGGourmet doris = new ODMGGourmet(odmg.newDList(), 
"b_testMtoNSeparate_II");
   
           long timestamp = System.currentTimeMillis();
           Fish tuna = new Fish("tuna_" + timestamp, 242, "salt");
  @@ -173,10 +173,10 @@
           Fish tuna = new Fish("tuna_" + timestamp, 242, "salt");
           Fish trout = new Fish("trout_" + timestamp, 52, "fresh water");
   
  -        ODMGGourmet paula = new ODMGGourmet("a_testMtoNTogether");
  -        ODMGGourmet candy = new ODMGGourmet("b_testMtoNTogether");
  -        ODMGGourmet james = new ODMGGourmet("c_testMtoNTogether");
  -        ODMGGourmet doris = new ODMGGourmet("d_testMtoNTogether");
  +        ODMGGourmet paula = new ODMGGourmet(odmg.newDList(), 
"a_testMtoNTogether");
  +        ODMGGourmet candy = new ODMGGourmet(odmg.newDList(), 
"b_testMtoNTogether");
  +        ODMGGourmet james = new ODMGGourmet(odmg.newDList(), 
"c_testMtoNTogether");
  +        ODMGGourmet doris = new ODMGGourmet(odmg.newDList(), 
"d_testMtoNTogether");
   
           paula.addFavoriteFood(trout);
           candy.addFavoriteFood(tuna);
  @@ -216,10 +216,10 @@
           Fish trout = new Fish("trout_" + timestamp, 52, "fresh water");
           Fish goldfish = new Fish("goldfish_" + timestamp, 10, "brackish 
water");
   
  -        ODMGGourmet paula = new ODMGGourmet("a_testMtoNTogether"+ timestamp);
  -        ODMGGourmet candy = new ODMGGourmet("b_testMtoNTogether"+ timestamp);
  -        ODMGGourmet james = new ODMGGourmet("c_testMtoNTogether"+ timestamp);
  -        ODMGGourmet doris = new ODMGGourmet("d_testMtoNTogether"+ timestamp);
  +        ODMGGourmet paula = new ODMGGourmet(odmg.newDList(), 
"a_testMtoNTogether"+ timestamp);
  +        ODMGGourmet candy = new ODMGGourmet(odmg.newDList(), 
"b_testMtoNTogether"+ timestamp);
  +        ODMGGourmet james = new ODMGGourmet(odmg.newDList(), 
"c_testMtoNTogether"+ timestamp);
  +        ODMGGourmet doris = new ODMGGourmet(odmg.newDList(), 
"d_testMtoNTogether"+ timestamp);
   
           paula.addFavoriteFood(trout);
           candy.addFavoriteFood(tuna);
  @@ -289,10 +289,10 @@
           Fish trout = new Fish("trout_" + timestamp, 52, "fresh water");
           Fish goldfish = new Fish("goldfish_" + timestamp, 10, "brackish 
water");
   
  -        ODMGGourmet paula = new ODMGGourmet("a_testMtoNTogether"+ timestamp);
  -        ODMGGourmet candy = new ODMGGourmet("b_testMtoNTogether"+ timestamp);
  -        ODMGGourmet james = new ODMGGourmet("c_testMtoNTogether"+ timestamp);
  -        ODMGGourmet doris = new ODMGGourmet("d_testMtoNTogether"+ timestamp);
  +        ODMGGourmet paula = new ODMGGourmet(odmg.newDList(), 
"a_testMtoNTogether"+ timestamp);
  +        ODMGGourmet candy = new ODMGGourmet(odmg.newDList(), 
"b_testMtoNTogether"+ timestamp);
  +        ODMGGourmet james = new ODMGGourmet(odmg.newDList(), 
"c_testMtoNTogether"+ timestamp);
  +        ODMGGourmet doris = new ODMGGourmet(odmg.newDList(), 
"d_testMtoNTogether"+ timestamp);
   
           paula.addFavoriteFood(trout);
           candy.addFavoriteFood(tuna);
  
  
  
  1.10      +2 -5      
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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- LockTestRepeatableReads.java      20 Sep 2004 14:30:59 -0000      1.9
  +++ LockTestRepeatableReads.java      14 Nov 2004 09:42:54 -0000      1.10
  @@ -13,10 +13,8 @@
   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;
   
   public class LockTestRepeatableReads extends TestCase
   {
  @@ -48,13 +46,12 @@
           oldIsolationLevel = cld.getIsolationLevel();
           cld.setIsolationLevel(testingIsolationLevel);
   
  -        lockManager = LockManagerFactory.getLockManager();
  -
           databaseName = TestHelper.DEF_DATABASE_NAME;
   
           // get facade instance
  -        Implementation odmg = OJB.getInstance();
  +        ImplementationInternal odmg = 
(ImplementationInternal)OJB.getInstance();
           db = odmg.newDatabase();
  +        lockManager = odmg.getLockManager();
           //open database
           db.open(databaseName, Database.OPEN_READ_WRITE);
   
  
  
  
  1.17      +4 -7      db-ojb/src/test/org/apache/ojb/odmg/UserTestCases.java
  
  Index: UserTestCases.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/UserTestCases.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- UserTestCases.java        14 Sep 2004 16:50:02 -0000      1.16
  +++ UserTestCases.java        14 Nov 2004 09:42:54 -0000      1.17
  @@ -3,8 +3,6 @@
   import java.util.List;
   
   import org.apache.ojb.broker.Identity;
  -import org.apache.ojb.broker.util.configuration.impl.OjbConfiguration;
  -import org.apache.ojb.broker.util.configuration.impl.OjbConfigurator;
   import org.apache.ojb.junit.ODMGTestCase;
   import org.apache.ojb.odmg.shared.Person;
   import org.apache.ojb.odmg.shared.PersonImpl;
  @@ -155,8 +153,7 @@
        */
       public void testImplicitLocking() throws Exception
       {
  -        OjbConfiguration conf = (OjbConfiguration) 
OjbConfigurator.getInstance().getConfigurationFor(null);
  -        boolean useImplicitLocking = conf.useImplicitLocking();
  +        boolean useImplicitLocking = odmg.isUsingImplicitLocking();
           boolean restore = false;
   
           // prepare test case
  @@ -165,7 +162,7 @@
               if (useImplicitLocking)
               {
                   restore = true;
  -                conf.setUseImplicitLocking(false);
  +                odmg.setUsingImplicitLocking(false);
               }
               String name = "testImplicitLocking - " + 
System.currentTimeMillis();
               String queryString = "select sites from " + Site.class.getName() 
+ " where name = $1";
  @@ -213,7 +210,7 @@
               // reset configuration
               if (restore)
               {
  -                conf.setUseImplicitLocking(useImplicitLocking);
  +                odmg.setUsingImplicitLocking(useImplicitLocking);
               }
           }
       }
  
  
  
  1.11      +2 -5      
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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- LockTestSerializable.java 20 Sep 2004 14:30:59 -0000      1.10
  +++ LockTestSerializable.java 14 Nov 2004 09:42:54 -0000      1.11
  @@ -13,10 +13,8 @@
   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;
   
   public class LockTestSerializable extends TestCase
   {
  @@ -48,13 +46,12 @@
           oldIsolationLevel = cld.getIsolationLevel();
           cld.setIsolationLevel(testingIsolationLevel);
   
  -        lockManager = LockManagerFactory.getLockManager();
  -
           databaseName = TestHelper.DEF_DATABASE_NAME;
   
           // get facade instance
  -        Implementation odmg = OJB.getInstance();
  +        ImplementationInternal odmg = 
(ImplementationInternal)OJB.getInstance();
           db = odmg.newDatabase();
  +        lockManager = odmg.getLockManager();
           //open database
           db.open(databaseName, Database.OPEN_READ_WRITE);
   
  
  
  
  1.12      +3 -4      db-ojb/src/test/org/apache/ojb/odmg/MultiDBUsageTest.java
  
  Index: MultiDBUsageTest.java
  ===================================================================
  RCS file: 
/home/cvs/db-ojb/src/test/org/apache/ojb/odmg/MultiDBUsageTest.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- MultiDBUsageTest.java     14 Sep 2004 16:50:02 -0000      1.11
  +++ MultiDBUsageTest.java     14 Nov 2004 09:42:54 -0000      1.12
  @@ -3,7 +3,6 @@
   import org.apache.ojb.broker.FarAwayClass;
   import org.apache.ojb.broker.PBKey;
   import org.apache.ojb.broker.PersistenceBroker;
  -import org.apache.ojb.broker.PersistenceBrokerFactory;
   import org.apache.ojb.broker.TestHelper;
   import org.apache.ojb.broker.metadata.MetadataManager;
   import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
  @@ -58,11 +57,11 @@
               
mm.connectionRepository().addDescriptor(cr.getDescriptor(TestHelper.FAR_AWAY_KEY));
           }
   
  -        odmg_1 = OJB.getInstance();
  +        odmg_1 = OJB.getInstance(ojb);
           db_1 = odmg_1.newDatabase();
           db_1.open(TestHelper.DEF_DATABASE_NAME, Database.OPEN_READ_WRITE);
   
  -        odmg_2 = OJB.getInstance();
  +        odmg_2 = OJB.getInstance(ojb);
           db_2 = odmg_2.newDatabase();
           db_2.open(TestHelper.FAR_AWAY_DATABASE_NAME, 
Database.OPEN_READ_WRITE);
       }
  @@ -291,7 +290,7 @@
   
       protected int getDBObjectCountWithNewPB(PBKey pbKey, Class target) 
throws Exception
       {
  -        PersistenceBroker broker = 
PersistenceBrokerFactory.createPersistenceBroker(pbKey);
  +        PersistenceBroker broker = 
ojb.getConfiguration(pbKey).createPersistenceBroker();
           Criteria c = new Criteria();
           Query q = new QueryByCriteria(target, c);
           int count = broker.getCount(q);
  
  
  
  1.6       +14 -7     db-ojb/src/test/org/apache/ojb/junit/PBTestCase.java
  
  Index: PBTestCase.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/junit/PBTestCase.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PBTestCase.java   14 Sep 2004 16:50:02 -0000      1.5
  +++ PBTestCase.java   14 Nov 2004 09:42:55 -0000      1.6
  @@ -1,7 +1,7 @@
   package org.apache.ojb.junit;
   
  -import org.apache.ojb.broker.PersistenceBroker;
  -import org.apache.ojb.broker.PersistenceBrokerFactory;
  +import org.apache.ojb.broker.PersistenceBrokerInternal;
  +import org.apache.ojb.broker.PersistenceConfiguration;
   
   /**
    * A base class for PB-api based test cases.
  @@ -12,10 +12,12 @@
    */
   public class PBTestCase extends OJBTestCase
   {
  -    public PersistenceBroker broker;
  +    protected PersistenceConfiguration  persistenceConf;
  +    protected PersistenceBrokerInternal broker;
   
       public PBTestCase()
       {
  +        super();
       }
   
       public PBTestCase(String name)
  @@ -26,7 +28,9 @@
       public void setUp() throws Exception
       {
           super.setUp();
  -        broker = PersistenceBrokerFactory.defaultPersistenceBroker();
  +        persistenceConf = ojb.getConfiguration(null);
  +        broker          = 
(PersistenceBrokerInternal)persistenceConf.createPersistenceBroker();
  +
           // allows to run all tests in batch mode, if the 'batch-mode'
           // was enabled
           broker.serviceConnectionManager().setBatchMode(true);
  @@ -34,10 +38,13 @@
   
       public void tearDown() throws Exception
       {
  -        super.tearDown();
  -        if(broker != null)
  +        if (broker != null)
           {
               broker.close();
           }
  +        persistenceConf.getCacheManager().clearCaches();
  +        persistenceConf.releaseAllInstances();
  +        persistenceConf = null;
  +        super.tearDown();
       }
   }
  
  
  
  1.8       +7 -11     db-ojb/src/test/org/apache/ojb/junit/OJBTestCase.java
  
  Index: OJBTestCase.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/junit/OJBTestCase.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- OJBTestCase.java  27 Oct 2004 20:47:41 -0000      1.7
  +++ OJBTestCase.java  14 Nov 2004 09:42:55 -0000      1.8
  @@ -30,24 +30,18 @@
       private static final String SKIP_STR = "OJB.skip.issues";
       private static final String SKIP_DEFAULT_VALUE = "false";
   
  -    /*
  -    setup OJB main class instance
  -    */
  -    public static OJB ojb;
  -    static
  -    {
  -        ojb = new OJB();
  -        // TODO: fix this!! This makes old tests compatible with 1.1 version
  -        PersistenceBrokerFactory.setOjb(ojb);
  -    }
  +    /** The OJB main class instance */
  +    protected OJB ojb;
   
       public OJBTestCase()
       {
  +        ojb = PersistenceBrokerFactory.getOjb();
       }
   
       public OJBTestCase(String name)
       {
           super(name);
  +        ojb = PersistenceBrokerFactory.getOjb();
       }
   
       protected void setUp() throws Exception
  @@ -60,7 +54,9 @@
   
       protected void tearDown() throws Exception
       {
  +        ojb.releaseAllConnections();
           super.tearDown();
  +        System.gc();
           // sleep thread to guarantee different timestamp values for
           // each test
           ojbSleep();
  
  
  
  1.2       +5 -4      db-ojb/src/test/org/apache/ojb/junit/ODMGTestCase.java
  
  Index: ODMGTestCase.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/junit/ODMGTestCase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ODMGTestCase.java 19 Apr 2004 16:31:15 -0000      1.1
  +++ ODMGTestCase.java 14 Nov 2004 09:42:55 -0000      1.2
  @@ -1,8 +1,8 @@
   package org.apache.ojb.junit;
   
  -import org.odmg.Implementation;
   import org.odmg.Database;
   import org.odmg.Transaction;
  +import org.apache.ojb.odmg.ImplementationInternal;
   import org.apache.ojb.odmg.OJB;
   import org.apache.ojb.broker.TestHelper;
   
  @@ -14,7 +14,7 @@
    */
   public class ODMGTestCase extends OJBTestCase
   {
  -    public Implementation odmg;
  +    public ImplementationInternal odmg;
       public Database database;
   
       public ODMGTestCase()
  @@ -29,7 +29,7 @@
       protected void setUp() throws Exception
       {
           super.setUp();
  -        odmg = OJB.getInstance();
  +        odmg = (ImplementationInternal)OJB.getInstance(ojb);
           database = odmg.newDatabase();
           database.open(TestHelper.DEF_DATABASE_NAME, 
Database.OPEN_READ_WRITE);
       }
  @@ -48,5 +48,6 @@
           catch(Exception e)
           {
           }
  +        odmg = null;
       }
   }
  
  
  
  1.7       +2 -3      
db-ojb/src/test/org/apache/ojb/broker/sequence/SequenceManagerHandle.java
  
  Index: SequenceManagerHandle.java
  ===================================================================
  RCS file: 
/home/cvs/db-ojb/src/test/org/apache/ojb/broker/sequence/SequenceManagerHandle.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SequenceManagerHandle.java        6 Nov 2003 01:38:16 -0000       1.6
  +++ SequenceManagerHandle.java        14 Nov 2004 09:42:55 -0000      1.7
  @@ -4,7 +4,6 @@
   import org.apache.ojb.broker.PersistenceBrokerException;
   import org.apache.ojb.broker.metadata.FieldDescriptor;
   import org.apache.ojb.broker.util.sequence.SequenceManager;
  -import org.apache.ojb.broker.util.sequence.SequenceManagerFactory;
   import org.apache.ojb.broker.util.sequence.SequenceManagerException;
   
   import java.util.ArrayList;
  @@ -42,7 +41,7 @@
   
       public void run()
       {
  -        SequenceManager sm = 
SequenceManagerFactory.getSequenceManager(broker);
  +        SequenceManager sm = broker.serviceSequenceManager();
           Object result;
           for (int i = 0; i < loops; i++)
           {
  
  
  
  1.17      +11 -9     
db-ojb/src/test/org/apache/ojb/broker/sequence/NativeIdentifierTest.java
  
  Index: NativeIdentifierTest.java
  ===================================================================
  RCS file: 
/home/cvs/db-ojb/src/test/org/apache/ojb/broker/sequence/NativeIdentifierTest.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- NativeIdentifierTest.java 12 Nov 2004 18:18:35 -0000      1.16
  +++ NativeIdentifierTest.java 14 Nov 2004 09:42:55 -0000      1.17
  @@ -12,7 +12,7 @@
   import org.apache.commons.lang.builder.ToStringBuilder;
   import org.apache.ojb.broker.Identity;
   import org.apache.ojb.broker.PersistenceBroker;
  -import org.apache.ojb.broker.PersistenceBrokerFactory;
  +import org.apache.ojb.broker.PersistenceBrokerInternal;
   import org.apache.ojb.broker.TestHelper;
   import org.apache.ojb.broker.metadata.ClassDescriptor;
   import org.apache.ojb.broker.metadata.ObjectReferenceDescriptor;
  @@ -104,7 +104,7 @@
           Connection con;
           Statement stmt;
   
  -        PersistenceBroker pb = 
PersistenceBrokerFactory.defaultPersistenceBroker();
  +        PersistenceBroker pb = persistenceConf.createPersistenceBroker();
           try
           {
               con = pb.serviceConnectionManager().getConnection();
  @@ -206,8 +206,9 @@
               if (broker != null) broker.close();
           }
   
  -        PersistenceBrokerFactory.releaseAllInstances();
  -        broker = PersistenceBrokerFactory.defaultPersistenceBroker();
  +        persistenceConf.releaseAllInstances();
  +        broker = 
(PersistenceBrokerInternal)persistenceConf.createPersistenceBroker();
  +
           SequenceDescriptor sd = 
ojb.getMetadataManager().connectionRepository().
                   getDescriptor(broker.getPBKey()).getSequenceDescriptor();
           assertEquals(SequenceManagerNativeImpl.class, 
sd.getSequenceManagerClass());
  @@ -220,7 +221,7 @@
   
           Connection con;
           Statement stmt;
  -        PersistenceBroker pb = 
PersistenceBrokerFactory.defaultPersistenceBroker();
  +        PersistenceBroker pb = persistenceConf.createPersistenceBroker();
           try
           {
               con = pb.serviceConnectionManager().getConnection();
  @@ -257,8 +258,9 @@
               if (pb != null) pb.close();
           }
   
  -        PersistenceBrokerFactory.releaseAllInstances();
  -        broker = PersistenceBrokerFactory.defaultPersistenceBroker();
  +        persistenceConf.releaseAllInstances();
  +        broker = 
(PersistenceBrokerInternal)persistenceConf.createPersistenceBroker();
  +
           SequenceDescriptor sd = 
ojb.getMetadataManager().connectionRepository().
                   getDescriptor(broker.getPBKey()).getSequenceDescriptor();
           assertEquals(oldSequenceManager, sd.getSequenceManagerClass());
  @@ -267,7 +269,7 @@
           changeAutoSetting(MainObject.class, "allReferences", true, false, 
false, false);
           changeAutoSetting(CollectionReference.class, "singleReference", 
true, false, false, false);
           changeAutoSetting(SingleReference.class, "mainObject", true, false, 
false, false);
  -        broker.close();
  +        super.tearDown();
       }
   
       public void testSimpleInsert_1() throws Exception
  
  
  
  1.29      +4 -5      
db-ojb/src/test/org/apache/ojb/broker/sequence/SequenceManagerTest.java
  
  Index: SequenceManagerTest.java
  ===================================================================
  RCS file: 
/home/cvs/db-ojb/src/test/org/apache/ojb/broker/sequence/SequenceManagerTest.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- SequenceManagerTest.java  14 Sep 2004 16:43:49 -0000      1.28
  +++ SequenceManagerTest.java  14 Nov 2004 09:42:55 -0000      1.29
  @@ -13,7 +13,6 @@
   import org.apache.ojb.broker.query.QueryByCriteria;
   import org.apache.ojb.broker.util.sequence.SequenceManager;
   import org.apache.ojb.broker.util.sequence.SequenceManagerException;
  -import org.apache.ojb.broker.util.sequence.SequenceManagerFactory;
   import org.apache.ojb.broker.util.sequence.SequenceManagerHelper;
   import org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl;
   import org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl;
  @@ -300,8 +299,8 @@
        */
       public void testDatabaseSequenceGeneration() throws Exception
       {
  -        PersistenceBroker broker = 
PersistenceBrokerFactory.defaultPersistenceBroker();
  -        SequenceManager sm = 
SequenceManagerFactory.getSequenceManager(broker);
  +        PersistenceBroker broker = 
ojb.getConfiguration(null).createPersistenceBroker();
  +        SequenceManager sm = broker.serviceSequenceManager();
           if (!(sm instanceof SequenceManagerNextValImpl))
           {
               System.out.println("This test only works for SeqMan 
implementations using "
  @@ -517,7 +516,7 @@
       private List createKeyList(PersistenceBroker broker, FieldDescriptor 
field, int number)
               throws SequenceManagerException
       {
  -        SequenceManager sm = 
SequenceManagerFactory.getSequenceManager(broker);
  +        SequenceManager sm = broker.serviceSequenceManager();
           List resultList = new ArrayList();
           int result;
           for (int i = 0; i < number; i++)
  
  
  
  1.2       +11 -8     
db-ojb/src/test/org/apache/ojb/odmg/shared/ODMGGourmet.java
  
  Index: ODMGGourmet.java
  ===================================================================
  RCS file: 
/home/cvs/db-ojb/src/test/org/apache/ojb/odmg/shared/ODMGGourmet.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ODMGGourmet.java  22 Jun 2004 18:16:22 -0000      1.1
  +++ ODMGGourmet.java  14 Nov 2004 09:42:55 -0000      1.2
  @@ -1,8 +1,6 @@
   package org.apache.ojb.odmg.shared;
   
   import org.apache.ojb.broker.Gourmet;
  -import org.apache.ojb.broker.TestHelper;
  -import org.apache.ojb.odmg.collections.DCollectionFactory;
   import org.odmg.DList;
   
   /**
  @@ -12,26 +10,31 @@
    */
   public class ODMGGourmet extends Gourmet
   {
  -
       /**
        * Constructor for ODMGGourmet.
        */
       public ODMGGourmet()
       {
           super();
  -        DList list = 
DCollectionFactory.getInstance().createDList(TestHelper.DEF_KEY);
  -        this.setFavoriteFood(list);
  +    }
  +
  +    /**
  +     * Constructor for ODMGGourmet.
  +     */
  +    public ODMGGourmet(DList favFood)
  +    {
  +        super();
  +        this.setFavoriteFood(favFood);
       }
   
       /**
        * Constructor for ODMGGourmet.
        * @param name
        */
  -    public ODMGGourmet(String name)
  +    public ODMGGourmet(DList favFood, String name)
       {
           super(name);
  -        DList list = 
DCollectionFactory.getInstance().createDList(TestHelper.DEF_KEY);
  -        this.setFavoriteFood(list);
  +        this.setFavoriteFood(favFood);
       }
   
   }
  
  
  
  1.2       +10 -0     db-ojb/src/test/org/apache/ojb/odmg/shared/Article.java
  
  Index: Article.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/shared/Article.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Article.java      22 Jun 2004 18:16:22 -0000      1.1
  +++ Article.java      14 Nov 2004 09:42:55 -0000      1.2
  @@ -202,6 +202,16 @@
               return false;
       }
   
  +
  +    /* (non-Javadoc)
  +     * @see java.lang.Object#hashCode()
  +     */
  +    public int hashCode()
  +    {
  +        // Since we redefined equals, we have to redefine hashCode as well
  +        return articleId;
  +    }
  +
       /**
        * Gets the isSelloutArticle.
        * @return Returns a boolean
  
  
  
  1.3       +3 -10     
db-ojb/src/test/org/apache/ojb/broker/sqlcount/TwoLevelSimpleTest.java
  
  Index: TwoLevelSimpleTest.java
  ===================================================================
  RCS file: 
/home/cvs/db-ojb/src/test/org/apache/ojb/broker/sqlcount/TwoLevelSimpleTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TwoLevelSimpleTest.java   11 Aug 2004 00:39:44 -0000      1.2
  +++ TwoLevelSimpleTest.java   14 Nov 2004 09:42:55 -0000      1.3
  @@ -9,8 +9,6 @@
   import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.PersistenceBrokerFactory;
   import org.apache.ojb.broker.cloneable.CloneableGroup;
  -import org.apache.ojb.broker.util.configuration.impl.OjbConfiguration;
  -import org.apache.ojb.broker.util.configuration.impl.OjbConfigurator;
   
   /**
    * @author <a href="mailto:om@xxxxxx";>Oliver Matz</a>
  @@ -21,11 +19,6 @@
       private Class old_ObjectCache;
       private String[] old_CacheFilter;
   
  -    private OjbConfiguration getConfig()
  -    {
  -        return (OjbConfiguration) 
OjbConfigurator.getInstance().getConfigurationFor(null);
  -    }
  -
       /**
        * switch cache to {@link org.apache.ojb.broker.cache.TwoLevelCache}.
        *
  @@ -37,7 +30,7 @@
           // 
ObjectCacheFactory.getInstance().setClassToServe(TwoLevelCache.class);
           
//ObjectCacheFactory.getInstance().setClassToServe(org.apache.ojb.broker.cache.ObjectCachePerBrokerImpl.class);
           super.setUp();
  -        old_CacheFilter = getConfig().getCacheFilters();
  +        //old_CacheFilter = getConfig().getCacheFilters();
           // old_ObjectCache = 
ObjectCacheFactory.getInstance().getClassToServe();
       }
   
  @@ -48,7 +41,7 @@
        */
       protected void tearDown() throws Exception
       {
  -        getConfig().setCacheFilters(old_CacheFilter);
  +        //getConfig().setCacheFilters(old_CacheFilter);
           // ObjectCacheFactory.getInstance().setClassToServe(old_ObjectCache);
           super.tearDown();
       }
  
  
  
  1.4       +4 -12     
db-ojb/src/test/org/apache/ojb/broker/sqlcount/EmptyCacheCountTest.java
  
  Index: EmptyCacheCountTest.java
  ===================================================================
  RCS file: 
/home/cvs/db-ojb/src/test/org/apache/ojb/broker/sqlcount/EmptyCacheCountTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- EmptyCacheCountTest.java  11 Aug 2004 00:39:44 -0000      1.3
  +++ EmptyCacheCountTest.java  14 Nov 2004 09:42:55 -0000      1.4
  @@ -11,26 +11,18 @@
   import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.PersistenceBrokerFactory;
   import org.apache.ojb.broker.cache.ObjectCacheEmptyImpl;
  -import org.apache.ojb.broker.util.configuration.impl.OjbConfiguration;
  -import org.apache.ojb.broker.util.configuration.impl.OjbConfigurator;
   
   /**
    * @author <a href="mailto:om@xxxxxx";>Oliver Matz</a>
    * @version $Id$
    */
  -public class EmptyCacheCountTest
  -        extends AbstractCountTest
  +public class EmptyCacheCountTest extends AbstractCountTest
   {
     protected PersistenceBroker myPB;
   
     private Class old_ObjectCache;
     private String[] old_CacheFilter;
   
  -  private OjbConfiguration getConfig()
  -  {
  -      return (OjbConfiguration) 
OjbConfigurator.getInstance().getConfigurationFor(null);
  -  }
  -
     /**
      * switch cache to {@link ObjectCacheEmptyImpl}.
      * @throws Exception
  @@ -41,7 +33,7 @@
         // 
ObjectCacheFactory.getInstance().setClassToServe(ObjectCacheEmptyImpl.class);
       super.setUp();
       myPB = PersistenceBrokerFactory.defaultPersistenceBroker();
  -    old_CacheFilter = getConfig().getCacheFilters();
  +    //old_CacheFilter = getConfig().getCacheFilters();
       // old_ObjectCache = ObjectCacheFactory.getInstance().getClassToServe();
     }
   
  @@ -51,7 +43,7 @@
      */
     protected void tearDown() throws Exception
     {
  -    getConfig().setCacheFilters(old_CacheFilter);
  +    //getConfig().setCacheFilters(old_CacheFilter);
       // ObjectCacheFactory.getInstance().setClassToServe(old_ObjectCache);
       super.tearDown();
     }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@xxxxxxxxxxxxx
For additional commands, e-mail: ojb-dev-help@xxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>
  • cvs commit: db-ojb/src/test/org/apache/ojb/broker/sqlcount TwoLevelSimpleTest.java EmptyCacheCountTest.java, tomdz <=