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 rh...@apache.org on 2006/06/08 23:07:31 UTC

svn commit: r412859 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunList.java

Author: rhillegas
Date: Thu Jun  8 14:07:31 2006
New Revision: 412859

URL: http://svn.apache.org/viewvc?rev=412859&view=rev
Log:
DERBY-1379: Committed Olav's autoload.diff. This fixes the problem which caused all of the nist tests to fail when derbyall was run against jar files under jdk1.6 with the db2jcc jar in the classpath.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunList.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunList.java?rev=412859&r1=412858&r2=412859&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunList.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunList.java Thu Jun  8 14:07:31 2006
@@ -42,6 +42,9 @@
 import java.util.Properties;
 import java.util.Vector;
 import java.util.StringTokenizer;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+
 
 public class RunList
 {
@@ -263,6 +266,16 @@
 			    ( new FileOutputStream(skipFile.getCanonicalPath(),true) );
 		    }
 
+                // Due to autoloading of JDBC drivers introduced in JDBC4
+                // (see DERBY-930) the embedded driver and Derby engine
+                // might already have been loaded.  To ensure that the
+                // embedded driver and engine used by the tests run in
+                // this suite are configured to use the correct
+                // property values we try to unload the embedded driver
+                if (useprocess == false) {
+                    unloadEmbeddedDriver();
+                }
+
                 System.out.println("Now run the suite's tests");
                 //System.out.println("shutdownurl: " + shutdownurl);
 
@@ -1609,5 +1622,25 @@
 
     }
 
+
+    /**
+     * Unloads the embedded JDBC driver and Derby engine in case
+     * is has already been loaded. 
+     * The purpose for doing this is that using an embedded engine
+     * that already is loaded makes it impossible to set new 
+     * system properties for each individual suite or test.
+     */
+    private static void unloadEmbeddedDriver() {
+        // Attempt to unload the embedded driver and engine
+        try {
+            DriverManager.getConnection("jdbc:derby:;shutdown=true");
+        } catch (SQLException se) {
+            // Ignore any exception thrown
+        }
+
+        // Call the garbage collector as spesified in the Derby doc
+        // for how to get rid of the classes that has been loaded
+        System.gc();
+    }
 }