001: /*
002: (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
003: [See end of file]
004: $Id: TestReifier.java,v 1.22 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.graph.*;
011: import com.hp.hpl.jena.graph.test.*;
012: import com.hp.hpl.jena.shared.*;
013:
014: import junit.framework.*;
015:
016: /**
017: Derived from the original reifier tests, and then folded back in by using an
018: abstract test base class.
019: @author kers, csayers.
020: */
021:
022: public class TestReifier extends AbstractTestReifier {
023:
024: private int count;
025: private Graph properties;
026: private IDBConnection con;
027:
028: public TestReifier(String name) {
029: super (name);
030: }
031:
032: /**
033: Initialiser required for MetaTestGraph interface.
034: */
035: public TestReifier(Class graphClass, String name,
036: ReificationStyle style) {
037: super (name);
038: }
039:
040: public static TestSuite suite() {
041: return MetaTestGraph.suite(TestReifier.class,
042: LocalGraphRDB.class);
043: }
044:
045: /**
046: LocalGraphRDB - an extension of GraphRDB that fixes the connection to
047: TestReifier's connection, passes in the appropriate reification style, uses the
048: default properties of the connection, and gives each graph a new name
049: exploiting the count.
050:
051: @author kers
052: */
053: public class LocalGraphRDB extends GraphRDB {
054: public LocalGraphRDB(ReificationStyle style) {
055: super (con, "testGraph-" + count++, properties,
056: styleRDB(style), true);
057: }
058: }
059:
060: public void setUp() {
061: con = TestConnection.makeAndCleanTestConnection();
062: properties = con.getDefaultModelProperties().getGraph();
063: }
064:
065: public void tearDown() throws Exception {
066: con.close();
067: }
068:
069: public Graph getGraph(ReificationStyle style) {
070: return new LocalGraphRDB(style);
071: }
072:
073: public Graph getGraph() {
074: return getGraph(ReificationStyle.Minimal);
075: }
076:
077: }
078:
079: /*
080: (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
081: All rights reserved.
082:
083: Redistribution and use in source and binary forms, with or without
084: modification, are permitted provided that the following conditions
085: are met:
086:
087: 1. Redistributions of source code must retain the above copyright
088: notice, this list of conditions and the following disclaimer.
089:
090: 2. Redistributions in binary form must reproduce the above copyright
091: notice, this list of conditions and the following disclaimer in the
092: documentation and/or other materials provided with the distribution.
093:
094: 3. The name of the author may not be used to endorse or promote products
095: derived from this software without specific prior written permission.
096:
097: THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
098: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
099: OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
100: IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
101: INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
102: NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
103: DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
104: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
105: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
106: THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
107: */
|