KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ojb > junit > ODMGTestCase


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 /**
10  *
11  *
12  * @author <a HREF="mailto:arminw@apache.org">Armin Waibel</a>
13  * @version $Id: ODMGTestCase.java,v 1.1.2.2 2005/05/07 16:02:57 arminw Exp $
14  */

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 JavaDoc name)
25     {
26         super(name);
27     }
28
29     protected void setUp() throws Exception JavaDoc
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 JavaDoc
38     {
39         try
40         {
41             Transaction currentTx = odmg.currentTransaction();
42             if(currentTx != null && currentTx.isOpen())
43             {
44                 currentTx.abort();
45             }
46         }
47         catch(Exception JavaDoc e)
48         {
49         }
50
51         super.tearDown();
52     }
53 }
54
Popular Tags