org.apache.ojb.odmg
Class ODMGRollbackTest

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.apache.ojb.odmg.ODMGRollbackTest
All Implemented Interfaces:
junit.framework.Test

public class ODMGRollbackTest
extends junit.framework.TestCase

Do some rollback tests and check behavior within transactions. CAUTION: This tests works only against the default repository.


Nested Class Summary
static class ODMGRollbackTest.RollbackObjectOne
           
static class ODMGRollbackTest.RollbackObjectTwo
           
 
Constructor Summary
ODMGRollbackTest(java.lang.String s)
           
 
Method Summary
protected  int getDBObjectCount(PersistenceBroker broker, java.lang.Class target)
           
protected  int getDBObjectCountViaOqlQuery(Implementation ojb, java.lang.Class target)
           
protected  int getDBObjectCountViaOqlQueryUseNewTransaction(Implementation ojb, java.lang.Class target)
           
protected  int getDBObjectCountWithNewPB(java.lang.Class target)
           
protected  java.util.Collection getNewODMGZoos(int count)
           
protected  java.util.Collection getNewProjects(int count)
           
static void main(java.lang.String[] args)
           
protected  ODMGZoo newODMGZoo()
           
protected  Project newProject()
           
 void setUp()
           
protected  void tearDown()
           
 void testCheckCacheAfterRollback()
           
 void testDatabaseClose()
           
 void testDoubleAbortTxCall()
           
 void testDuplicateLocking()
           
 void testEmpty()
          test empty usage of methods
 void testInternalCausedRollback()
           
 void testResultsAfterTransaction()
          Tests object count after a commited transaction
 void testResultsAfterTransactionWithClearedCache()
          Tests object count after a commited transaction
 void testResultsWhileTransactionWithCheckpoint()
          Tests behavior within transactions.
 void testTransactionFlush()
           
 void testUserRollback()
          Test the rollback behaviour.
 void testUserRollbackWithCheckpoint()
          Test the rollback behaviour.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ODMGRollbackTest

public ODMGRollbackTest(java.lang.String s)
Method Detail

testDatabaseClose

public void testDatabaseClose()
                       throws java.lang.Exception
Throws:
java.lang.Exception

testTransactionFlush

public void testTransactionFlush()
                          throws java.lang.Exception
Throws:
java.lang.Exception

testResultsWhileTransactionWithCheckpoint

public void testResultsWhileTransactionWithCheckpoint()
                                               throws java.lang.Exception
Tests behavior within transactions. If i store 5 odmgZoos within a transaction and after that within the same transaction i do query 'select all odmgZoos' the number of odmgZoos returned should be oldNumber+5 when using checkpoint.

Throws:
java.lang.Exception

testResultsAfterTransaction

public void testResultsAfterTransaction()
                                 throws java.lang.Exception
Tests object count after a commited transaction

Throws:
java.lang.Exception

testResultsAfterTransactionWithClearedCache

public void testResultsAfterTransactionWithClearedCache()
                                                 throws java.lang.Exception
Tests object count after a commited transaction

Throws:
java.lang.Exception

testUserRollback

public void testUserRollback()
                      throws java.lang.Exception
Test the rollback behaviour. If i store 10 odmgZoos within a transaction and after that store the transaction was aborted, the number of odmgZoos in the DB should be unchanged.

Throws:
java.lang.Exception

testUserRollbackWithCheckpoint

public void testUserRollbackWithCheckpoint()
                                    throws java.lang.Exception
Test the rollback behaviour. If i store 10 odmgZoos within a transaction and do a checkpoint call. After that the transaction was aborted, the number of odmgZoos in the DB should be unchanged.

Throws:
java.lang.Exception

getNewProjects

protected java.util.Collection getNewProjects(int count)

newProject

protected Project newProject()

getNewODMGZoos

protected java.util.Collection getNewODMGZoos(int count)

newODMGZoo

protected ODMGZoo newODMGZoo()

getDBObjectCountWithNewPB

protected int getDBObjectCountWithNewPB(java.lang.Class target)
                                 throws java.lang.Exception
Throws:
java.lang.Exception

getDBObjectCount

protected int getDBObjectCount(PersistenceBroker broker,
                               java.lang.Class target)
                        throws java.lang.Exception
Throws:
java.lang.Exception

getDBObjectCountViaOqlQueryUseNewTransaction

protected int getDBObjectCountViaOqlQueryUseNewTransaction(Implementation ojb,
                                                           java.lang.Class target)
                                                    throws java.lang.Exception
Throws:
java.lang.Exception

getDBObjectCountViaOqlQuery

protected int getDBObjectCountViaOqlQuery(Implementation ojb,
                                          java.lang.Class target)
                                   throws java.lang.Exception
Throws:
java.lang.Exception

setUp

public void setUp()

tearDown

protected void tearDown()
                 throws java.lang.Exception
Throws:
java.lang.Exception

main

public static void main(java.lang.String[] args)

testDuplicateLocking

public void testDuplicateLocking()
                          throws java.lang.Exception
Throws:
java.lang.Exception

testCheckCacheAfterRollback

public void testCheckCacheAfterRollback()
                                 throws java.lang.Exception
Throws:
java.lang.Exception

testEmpty

public void testEmpty()
               throws java.lang.Exception
test empty usage of methods

Throws:
java.lang.Exception

testDoubleAbortTxCall

public void testDoubleAbortTxCall()
                           throws java.lang.Exception
Throws:
java.lang.Exception

testInternalCausedRollback

public void testInternalCausedRollback()
                                throws java.lang.Exception
Throws:
java.lang.Exception


Authors: Thomas Mahler and others. (C) 2000 - 2003 Apache Software Foundation
All rights reserved. Published under the Apache License.
http://db.apache.org/ojb
Version: 1.0.rc5, 2003-12-14