tfischer 2005/05/22 03:03:00
Modified: src/rttest/org/apache/torque DataTest.java
Log:
Added a new testcase testConnection
This test is useful if one is trying to get the runtimetest running for a new
database type
Revision Changes Path
1.20 +24 -1 db-torque/src/rttest/org/apache/torque/DataTest.java
Index: DataTest.java
===================================================================
RCS file: /home/cvs/db-torque/src/rttest/org/apache/torque/DataTest.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- DataTest.java 10 May 2005 19:18:08 -0000 1.19
+++ DataTest.java 22 May 2005 10:02:59 -0000 1.20
@@ -16,6 +16,7 @@
* limitations under the License.
*/
+import java.sql.Connection;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Arrays;
@@ -74,6 +75,28 @@
}
/**
+ * test whether we can connect to the database at all
+ * @throws Exception if no connection can be established
+ */
+ public void testConnect() throws Exception
+ {
+ Connection connection = null;
+ try
+ {
+ connection = Torque.getConnection();
+ connection.close();
+ connection = null;
+ }
+ finally
+ {
+ if (connection != null)
+ {
+ connection.close();
+ }
+ }
+ }
+
+ /**
* does some inserts.
* @throws Exception if the test fails
*/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]