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 kr...@apache.org on 2008/05/20 11:49:37 UTC

svn commit: r658181 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java

Author: kristwaa
Date: Tue May 20 02:49:37 2008
New Revision: 658181

URL: http://svn.apache.org/viewvc?rev=658181&view=rev
Log:
DERBY-3431: DatabaseMetaData.getConnection returns the wrong connection when using connection pooling.
Added another tests for this issue in DatabaseMetaDataTest.
Only the test for embedded is enabled, as the client driver has a bug.
Also note that the embedded driver has a related bug, but it is not exposed by this test (see J2EEDataSourceTest.testConnectionLeakInDatabaseMetaData instead).
Patch file: derby-3431-1b-test_repro.diff

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java?rev=658181&r1=658180&r2=658181&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java Tue May 20 02:49:37 2008
@@ -194,6 +194,15 @@
         TestSuite suite = new TestSuite("DatabaseMetaDataTest");
         suite.addTest(
             TestConfiguration.defaultSuite(DatabaseMetaDataTest.class));
+
+        // Add some tests to be run with connection pooling enabled.
+        suite.addTest(connectionPoolingSuite("embedded"));
+        /*
+         * DISABLED until DERBY-3431 has been fixed.
+        suite.addTest(TestConfiguration.clientServerDecorator(
+                    connectionPoolingSuite("client")));
+        */
+
         // Test for DERBY-2584 needs a fresh database to ensure that the
         // meta-data queries haven't already been compiled. No need to run the
         // test in client/server mode since it only tests the compilation of
@@ -208,6 +217,30 @@
     }
     
     /**
+     * Returns a suite of tests to be run with connection pooling enabled.
+     *
+     * @param jdbcClient name of the client being used (for verbosity only)
+     * @return A suite of tests.
+     */
+    private static Test connectionPoolingSuite(String jdbcClient) {
+        TestSuite baseCpSuite = new TestSuite("Base connection pooling suite");
+        // Add the tests here.
+        baseCpSuite.addTest(new DatabaseMetaDataTest("testConnectionSpecific"));
+
+        // Setup the two configurations; CPDS and XADS.
+        TestSuite fullCpSuite = new TestSuite(
+                "DatabaseMetaData with connection pooling:" + jdbcClient);
+        TestSuite cpSuite = new TestSuite("ConnectionPoolDataSource");
+        TestSuite xaSuite = new TestSuite("XADataSource");
+        cpSuite.addTest(TestConfiguration.connectionCPDecorator(baseCpSuite));
+        xaSuite.addTest(TestConfiguration.connectionXADecorator(baseCpSuite));
+        fullCpSuite.addTest(cpSuite);
+        fullCpSuite.addTest(xaSuite);
+
+        return fullCpSuite;
+    }
+
+    /**
      * Return the identifiers used to create schemas,
      * tables etc. in the order the database stores them.
      */