001: /*
002: (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
003: [See end of file]
004: $Id: TestGraphRDBMaker.java,v 1.13 2008/01/02 12:08:14 andy_seaborne Exp $
005: */
006:
007: package com.hp.hpl.jena.db.test;
008:
009: import com.hp.hpl.jena.db.*;
010: import com.hp.hpl.jena.db.impl.*;
011: import com.hp.hpl.jena.graph.*;
012: import com.hp.hpl.jena.graph.test.*;
013: import com.hp.hpl.jena.shared.*;
014:
015: import junit.framework.*;
016:
017: /**
018: @author hedgehog
019:
020: Test the RDB graph factory, based on the abstract test class. We track the
021: current graph factory so that we can discard all the graphs we create during
022: the test.
023: */
024:
025: public class TestGraphRDBMaker extends AbstractTestGraphMaker {
026: /**
027: The connection for the graph factory.
028: */
029: IDBConnection connection;
030:
031: public TestGraphRDBMaker(String name) {
032: super (name);
033: }
034:
035: public static TestSuite suite() {
036: return new TestSuite(TestGraphRDBMaker.class);
037: }
038:
039: public void setUp() { // order is import - super.setUp grabs a graph
040: connection = TestConnection.makeAndCleanTestConnection();
041: super .setUp();
042: }
043:
044: /**
045: The current factory object, or null when there isn't one.
046: */
047: private GraphRDBMaker current;
048:
049: /**
050: Invent a new factory on the connection, record it, and return it.
051: */
052: public GraphMaker getGraphMaker() {
053: return current = new GraphRDBMaker(connection,
054: ReificationStyle.Minimal);
055: }
056:
057: /**
058: Run the parent teardown, and then remove all the freshly created graphs.
059: * @throws
060: */
061: public void tearDown() {
062: super .tearDown();
063: if (current != null)
064: current.removeAll();
065: try {
066: connection.close();
067: } catch (Exception e) {
068: throw new JenaException(e);
069: }
070: }
071: }
072:
073: /*
074: (c) Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
075: All rights reserved.
076:
077: Redistribution and use in source and binary forms, with or without
078: modification, are permitted provided that the following conditions
079: are met:
080:
081: 1. Redistributions of source code must retain the above copyright
082: notice, this list of conditions and the following disclaimer.
083:
084: 2. Redistributions in binary form must reproduce the above copyright
085: notice, this list of conditions and the following disclaimer in the
086: documentation and/or other materials provided with the distribution.
087:
088: 3. The name of the author may not be used to endorse or promote products
089: derived from this software without specific prior written permission.
090:
091: THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
092: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
093: OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
094: IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
095: INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
096: NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
097: DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
098: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
099: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
100: THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
101: */
|