You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ka...@apache.org on 2007/05/21 16:11:04 UTC

svn commit: r540150 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests: suites/ tests/jdbc4/

Author: kahatlen
Date: Mon May 21 07:11:03 2007
New Revision: 540150

URL: http://svn.apache.org/viewvc?view=rev&rev=540150
Log:
DERBY-2674 (partial) Stop running jdbc40 tests in the old test framework

The attached patch removes the TestPreparedStatementMethods test and
associated files that are not used by other tests.

An inspection of PreparedStatementTest showed that testing of
isPoolable/setPoolable on a closed PreparedStatement was omitted when
the test was ported to Junit. The patch adds test cases for this to
PreparedStatementTest.

Contributed by Øystein Grøvlen.

Removed:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestPreparedStatementMethods.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestPreparedStatementMethods_app.properties
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/aclob.txt
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/littleclob.txt
Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdbc40.runall
    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/TestConnectionMethods_app.properties
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/copyfiles.ant

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdbc40.runall
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdbc40.runall?view=diff&rev=540150&r1=540149&r2=540150
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdbc40.runall (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdbc40.runall Mon May 21 07:11:03 2007
@@ -1,4 +1,3 @@
 jdbc4/TestConnectionMethods.java
-jdbc4/TestPreparedStatementMethods.java
 jdbc4/TestResultSetMethods.java
 jdbc4/AutoloadBooting.junit

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?view=diff&rev=540150&r1=540149&r2=540150
==============================================================================
--- 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 Mon May 21 07:11:03 2007
@@ -141,6 +141,9 @@
     public void tearDown() 
         throws Exception {
         
+        s.close();
+        ps.close();
+
         psFetchBlob.close();
         psFetchClob.close();
         psInsertBlob.close();
@@ -550,16 +553,28 @@
      */
     
     public void testSetPoolable() throws SQLException {
+        // Set the poolable statement hint to false
+        ps.setPoolable(false);
+        assertFalse("Expected a non-poolable statement", ps.isPoolable());
+        // Set the poolable statement hint to true
+        ps.setPoolable(true);
+        assertTrue("Expected a non-poolable statement", ps.isPoolable());
+    }
+
+    /**
+     *
+     * Tests the PreparedStatement interface method setPoolable on a closed
+     * PreparedStatement
+     *
+     * @throws SQLException
+     */
+    public void testSetPoolableOnClosed() throws SQLException {
         try {
+            ps.close();
             // Set the poolable statement hint to false
             ps.setPoolable(false);
-            if (ps.isPoolable())
-                fail("Expected a non-poolable statement");
-            // Set the poolable statement hint to true
-            ps.setPoolable(true);
-            if (!ps.isPoolable())
-                fail("Expected a poolable statement");
-        } catch(SQLException sqle) {
+            fail("Expected an exception on closed statement");
+         } catch(SQLException sqle) {
             // Check which SQLException state we've got and if it is
             // expected, do not print a stackTrace
             // Embedded uses XJ012, client uses XCL31.
@@ -569,8 +584,6 @@
             } else {
                 fail("Unexpected SQLException " + sqle);
             }
-        } catch(Exception e) {
-            fail("Unexpected exception thrown in method " + e);
         }
     }
     
@@ -583,10 +596,23 @@
      */
     
     public void testIsPoolable() throws SQLException {
+        // By default a prepared statement is poolable
+        assertTrue("Expected a poolable statement", ps.isPoolable());
+    }
+
+    /**
+     *
+     * Tests the PreparedStatement interface method isPoolable on closed
+     * PreparedStatement
+     *
+     * @throws SQLException
+     *
+     */
+    public void testIsPoolableOnClosed() throws SQLException {
         try {
-            // By default a prepared statement is poolable
-            if (!ps.isPoolable())
-                fail("Expected a poolable statement");
+            ps.close();
+            boolean p = ps.isPoolable();
+            fail("Should throw exception on closed statement");
         } catch(SQLException sqle) {
             // Check which SQLException state we've got and if it is
             // expected, do not print a stackTrace
@@ -597,11 +623,8 @@
             } else {
                 fail("Unexpected SQLException " + sqle);
             }
-        } catch(Exception e) {
-            fail("Unexpected exception thrown in method " + e);
         }
     }
-    
     
     /**
      *

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestConnectionMethods_app.properties
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestConnectionMethods_app.properties?view=diff&rev=540150&r1=540149&r2=540150
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestConnectionMethods_app.properties (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestConnectionMethods_app.properties Mon May 21 07:11:03 2007
@@ -12,5 +12,5 @@
 runwithjdk14=false
 excludeJCC=at-or-after:1.0
 
-supportfiles=tests/jdbc4/short.txt,tests/jdbc4/littleclob.txt,tests/jdbc4/aclob.txt
+supportfiles=tests/jdbc4/short.txt
 useextdirs=true

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/copyfiles.ant
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/copyfiles.ant?view=diff&rev=540150&r1=540149&r2=540150
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/copyfiles.ant (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/copyfiles.ant Mon May 21 07:11:03 2007
@@ -1,7 +1,4 @@
 default_app.properties
 TestRowId_app.properties
 TestConnectionMethods_app.properties
-TestPreparedStatementMethods_app.properties
-aclob.txt
-littleclob.txt
 short.txt