You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by ol...@apache.org on 2003/06/28 14:48:52 UTC

cvs commit: db-ojb/src/test/org/apache/ojb/otm AllTests.java OtmExamples.java

olegnitz    2003/06/28 05:48:52

  Modified:    src/test/org/apache/ojb/otm AllTests.java OtmExamples.java
  Log:
  Minor fixes to OtmExamples, added SwizzleTests to the list of AllTests
  
  Revision  Changes    Path
  1.7       +1 -0      db-ojb/src/test/org/apache/ojb/otm/AllTests.java
  
  Index: AllTests.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/otm/AllTests.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AllTests.java	25 May 2003 20:59:53 -0000	1.6
  +++ AllTests.java	28 Jun 2003 12:48:52 -0000	1.7
  @@ -34,6 +34,7 @@
           suite.addTest(new TestSuite(LockTestCommittedReads.class));
           suite.addTest(new TestSuite(LockTestRepeatableReads.class));
           suite.addTest(new TestSuite(LockTestSerializable.class));
  +        suite.addTest(new TestSuite(SwizzleTests.class));
           return suite;
       }
   
  
  
  
  1.13      +24 -6     db-ojb/src/test/org/apache/ojb/otm/OtmExamples.java
  
  Index: OtmExamples.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/otm/OtmExamples.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- OtmExamples.java	20 Jun 2003 08:14:21 -0000	1.12
  +++ OtmExamples.java	28 Jun 2003 12:48:52 -0000	1.13
  @@ -41,6 +41,7 @@
   
       public void tearDown()
       {
  +        _conn.close();
           _conn = null;
       }
   
  @@ -187,8 +188,22 @@
               tx = _kit.getTransaction(_conn);
               tx.begin();
               article = (Article) _conn.getObjectByIdentity(aOid);
  -            pg = (ProductGroup) article.getProductGroup();
  -            assertEquals("should be equal", "1", pg.getName());
  +            assertEquals("should be equal", "1", article.getProductGroup().getName());
  +            tx.commit();
  +
  +            // test checkpoint
  +            tx = _kit.getTransaction(_conn);
  +            tx.begin();
  +            pg = (ProductGroup) _conn.getObjectByIdentity(pgOid);
  +            pg.setName("2");
  +            _conn.makePersistent(pg);
  +            tx.checkpoint();
  +            tx.rollback();
  +
  +            tx = _kit.getTransaction(_conn);
  +            tx.begin();
  +            article = (Article) _conn.getObjectByIdentity(aOid);
  +            assertEquals("should be equal", "1", article.getProductGroup().getName());
               tx.commit();
   
               try
  @@ -246,8 +261,7 @@
   
               tx = _kit.getTransaction(_conn);
               tx.begin();
  -            pg = (ProductGroup) _conn.getObjectByIdentity(pgOid,
  -                    LockType.WRITE_LOCK);
  +            pg = (ProductGroup) _conn.getObjectByIdentity(pgOid);
               pg.setName("2");
   
               tx2 = _kit.getTransaction(conn2);
  @@ -518,8 +532,12 @@
           {
               try 
               {
  -                tx = _kit.getTransaction(_conn);
  -                tx.begin();
  +                if (tx == null || !tx.isInProgress())
  +                {
  +                    tx = _kit.getTransaction(_conn);
  +                    tx.begin();
  +                }
  +                
                   if (aOid != null)
                   {
                       article = (Article) _conn.getObjectByIdentity(aOid);