db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r472016 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests: suites/ tests/jdbc4/
Date Tue, 07 Nov 2006 07:39:27 GMT
Author: kahatlen
Date: Mon Nov  6 23:39:25 2006
New Revision: 472016

URL: http://svn.apache.org/viewvc?view=rev&rev=472016
Log:
DERBY-2023: Ensure all tests called by jdbc40._Suite run in embedded
and client as required

The attached patch (derby-2023.diff) makes most of the tests in
jdbc4._Suite run in client and embedded. The exceptions are

  - ClosedObjectTest
  - StatementEventsTest
  - XA40Test
  - UnsupportedVetter
  - DataSourceTest

These tests can only run in embedded mode until DERBY-2047 has been
fixed, and I have added a note about it in their suite() methods.

jdbc4._Suite is removed from jdbc40.runall.

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/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/ClobTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ClosedObjectTest.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/DataSourceTest.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/StatementEventsTest.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/TestDbMetaData.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestJDBC40Exception.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/UnsupportedVetter.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/XA40Test.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/_Suite.java

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=472016&r1=472015&r2=472016
==============================================================================
--- 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 Nov  6 23:39:25 2006
@@ -4,4 +4,3 @@
 jdbc4/AutoloadBooting.junit
 jdbc4/AutoloadTest.junit
 jdbc4/VerifySignatures.junit
-jdbc4/_Suite.junit

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?view=diff&rev=472016&r1=472015&r2=472016
==============================================================================
--- 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
Mon Nov  6 23:39:25 2006
@@ -24,6 +24,7 @@
 import junit.framework.*;
 
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
 
 import java.sql.*;
 import java.io.*;
@@ -389,8 +390,13 @@
      * Create test suite for this test.
      */
     public static Test suite() {
-        return new BlobClobTestSetup(new TestSuite(BlobTest.class,
-                                                   "BlobTest suite"));
+        TestSuite suite = new TestSuite("BlobTest suite");
+        suite.addTest(new BlobClobTestSetup(
+            new TestSuite(BlobTest.class, "BlobTest:embedded")));
+        suite.addTest(TestConfiguration.clientServerDecorator(
+            new BlobClobTestSetup(new TestSuite(BlobTest.class,
+                                                "BlobTest:client"))));
+        return suite;
     }
 
 } // End class BlobTest

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?view=diff&rev=472016&r1=472015&r2=472016
==============================================================================
--- 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
Mon Nov  6 23:39:25 2006
@@ -24,6 +24,7 @@
 import junit.framework.*;
 
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
 
 import java.io.IOException;
 import java.io.Reader;
@@ -584,13 +585,16 @@
      * Return suite with all tests of the class.
      */
     public static Test suite() {
-        TestSuite mainSuite = new TestSuite(
-                "CallableStatementTest and SetObjectUnsupportedTest suite");
-        TestSuite suite = new TestSuite(CallableStatementTest.class,
-                                        "CallableStatementTest suite");
-        mainSuite.addTest(new CallableStatementTestSetup(suite));
-        mainSuite.addTest(SetObjectUnsupportedTest.suite(true));
-        return mainSuite;
+        TestSuite suite = new TestSuite("CallableStatementTest suite");
+        suite.addTest(baseSuite("CallableStatementTest:embedded"));
+        suite.addTest(TestConfiguration.clientServerDecorator(
+            baseSuite("CallableStatementTest:client")));
+        return suite;
+    }
+
+    private static Test baseSuite(String name) {
+        TestSuite suite = new TestSuite(CallableStatementTest.class, name);
+        return new CallableStatementTestSetup(suite);
     }
     
 } // End class CallableStatementTest

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?view=diff&rev=472016&r1=472015&r2=472016
==============================================================================
--- 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
Mon Nov  6 23:39:25 2006
@@ -25,6 +25,7 @@
 import junit.framework.*;
 
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
 
 import java.sql.*;
 import java.io.*;
@@ -389,8 +390,13 @@
      * Create test suite for this test.
      */
     public static Test suite() {
-        return new BlobClobTestSetup(new TestSuite(ClobTest.class,
-                                                   "ClobTest suite"));
+        TestSuite suite = new TestSuite("ClobTest suite");
+        suite.addTest(new BlobClobTestSetup(
+            new TestSuite(ClobTest.class, "ClobTest:embedded")));
+        suite.addTest(TestConfiguration.clientServerDecorator(
+            new BlobClobTestSetup(new TestSuite(ClobTest.class,
+                                                "ClobTest:client"))));
+        return suite;
     }
 
 } // End class ClobTest

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ClosedObjectTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ClosedObjectTest.java?view=diff&rev=472016&r1=472015&r2=472016
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ClosedObjectTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ClosedObjectTest.java
Mon Nov  6 23:39:25 2006
@@ -111,6 +111,16 @@
         }
     }
 
+    /** Creates a suite with all tests in the class. */
+    public static Test suite() {
+        TestSuite suite = new TestSuite("ClosedObjectTest suite");
+        suite.addTest(baseSuite("ClosedObjectTest:embedded"));
+        // This test will fail in client/server mode until DERBY-2047 is fixed.
+        //suite.addTest(TestConfiguration.clientServerDecorator(
+        //    baseSuite("ClosedObjectTest:client")));
+        return suite;
+    }
+
     /**
      * Creates the test suite and fills it with tests using
      * <code>DataSource</code>, <code>ConnectionPoolDataSource</code>
@@ -119,8 +129,8 @@
      * @return a <code>Test</code> value
      * @exception Exception if an error occurs while building the test suite
      */
-    public static Test suite()  {
-        TestSuite topSuite = new TestSuite("ClosedObjectTest suite");
+    private static Test baseSuite(String name)  {
+        TestSuite topSuite = new TestSuite(name);
 
         TestSuite dsSuite = new TestSuite("ClosedObjectTest DataSource");
         DataSourceDecorator dsDecorator = new DataSourceDecorator(dsSuite);
@@ -282,6 +292,11 @@
             decorator_ = decorator;
         }
 
+        /** Tears down the test environment. */
+        protected void tearDown() throws Exception {
+            object_ = null;
+        }
+
         /**
          * Returns the closed object.
          *
@@ -420,10 +435,12 @@
         /**
          * Tears down the test. Closes open resources.
          *
-         * @exception SQLException if an error occurs
+         * @exception Exception if an error occurs
          */
-        public void tearDown() throws SQLException {
+        public void tearDown() throws Exception {
             stmt_.close();
+            stmt_ = null;
+            super.tearDown();
         }
 
         /**
@@ -690,6 +707,7 @@
         public final void tearDown() throws SQLException {
             connection_.rollback();
             connection_.close();
+            connection_ = 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?view=diff&rev=472016&r1=472015&r2=472016
==============================================================================
--- 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
Mon Nov  6 23:39:25 2006
@@ -25,6 +25,7 @@
 import org.apache.derbyTesting.functionTests.util.TestDataSourceFactory;
 import org.apache.derbyTesting.functionTests.util.SQLStateConstants;
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
 
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
@@ -294,19 +295,18 @@
      *  when appropriate.
      */
     public static Test suite() {
-        TestSuite connSuite = 
-            new TestSuite(ConnectionTest.class, "ConnectionTest suite");
-        // Add client only tests
-        // NOTE: JCC is excluded
-        if (usingDerbyNetClient()) {
-            connSuite.addTest(
-                    clientSuite("ConnectionTest client-only suite"));
-        }
-        // Add embedded only tests
-        if (usingEmbedded()) {
-            connSuite.addTest(
-                    embeddedSuite("ConnectionTest embedded-only suite"));
-        }
+        TestSuite connSuite = new TestSuite("ConnectionTest suite");
+
+        TestSuite embedded = new TestSuite("ConnectionTest:embedded");
+        embedded.addTestSuite(ConnectionTest.class);
+        embedded.addTest(embeddedSuite("ConnectionTest:embedded-only"));
+        connSuite.addTest(embedded);
+
+        TestSuite client = new TestSuite("ConnectionTest:client");
+        client.addTestSuite(ConnectionTest.class);
+        client.addTest(clientSuite("ConnectionTest:client-only"));
+        connSuite.addTest(TestConfiguration.clientServerDecorator(client));
+
         return connSuite;
     }
     

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/DataSourceTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/DataSourceTest.java?view=diff&rev=472016&r1=472015&r2=472016
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/DataSourceTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/DataSourceTest.java
Mon Nov  6 23:39:25 2006
@@ -25,6 +25,7 @@
 
 import org.apache.derbyTesting.functionTests.util.TestDataSourceFactory;
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
 
 import java.sql.*;
 import javax.sql.*;
@@ -118,6 +119,8 @@
      * Return suite with all tests of the class.
      */
     public static Test suite() {
+        // This test will fail in client/server mode until DERBY-2047 is fixed.
+        //return TestConfiguration.defaultSuite(DataSourceTest.class);
         return (new TestSuite(DataSourceTest.class,
                               "DataSourceTest suite"));
     }

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?view=diff&rev=472016&r1=472015&r2=472016
==============================================================================
--- 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
Mon Nov  6 23:39:25 2006
@@ -24,6 +24,8 @@
 import org.apache.derby.shared.common.reference.JDBC40Translation;
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
 import org.apache.derbyTesting.junit.BaseTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
+import junit.framework.Test;
 
 /**
  * JUnit test which checks that the constants in JDBC40Translation are
@@ -34,6 +36,10 @@
 
     public JDBC40TranslationTest(String name) {
         super(name);
+    }
+
+    public static Test suite() {
+        return TestConfiguration.defaultSuite(JDBC40TranslationTest.class);
     }
 
     public void testDatabaseMetaDataFUNCTION_PARAMETER_UNKNOWN() {

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?view=diff&rev=472016&r1=472015&r2=472016
==============================================================================
--- 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
Mon Nov  6 23:39:25 2006
@@ -25,6 +25,7 @@
 import junit.framework.*;
 
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
 
 /**
  * Tests of the <code>java.sql.ParameterMetaData</code> JDBC40 API
@@ -67,6 +68,8 @@
         throws Exception {
         if(ps != null && !ps.isClosed())
             ps.close();
+        ps = null;
+        pmd = null;
         
         super.tearDown();
     }
@@ -97,7 +100,7 @@
      * Return suite with all tests of the class.
      */
     public static Test suite() {
-        return (new TestSuite(ParameterMetaDataWrapperTest.class,
-                              "ParameterMetaDataWrapperTest suite"));
+        return TestConfiguration.defaultSuite(
+            ParameterMetaDataWrapperTest.class);
     }
 }

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=472016&r1=472015&r2=472016
==============================================================================
--- 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 Nov  6 23:39:25 2006
@@ -26,6 +26,7 @@
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
 import org.apache.derbyTesting.junit.BaseJDBCTestSetup;
 import org.apache.derbyTesting.functionTests.util.streams.LoopingAlphabetStream;
+import org.apache.derbyTesting.junit.TestConfiguration;
 
 import java.io.*;
 import java.sql.*;
@@ -149,10 +150,16 @@
     }
 
     public static Test suite() {
-        TestSuite suite = new TestSuite(
-                "PreparedStatementTest and SetObjectUnsupportedTest suite");
+        TestSuite suite = new TestSuite("PreparedStatementTest suite");
+        suite.addTest(baseSuite("PreparedStatementTest:embedded"));
+        suite.addTest(TestConfiguration.clientServerDecorator(
+            baseSuite("PreparedStatementTest:client")));
+        return suite;
+    }
+
+    private static Test baseSuite(String name) {
+        TestSuite suite = new TestSuite(name);
         suite.addTestSuite(PreparedStatementTest.class);
-        suite.addTest(SetObjectUnsupportedTest.suite(false));
         return new BaseJDBCTestSetup(suite) {
                 public void setUp()
                         throws java.lang.Exception {

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?view=diff&rev=472016&r1=472015&r2=472016
==============================================================================
--- 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
Mon Nov  6 23:39:25 2006
@@ -24,6 +24,7 @@
 
 import org.apache.derbyTesting.functionTests.util.SQLStateConstants;
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
 
 import java.sql.*;
 import javax.sql.*;
@@ -67,6 +68,9 @@
             rs.close();
         if(ps != null && !ps.isClosed())
             ps.close();
+        ps = null;
+        rs = null;
+        rsmd = null;
         
         super.tearDown();
 
@@ -98,7 +102,6 @@
      * Return suite with all tests of the class.
      */
     public static Test suite() {
-        return (new TestSuite(ResultSetMetaDataTest.class,
-                              "ResultSetMetaDataTest suite"));
+        return TestConfiguration.defaultSuite(ResultSetMetaDataTest.class);
     }
 }

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?view=diff&rev=472016&r1=472015&r2=472016
==============================================================================
--- 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
Mon Nov  6 23:39:25 2006
@@ -27,6 +27,7 @@
 
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
 import org.apache.derbyTesting.junit.BaseJDBCTestSetup;
+import org.apache.derbyTesting.junit.TestConfiguration;
 
 import java.io.*;
 import java.sql.*;
@@ -1313,19 +1314,23 @@
     }
 
     public static Test suite() {
-        TestSuite rsSuite =
-            new TestSuite(ResultSetTest.class, "ResultSetTest suite");
-        // Add client only tests
-        // NOTE: JCC is excluded
-        if (usingDerbyNetClient()) {
-            rsSuite.addTest(
-                    clientSuite("ResultSetTest client-only suite"));
-        }
-        // Add embedded only tests
-        if (usingEmbedded()) {
-            rsSuite.addTest(
-                    embeddedSuite("ResultSetTest embedded-only suite"));
-        }
+        TestSuite rsSuite = new TestSuite("ResultSetTest suite");
+
+        TestSuite embedded = new TestSuite("ResultSetTest:embedded");
+        embedded.addTestSuite(ResultSetTest.class);
+        embedded.addTest(embeddedSuite("ResultSetTest:embedded-only"));
+        rsSuite.addTest(decorateTestSuite(embedded));
+
+        TestSuite client = new TestSuite("ResultSetTest:client");
+        client.addTestSuite(ResultSetTest.class);
+        client.addTest(clientSuite("ResultSetTest:client-only"));
+        rsSuite.addTest(TestConfiguration.clientServerDecorator(
+            decorateTestSuite(client)));
+
+        return rsSuite;
+    }
+
+    private static Test decorateTestSuite(Test rsSuite) {
         // Wrap suite in a TestSetup-class.
         return new BaseJDBCTestSetup(rsSuite) {
                 protected void setUp()

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?view=diff&rev=472016&r1=472015&r2=472016
==============================================================================
--- 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
Mon Nov  6 23:39:25 2006
@@ -21,6 +21,7 @@
 package org.apache.derbyTesting.functionTests.tests.jdbc4;
 
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
 
 import junit.framework.*;
 
@@ -182,8 +183,7 @@
      * @return test suite.
      */
     public static Test suite() {
-        return new TestSuite(RowIdNotImplementedTest.class,
-                             "RowIdNotImplementedTest suite");
+        return TestConfiguration.defaultSuite(RowIdNotImplementedTest.class);
     }
     
 } // End class RowIdNotImplementedTest

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?view=diff&rev=472016&r1=472015&r2=472016
==============================================================================
--- 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
Mon Nov  6 23:39:25 2006
@@ -28,14 +28,12 @@
 import junit.framework.TestSuite;
 
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
 
 /**
  * Tests that calling <code>setObject()</code> and <code>setNull()</code>
with
  * <code>sqlTargetType</code> set to an unsupported type fails with
  * <code>SQLFeatureNotSupportedException</code>.
- *
- * <p> The test is run as part of <code>PreparedStatementTest</code>
- * and <code>CallableStatementTest</code>.
  */
 public class SetObjectUnsupportedTest extends BaseJDBCTestCase {
     /** Name and id of the target type used in the test. */
@@ -168,6 +166,20 @@
     };
 
     /**
+     * Create a suite with all tests.
+     */
+    public static Test suite() {
+        TestSuite suite = new TestSuite("SetObjectUnsupportedTest suite");
+        suite.addTest(baseSuite(false, "SetObjectUnsupportedTest:prepared"));
+        suite.addTest(baseSuite(true, "SetObjectUnsupportedTest:callable"));
+        TestSuite client = new TestSuite("SetObjectUnsupportedTest:client");
+        client.addTest(baseSuite(false, "SetObjectUnsupportedTest:prepared"));
+        client.addTest(baseSuite(true, "SetObjectUnsupportedTest:callable"));
+        suite.addTest(TestConfiguration.clientServerDecorator(client));
+        return suite;
+    }
+
+    /**
      * Build a test suite which tests <code>setObject()</code> with
      * each of the types in <code>TYPES</code>.
      *
@@ -176,8 +188,8 @@
      * <code>PreparedStatement</code>
      * @return a test suite
      */
-    static Test suite(boolean callable) {
-        TestSuite suite = new TestSuite("SetObjectUnsupportedTest suite");
+    static Test baseSuite(boolean callable, String name) {
+        TestSuite suite = new TestSuite(name);
         for (TypeInfo typeInfo : TYPES) {
             suite.addTest(new SetObjectUnsupportedTest
                           ("testUnsupportedSetObject", typeInfo, callable));

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementEventsTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementEventsTest.java?view=diff&rev=472016&r1=472015&r2=472016
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementEventsTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/StatementEventsTest.java
Mon Nov  6 23:39:25 2006
@@ -27,6 +27,7 @@
 
 import org.apache.derbyTesting.functionTests.util.TestDataSourceFactory;
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
 
 import java.util.Enumeration;
 
@@ -140,21 +141,27 @@
     /**
      * Free resources used in the test.
      *
-     * @exception SQLException if a database error occurs
+     * @exception Exception if an error occurs
      */
-    public void tearDown() throws SQLException {
+    protected void tearDown() throws Exception {
         connection.close();
         pooledConnection.close();
+        connection = null;
+        pooledConnection = null;
+        closedStatement = null;
+        errorStatement = null;
+        super.tearDown();
     }
 
     /**
      * Return suite with all tests of the class for all combinations of
      * pooled/xa connection and prepared/callable statement.
      *
+     * @param name name of the test suite
      * @return a test suite
      */
-    public static Test suite() {
-        TestSuite suites = new TestSuite("StatementEventsTest suite");
+    private static Test baseSuite(String name) {
+        TestSuite suites = new TestSuite(name);
         boolean[] truefalse = new boolean[] { true, false };
         for (boolean xa : truefalse) {
             for (boolean callable : truefalse) {
@@ -162,6 +169,16 @@
             }
         }
         return suites;
+    }
+
+    /** Create a test suite with all tests in the class. */
+    public static Test suite() {
+        TestSuite suite = new TestSuite("StatementEventsTest suite");
+        suite.addTest(baseSuite("StatementEventsTest:embedded"));
+        // This test will fail in client/server mode until DERBY-2047 is fixed.
+        //suite.addTest(TestConfiguration.clientServerDecorator(
+        //    baseSuite("StatementEventsTest:client")));
+        return suite;
     }
 
     /**

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?view=diff&rev=472016&r1=472015&r2=472016
==============================================================================
--- 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
Mon Nov  6 23:39:25 2006
@@ -22,6 +22,7 @@
 
 import org.apache.derbyTesting.functionTests.util.SQLStateConstants;
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
 
 import junit.framework.*;
 
@@ -70,6 +71,7 @@
         // Close default statement
         if (stmt != null) {
             stmt.close();
+            stmt = null;
         }
 
         super.tearDown();
@@ -284,7 +286,8 @@
         // Decorate test suite with a TestSetup class.
         suite.addTest(new StatementTestSetup(
                         new TestSuite(StatementTest.class)));
-
+        suite.addTest(TestConfiguration.clientServerDecorator(
+            new StatementTestSetup(new TestSuite(StatementTest.class))));
         return suite;
     }
     

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestDbMetaData.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestDbMetaData.java?view=diff&rev=472016&r1=472015&r2=472016
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestDbMetaData.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestDbMetaData.java
Mon Nov  6 23:39:25 2006
@@ -35,6 +35,7 @@
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
 import org.apache.derbyTesting.junit.CleanDatabaseTestSetup;
 import org.apache.derbyTesting.junit.JDBC;
+import org.apache.derbyTesting.junit.TestConfiguration;
 
 /**
  * Test of database metadata for new methods in JDBC 40.
@@ -74,14 +75,22 @@
                   "JAVA EXTERNAL NAME 'java.some.func'");
     }
 
-    public static Test suite() {
-        TestSuite testSuite = new TestSuite("TestDbMetaData suite");
+    private static Test baseSuite(String name) {
+        TestSuite testSuite = new TestSuite(name);
         testSuite.addTestSuite(TestDbMetaData.class);
         return new CleanDatabaseTestSetup(testSuite) {
                 protected void decorateSQL(Statement s) throws SQLException {
                     createFunctions(s);
                 }
             };
+    }
+
+    public static Test suite() {
+        TestSuite suite = new TestSuite("TestDbMetaData suite");
+        suite.addTest(baseSuite("TestDbMetaData:embedded"));
+        suite.addTest(TestConfiguration.clientServerDecorator(
+            baseSuite("TestDbMetaData:client")));
+        return suite;
     }
 
     public void testSupportsStoredFunctionsUsingCallSyntax()

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestJDBC40Exception.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestJDBC40Exception.java?view=diff&rev=472016&r1=472015&r2=472016
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestJDBC40Exception.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestJDBC40Exception.java
Mon Nov  6 23:39:25 2006
@@ -22,9 +22,7 @@
 
 package org.apache.derbyTesting.functionTests.tests.jdbc4;
 
-import java.sql.CallableStatement;
 import java.sql.Connection;
-import java.sql.PreparedStatement;
 import java.sql.Statement;
 import java.sql.SQLDataException;
 import java.sql.SQLException;
@@ -32,25 +30,20 @@
 import java.sql.SQLSyntaxErrorException;
 import java.sql.SQLTransientConnectionException;
 import java.sql.SQLTransactionRollbackException;
-import java.sql.Types;
 import junit.framework.Test;
-import junit.framework.TestSuite;
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
-import org.apache.derby.iapi.reference.Property;
+import org.apache.derbyTesting.junit.DatabasePropertyTestSetup;
+import org.apache.derbyTesting.junit.TestConfiguration;
 
 public class TestJDBC40Exception extends BaseJDBCTestCase {
 
-    /** Timeout value to restore to in tearDown(). */
-    private int oldTimeout;
-    
     public TestJDBC40Exception(String name) {
         super(name);
     }
 
     public static Test suite() {
-        TestSuite testSuite = new TestSuite(TestJDBC40Exception.class,
-                "TestJDBC40Exception suite");
-        return testSuite;
+        Test suite = TestConfiguration.defaultSuite(TestJDBC40Exception.class);
+        return DatabasePropertyTestSetup.setLockTimeouts(suite, -1, 2);
     }
 
     protected void setUp() throws SQLException {
@@ -59,54 +52,14 @@
                   "primary key, data varchar (5))");
         s.execute("insert into EXCEPTION_TABLE1 (id, data)" +
                   "values (1, 'data1')");
-        // lower waitTimeout, otherwise testTimeout takes forever
-        oldTimeout = getWaitTimeout();
-        setWaitTimeout(2);
         s.close();
     }
 
     protected void tearDown() throws Exception {
         createStatement().execute("drop table EXCEPTION_TABLE1");
-        setWaitTimeout(oldTimeout);
         super.tearDown();
     }
 
-    /**
-     * Set the value of the waitTimeout property.
-     *
-     * @param timeout time in seconds to wait for a lock
-     * @exception SQLException if a database error occurs
-     */
-    private void setWaitTimeout(int timeout) throws SQLException {
-        PreparedStatement ps = prepareStatement(
-            "CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY(" +
-            "'derby.locks.waitTimeout', ?)");
-        ps.setInt(1, timeout);
-        ps.execute();
-        ps.close();
-    }
-
-    /**
-     * Get the value of the waitTimeout property. If no timeout is set, use
-     * org.apache.derby.iapi.reference.Property.WAIT_TIMEOUT_DEFAULT.
-     *
-     * @return the current timeout in seconds
-     * @exception SQLException if a database error occurs
-     */
-    private int getWaitTimeout() throws SQLException {
-        CallableStatement cs = prepareCall(
-            "{ ? = CALL SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY(" +
-            "'derby.locks.waitTimeout') }");
-        cs.registerOutParameter(1, Types.VARCHAR);
-        cs.execute();
-        int timeout = cs.getInt(1);
-        if (cs.wasNull()) {
-            timeout = Property.WAIT_TIMEOUT_DEFAULT;
-        }
-        cs.close();
-        return timeout;
-    }
-    
     public void testIntegrityConstraintViolationException()
             throws SQLException {
         try {

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/UnsupportedVetter.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/UnsupportedVetter.java?view=diff&rev=472016&r1=472015&r2=472016
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/UnsupportedVetter.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/UnsupportedVetter.java
Mon Nov  6 23:39:25 2006
@@ -33,6 +33,7 @@
 import org.apache.derbyTesting.functionTests.util.TestUtil;
 import org.apache.derbyTesting.functionTests.util.TestDataSourceFactory;
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
 
 /**
  * JUnit test which checks that only expected methods throw
@@ -1073,5 +1074,10 @@
 		
 	}
 	
+    public static Test suite() {
+        // This test will fail in client/server mode until DERBY-2047 is fixed.
+        //return TestConfiguration.defaultSuite(UnsupportedVetter.class);
+        return new TestSuite(UnsupportedVetter.class, "UnsupportedVetter");
+    }
 }
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/XA40Test.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/XA40Test.java?view=diff&rev=472016&r1=472015&r2=472016
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/XA40Test.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/XA40Test.java
Mon Nov  6 23:39:25 2006
@@ -22,6 +22,7 @@
 
 import org.apache.derbyTesting.functionTests.util.TestDataSourceFactory;
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
 
 import junit.framework.*;
 
@@ -81,10 +82,9 @@
     /**
      * Close default connection and XAConnection if necessary.
      *
-     * @throws SQLException if a database access exception occurs.
+     * @throws Exception if an exception occurs.
      */
-    public void tearDown() 
-        throws SQLException {
+    protected void tearDown() throws Exception {
         // Close default connection
         // Check if connection is open to avoid exception on rollback.
         if (con != null && !con.isClosed()) {
@@ -96,6 +96,11 @@
         if (xac != null) {
             xac.close();
         }
+        con = null;
+        xads = null;
+        xac = null;
+        xar = null;
+        super.tearDown();
     }
 
     
@@ -177,6 +182,9 @@
      * Create test suite for XA40Test.
      */
     public static Test suite() {
+        // This test will fail in client/server mode until DERBY-2047 is fixed.
+        //return TestConfiguration.defaultSuite(XA40Test.class);
+
         TestSuite suite = new TestSuite("XA40Test suite");
         // Decorate test suite with a TestSetup class.
         suite.addTest(new TestSuite(XA40Test.class));

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/_Suite.java?view=diff&rev=472016&r1=472015&r2=472016
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/_Suite.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/_Suite.java
Mon Nov  6 23:39:25 2006
@@ -56,17 +56,18 @@
 		suite.addTest(ClosedObjectTest.suite());
 		suite.addTest(ConnectionTest.suite());
 		suite.addTest(DataSourceTest.suite());
-		suite.addTestSuite(JDBC40TranslationTest.class);	
+		suite.addTest(JDBC40TranslationTest.suite());
 		suite.addTest(ParameterMetaDataWrapperTest.suite());
 		suite.addTest(PreparedStatementTest.suite());
 		suite.addTest(ResultSetMetaDataTest.suite());
 		suite.addTest(ResultSetTest.suite());
 		suite.addTest(RowIdNotImplementedTest.suite());
+		suite.addTest(SetObjectUnsupportedTest.suite());
 		suite.addTest(StatementEventsTest.suite());
 		suite.addTest(StatementTest.suite());
 		suite.addTest(TestDbMetaData.suite());
 		suite.addTest(TestJDBC40Exception.suite());
-		suite.addTestSuite(UnsupportedVetter.class);		
+		suite.addTest(UnsupportedVetter.suite());
 		suite.addTest(XA40Test.suite());
         
         // This test is a little strange in its suite



Mime
View raw message