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 BatchModeTest.java
Date Tue, 28 Oct 2003 21:05:16 GMT
arminw      2003/10/28 13:05:16

  Modified:    src/test/org/apache/ojb/broker BatchModeTest.java
  Log:
  add test
  
  Revision  Changes    Path
  1.4       +72 -1     db-ojb/src/test/org/apache/ojb/broker/BatchModeTest.java
  
  Index: BatchModeTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/BatchModeTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BatchModeTest.java	26 Oct 2003 17:18:33 -0000	1.3
  +++ BatchModeTest.java	28 Oct 2003 21:05:16 -0000	1.4
  @@ -18,6 +18,7 @@
   import org.apache.ojb.broker.query.Criteria;
   
   import java.util.Collection;
  +import java.util.Iterator;
   
   /**
    * @author Oleg Nitz
  @@ -136,7 +137,7 @@
           }
       }
   
  -    public void testMassInsert()
  +    public void testMassInsertDelete()
       {
           String name = "testMassInsert_" + System.currentTimeMillis();
   
  @@ -156,5 +157,75 @@
           Query q = QueryFactory.newQuery(Person.class, crit);
           Collection result = broker.getCollectionByQuery(q);
           assertEquals(200, result.size());
  +
  +        broker.beginTransaction();
  +        for (Iterator iterator = result.iterator(); iterator.hasNext();)
  +        {
  +            broker.delete(iterator.next());
  +        }
  +        broker.commitTransaction();
  +
  +        crit = new Criteria();
  +        crit.addLike("lastname", name);
  +        q = QueryFactory.newQuery(Person.class, crit);
  +        result = broker.getCollectionByQuery(q);
  +        assertEquals(0, result.size());
  +    }
  +
  +    public void testBatchModeDeclaration() throws Exception
  +    {
  +        String name = "testBatchModeDeclaration_" + System.currentTimeMillis();
  +
  +        broker.serviceConnectionManager().setBatchMode(true);
  +        broker.beginTransaction();
  +        Person p = new Person();
  +        p.setFirstname("a mass test");
  +        p.setLastname(name);
  +        broker.store(p);
  +        broker.commitTransaction();
  +
  +        // new PB instance
  +        tearDown();
  +        setUp();
  +
  +        broker.beginTransaction();
  +        broker.serviceConnectionManager().setBatchMode(true);
  +        p = new Person();
  +        p.setFirstname("a mass test");
  +        p.setLastname(name);
  +        broker.store(p);
  +        broker.commitTransaction();
  +
  +        // new PB instance
  +        tearDown();
  +        setUp();
  +        broker.serviceConnectionManager().setBatchMode(true);
  +        broker.serviceConnectionManager().getConnection();
  +        broker.beginTransaction();
  +        broker.commitTransaction();
  +
  +        // new PB instance
  +        tearDown();
  +        setUp();
  +        broker.serviceConnectionManager().setBatchMode(true);
  +        broker.serviceConnectionManager().getConnection();
  +        broker.beginTransaction();
  +        broker.abortTransaction();
  +
  +        // new PB instance
  +        tearDown();
  +        setUp();
  +        broker.beginTransaction();
  +        broker.serviceConnectionManager().setBatchMode(true);
  +        broker.serviceConnectionManager().getConnection();
  +        broker.commitTransaction();
  +
  +        // new PB instance
  +        tearDown();
  +        setUp();
  +        broker.beginTransaction();
  +        broker.serviceConnectionManager().setBatchMode(true);
  +        broker.serviceConnectionManager().getConnection();
  +        broker.abortTransaction();
       }
   }
  
  
  

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