KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * (c) Copyright 2001, 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
3  * [See end of file]
4  */

5
6 package com.hp.hpl.jena.db.test;
7
8 import junit.framework.* ;
9
10 import com.hp.hpl.jena.db.IDBConnection;
11 import com.hp.hpl.jena.db.ModelRDB;
12 import com.hp.hpl.jena.rdf.model.*;
13
14 /**
15  * Based on earlier Jena tests by members of the Jena team.
16  *
17  * @author csayers
18  * @version $Revision: 1.31 $
19  */

20 public class TestPackage extends TestSuite
21 {
22     
23     /*
24      * this testPackage requires the parameters for a
25      * database connection to be defined. one method
26      * is to explicitly define the parameters for
27      * mysql, oracle, postgresql as shown here below.
28      *
29      * an alternative is to use the "guess" methods
30      * in ModelFactoryBase to get the parameters from
31      * a configuration file (see test-db.sh, test.bat,
32      * test.sh). if the guess methods do not work for
33      * you, comment them out and use/modify the manual
34      * settings for your database engine, below.
35      */

36  
37     /*/ oracle settings
38     static String M_DB_URL = "jdbc:oracle:oci8:@";
39     static String M_DB_USER = "scott";
40     static String M_DB_PASSWD = "tiger";
41     static String M_DB = "Oracle";
42     static String M_DBDRIVER_CLASS = "oracle.jdbc.OracleDriver";
43     // */

44     
45     /*/ mysql settings
46     static String M_DB_URL = "jdbc:mysql://localhost/test";
47     static String M_DB_USER = "test";
48     static String M_DB_PASSWD = "";
49     static String M_DB = "MySQL";
50     static String M_DBDRIVER_CLASS = "com.mysql.jdbc.Driver";
51     // */

52         
53     /*/ postgresql settings
54     static String M_DB_URL = "jdbc:postgresql://localhost/test";
55     static String M_DB_USER = "test";
56     static String M_DB_PASSWD = "";
57     static String M_DB = "PostgreSQL";
58     static String M_DBDRIVER_CLASS = "org.postgresql.Driver";
59     // */

60         
61     // */
62
static String JavaDoc M_DB_URL = ModelFactoryBase.guessDBURL();
63     static String JavaDoc M_DB_USER = ModelFactoryBase.guessDBUser();
64     static String JavaDoc M_DB_PASSWD = ModelFactoryBase.guessDBPassword();
65     static String JavaDoc M_DB = ModelFactoryBase.guessDBType();
66     static String JavaDoc M_DBDRIVER_CLASS = ModelFactoryBase.guessDBDriver();
67     // */
68

69     static public TestSuite suite() {
70         return new TestPackage();
71     }
72     
73     /** Creates new TestPackage */
74     private TestPackage() {
75         super("GraphRDB");
76         addTest( "TestConnection", TestConnection.suite() );
77         addTest( "TestBasicOperations", TestBasicOperations.suite() );
78         addTest( "TestSimpleSelector", TestSimpleSelector.suite() );
79         addTest( "TestCompatability", TestCompatability.suite() );
80         addTest( "TestCompareToMem", TestCompareToMem.suite() );
81         addTest( "TestGraphRDB", TestGraphRDB.suite());
82         addTest( "TestModelRDB", TestModelRDB.suite());
83         addTest( "TestGraphRDBMaker", TestGraphRDBMaker.suite());
84         addTest( "TestMultiModel", TestMultiModel.suite());
85         addTest( "TestNsPrefix", TestNsPrefix.suite());
86         addTest( "TestPrefixMapping", TestPrefixMapping.suite());
87         addTest( "TestTransactions", TestTransactions.suite() );
88         addTest( "TestDBSpec", TestDBSpec.suite() );
89         addTest( "TestReifier", TestReifier.suite() );
90         addTest( "TestReifierCompareToMem", TestReifierCompareToMem.suite());
91         addTest( "TestQueryRDB", TestQueryRDB.suite());
92         addTest( "TestQuery1", TestQuery1.suite());
93         addTest( "TestModelFactory", TestModelFactory.suite() );
94         }
95
96     public static class TestModelFactory extends TestCase
97         {
98         public TestModelFactory( String JavaDoc name ) { super( name ); }
99         public static TestSuite suite() { return new TestSuite( TestModelFactory.class ); }
100         
101         public void testModelFactory()
102             {
103             IDBConnection c = TestConnection.makeAndCleanTestConnection();
104             assertTrue( ModelFactory.createModelRDBMaker( c ).createModel() instanceof ModelRDB );
105             }
106         }
107     
108     private void addTest(String JavaDoc name, TestSuite tc) {
109         tc.setName(name);
110         addTest(tc);
111     }
112
113 }
114
115 /*
116  * (c) Copyright 2001, 2002, 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
117  * All rights reserved.
118  *
119  * Redistribution and use in source and binary forms, with or without
120  * modification, are permitted provided that the following conditions
121  * are met:
122  * 1. Redistributions of source code must retain the above copyright
123  * notice, this list of conditions and the following disclaimer.
124  * 2. Redistributions in binary form must reproduce the above copyright
125  * notice, this list of conditions and the following disclaimer in the
126  * documentation and/or other materials provided with the distribution.
127  * 3. The name of the author may not be used to endorse or promote products
128  * derived from this software without specific prior written permission.
129  *
130  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
131  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
132  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
133  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
134  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
135  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
136  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
137  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
138  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
139  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
140  */

141
Popular Tags