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/odmg CollectionsTest.java
Date Sat, 11 Sep 2004 17:39:09 GMT
arminw      2004/09/11 10:39:09

  Modified:    src/test/org/apache/ojb/odmg Tag: OJB_1_0_RELEASE
                        CollectionsTest.java
  Log:
  update test case
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.13.2.1  +20 -38    db-ojb/src/test/org/apache/ojb/odmg/CollectionsTest.java
  
  Index: CollectionsTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/CollectionsTest.java,v
  retrieving revision 1.13
  retrieving revision 1.13.2.1
  diff -u -r1.13 -r1.13.2.1
  --- CollectionsTest.java	5 Apr 2004 17:11:48 -0000	1.13
  +++ CollectionsTest.java	11 Sep 2004 17:39:09 -0000	1.13.2.1
  @@ -10,13 +10,10 @@
   
   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.Query;
   import org.apache.ojb.broker.query.QueryFactory;
  -import org.apache.ojb.junit.OJBTestCase;
  -import org.odmg.Database;
  -import org.odmg.Implementation;
  +import org.apache.ojb.junit.ODMGTestCase;
   import org.odmg.OQLQuery;
   import org.odmg.Transaction;
   
  @@ -26,11 +23,8 @@
    * @author <a href="mailto:armin@codeAuLait.de">Armin Waibel</a>
    * @version $Id$
    */
  -public class CollectionsTest extends OJBTestCase
  +public class CollectionsTest extends ODMGTestCase
   {
  -    private Implementation odmg;
  -    private Database db;
  -
       public CollectionsTest(String s)
       {
           super(s);
  @@ -45,24 +39,11 @@
       public void setUp() throws Exception
       {
           super.setUp();
  -
  -        odmg = OJB.getInstance();
  -        db = odmg.newDatabase();
  -        db.open(TestHelper.DEF_DATABASE_NAME, Database.OPEN_READ_WRITE);
       }
   
       protected void tearDown() throws Exception
       {
           super.tearDown();
  -        try
  -        {
  -            if(odmg.currentTransaction() == null) db.close();
  -            odmg = null;
  -        }
  -        catch (Exception e)
  -        {
  -            // ignore
  -        }
       }
   
   
  @@ -76,7 +57,7 @@
           Gatherer gat = new Gatherer(null, prefix + "_Gatherer");
           TransactionExt tx = (TransactionExt)odmg.newTransaction();
           tx.begin();
  -        db.makePersistent(gat);
  +        database.makePersistent(gat);
           tx.commit();
           // check if gatherer was stored
           tx.begin();
  @@ -134,7 +115,7 @@
           gat.setCollectiblesC(Arrays.asList(prepareCollectibleC(null, prefix)));
           TransactionExt tx = (TransactionExt)odmg.newTransaction();
           tx.begin();
  -        db.makePersistent(gat);
  +        database.makePersistent(gat);
           tx.commit();
   
           // check if gatherer was stored
  @@ -173,6 +154,7 @@
                   " where name like $1");
           query.bind(prefix + "%");
           result = (Collection) query.execute();
  +
           assertEquals("Wrong number of objects found", 2, result.size());
           tx.commit();
   
  @@ -205,7 +187,7 @@
           gat.setCollectiblesA(colList);
           TransactionExt tx = (TransactionExt)odmg.newTransaction();
           tx.begin();
  -        db.makePersistent(gat);
  +        database.makePersistent(gat);
           tx.commit();
   
           // check if gatherer was stored
  @@ -235,7 +217,7 @@
           fetchedGat.setCollectiblesA(newCols);
           tx.lock(fetchedGat, Transaction.WRITE);
           // todo: do we need to delete removed reference explicit?
  -        db.deletePersistent(colsA.get(0));
  +        database.deletePersistent(colsA.get(0));
           //*************************************
           tx.commit();
   
  @@ -282,7 +264,7 @@
           gat.setCollectiblesA(colList);
           gat.setCollectiblesB(colListB);
   
  -        db.makePersistent(gat);
  +        database.makePersistent(gat);
           tx.commit();
   
           // check if gatherer was stored
  @@ -350,8 +332,8 @@
   
           Transaction tx = odmg.newTransaction();
           tx.begin();
  -        db.makePersistent(coll_1);
  -        db.makePersistent(coll_2);
  +        database.makePersistent(coll_1);
  +        database.makePersistent(coll_2);
           tx.commit();
   
           tx.begin();
  @@ -429,7 +411,7 @@
           gat.setCollectiblesA(Arrays.asList(prepareCollectibleA(gat, prefix + "_1_")));
           TransactionExt tx = (TransactionExt)odmg.newTransaction();
           tx.begin();
  -        db.makePersistent(gat);
  +        database.makePersistent(gat);
           tx.commit();
   
           tx.begin();
  @@ -494,8 +476,8 @@
           gat2.setCollectiblesC(Arrays.asList(new CollectibleC[]{collC_2}));
           TransactionExt tx = (TransactionExt)odmg.newTransaction();
           tx.begin();
  -        db.makePersistent(gat);
  -        db.makePersistent(gat2);
  +        database.makePersistent(gat);
  +        database.makePersistent(gat2);
           tx.commit();
   
           // query and check the result
  @@ -584,7 +566,7 @@
           gat.setCollectiblesC(Arrays.asList(prepareCollectibleC(null, prefix)));
           TransactionExt tx = (TransactionExt)odmg.newTransaction();
           tx.begin();
  -        db.makePersistent(gat);
  +        database.makePersistent(gat);
           tx.commit();
   
           // check if gatherer was stored
  @@ -616,7 +598,7 @@
           tx.lock(fetchedGat, Transaction.WRITE);
           fetchedGat.setCollectiblesA(newCols);
           // todo: we need to delete removed object explicit?
  -        db.deletePersistent(colC.get(0));
  +        database.deletePersistent(colC.get(0));
           //**********************************************************
           tx.commit();
   
  @@ -668,7 +650,7 @@
           gat.setCollectiblesC(Arrays.asList(prepareCollectibleC(null, prefix)));
           TransactionExt tx = (TransactionExt)odmg.newTransaction();
           tx.begin();
  -        db.makePersistent(gat);
  +        database.makePersistent(gat);
           tx.commit();
   
           // check if gatherer was stored
  @@ -750,7 +732,7 @@
   
           TransactionExt tx = (TransactionExt)odmg.newTransaction();
           tx.begin();
  -        db.makePersistent(gat);
  +        database.makePersistent(gat);
           tx.commit();
   
           // check if gatherer was stored
  @@ -824,7 +806,7 @@
   > Create new B.
   > Add B to A.
   > Make A persistent.
  -> A and B successfully persisted to the DB.
  +> A and B successfully persisted to the database.
   > Clear the OJB cache
   > Retrieve A (using PB)
   > Start Tx (ODMG)
  @@ -852,7 +834,7 @@
   
           TransactionExt tx = (TransactionExt) odmg.newTransaction();
           tx.begin();
  -        db.makePersistent(gat);
  +        database.makePersistent(gat);
           tx.commit();
   
           // now cross ODMG with PB api
  
  
  

---------------------------------------------------------------------
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