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/broker PBRollbackTest.java
Date Tue, 16 Aug 2005 20:12:42 GMT
arminw      2005/08/16 13:12:42

  Modified:    src/test/org/apache/ojb/broker Tag: OJB_1_0_RELEASE
                        PBRollbackTest.java
  Log:
  fix test case
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.8.2.2   +7 -39     db-ojb/src/test/org/apache/ojb/broker/PBRollbackTest.java
  
  Index: PBRollbackTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/PBRollbackTest.java,v
  retrieving revision 1.8.2.1
  retrieving revision 1.8.2.2
  diff -u -r1.8.2.1 -r1.8.2.2
  --- PBRollbackTest.java	27 Nov 2004 02:12:38 -0000	1.8.2.1
  +++ PBRollbackTest.java	16 Aug 2005 20:12:42 -0000	1.8.2.2
  @@ -123,16 +123,13 @@
       public void testUserRollbackClearCache() throws Exception
       {
           Collection projects = getNewProjects(10);
  -        PersistenceBroker broker = PersistenceBrokerFactory.defaultPersistenceBroker();
           storeObjects(broker, projects);
           Criteria c = new Criteria();
           Query q = new QueryByCriteria(Project.class, c);
           broker.beginTransaction();
           int beforeRollback = broker.getCount(q);
           broker.commitTransaction();
  -        broker.close();
   
  -        broker = PersistenceBrokerFactory.defaultPersistenceBroker();
           broker.beginTransaction();
           storeObjects(broker, getNewProjects(10));
           broker.clearCache();
  @@ -150,13 +147,10 @@
           broker.abortTransaction();
           //explicit clear cache
           broker.clearCache();
  -        broker.close();
   
  -        broker = PersistenceBrokerFactory.defaultPersistenceBroker();
           c = new Criteria();
           q = new QueryByCriteria(Project.class, c);
           int afterRollback = broker.getCount(q);
  -        broker.close();
   
           assertEquals(beforeRollback, afterRollback);
           assertEquals(beforeRollback + 10, whileTransaction);
  @@ -166,16 +160,13 @@
       public void testUserRollback() throws Exception
       {
           Collection projects = getNewProjects(10);
  -        PersistenceBroker broker = PersistenceBrokerFactory.defaultPersistenceBroker();
           storeObjects(broker, projects);
           Criteria c = new Criteria();
           Query q = new QueryByCriteria(Project.class, c);
           broker.beginTransaction();
           int beforeRollback = broker.getCount(q);
           broker.commitTransaction();
  -        broker.close();
   
  -        broker = PersistenceBrokerFactory.defaultPersistenceBroker();
           broker.beginTransaction();
           storeObjects(broker, getNewProjects(10));
   
  @@ -190,13 +181,10 @@
           }
   
           broker.abortTransaction();
  -        broker.close();
   
  -        broker = PersistenceBrokerFactory.defaultPersistenceBroker();
           c = new Criteria();
           q = new QueryByCriteria(Project.class, c);
           int afterRollback = broker.getCount(q);
  -        broker.close();
   
           assertEquals(beforeRollback, afterRollback);
           assertEquals(beforeRollback + 10, whileTransaction);
  @@ -206,7 +194,6 @@
       public void testRollbackCausedByNotExistingObject() throws Exception
       {
           Collection projects = getNewProjects(10);
  -        PersistenceBroker broker = PersistenceBrokerFactory.defaultPersistenceBroker();
           Query q;
           int beforeRollback;
           try
  @@ -241,14 +228,8 @@
               // e.printStackTrace();
               broker.abortTransaction();
           }
  -        finally
  -        {
  -            if(broker != null && !broker.isClosed()) broker.close();
  -        }
   
  -        broker = PersistenceBrokerFactory.defaultPersistenceBroker();
           int afterRollback = broker.getCount(q);
  -        broker.close();
   
           assertEquals("Object count does not match after rollback", beforeRollback, afterRollback);
       }
  @@ -264,23 +245,16 @@
                   ObjectReferenceDescriptor.CASCADE_OBJECT,
                   false);
           ArrayList projects = getNewProjects(5);
  -        PersistenceBroker broker = PersistenceBrokerFactory.defaultPersistenceBroker();
           Query q;
           int beforeRollback;
  -        try
  -        {
  -            broker.beginTransaction();
  -            storeObjects(broker, projects);
  -            broker.commitTransaction();
   
  -            Criteria c = new Criteria();
  -            q = new QueryByCriteria(Project.class, c);
  -            beforeRollback = broker.getCount(q);
  -        }
  -        finally
  -        {
  -            if(broker != null && !broker.isClosed()) broker.close();
  -        }
  +        broker.beginTransaction();
  +        storeObjects(broker, projects);
  +        broker.commitTransaction();
  +
  +        Criteria c = new Criteria();
  +        q = new QueryByCriteria(Project.class, c);
  +        beforeRollback = broker.getCount(q);
   
           broker = PersistenceBrokerFactory.defaultPersistenceBroker();
           try
  @@ -304,14 +278,8 @@
               // e.printStackTrace();
               broker.abortTransaction();
           }
  -        finally
  -        {
  -            if(broker != null && !broker.isClosed()) broker.close();
  -        }
   
  -        broker = PersistenceBrokerFactory.defaultPersistenceBroker();
           int afterRollback = broker.getCount(q);
  -        broker.close();
   
           assertEquals("Object count does not match after rollback", beforeRollback, afterRollback);
       }
  
  
  

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