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 ObjectImageTest.java
Date Mon, 05 Dec 2005 15:06:53 GMT
arminw      2005/12/05 07:06:53

  Modified:    src/test/org/apache/ojb/odmg Tag: OJB_1_0_RELEASE
                        ObjectImageTest.java
  Log:
  update test
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.1.2.7   +11 -5     db-ojb/src/test/org/apache/ojb/odmg/ObjectImageTest.java
  
  Index: ObjectImageTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/ObjectImageTest.java,v
  retrieving revision 1.1.2.6
  retrieving revision 1.1.2.7
  diff -u -r1.1.2.6 -r1.1.2.7
  --- ObjectImageTest.java	26 Nov 2005 02:19:54 -0000	1.1.2.6
  +++ ObjectImageTest.java	5 Dec 2005 15:06:53 -0000	1.1.2.7
  @@ -105,24 +105,26 @@
           TransactionExt tx = (TransactionExt) odmg.newTransaction();
           tx.begin();
           Book book = new Book(prefix, null, null);
  +        Review r1 = new Review(prefix + "_1");
           database.makePersistent(book);
  +        database.makePersistent(r1);
           tx.commit();
  +
           Integer book_version = book.getVersion();
  +        Integer r_1_version = r1.getVersion();
   
  -        Review r1 = new Review(prefix + "_1");
           Review r2 = new Review(prefix + "_2");
           tx.begin();
  +        tx.lock(r1, Transaction.WRITE);
           tx.lock(book, Transaction.READ);
           book.addReview(r1);
           book.addReview(r2);
  -        database.makePersistent(r1);
           database.makePersistent(r2);
           tx.commit();
   
           assertEquals(book_version, book.getVersion());
           assertTrue(book.getId() != null);
   
  -        Integer r_1_version = r1.getVersion();
           Integer r_2_version = r2.getVersion();
   
           tx.begin();
  @@ -133,6 +135,10 @@
           assertNotNull(loadedCopy.getReviews());
           assertEquals(2, loadedCopy.getReviews().size());
           assertEquals(book_version, loadedCopy.getVersion());
  +        Review new_r1 = (Review) loadedCopy.getReviews().get(0);
  +        Review new_r2 = (Review) loadedCopy.getReviews().get(1);
  +        assertEquals(r_1_version.intValue() + 1, new_r1.getVersion().intValue());
  +        assertEquals(r_2_version, new_r2.getVersion());
   
           tx.getBroker().clearCache();
           Criteria criteria = new Criteria();
  @@ -151,7 +157,7 @@
           Review stayed =  (Review) loadedCopy.getReviews().get(0);
           tx.commit();
           // expect same version, nothing should be changed
  -        assertEquals(r_1_version, stayed.getVersion());
  +        assertEquals(r_2_version, stayed.getVersion());
           //
           //assertEquals(r_1_version, removed.getVersion());
   
  
  
  

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