db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r434169 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting: functionTests/tests/jdbc4/ junit/
Date Wed, 23 Aug 2006 20:42:14 GMT
Author: djd
Date: Wed Aug 23 13:42:13 2006
New Revision: 434169

URL: http://svn.apache.org/viewvc?rev=434169&view=rev
Log:
Update the jdbc4 JUnit tests to use the recent additions, such as the single connection provided
by BaseJDBCTestCase and the test decorator base class BaseJDBCTestSetup.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobClobTestSetup.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTestSetup.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ClobTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ConnectionTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/JDBC40TranslationTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ParameterMetaDataWrapperTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/PreparedStatementTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ResultSetMetaDataTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ResultSetTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/RowIdNotImplementedTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/SetObjectUnsupportedTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTestSetup.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobClobTestSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobClobTestSetup.java?rev=434169&r1=434168&r2=434169&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobClobTestSetup.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobClobTestSetup.java Wed Aug 23 13:42:13 2006
@@ -25,6 +25,7 @@
 import junit.framework.Test;
 
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.BaseJDBCTestSetup;
 
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
@@ -39,17 +40,13 @@
  * because the createBlob/-Clob methods are not yet implemented.
  */
 public class BlobClobTestSetup
-    extends TestSetup {
+    extends BaseJDBCTestSetup {
 
     /** Constant for accessing the row with null values. */
     public static final int ID_NULLVALUES = 1;
     /** Constant for accessing the row with sample values. */
     public static final int ID_SAMPLEVALUES = 2;
 
-    /** ResultSet used to fetch BLOB or CLOB. */
-    private static ResultSet rs = null;
-    /** Statement used to fetch BLOB or CLOB. */
-    private static Statement stmt = null;
     /** Blob data. */
     private static final byte[] blobData = new byte[] {
         0x65, 0x66, 0x67, 0x68, 0x69,
@@ -72,9 +69,9 @@
      * Create a table with BLOB and CLOB, so that such objects can be
      * accessed/used from JDBC.
      */
-    public void setUp() 
+    protected void setUp() 
         throws IOException, SQLException {
-        Connection con = BaseJDBCTestCase.getConnection();
+        Connection con = getConnection();
         Statement stmt = con.createStatement();
         stmt.execute("create table BLOBCLOB (ID int primary key, " +
                                             "BLOBDATA blob(1k)," + 
@@ -89,14 +86,15 @@
 
     /**
      * Drop the table we created during setup.
+     * @throws Exception 
      */
-    public void tearDown()
-        throws SQLException {
-        Connection con = BaseJDBCTestCase.getConnection();
+    protected void tearDown()
+        throws Exception {
+        Connection con = getConnection();
         Statement stmt = con.createStatement();
         stmt.execute("drop table BLOBCLOB");
         stmt.close();
-        con.close();
+        super.tearDown();
     }
     
     /**
@@ -119,8 +117,8 @@
         pStmt.setBlob(1, blobInput, blobData.length);
         pStmt.setInt(2, ID_SAMPLEVALUES);
         assertEquals("Invalid update count", 1, pStmt.executeUpdate());
-        stmt = con.createStatement();
-        rs = stmt.executeQuery("select BLOBDATA from BLOBCLOB where ID = " +
+        Statement stmt = con.createStatement();
+        ResultSet rs = stmt.executeQuery("select BLOBDATA from BLOBCLOB where ID = " +
                 ID_SAMPLEVALUES);
         rs.next();
         Blob blob = rs.getBlob(1);
@@ -149,8 +147,8 @@
         pStmt.setClob(1, clobInput, clobData.length());
         pStmt.setInt(2, ID_SAMPLEVALUES);
         assertEquals("Invalid update count", 1, pStmt.executeUpdate());
-        stmt = con.createStatement();
-        rs = stmt.executeQuery("select CLOBDATA from BLOBCLOB where ID = " +
+        Statement stmt = con.createStatement();
+        ResultSet rs = stmt.executeQuery("select CLOBDATA from BLOBCLOB where ID = " +
                 ID_SAMPLEVALUES);
         rs.next();
         Clob clob = rs.getClob(1);

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobTest.java?rev=434169&r1=434168&r2=434169&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobTest.java Wed Aug 23 13:42:13 2006
@@ -119,8 +119,6 @@
 
     /** Default Blob object used by the tests. */
     private Blob blob = null;
-    /** Default connection used by the tests. */
-    private Connection con = null;
     
     // Initialize with the details of the method that are exempted from 
     //throwing a SQLException when they are called after calling free()
@@ -156,24 +154,14 @@
     
     public void setUp() 
         throws SQLException {
-        con = getConnection();
-        blob = BlobClobTestSetup.getSampleBlob(con);
+
+        blob = BlobClobTestSetup.getSampleBlob(getXConnection());
         
         //call the buildHashSetMethod to initialize the 
         //HashSet with the method signatures that are exempted 
         //from throwing a SQLException after free has been called
         //on the Clob object.
         buildHashSet();
-    }
-    
-    public void tearDown()
-        throws SQLException {
-        blob = null;
-        if (con != null && !con.isClosed()) {
-            con.rollback();
-            con.close();
-        }
-        con = null;
     }
     
     /**

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTest.java?rev=434169&r1=434168&r2=434169&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTest.java Wed Aug 23 13:42:13 2006
@@ -37,8 +37,7 @@
 public class CallableStatementTest
     extends BaseJDBCTestCase {
 
-    /** Default connection used by the tests. */
-    private Connection con = null;
+
     /** Default callable statement used by the tests. */
     private CallableStatement cStmt = null;
     
@@ -57,10 +56,9 @@
      * @throws SQLException if creation of connection or callable statement
      *                      fail.
      */
-    public void setUp() 
+    protected void setUp() 
         throws SQLException {
-        con = getConnection();
-        cStmt = con.prepareCall("? = CALL FLOOR(?)");
+        cStmt = prepareCall("? = CALL FLOOR(?)");
         cStmt.registerOutParameter(1, Types.DOUBLE);
     }
 
@@ -70,22 +68,18 @@
      * @throws SQLException if closing of the connection or the callable
      *                      statement fail.
      */
-    public void tearDown()
-        throws SQLException {
+    protected void tearDown()
+        throws Exception {
         if (cStmt != null && !cStmt.isClosed()) {
             cStmt.close();
         }
-        if (con != null && !con.isClosed()) {
-            con.rollback();
-            con.close();
-        }
-        cStmt = null;
-        con = null;
+
+        super.tearDown();
     }
    
     public void testNamedParametersAreNotSupported()
         throws SQLException {
-        DatabaseMetaData met = con.getMetaData();
+        DatabaseMetaData met = getXConnection().getMetaData();
         assertFalse("Named parameters are not supported, but the metadata " +
                     "says they are", met.supportsNamedParameters());
         met = null;
@@ -191,7 +185,7 @@
      */
     public void testGetCharacterStreamIntOnInParameterOfValidType()
         throws SQLException {
-        cStmt = CallableStatementTestSetup.getBinaryDirectProcedure(con);
+        cStmt = CallableStatementTestSetup.getBinaryDirectProcedure(getXConnection());
         cStmt.setString(1, "A string");
         cStmt.execute();
         try {
@@ -215,7 +209,7 @@
      */
     public void testGetCharacterStreamIntVARCHAR()
         throws IOException, SQLException {
-        cStmt = CallableStatementTestSetup.getIntToStringFunction(con);
+        cStmt = CallableStatementTestSetup.getIntToStringFunction(getXConnection());
         cStmt.setInt(2, 4509);
         assertFalse("No resultsets should be returned", cStmt.execute());
         assertEquals("Incorrect updatecount", -1, cStmt.getUpdateCount());
@@ -246,7 +240,7 @@
     public void testGetCharacterStreamIntVARBINARYDirect()
         throws IOException, SQLException {
         String data = "This is the test string.";
-        cStmt = CallableStatementTestSetup.getBinaryDirectProcedure(con);
+        cStmt = CallableStatementTestSetup.getBinaryDirectProcedure(getXConnection());
         cStmt.setString(1, data);
         assertFalse("No resultsets should be returned", cStmt.execute());
         // Note that getUpdateCount behaves differently on client and embedded.
@@ -285,7 +279,7 @@
      */
     public void testGetCharacterStreamIntVARBINARYFromDb()
         throws IOException, SQLException {
-        cStmt = CallableStatementTestSetup.getBinaryFromDbFunction(con);
+        cStmt = CallableStatementTestSetup.getBinaryFromDbFunction(getXConnection());
         cStmt.setInt(2, CallableStatementTestSetup.STRING_BYTES_ID);
         assertFalse("No resultsets should be returned", cStmt.execute());
         assertEquals("Incorrect updatecount", -1, cStmt.getUpdateCount());
@@ -316,7 +310,7 @@
      */
     public void testGetCharacterStreamIntOnVARBINARYWithNull()
         throws SQLException {
-        cStmt = CallableStatementTestSetup.getBinaryFromDbFunction(con);
+        cStmt = CallableStatementTestSetup.getBinaryFromDbFunction(getXConnection());
         cStmt.setInt(2, CallableStatementTestSetup.SQL_NULL_ID);
         assertFalse("No resultsets should be returned", cStmt.execute());
         assertEquals("Incorrect updatecount", -1, cStmt.getUpdateCount());
@@ -331,7 +325,7 @@
      */
     public void testGetCharacterStreamIntOnVARCHARWithNull()
         throws SQLException {
-        cStmt = CallableStatementTestSetup.getVarcharFromDbFunction(con);
+        cStmt = CallableStatementTestSetup.getVarcharFromDbFunction(getXConnection());
         cStmt.setInt(2, CallableStatementTestSetup.SQL_NULL_ID);
         assertFalse("No resultsets should be returned", cStmt.execute());
         assertEquals("Incorrect updatecount", -1, cStmt.getUpdateCount());

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTestSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTestSetup.java?rev=434169&r1=434168&r2=434169&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTestSetup.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTestSetup.java Wed Aug 23 13:42:13 2006
@@ -26,6 +26,7 @@
 import junit.extensions.TestSetup;
 
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.BaseJDBCTestSetup;
 
 import java.io.UnsupportedEncodingException;
 import java.sql.*;
@@ -38,7 +39,7 @@
  * functions and procedures.
  */
 public class CallableStatementTestSetup
-    extends TestSetup {
+    extends BaseJDBCTestSetup {
 
     private static final String SOURCECLASS = "org.apache.derbyTesting." +
         "functionTests.tests.jdbc4.CallableStatementTestSetup.";
@@ -74,9 +75,9 @@
         super(test);
     }
 
-    public void setUp()
+    protected void setUp()
         throws SQLException {
-        Connection con = BaseJDBCTestCase.getConnection();
+        Connection con = getConnection();
         // Create the tables, functions and procedures we need.
         Statement stmt = con.createStatement();
         // Create table CSDATA and populate
@@ -122,11 +123,12 @@
                 "RETURNS VARCHAR(256) " +
                 "PARAMETER STYLE JAVA READS SQL DATA LANGUAGE JAVA " +
                 "EXTERNAL NAME '" + SOURCECLASS + "getVarcharFromDb'");
+        stmt.close();
     }
 
-    public void tearDown()
-        throws SQLException {
-        Connection con = BaseJDBCTestCase.getConnection();
+    protected void tearDown()
+        throws Exception {
+        Connection con = getConnection();
         Statement stmt = con.createStatement();
         // Drop functions
         for (String function : FUNCTION_DROPS) {
@@ -141,7 +143,7 @@
             stmt.execute("DROP TABLE "  + table);
         }
         stmt.close();
-        con.close();
+        super.tearDown();
     }
 
     // Methods for getting CallableStatements

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ClobTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ClobTest.java?rev=434169&r1=434168&r2=434169&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ClobTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ClobTest.java Wed Aug 23 13:42:13 2006
@@ -120,8 +120,6 @@
 
     /** Default Clob object used by the tests. */
     private Clob clob = null;
-    /** Default connection used by the tests. */
-    private Connection con = null;
     
     // Initialize with the details of the method that are exempted from 
     //throwing a SQLException when they are called after calling free()
@@ -155,24 +153,13 @@
     
     public void setUp() 
         throws SQLException {
-        con = getConnection();
-        clob = BlobClobTestSetup.getSampleClob(con);
+        clob = BlobClobTestSetup.getSampleClob(getXConnection());
         
         //call the buildHashSetMethod to initialize the 
         //HashSet with the method signatures that are exempted 
         //from throwing a SQLException after free has been called
         //on the Clob object.
         buildHashSet();
-    }
-
-    public void tearDown()
-        throws SQLException {
-        clob = null;
-        if (con != null && !con.isClosed()) {
-            con.rollback();
-            con.close();
-        }
-        con = null;
     }
     
     /**

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ConnectionTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ConnectionTest.java?rev=434169&r1=434168&r2=434169&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ConnectionTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ConnectionTest.java Wed Aug 23 13:42:13 2006
@@ -47,11 +47,6 @@
 public class ConnectionTest
     extends BaseJDBCTestCase {
 
-    /** 
-     * Default connection used by the tests. 
-     */
-    protected Connection con = null;
-
     /**
      * Create a test with the given name.
      * 
@@ -60,23 +55,6 @@
     public ConnectionTest(String name) {
         super(name);
     }
-    
-    /**
-     * Obtain a connection that the tests can use.
-     */
-    public void setUp() 
-        throws SQLException {
-        con = getConnection(); 
-    }
-
-    public void tearDown() 
-        throws SQLException {
-        if (con != null && !con.isClosed()) {
-            con.rollback();
-            con.close();
-        }
-        con = null;
-    }
    
     //------------------------- T E S T  M E T H O D S ------------------------
     
@@ -94,7 +72,7 @@
      */
     public void embeddedCreateBlob()
         throws SQLException {
-            Blob blob = con.createBlob();
+            Blob blob = getXConnection().createBlob();
             //Check if the blob is empty
             if(blob.length() > 0)
                 fail("The new Blob should not have more than zero bytes " +
@@ -115,7 +93,7 @@
      */
     public void embeddedCreateClob()
         throws SQLException {
-            Clob clob = con.createClob();
+            Clob clob = getXConnection().createClob();
             //check if the Clob is empty
             if(clob.length() > 0)
                 fail("The new Clob should not have a length of greater than " +
@@ -125,7 +103,7 @@
     public void testCreateArrayNotImplemented()
         throws SQLException {
         try {
-            con.createArrayOf(null, null);
+            getXConnection().createArrayOf(null, null);
             fail("createArrayOf(String,Object[]) should not be implemented");
         } catch (SQLFeatureNotSupportedException sfnse) {
             // Do nothing, we are fine
@@ -135,7 +113,7 @@
     public void testCreateNClobNotImplemented()
         throws SQLException {
         try {
-            con.createNClob();
+            getXConnection().createNClob();
             fail("createNClob() should not be implemented");
         } catch (SQLFeatureNotSupportedException sfnse) {
             // Do nothing, we are fine
@@ -151,14 +129,14 @@
      */
     public void testCreateQueryObjectIsImplemented()
         throws SQLException {
-        con.createQueryObject(TestQuery.class);
-        con.createQueryObject(TestQuery.class, con);
+        getXConnection().createQueryObject(TestQuery.class);
+        getXConnection().createQueryObject(TestQuery.class, getXConnection());
     }
 
     public void testCreateSQLXMLNotImplemented()
         throws SQLException {
         try {
-            con.createSQLXML();
+            getXConnection().createSQLXML();
             fail("createSQLXML() should not be implemented");
         } catch (SQLFeatureNotSupportedException sfnse) {
             // Do nothing, we are fine
@@ -168,7 +146,7 @@
     public void testCreateStructNotImplemented()
         throws SQLException {
         try {
-            con.createStruct(null, null);
+            getXConnection().createStruct(null, null);
             fail("createStruct(String,Object[]) should not be implemented");
         } catch (SQLFeatureNotSupportedException sfnse) {
             // Do nothing, we are fine
@@ -178,15 +156,15 @@
     public void testGetClientInfo()
         throws SQLException {
         assertTrue("getClientInfo() must return an empty Properties object", 
-                   con.getClientInfo().isEmpty());
+                   getXConnection().getClientInfo().isEmpty());
     }
     
     public void testGetClientInfoString()
         throws SQLException {
         assertNull("getClientInfo(null) must return null",
-                   con.getClientInfo(null));
+                   getXConnection().getClientInfo(null));
         assertNull("getClientInfo(\"someProperty\") must return null",
-                   con.getClientInfo("someProperty"));
+                   getXConnection().getClientInfo("someProperty"));
     }
 
     /**
@@ -198,14 +176,14 @@
      */
     public void testIsValidImplemented() throws SQLException {
         // Test with an infinite (0) timeout
-        assertTrue(con.isValid(0));
+        assertTrue(getXConnection().isValid(0));
 
         // Test with a 1 second timeout
-        assertTrue(con.isValid(1));
+        assertTrue(getXConnection().isValid(1));
 
         // Test with an illegal timeout
         try {
-            con.isValid(-1);
+            getXConnection().isValid(-1);
         } catch (SQLException sqle) {
             assertSQLState("Incorrect SQL state when calling isValid(-1)",
                            "XJ081", sqle);
@@ -218,29 +196,29 @@
      * @exception SQLException if an error occurs
      */
     public void testGetTypeMapReturnsEmptyMap() throws SQLException {
-        assertTrue(con.getTypeMap().isEmpty());
+        assertTrue(getXConnection().getTypeMap().isEmpty());
     }
 
     public void testIsWrapperReturnsFalse()
         throws SQLException {
-        assertFalse(con.isWrapperFor(ResultSet.class));
+        assertFalse(getXConnection().isWrapperFor(ResultSet.class));
     }
 
     public void testIsWrapperReturnsTrue()
         throws SQLException {
-        assertTrue(con.isWrapperFor(Connection.class));
+        assertTrue(getXConnection().isWrapperFor(Connection.class));
     }
 
     public void testSetClientInfoProperties()
         throws SQLException {
-        con.setClientInfo(null);
+        getXConnection().setClientInfo(null);
         Properties p = new Properties();
-        con.setClientInfo(p);
+        getXConnection().setClientInfo(p);
 
         p.setProperty("prop1", "val1");
         p.setProperty("prop2", "val2");
         try {
-            con.setClientInfo(p);
+            getXConnection().setClientInfo(p);
             fail("setClientInfo(String,String) should throw "+
                  "SQLClientInfoException");
         } catch (SQLClientInfoException cie) {
@@ -260,16 +238,16 @@
 
     public void testSetClientInfoString()
         throws SQLException {
-        con.setClientInfo(null, null);
+        getXConnection().setClientInfo(null, null);
 
         try {
-            con.setClientInfo("foo", null);
+            getXConnection().setClientInfo("foo", null);
             fail("setClientInfo(String, null) should throw "+
                  "NullPointerException");
         } catch (NullPointerException npe) {}
 
         try {
-            con.setClientInfo("name", "value");
+            getXConnection().setClientInfo("name", "value");
             fail("setClientInfo(String,String) should throw "+
                  "SQLClientInfoException");
         } catch (SQLClientInfoException cie) {
@@ -285,14 +263,14 @@
     
     public void testUnwrapValid()
         throws SQLException {
-        Connection unwrappedCon = con.unwrap(Connection.class);
-        assertSame("Unwrap returned wrong object.", con, unwrappedCon);
+        Connection unwrappedCon = getXConnection().unwrap(Connection.class);
+        assertSame("Unwrap returned wrong object.", getXConnection(), unwrappedCon);
     }
 
     public void testUnwrapInvalid()
         throws SQLException {
         try {
-            ResultSet unwrappedRs = con.unwrap(ResultSet.class);
+            ResultSet unwrappedRs = getXConnection().unwrap(ResultSet.class);
             fail("unwrap should have thrown an exception");
         } catch (SQLException sqle) {
             assertSQLState("Incorrect SQL state when unable to unwrap",

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/JDBC40TranslationTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/JDBC40TranslationTest.java?rev=434169&r1=434168&r2=434169&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/JDBC40TranslationTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/JDBC40TranslationTest.java Wed Aug 23 13:42:13 2006
@@ -23,13 +23,14 @@
 import java.sql.Types;
 import org.apache.derby.shared.common.reference.JDBC40Translation;
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.BaseTestCase;
 
 /**
  * JUnit test which checks that the constants in JDBC40Translation are
  * correct. Each constant in JDBC40Translation should have a test
  * method comparing it to the value in the java.sql interface.
  */
-public class JDBC40TranslationTest extends BaseJDBCTestCase {
+public class JDBC40TranslationTest extends BaseTestCase {
 
     public JDBC40TranslationTest(String name) {
         super(name);

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ParameterMetaDataWrapperTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ParameterMetaDataWrapperTest.java?rev=434169&r1=434168&r2=434169&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ParameterMetaDataWrapperTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ParameterMetaDataWrapperTest.java Wed Aug 23 13:42:13 2006
@@ -31,12 +31,10 @@
  */
 public class ParameterMetaDataWrapperTest extends BaseJDBCTestCase {
     
-    //Default Connection used by the tests
-    Connection conn = null;
     //Default PreparedStatement used by the tests
-    PreparedStatement ps = null;
+    private PreparedStatement ps = null;
     //Default ParameterMetaData object used by the tests
-    ParameterMetaData pmd = null;
+    private ParameterMetaData pmd = null;
     
     /**
      * Create a test with the given name
@@ -53,10 +51,9 @@
      * @throws SQLException if creation of connection or callable statement
      *                      fail.
      */
-    public void setUp() 
+    protected void setUp() 
         throws SQLException {
-        conn = getConnection();
-        ps   = conn.prepareStatement("values 1");
+        ps   = prepareStatement("values 1");
         pmd  = ps.getParameterMetaData();
     }
 
@@ -66,12 +63,12 @@
      * @throws SQLException if closing of the connection or the callable
      *                      statement fail.
      */
-    public void tearDown()
-        throws SQLException {
+    protected void tearDown()
+        throws Exception {
         if(ps != null && !ps.isClosed())
             ps.close();
-        if(conn != null && !conn.isClosed())
-            conn.close();
+        
+        super.tearDown();
     }
 
     public void testIsWrapperForParameterMetaData() throws SQLException {

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/PreparedStatementTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/PreparedStatementTest.java?rev=434169&r1=434168&r2=434169&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/PreparedStatementTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/PreparedStatementTest.java Wed Aug 23 13:42:13 2006
@@ -45,11 +45,10 @@
      * Default connection and prepared statements that are used by the tests.
      */
     //Connection object
-    Connection conn      = null;
     //PreparedStatement object
-    PreparedStatement ps = null;
+    private PreparedStatement ps = null;
     //Statement object
-    Statement s = null;
+    private Statement s = null;
 
     
     /**
@@ -70,14 +69,13 @@
      */
     public void setUp() 
         throws SQLException {
-        conn = getConnection();
-        //create the statement object
-        s = conn.createStatement();
+       //create the statement object
+        s = createStatement();
         //Create the PreparedStatement that will then be used as the basis 
         //throughout this test henceforth
         //This prepared statement will however NOT be used for testing
         //setClob and setBlob
-        ps = conn.prepareStatement("select count(*) from sys.systables");
+        ps = prepareStatement("select count(*) from sys.systables");
         
          // STEP1: create the tables
          // Structure of table
@@ -97,17 +95,13 @@
      *
      */
     public void tearDown() 
-        throws SQLException {
+        throws Exception {
         
         s.execute("drop table ClobTestTable");
         s.execute("drop table BlobTestTable");
         s.close();
         
-        if (conn != null && !conn.isClosed()) {
-            conn.rollback();
-            conn.close();
-        }
-        conn = null;
+        super.tearDown();
     }
 
     public static Test suite() {
@@ -327,7 +321,7 @@
         StringReader is = new StringReader("Test data for the Clob object");
         is.reset();
         
-        PreparedStatement ps_sc = conn.prepareStatement("insert into ClobTestTable values(?,?)");
+        PreparedStatement ps_sc = prepareStatement("insert into ClobTestTable values(?,?)");
         
         //initially insert the data
         ps_sc.setInt(1,1);
@@ -369,7 +363,7 @@
         // Insert test data.
         String testString = "Test string for setCharacterStream\u1A00";
         Reader reader = new StringReader(testString);
-        PreparedStatement psChar = conn.prepareStatement(
+        PreparedStatement psChar = prepareStatement(
                 "insert into ClobTestTable values (?,?)");
         psChar.setInt(1, 1);
         psChar.setCharacterStream(2, reader);
@@ -409,7 +403,7 @@
         InputStream is = new java.io.ByteArrayInputStream(BYTES);
         is.reset();
         
-        PreparedStatement ps_sb = conn.prepareStatement("insert into BlobTestTable values(?,?)");
+        PreparedStatement ps_sb = prepareStatement("insert into BlobTestTable values(?,?)");
         
         //initially insert the data
         ps_sb.setInt(1,1);
@@ -450,7 +444,7 @@
             throws IOException, SQLException {
         // Insert test data.
         InputStream is = new ByteArrayInputStream(BYTES);
-        PreparedStatement psByte = conn.prepareStatement(
+        PreparedStatement psByte = prepareStatement(
                 "insert into BlobTestTable values (?,?)");
         psByte.setInt(1, 1);
         psByte.setBinaryStream(2, is);
@@ -553,7 +547,7 @@
         
         is.reset();
         
-        PreparedStatement ps_sc = conn.prepareStatement("insert into ClobTestTable values(?,?)");
+        PreparedStatement ps_sc = prepareStatement("insert into ClobTestTable values(?,?)");
         
         //initially insert the data
         ps_sc.setInt(1,1);
@@ -577,7 +571,7 @@
         // Insert test data.
         String testString = "Test string for setCharacterStream\u1A00";
         Reader reader = new StringReader(testString);
-        PreparedStatement psChar = conn.prepareStatement(
+        PreparedStatement psChar = prepareStatement(
                 "insert into ClobTestTable values (?,?)");
         psChar.setInt(1, 1);
         psChar.setCharacterStream(2, reader);
@@ -612,7 +606,7 @@
         
         is.reset();
         
-        PreparedStatement ps_sb = conn.prepareStatement("insert into ClobTestTable values(?,?)");
+        PreparedStatement ps_sb = prepareStatement("insert into ClobTestTable values(?,?)");
         
         //initially insert the data
         ps_sb.setInt(1,1);
@@ -641,7 +635,7 @@
             throws IOException, SQLException {
         // Insert test data.
         InputStream is = new ByteArrayInputStream(BYTES);
-        PreparedStatement psAscii = conn.prepareStatement(
+        PreparedStatement psAscii = prepareStatement(
                 "insert into ClobTestTable values (?,?)");
         psAscii.setInt(1, 1);
         psAscii.setAsciiStream(2, is);
@@ -686,7 +680,7 @@
         
         is.reset();
         
-        PreparedStatement ps_sb = conn.prepareStatement("insert into BlobTestTable values(?,?)");
+        PreparedStatement ps_sb = prepareStatement("insert into BlobTestTable values(?,?)");
         
         //initially insert the data
         ps_sb.setInt(1,1);
@@ -716,7 +710,7 @@
             throws IOException, SQLException {
         // Insert test data.
         InputStream is = new ByteArrayInputStream(BYTES);
-        PreparedStatement psBinary = conn.prepareStatement(
+        PreparedStatement psBinary = prepareStatement(
                 "insert into BlobTestTable values (?,?)");
         psBinary.setInt(1, 1);
         psBinary.setBinaryStream(2, is);

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ResultSetMetaDataTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ResultSetMetaDataTest.java?rev=434169&r1=434168&r2=434169&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ResultSetMetaDataTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ResultSetMetaDataTest.java Wed Aug 23 13:42:13 2006
@@ -31,7 +31,7 @@
 
 public class ResultSetMetaDataTest extends BaseJDBCTestCase {
     //classes that will be used for the test
-    private Connection        conn =null;
+
     private PreparedStatement ps   =null;
     private ResultSet         rs   =null;
     //The ResultSetMetaData object that will be used throughout the test
@@ -51,9 +51,8 @@
     /**
      * Create a default DataSource
      */
-    public void setUp() throws SQLException {
-        conn =   getConnection();
-        ps   =   conn.prepareStatement("select count(*) from sys.systables");
+    protected void setUp() throws SQLException {
+         ps   =   prepareStatement("select count(*) from sys.systables");
 	rs   =   ps.executeQuery();
         rsmd =   rs.getMetaData();
     }
@@ -63,15 +62,14 @@
      * Initialize the ds to null once the tests that need to be run have been 
      * run
      */
-    public void tearDown() throws SQLException {
+    protected void tearDown() throws Exception {
         if(rs != null && !rs.isClosed())
             rs.close();
         if(ps != null && !ps.isClosed())
             ps.close();
-        if(conn != null && !conn.isClosed()) {
-            conn.rollback();
-            conn.close();
-        }
+        
+        super.tearDown();
+
     }
 
     public void testIsWrapperForResultSetMetaData() throws SQLException {

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ResultSetTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ResultSetTest.java?rev=434169&r1=434168&r2=434169&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ResultSetTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ResultSetTest.java Wed Aug 23 13:42:13 2006
@@ -26,6 +26,7 @@
 import junit.framework.*;
 
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.BaseJDBCTestSetup;
 
 import java.io.*;
 import java.sql.*;
@@ -56,8 +57,6 @@
      **/
     private static int insertKey = 0;
 
-    /** Default connection used by the tests. */
-    private Connection con = null;
     /** Statement used to obtain default resultset. */
     private Statement stmt = null;
     /** Default resultset used by the tests. */
@@ -74,11 +73,10 @@
         super(name);
     }
 
-    public void setUp()
+    protected void setUp()
         throws SQLException {
         key = requestKey();
-        con = getConnection();
-        stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY,
+        stmt = createStatement(ResultSet.TYPE_FORWARD_ONLY,
                 ResultSet.CONCUR_UPDATABLE);
 
         rs = stmt.executeQuery("SELECT * FROM SYS.SYSTABLES");
@@ -87,8 +85,8 @@
         rs.next();
     }
 
-    public void tearDown()
-        throws SQLException {
+    protected void tearDown()
+        throws Exception {
 
         if (rs != null) {
             rs.close();
@@ -96,10 +94,8 @@
         if (stmt != null) {
             stmt.close();
         }
-        if (con != null && !con.isClosed()) {
-            con.rollback();
-            con.close();
-        }
+
+        super.tearDown();
     }
 
     public void testGetNCharacterStreamIntNotImplemented()
@@ -346,7 +342,7 @@
                 java.io.ByteArrayInputStream(BYTES2);
 
         //Prepared Statement used to insert the data
-        PreparedStatement ps_sb = prep(con, "dLongBit");
+        PreparedStatement ps_sb = prep("dLongBit");
         ps_sb.setInt(1,key);
         ps_sb.setBinaryStream(2,is,BYTES1.length);
         ps_sb.executeUpdate();
@@ -356,7 +352,7 @@
         //use a different ResultSet variable so that the
         //other tests can go on unimpacted
 
-        ResultSet rs1 = fetchUpd(con, "dLongBit", key);
+        ResultSet rs1 = fetchUpd("dLongBit", key);
         rs1.next();
         rs1.updateBinaryStream(1,is_for_update,(int)BYTES2.length);
         rs1.updateRow();
@@ -366,7 +362,7 @@
         //using the updateBinaryStream method is the same
         //data that we expected
 
-        rs1 = fetch(con, "dLongBit", key);
+        rs1 = fetch("dLongBit", key);
         rs1.next();
         InputStream is_ret = rs1.getBinaryStream(1);
 
@@ -408,7 +404,7 @@
                 java.io.ByteArrayInputStream(BYTES2);
 
         //Prepared Statement used to insert the data
-        PreparedStatement ps_sb = con.prepareStatement
+        PreparedStatement ps_sb = prepareStatement
                 ("insert into UpdateTestTable_ResultSet values(?,?)");
         ps_sb.setInt(1,1);
         ps_sb.setAsciiStream(2,is,BYTES1.length);
@@ -463,7 +459,7 @@
                 (str_for_update);
 
         //Prepared Statement used to insert the data
-        PreparedStatement ps_sb = prep(con, "dLongVarchar"); 
+        PreparedStatement ps_sb = prep("dLongVarchar"); 
         ps_sb.setInt(1,key);
         ps_sb.setCharacterStream(2,r,str.length());
         ps_sb.executeUpdate();
@@ -472,7 +468,7 @@
         //Update operation
         //use a different ResultSet variable so that the
         //other tests can go on unimpacted
-        ResultSet rs1 = fetchUpd(con, "dLongVarchar", key);
+        ResultSet rs1 = fetchUpd("dLongVarchar", key);
         rs1.next();
         rs1.updateCharacterStream(1,r_for_update,str_for_update.length());
         rs1.updateRow();
@@ -482,7 +478,7 @@
         //using the updateAsciiStream method is the same
         //data that we expected
 
-        rs1 = fetch(con, "dLongVarchar", key); 
+        rs1 = fetch("dLongVarchar", key); 
         rs1.next();
 
         StringReader r_ret = (StringReader)rs1.getCharacterStream(1);
@@ -525,7 +521,7 @@
                 java.io.ByteArrayInputStream(BYTES2);
 
         //Prepared Statement used to insert the data
-        PreparedStatement ps_sb = prep(con, "dLongBit");
+        PreparedStatement ps_sb = prep("dLongBit");
         ps_sb.setInt(1, key);
         ps_sb.setBinaryStream(2,is,BYTES1.length);
         ps_sb.executeUpdate();
@@ -536,7 +532,7 @@
         //use a different ResultSet variable so that the
         //other tests can go on unimpacted
 
-        ResultSet rs1 = fetchUpd(con, "dLongBit", key);
+        ResultSet rs1 = fetchUpd("dLongBit", key);
         rs1.next();
         rs1.updateBinaryStream("dLongBit",is_for_update,(int)BYTES2.length);
         rs1.updateRow();
@@ -546,7 +542,7 @@
         //using the updateBinaryStream method is the same
         //data that we expected
 
-        rs1 = fetch(con, "dLongBit", key);
+        rs1 = fetch("dLongBit", key);
         rs1.next();
         InputStream is_ret = rs1.getBinaryStream(1);
 
@@ -570,14 +566,14 @@
         InputStream is2 = new java.io.ByteArrayInputStream(BYTES2);
 
         //Prepared Statement used to insert the data
-        PreparedStatement ps_sb = prep(con, "dLongBit");
+        PreparedStatement ps_sb = prep("dLongBit");
         ps_sb.setInt(1, key);
         ps_sb.setBinaryStream(2, is1);
         ps_sb.executeUpdate();
         ps_sb.close();
 
         //Update operation
-        ResultSet rs1 = fetchUpd(con, "dLongBit", key);
+        ResultSet rs1 = fetchUpd("dLongBit", key);
         rs1.next();
         rs1.updateBinaryStream(1, is2);
         rs1.updateRow();
@@ -587,7 +583,7 @@
         //using the updateBinaryStream method is the same
         //data that we expected
 
-        rs1 = fetch(con, "dLongBit", key);
+        rs1 = fetch("dLongBit", key);
         rs1.next();
         assertEquals(new ByteArrayInputStream(BYTES2), rs1.getBinaryStream(1));
         rs1.close();
@@ -604,14 +600,14 @@
         InputStream is2 = new java.io.ByteArrayInputStream(BYTES2);
 
         //Prepared Statement used to insert the data
-        PreparedStatement ps_sb = prep(con, "dBlob");
+        PreparedStatement ps_sb = prep("dBlob");
         ps_sb.setInt(1, key);
         ps_sb.setBinaryStream(2, is1);
         ps_sb.executeUpdate();
         ps_sb.close();
 
         //Update operation
-        ResultSet rs1 = fetchUpd(con, "dBlob", key);
+        ResultSet rs1 = fetchUpd("dBlob", key);
         rs1.next();
         rs1.updateBinaryStream(1, is2);
         rs1.updateRow();
@@ -621,7 +617,7 @@
         //using the updateBinaryStream method is the same
         //data that we expected
 
-        rs1 = fetch(con, "dBlob", key);
+        rs1 = fetch("dBlob", key);
         rs1.next();
         assertEquals(new ByteArrayInputStream(BYTES2), rs1.getBinaryStream(1));
         rs1.close();
@@ -634,14 +630,14 @@
         InputStream is2 = new java.io.ByteArrayInputStream(BYTES2);
 
         //Prepared Statement used to insert the data
-        PreparedStatement ps_sb = prep(con, "dLongBit");
+        PreparedStatement ps_sb = prep("dLongBit");
         ps_sb.setInt(1, key);
         ps_sb.setBinaryStream(2, is1);
         ps_sb.executeUpdate();
         ps_sb.close();
 
         //Update operation
-        ResultSet rs1 = fetchUpd(con, "dLongBit", key);
+        ResultSet rs1 = fetchUpd("dLongBit", key);
         rs1.next();
         rs1.updateBinaryStream("dLongBit", is2);
         rs1.updateRow();
@@ -651,7 +647,7 @@
         //using the updateBinaryStream method is the same
         //data that we expected
 
-        rs1 = fetch(con, "dLongBit", key);
+        rs1 = fetch("dLongBit", key);
         rs1.next();
         assertEquals(new ByteArrayInputStream(BYTES2), rs1.getBinaryStream(1));
         rs1.close();
@@ -682,7 +678,7 @@
                 java.io.ByteArrayInputStream(BYTES2);
 
         //Prepared Statement used to insert the data
-        PreparedStatement ps_sb = prep(con, "dLongVarchar");
+        PreparedStatement ps_sb = prep("dLongVarchar");
         ps_sb.setInt(1, key);
         ps_sb.setAsciiStream(2,is,BYTES1.length);
         ps_sb.executeUpdate();
@@ -692,7 +688,7 @@
         //use a different ResultSet variable so that the
         //other tests can go on unimpacted
 
-        ResultSet rs1 = fetchUpd(con, "dLongVarchar", key);
+        ResultSet rs1 = fetchUpd("dLongVarchar", key);
         rs1.next();
         rs1.updateAsciiStream("dLongVarchar",is_for_update,(int)BYTES2.length);
         rs1.updateRow();
@@ -702,7 +698,7 @@
         //using the updateAsciiStream method is the same
         //data that we expected
 
-        rs1 = fetch(con, "dLongVarchar", key);
+        rs1 = fetch("dLongVarchar", key);
         rs1.next();
         InputStream is_ret = rs1.getAsciiStream(1);
 
@@ -728,21 +724,21 @@
                 java.io.ByteArrayInputStream(BYTES2);
 
         // Prepared Statement used to insert the data.
-        PreparedStatement ps_sb = prep(con, "dLongVarchar");
+        PreparedStatement ps_sb = prep("dLongVarchar");
         ps_sb.setInt(1, key);
         ps_sb.setAsciiStream(2, is, BYTES1.length);
         ps_sb.executeUpdate();
         ps_sb.close();
 
         // Update the data.
-        ResultSet rs1 = fetchUpd(con, "dLongVarchar", key);
+        ResultSet rs1 = fetchUpd("dLongVarchar", key);
         rs1.next();
         rs1.updateAsciiStream(1, isForUpdate);
         rs1.updateRow();
         rs1.close();
 
         // Query to see whether the data that has been updated.
-        rs1 = fetch(con, "dLongVarchar", key);
+        rs1 = fetch("dLongVarchar", key);
         rs1.next();
         InputStream isRet = rs1.getAsciiStream(1);
         isRet.read(bytesRet);
@@ -767,21 +763,21 @@
                 java.io.ByteArrayInputStream(BYTES2);
 
         // Prepared Statement used to insert the data.
-        PreparedStatement ps_sb = prep(con, "dLongVarchar");
+        PreparedStatement ps_sb = prep("dLongVarchar");
         ps_sb.setInt(1, key);
         ps_sb.setAsciiStream(2, is, BYTES1.length);
         ps_sb.executeUpdate();
         ps_sb.close();
 
         // Update the data.
-        ResultSet rs1 = fetchUpd(con, "dLongVarchar", key);
+        ResultSet rs1 = fetchUpd("dLongVarchar", key);
         rs1.next();
         rs1.updateAsciiStream("dLongVarchar", isForUpdate);
         rs1.updateRow();
         rs1.close();
 
         // Query to see whether the data that has been updated.
-        rs1 = fetch(con, "dLongVarchar", key);
+        rs1 = fetch("dLongVarchar", key);
         rs1.next();
         InputStream isRet = rs1.getAsciiStream(1);
         isRet.read(bytesRet);
@@ -810,7 +806,7 @@
                 (str_for_update);
 
         //Prepared Statement used to insert the data
-        PreparedStatement ps_sb = prep(con, "dLongVarchar");
+        PreparedStatement ps_sb = prep("dLongVarchar");
         ps_sb.setInt(1, key);
         ps_sb.setCharacterStream(2,r,str.length());
         ps_sb.executeUpdate();
@@ -819,7 +815,7 @@
         //Update operation
         //use a different ResultSet variable so that the
         //other tests can go on unimpacted
-        ResultSet rs1 = fetchUpd(con, "dLongVarchar", key);
+        ResultSet rs1 = fetchUpd("dLongVarchar", key);
         rs1.next();
         rs1.updateCharacterStream("dLongVarchar", 
                                   r_for_update,
@@ -831,7 +827,7 @@
         //using the updateAsciiStream method is the same
         //data that we expected
 
-        rs1 = fetch(con, "dLongVarchar", key);
+        rs1 = fetch("dLongVarchar", key);
         rs1.next();
 
         StringReader r_ret = (StringReader)rs1.getCharacterStream(1);
@@ -854,21 +850,21 @@
         String strUpdated = "An updated (\u0FEF\u9876) test string";
 
         // Insert test data
-        PreparedStatement psChar = prep(con, "dLongVarchar");
+        PreparedStatement psChar = prep("dLongVarchar");
         psChar.setInt(1, key);
         psChar.setCharacterStream(2, new StringReader(str));
         psChar.execute();
         psChar.close();
 
         // Update test data
-        ResultSet rs = fetchUpd(con, "dLongVarchar", key);
+        ResultSet rs = fetchUpd("dLongVarchar", key);
         rs.next();
         rs.updateCharacterStream(1, new StringReader(strUpdated));
         rs.updateRow();
         rs.close();
 
         // Verify that update took place and is correct.
-        rs = fetch(con, "dLongVarchar", key);
+        rs = fetch("dLongVarchar", key);
         rs.next();
         Reader updatedStr = rs.getCharacterStream(1);
         for (int i=0; i < strUpdated.length(); i++) {
@@ -886,21 +882,21 @@
         String strUpdated = "An updated (\u0FEF\u9876) test string";
 
         // Insert test data
-        PreparedStatement psChar = prep(con, "dLongVarchar");
+        PreparedStatement psChar = prep("dLongVarchar");
         psChar.setInt(1, key);
         psChar.setCharacterStream(2, new StringReader(str));
         psChar.execute();
         psChar.close();
 
         // Update test data
-        ResultSet rs = fetchUpd(con, "dLongVarchar", key);
+        ResultSet rs = fetchUpd("dLongVarchar", key);
         rs.next();
         rs.updateCharacterStream("dLongVarchar", new StringReader(strUpdated));
         rs.updateRow();
         rs.close();
 
         // Verify that update took place and is correct.
-        rs = fetch(con, "dLongVarchar", key);
+        rs = fetch("dLongVarchar", key);
         rs.next();
         Reader updatedStr = rs.getCharacterStream(1);
         for (int i=0; i < strUpdated.length(); i++) {
@@ -935,7 +931,7 @@
         InputStream is2 = new java.io.ByteArrayInputStream(BYTES2);
 
         //Prepared Statement used to insert the data
-        PreparedStatement ps_sb = prep(con, "dClob");
+        PreparedStatement ps_sb = prep("dClob");
 
         //first insert
         ps_sb.setInt(1,key);
@@ -958,12 +954,12 @@
         //update the second result set with this
         //Clob value
 
-        ResultSet rs1 = fetchUpd(con, "dClob", key);
+        ResultSet rs1 = fetchUpd("dClob", key);
         rs1.next();
         Clob clob = rs1.getClob(1);
         rs1.close();
 
-        rs1 = fetchUpd(con, "dClob", key2);
+        rs1 = fetchUpd("dClob", key2);
         rs1.next();
         rs1.updateClob(1,clob);
         rs1.updateRow();
@@ -973,7 +969,7 @@
         //using the updateClob method is the same
         //data that we expected
 
-        rs1 = fetch(con, "dClob", key2);
+        rs1 = fetch("dClob", key2);
         rs1.next();
         assertEquals(clob, rs1.getClob(1));
         rs1.close();
@@ -986,21 +982,21 @@
         Reader r2 = new java.io.StringReader(new String(BYTES2));
 
         // Prepared Statement used to insert the data
-        PreparedStatement ps_sb = prep(con, "dClob");
+        PreparedStatement ps_sb = prep("dClob");
         ps_sb.setInt(1, key);
         ps_sb.setCharacterStream(2, r1);
         ps_sb.executeUpdate();
         ps_sb.close();
 
         // Update operation
-        ResultSet rs1 = fetchUpd(con, "dClob", key);
+        ResultSet rs1 = fetchUpd("dClob", key);
         rs1.next();
         rs1.updateClob(1, r2);
         rs1.updateRow();
         rs1.close();
 
         // Query to see whether the data that has been updated.
-        rs1 = fetch(con, "dClob", key);
+        rs1 = fetch("dClob", key);
         rs1.next();
         assertEquals(new StringReader(new String(BYTES2)),
                      rs1.getCharacterStream(1));
@@ -1030,7 +1026,7 @@
         InputStream is2 = new java.io.ByteArrayInputStream(BYTES2);
 
         //Prepared Statement used to insert the data
-        PreparedStatement ps_sb = prep(con, "dBlob");
+        PreparedStatement ps_sb = prep("dBlob");
 
         //first insert
         ps_sb.setInt(1, key);
@@ -1053,12 +1049,12 @@
         //update the second result set with this
         //Clob value
 
-        ResultSet rs1 = fetch(con, "dBlob", key);
+        ResultSet rs1 = fetch("dBlob", key);
         rs1.next();
         Blob blob = rs1.getBlob(1);
         rs1.close();
 
-        rs1 = fetchUpd(con, "dBlob", key2);
+        rs1 = fetchUpd("dBlob", key2);
         rs1.next();
         rs1.updateBlob(1,blob);
         rs1.updateRow();
@@ -1068,7 +1064,7 @@
         //using the updateBlob method is the same
         //data that we expected
 
-        rs1 = fetch(con, "dBlob", key2);
+        rs1 = fetch("dBlob", key2);
         rs1.next();
         assertEquals(blob, rs1.getBlob(1));
         rs1.close();
@@ -1081,21 +1077,21 @@
         InputStream is2 = new java.io.ByteArrayInputStream(BYTES2);
 
         // Prepared Statement used to insert the data
-        PreparedStatement ps_sb = prep(con, "dBlob");
+        PreparedStatement ps_sb = prep("dBlob");
         ps_sb.setInt(1, key);
         ps_sb.setBinaryStream(2, is1);
         ps_sb.executeUpdate();
         ps_sb.close();
 
         // Update operation
-        ResultSet rs1 = fetchUpd(con, "dBlob", key);
+        ResultSet rs1 = fetchUpd("dBlob", key);
         rs1.next();
         rs1.updateBlob(1, is2);
         rs1.updateRow();
         rs1.close();
 
         // Query to see whether the data that has been updated.
-        rs1 = fetch(con, "dBlob", key);
+        rs1 = fetch("dBlob", key);
         rs1.next();
         assertEquals(new ByteArrayInputStream(BYTES2), rs1.getBinaryStream(1));
         rs1.close();
@@ -1124,7 +1120,7 @@
         InputStream is2 = new java.io.ByteArrayInputStream(BYTES2);
 
         //Prepared Statement used to insert the data
-        PreparedStatement ps_sb = prep(con, "dClob");
+        PreparedStatement ps_sb = prep("dClob");
 
         //first insert
         ps_sb.setInt(1, key);
@@ -1147,12 +1143,12 @@
         //update the second result set with this
         //Clob value
 
-        ResultSet rs1 = fetch(con, "dClob", key);
+        ResultSet rs1 = fetch("dClob", key);
         rs1.next();
         Clob clob = rs1.getClob(1);
         rs1.close();
 
-        rs1 = fetchUpd(con, "dClob", key2);
+        rs1 = fetchUpd("dClob", key2);
         rs1.next();
         rs1.updateClob("dClob",clob);
         rs1.updateRow();
@@ -1162,7 +1158,7 @@
         //using the updateClob method is the same
         //data that we expected
 
-        rs1 = fetch(con, "dClob", key2);
+        rs1 = fetch("dClob", key2);
         rs1.next();
         assertEquals(clob, rs1.getClob(1));
         rs1.close();
@@ -1175,21 +1171,21 @@
         Reader r2 = new java.io.StringReader(new String(BYTES2));
 
         // Prepared Statement used to insert the data
-        PreparedStatement ps_sb = prep(con, "dClob");
+        PreparedStatement ps_sb = prep("dClob");
         ps_sb.setInt(1, key);
         ps_sb.setCharacterStream(2, r1);
         ps_sb.executeUpdate();
         ps_sb.close();
 
         // Update operation
-        ResultSet rs1 = fetchUpd(con, "dClob", key);
+        ResultSet rs1 = fetchUpd("dClob", key);
         rs1.next();
         rs1.updateClob("dClob", r2);
         rs1.updateRow();
         rs1.close();
 
         // Query to see whether the data that has been updated.
-        rs1 = fetch(con, "dClob", key);
+        rs1 = fetch("dClob", key);
         rs1.next();
         assertEquals(new StringReader(new String(BYTES2)),
                      rs1.getCharacterStream(1));
@@ -1219,7 +1215,7 @@
         InputStream is2 = new java.io.ByteArrayInputStream(BYTES2);
 
         //Prepared Statement used to insert the data
-        PreparedStatement ps_sb = prep(con, "dBlob");
+        PreparedStatement ps_sb = prep("dBlob");
 
         //first insert
         ps_sb.setInt(1, key);
@@ -1242,12 +1238,12 @@
         //update the second result set with this
         //Clob value
 
-        ResultSet rs1 = fetch(con, "dBlob", key);
+        ResultSet rs1 = fetch("dBlob", key);
         rs1.next();
         Blob blob = rs1.getBlob(1);
         rs1.close();
 
-        rs1 = fetchUpd(con, "dBlob", key2);
+        rs1 = fetchUpd("dBlob", key2);
         rs1.next();
         rs1.updateBlob("dBlob",blob);
         rs1.updateRow();
@@ -1257,7 +1253,7 @@
         //using the updateBlob method is the same
         //data that we expected
 
-        rs1 = fetch(con, "dBlob", key2);
+        rs1 = fetch("dBlob", key2);
         rs1.next();
         assertEquals(blob, rs1.getBlob(1)); 
         rs1.close();
@@ -1270,21 +1266,21 @@
         InputStream is2 = new java.io.ByteArrayInputStream(BYTES2);
 
         // Prepared Statement used to insert the data
-        PreparedStatement ps_sb = prep(con, "dBlob");
+        PreparedStatement ps_sb = prep("dBlob");
         ps_sb.setInt(1, key);
         ps_sb.setBinaryStream(2, is1);
         ps_sb.executeUpdate();
         ps_sb.close();
 
         // Update operation
-        ResultSet rs1 = fetchUpd(con, "dBlob", key);
+        ResultSet rs1 = fetchUpd("dBlob", key);
         rs1.next();
         rs1.updateBlob("dBlob", is2);
         rs1.updateRow();
         rs1.close();
 
         // Query to see whether the data that has been updated.
-        rs1 = fetch(con, "dBlob", key);
+        rs1 = fetch("dBlob", key);
         rs1.next();
         assertEquals(new ByteArrayInputStream(BYTES2), rs1.getBinaryStream(1));
         rs1.close();
@@ -1331,50 +1327,31 @@
                     embeddedSuite("ResultSetTest embedded-only suite"));
         }
         // Wrap suite in a TestSetup-class.
-        return new TestSetup(rsSuite) {
-                public void setUp()
-                        throws SQLException {
-                    oneTimeSetup();
-                }
-
-                public void tearDown()
+        return new BaseJDBCTestSetup(rsSuite) {
+                protected void setUp()
                         throws SQLException {
-                    oneTimeTearDown();
+                    Connection con = getConnection();
+                    Statement stmt = con.createStatement();
+                    stmt.execute("create table UpdateTestTableResultSet (" +
+                            "sno int not null unique," +
+                            "dBlob BLOB," +
+                            "dClob CLOB," +
+                            "dLongVarchar LONG VARCHAR," +
+                            "dLongBit LONG VARCHAR FOR BIT DATA)");
+                    stmt.close();
+               }
+
+                protected void tearDown()
+                        throws Exception {
+                    Connection con = getConnection();
+                    Statement stmt = con.createStatement();
+                    stmt.execute("drop table UpdateTestTableResultSet");
+                    stmt.close();
+                    super.tearDown();
                 }
             };
     }
 
-    /**
-     * Perform one-time setup for the suite.
-     * Creates the necessary tables for the tests.
-     */
-    protected static void oneTimeSetup()
-            throws SQLException {
-        Connection con = getConnection();
-        Statement stmt = con.createStatement();
-        stmt.execute("create table UpdateTestTableResultSet (" +
-                "sno int not null unique," +
-                "dBlob BLOB," +
-                "dClob CLOB," +
-                "dLongVarchar LONG VARCHAR," +
-                "dLongBit LONG VARCHAR FOR BIT DATA)");
-        stmt.close();
-        con.close();
-    }
-
-    /**
-     * Perform one-time cleanup for the suite.
-     * Deletes the tables used by the tests.
-     */
-    protected static void oneTimeTearDown()
-            throws SQLException {
-        Connection con = getConnection();
-        Statement stmt = con.createStatement();
-        stmt.execute("drop table UpdateTestTableResultSet");
-        stmt.close();
-        con.close();
-    }
-
     /*************************************************************************
      **                    U T I L I T Y  M E T H O D S                      *
      *************************************************************************/
@@ -1396,9 +1373,9 @@
      * @param con connection to database
      * @param colName name of the column to insert into
      */
-    private static PreparedStatement prep(Connection con, String colName)
+    private PreparedStatement prep(String colName)
             throws SQLException {
-        return con.prepareStatement("insert into UpdateTestTableResultSet " +
+        return prepareStatement("insert into UpdateTestTableResultSet " +
                 "(sno, " + colName + ") values (?,?)");
     }
 
@@ -1411,9 +1388,9 @@
      * @return a <code>ResultSet</code> with zero or one row, depending on
      *      the key used
      */
-    private static ResultSet fetchUpd(Connection con, String colName, int key)
+    private ResultSet fetchUpd(String colName, int key)
             throws SQLException {
-        Statement stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY,
+        Statement stmt = createStatement(ResultSet.TYPE_FORWARD_ONLY,
                                              ResultSet.CONCUR_UPDATABLE);
         return stmt.executeQuery("select " + colName +
                 " from UpdateTestTableResultSet where sno = " + key +
@@ -1429,9 +1406,9 @@
      * @return a <code>ResultSet</code> with zero or one row, depending on
      *      the key used
      */
-    private static ResultSet fetch(Connection con, String colName, int key)
+    private ResultSet fetch(String colName, int key)
             throws SQLException {
-        Statement stmt = con.createStatement();
+        Statement stmt = createStatement();
         return stmt.executeQuery("select " + colName +
                 " from UpdateTestTableResultSet where sno = " + key);
     }

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/RowIdNotImplementedTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/RowIdNotImplementedTest.java?rev=434169&r1=434168&r2=434169&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/RowIdNotImplementedTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/RowIdNotImplementedTest.java Wed Aug 23 13:42:13 2006
@@ -43,9 +43,6 @@
 public class RowIdNotImplementedTest 
     extends BaseJDBCTestCase {
 
-    /** Default connection used by the tests. */
-    private Connection con = null;
-
     /**
      * Create test with given name.
      *
@@ -55,33 +52,11 @@
         super(name);
     }
     
-    /**
-     * Obtain default connection.
-     *
-     * @throws SQLException if obtaining connection fails.
-     */
-    public void setUp()
-        throws SQLException {
-        con = getConnection();
-    }
-
-    /**
-     * Do rollback and close on connection.
-     *
-     * @throws SQLException if rollback or close fails on connection.
-     */
-    public void tearDown()
-        throws SQLException {
-        if (con != null && !con.isClosed()) {
-            con.rollback();
-            con.close();
-        }
-    }
 
     public void testRowIdInPreparedStatementSetRowId() 
         throws SQLException {
         PreparedStatement pStmt = 
-            con.prepareStatement("select count(*) from sys.systables");
+            prepareStatement("select count(*) from sys.systables");
         try {
             pStmt.setRowId(1, null);
             fail("PreparedStatement.setRowId should not be implemented");
@@ -170,7 +145,7 @@
 
     public void testRowIdInDatabaseMetaDataRowIdLifeTime() 
         throws SQLException {
-        DatabaseMetaData meta = con.getMetaData();
+        DatabaseMetaData meta = getXConnection().getMetaData();
         RowIdLifetime rowIdLifetime = meta.getRowIdLifetime();
         assertEquals("RowIdLifetime should be ROWID_UNSUPPORTED",
             RowIdLifetime.ROWID_UNSUPPORTED,
@@ -227,7 +202,7 @@
     private CallableStatement getCallableStatement() 
         throws SQLException {
         // No need to actuall call a stored procedure.
-        return con.prepareCall("values 1");
+        return prepareCall("values 1");
     }
 
     /**
@@ -239,7 +214,7 @@
     private ResultSet getResultSet()
         throws SQLException {
         // Create a very simple resultset.
-        return con.createStatement().executeQuery("values 1");
+        return createStatement().executeQuery("values 1");
     }
     
     /**

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/SetObjectUnsupportedTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/SetObjectUnsupportedTest.java?rev=434169&r1=434168&r2=434169&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/SetObjectUnsupportedTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/SetObjectUnsupportedTest.java Wed Aug 23 13:42:13 2006
@@ -76,8 +76,7 @@
      */
     private PreparedStatement prepare() throws SQLException {
         String sql = "values (CAST (? AS VARCHAR(128)))";
-        Connection c = getConnection();
-        return callable ? c.prepareCall(sql) : c.prepareStatement(sql);
+        return callable ? prepareCall(sql) : prepareStatement(sql);
     }
 
     /**

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTest.java?rev=434169&r1=434168&r2=434169&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTest.java Wed Aug 23 13:42:13 2006
@@ -33,9 +33,7 @@
 public class StatementTest
     extends BaseJDBCTestCase {
 
-    /** Default connection used by the tests. */
-    private Connection con = null;
-    /** Default statement used by the tests. */
+   /** Default statement used by the tests. */
     private Statement stmt = null;
     
     /**
@@ -53,13 +51,11 @@
      * @throws SQLException if setAutoCommit, createStatement or 
      *                      BaseJDBCTestCase.getConnection fails.
      */
-    public void setUp() 
+    protected void setUp() 
         throws SQLException {
-        con = getConnection();
-        assertFalse("Connection must be open initially", con.isClosed());
-        con.setAutoCommit(false);
+        getXConnection().setAutoCommit(false);
         // Create a default statement.
-        stmt = con.createStatement();
+        stmt = createStatement();
         assertFalse("First statement must be open initially", 
                 stmt.isClosed());
     }
@@ -69,20 +65,14 @@
      *
      * @throws SQLException if a database access exception occurs.
      */
-    public void tearDown() 
-        throws SQLException {
+    protected void tearDown() 
+        throws Exception {
         // Close default statement
         if (stmt != null) {
             stmt.close();
         }
-        // Close default connection
-        // Check if connection is open to avoid exception on rollback.
-        if (con != null && !con.isClosed()) {
-            // Abort changes that may have been done in the test.
-            // The test-method may however commit these itself.
-            con.rollback();
-            con.close();
-        }
+
+        super.tearDown();
     }
 
     /**
@@ -108,7 +98,7 @@
     public void testIsClosedWithTwoStatementsOnSameConnection()
         throws SQLException {
         // Create a second statement on the default connection.
-        Statement stmt2 = con.createStatement();
+        Statement stmt2 = createStatement();
         assertFalse("Second statement must be open initially", 
                 stmt2.isClosed());
         assertFalse("First statement should not be closed when " +
@@ -132,7 +122,7 @@
     public void testIsClosedWhenClosingConnection()
         throws SQLException {
         // Create an extra statement for good measure.
-        Statement stmt2 = con.createStatement();
+        Statement stmt2 = createStatement();
         assertFalse("Second statement must be open initially",
                 stmt2.isClosed());
         // Exeute something on it, as opposed to the default statement.
@@ -141,7 +131,8 @@
                 "execute()", stmt2.isClosed());
         // Close the connection. We must commit/rollback first, or else a
         // "Invalid transaction state" exception is raised.
-        con.rollback();
+        rollback();
+        Connection con = getXConnection();
         con.close();
         assertTrue("Connection should be closed after close()", 
                 con.isClosed());
@@ -165,6 +156,7 @@
         throws SQLException {
         stmt.executeQuery("select count(*) from stmtTable");
         // Connection should now be in an invalid transaction state.
+        Connection con = stmt.getConnection();
         try {
             con.close();
             fail("Invalid transaction state exception was not thrown");
@@ -207,6 +199,7 @@
      */
     public void testStatementExecuteAfterConnectionClose() 
         throws SQLException {
+        Connection con = stmt.getConnection();
         con.close();
         assertTrue("Connection should be closed after close()", 
                 con.isClosed());

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTestSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTestSetup.java?rev=434169&r1=434168&r2=434169&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTestSetup.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementTestSetup.java Wed Aug 23 13:42:13 2006
@@ -21,6 +21,7 @@
 package org.apache.derbyTesting.functionTests.tests.jdbc4;
 
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.BaseJDBCTestSetup;
 
 import junit.framework.Test;
 import junit.extensions.TestSetup;
@@ -33,7 +34,7 @@
  *  @see StatementTest
  */
 public class StatementTestSetup 
-    extends TestSetup {
+    extends BaseJDBCTestSetup {
 
     /**
      * Initialize database schema.
@@ -52,9 +53,9 @@
      *
      * @see StatementTest
      */
-    public void setUp()
+    protected void setUp()
         throws SQLException {
-        Connection con = BaseJDBCTestCase.getConnection();
+        Connection con = getConnection();
         // Create tables used by the test.
         Statement stmt = con.createStatement();
         // See if the table is already there, and if so, delete it.
@@ -79,7 +80,6 @@
         rs.close();
         stmt.close();
         con.commit();
-        con.close();
     }
 
     /**
@@ -88,14 +88,14 @@
      *
      * @throws SQLException if database operations fail.
      */
-    public void tearDown() 
-        throws SQLException {
-        Connection con = BaseJDBCTestCase.getConnection();
+    protected void tearDown() 
+        throws Exception {
+        Connection con = getConnection();
         Statement stmt = con.createStatement();
         stmt.execute("drop table stmtTable");
         stmt.close();
         con.commit();
-        con.close();
+        super.tearDown();
     }
    
 } // End class StatementTestSetup

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java?rev=434169&r1=434168&r2=434169&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java Wed Aug 23 13:42:13 2006
@@ -123,13 +123,25 @@
      * Utility method to create a PreparedStatement using the connection
      * returned by getConnection.
      * @return Statement object from
-     * getConnection.createStatement(resultSetType, resultSetConcurrency)
+     * getConnection.prepareStatement(sql)
      * @throws SQLException
      */
     public PreparedStatement prepareStatement(String sql) throws SQLException
     {
         return getXConnection().prepareStatement(sql);
     }    
+
+    /**
+     * Utility method to create a CallableStatement using the connection
+     * returned by getConnection.
+     * @return Statement object from
+     * getConnection().prepareCall(sql)
+     * @throws SQLException
+     */
+    public CallableStatement prepareCall(String sql) throws SQLException
+    {
+        return getXConnection().prepareCall(sql);
+    }
     
     /**
      * Utility method to commit using the connection
@@ -159,12 +171,6 @@
     {
         JDBC.cleanup(conn);
         conn = null;
-    }
-
-    // TEMP
-    public static Connection getConnection() throws SQLException
-    {
-        return openDefaultConnection();
     }
 
     /**



Mime
View raw message