KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > smallsql > junit > AllTests


1 /* =============================================================
2  * SmallSQL : a free Java DBMS library for the Java(tm) platform
3  * =============================================================
4  *
5  * (C) Copyright 2004-2006, by Volker Berlin.
6  *
7  * Project Info: http://www.smallsql.de/
8  *
9  * This library is free software; you can redistribute it and/or modify it
10  * under the terms of the GNU Lesser General Public License as published by
11  * the Free Software Foundation; either version 2.1 of the License, or
12  * (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17  * License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22  * USA.
23  *
24  * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
25  * in the United States and other countries.]
26  *
27  * ---------------
28  * AllTests.java
29  * ---------------
30  * Author: Volker Berlin
31  *
32  */

33 package smallsql.junit;
34
35 import junit.framework.*;
36 import java.sql.*;
37
38 public class AllTests extends TestCase{
39
40     final static String JavaDoc jdbCURL = "jdbc:smallsql:AllTests";
41     private static Connection con;
42     
43     
44     public static Connection getConnection() throws SQLException{
45         if(con == null || con.isClosed()){
46             con = createConnection();
47         }
48         return con;
49     }
50     
51
52     public static Connection createConnection() throws SQLException{
53         //DriverManager.setLogStream( System.out );
54
new smallsql.database.SSDriver();
55         new sun.jdbc.odbc.JdbcOdbcDriver();
56         return DriverManager.getConnection(jdbCURL);
57         //return DriverManager.getConnection("jdbc:odbc:mssql","sa","");
58
}
59
60     public static void printRS( ResultSet rs ) throws SQLException{
61         while(rs.next()){
62             for(int i=1; i<=rs.getMetaData().getColumnCount(); i++){
63                 System.out.print(rs.getObject(i)+"\t");
64             }
65             System.out.println();
66         }
67     }
68
69     public static Test suite() throws Exception JavaDoc{
70         TestSuite theSuite = new TestSuite("SmallSQL all Tests");
71         theSuite.addTest ( TestDataTypes.suite() );
72         theSuite.addTestSuite(TestDBMetaData.class);
73         theSuite.addTestSuite(TestExceptionMethods.class);
74         theSuite.addTest (TestExceptions.suite());
75         theSuite.addTestSuite(TestDeleteUpdate.class);
76         theSuite.addTest (TestFunctions.suite() );
77         theSuite.addTestSuite(TestGroupBy.class);
78         theSuite.addTestSuite(TestIdentifer.class);
79         theSuite.addTest (TestJoins.suite());
80         theSuite.addTestSuite(TestMoneyRounding.class );
81         theSuite.addTest (TestOperatoren.suite() );
82         theSuite.addTestSuite(TestOrderBy.class);
83         theSuite.addTestSuite(TestOther.class);
84         theSuite.addTestSuite(TestScrollable.class);
85         theSuite.addTestSuite(TestTransactions.class);
86         theSuite.addTestSuite(TestStatement.class);
87         theSuite.addTestSuite(TestResultSet.class);
88         return theSuite;
89     }
90
91     public static void main(String JavaDoc[] argv) {
92         try{
93             //junit.swingui.TestRunner.main(new String[]{AllTests.class.getName()});
94
junit.textui.TestRunner.main(new String JavaDoc[]{AllTests.class.getName()});
95         }catch(Throwable JavaDoc e){
96             e.printStackTrace();
97         }
98     }
99
100 }
Popular Tags