1 package org.apache.ojb.junit; 2 3 import org.apache.ojb.broker.TestHelper; 4 import org.apache.ojb.odmg.ImplementationExt; 5 import org.apache.ojb.odmg.OJB; 6 import org.odmg.Database; 7 import org.odmg.Transaction; 8 9 15 public class ODMGTestCase extends OJBTestCase 16 { 17 public ImplementationExt odmg; 18 public Database database; 19 20 public ODMGTestCase() 21 { 22 } 23 24 public ODMGTestCase(String name) 25 { 26 super(name); 27 } 28 29 protected void setUp() throws Exception 30 { 31 super.setUp(); 32 odmg = OJB.getInstance(); 33 database = odmg.newDatabase(); 34 database.open(TestHelper.DEF_DATABASE_NAME, Database.OPEN_READ_WRITE); 35 } 36 37 protected void tearDown() throws Exception 38 { 39 try 40 { 41 Transaction currentTx = odmg.currentTransaction(); 42 if(currentTx != null && currentTx.isOpen()) 43 { 44 currentTx.abort(); 45 } 46 } 47 catch(Exception e) 48 { 49 } 50 51 super.tearDown(); 52 } 53 } 54 | Popular Tags |