KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2   (c) Copyright 2003, 2004, 2005 Hewlett-Packard Development Company, LP
3   [See end of file]
4   $Id: TestReifier.java,v 1.18 2005/02/21 12:03:34 andy_seaborne Exp $
5 */

6
7 package com.hp.hpl.jena.db.test;
8
9 import com.hp.hpl.jena.db.*;
10 import com.hp.hpl.jena.graph.*;
11 import com.hp.hpl.jena.graph.test.*;
12 import com.hp.hpl.jena.shared.*;
13
14 import junit.framework.*;
15
16 /**
17     Derived from the original reifier tests, and then folded back in by using an
18     abstract test base class.
19     @author kers, csayers.
20 */

21
22 public class TestReifier extends AbstractTestReifier {
23     
24     private int count;
25     private Graph properties;
26     private IDBConnection con;
27
28     public TestReifier( String JavaDoc name )
29         { super(name); }
30
31     /**
32         Initialiser required for MetaTestGraph interface.
33      */

34     public TestReifier( Class JavaDoc graphClass, String JavaDoc name, ReificationStyle style )
35         { super( name ); }
36         
37     public static TestSuite suite() {
38         return MetaTestGraph.suite( TestReifier.class, LocalGraphRDB.class );
39     }
40         
41     /**
42         LocalGraphRDB - an extension of GraphRDB that fixes the connection to
43         TestReifier's connection, passes in the appropriate reification style, uses the
44         default properties of the connection, and gives each graph a new name
45         exploiting the count.
46     
47         @author kers
48      */

49     public class LocalGraphRDB extends GraphRDB
50         {
51         public LocalGraphRDB( ReificationStyle style )
52             { super( con, "testGraph-" + count ++, properties, styleRDB( style ), true ); }
53         }
54         
55     public void setUp()
56         { con = TestConnection.makeAndCleanTestConnection();
57         properties = con.getDefaultModelProperties().getGraph(); }
58
59     public void tearDown() throws Exception JavaDoc
60         { con.close(); }
61
62     public Graph getGraph( ReificationStyle style )
63         { return new LocalGraphRDB( style ); }
64         
65     }
66
67 /*
68     (c) Copyright 2003, 2004, 2005 Hewlett-Packard Development Company, LP
69     All rights reserved.
70
71     Redistribution and use in source and binary forms, with or without
72     modification, are permitted provided that the following conditions
73     are met:
74
75     1. Redistributions of source code must retain the above copyright
76        notice, this list of conditions and the following disclaimer.
77
78     2. Redistributions in binary form must reproduce the above copyright
79        notice, this list of conditions and the following disclaimer in the
80        documentation and/or other materials provided with the distribution.
81
82     3. The name of the author may not be used to endorse or promote products
83        derived from this software without specific prior written permission.
84
85     THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
86     IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
87     OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
88     IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
89     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
90     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
91     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
92     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
93     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
94     THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
95 */

96
Popular Tags