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 ODMGRollbackTest.java
Date Thu, 16 Oct 2003 16:57:39 GMT
arminw      2003/10/16 09:57:39

  Modified:    src/test/org/apache/ojb/odmg ODMGRollbackTest.java
  Log:
  add new test case
  
  Revision  Changes    Path
  1.16      +54 -0     db-ojb/src/test/org/apache/ojb/odmg/ODMGRollbackTest.java
  
  Index: ODMGRollbackTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/ODMGRollbackTest.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- ODMGRollbackTest.java	4 Oct 2003 17:44:14 -0000	1.15
  +++ ODMGRollbackTest.java	16 Oct 2003 16:57:39 -0000	1.16
  @@ -649,6 +649,60 @@
           }
       }
   
  +    public void testDoubleAbortTxCall() throws Exception
  +    {
  +        Implementation ojb = OJB.getInstance();
  +        Database db = ojb.newDatabase();
  +        db.open(databaseName, Database.OPEN_READ_WRITE);
  +        try
  +        {
  +            Transaction tx = ojb.newTransaction();
  +            tx.begin();
  +            tx.abort();
  +            tx.abort();
  +        }
  +        catch(Exception e)
  +        {
  +            e.printStackTrace();
  +            throw e;
  +        }
  +        finally
  +        {
  +            db.close();
  +        }
  +    }
  +
  +    public void testInternalCausedRollback() throws Exception
  +    {
  +        Implementation ojb = OJB.getInstance();
  +        Database db = ojb.newDatabase();
  +        db.open(databaseName, Database.OPEN_READ_WRITE);
  +
  +        Transaction tx = ojb.newTransaction();
  +        String name = "testCheckCacheAfterRollback_"+System.currentTimeMillis();
  +        try
  +        {
  +            tx.begin();
  +
  +            RollbackObjectOne ro = new RollbackObjectOne();
  +            ro.setName(name);
  +            tx.lock(ro, Transaction.WRITE);
  +            // this should fail
  +            tx.lock(new Exception(), Transaction.WRITE);
  +
  +            tx.commit();
  +            fail("A exception was expected");
  +        }
  +        catch(Exception e)
  +        {
  +            if(tx != null && tx.isOpen()) tx.abort();
  +        }
  +        finally
  +        {
  +            db.close();
  +        }
  +    }
  +
   
       //**************************************************************
       // test classes
  
  
  

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