KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > db > test > TestGraphRDBMaker


1 /*
2   (c) Copyright 2003, 2004, 2005 Hewlett-Packard Development Company, LP
3   [See end of file]
4   $Id: TestGraphRDBMaker.java,v 1.9 2005/04/15 12:40:54 chris-dollin Exp $
5 */

6
7 package com.hp.hpl.jena.db.test;
8
9 import java.sql.SQLException JavaDoc;
10
11 import com.hp.hpl.jena.db.*;
12 import com.hp.hpl.jena.db.impl.*;
13 import com.hp.hpl.jena.graph.*;
14 import com.hp.hpl.jena.graph.test.*;
15 import com.hp.hpl.jena.shared.*;
16
17 import junit.framework.*;
18
19 /**
20     @author hedgehog
21     
22     Test the RDB graph factory, based on the abstract test class. We track the
23     current graph factory so that we can discard all the graphs we create during
24     the test.
25 */

26
27 public class TestGraphRDBMaker extends AbstractTestGraphMaker
28     {
29     /**
30          The connection for the graph factory.
31     */

32     IDBConnection connection;
33     
34     public TestGraphRDBMaker( String JavaDoc name )
35         { super( name ); }
36
37     public static TestSuite suite()
38         { return new TestSuite( TestGraphRDBMaker.class ); }
39         
40     public void setUp()
41         { // order is import - super.setUp grabs a graph
42
connection = TestConnection.makeAndCleanTestConnection();
43         super.setUp();
44         }
45
46     /**
47         The current factory object, or null when there isn't one.
48      */

49     private GraphRDBMaker current;
50     
51     /**
52         Invent a new factory on the connection, record it, and return it.
53     */

54     public GraphMaker getGraphMaker()
55         { return current = new GraphRDBMaker( connection, ReificationStyle.Minimal ); }
56         
57     /**
58         Run the parent teardown, and then remove all the freshly created graphs.
59      * @throws
60     */

61     public void tearDown()
62         {
63         super.tearDown();
64         if (current != null) current.removeAll();
65         try { connection.close(); } catch (Exception JavaDoc e) { throw new JenaException( e ); }
66         }
67     }
68
69 /*
70     (c) Copyright 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
71     All rights reserved.
72
73     Redistribution and use in source and binary forms, with or without
74     modification, are permitted provided that the following conditions
75     are met:
76
77     1. Redistributions of source code must retain the above copyright
78        notice, this list of conditions and the following disclaimer.
79
80     2. Redistributions in binary form must reproduce the above copyright
81        notice, this list of conditions and the following disclaimer in the
82        documentation and/or other materials provided with the distribution.
83
84     3. The name of the author may not be used to endorse or promote products
85        derived from this software without specific prior written permission.
86
87     THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
88     IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
89     OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
90     IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
91     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
92     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
93     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
94     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
95     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
96     THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
97 */
Popular Tags