db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r551732 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests: suites/ tests/lang/
Date Thu, 28 Jun 2007 23:22:04 GMT
Author: djd
Date: Thu Jun 28 16:22:03 2007
New Revision: 551732

URL: http://svn.apache.org/viewvc?view=rev&rev=551732
Log:
DERBY-2727 Re-commited converion of AggregateClassLoadingTest with version that works
with IBM JVMs by not clearing the context class loader but instead resetting it.

Added:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AggregateClassLoadingTest.java
  (contents, props changed)
      - copied, changed from r550949, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AggregateClassLoadingTest.java
Removed:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AggregateClassLoading.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AggregateClassLoading_app.properties
Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbylang.runall
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbylang.runall
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbylang.runall?view=diff&rev=551732&r1=551731&r2=551732
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbylang.runall
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbylang.runall
Thu Jun 28 16:22:03 2007
@@ -1,7 +1,6 @@
 jdbcapi/metadata.java
 jdbcapi/metadataMultiConn.java
 jdbcapi/odbc_metadata.java
-lang/AggregateClassLoading.java
 lang/DB2IsolationLevels.sql
 lang/LOBDB2compatibility.sql
 lang/aggregateOptimization.sql

Copied: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AggregateClassLoadingTest.java
(from r550949, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AggregateClassLoadingTest.java)
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AggregateClassLoadingTest.java?view=diff&rev=551732&p1=db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AggregateClassLoadingTest.java&r1=550949&p2=db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AggregateClassLoadingTest.java&r2=551732
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AggregateClassLoadingTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AggregateClassLoadingTest.java
Thu Jun 28 16:22:03 2007
@@ -34,6 +34,7 @@
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
 import org.apache.derbyTesting.junit.CleanDatabaseTestSetup;
 import org.apache.derbyTesting.junit.DatabasePropertyTestSetup;
+import org.apache.derbyTesting.junit.JDBC;
 import org.apache.derbyTesting.junit.SecurityManagerSetup;
 import org.apache.derbyTesting.junit.SystemPropertyTestSetup;
 
@@ -47,9 +48,6 @@
  * loading happens on the engine side.
  */
 public class AggregateClassLoadingTest extends BaseJDBCTestCase {
-
-	private static URL derbyURL;
-	private static URLClassLoader cl;
 	
 	/**
 	 * Basic constructor.
@@ -84,8 +82,19 @@
 						new CleanDatabaseTestSetup(
 								new TestSuite(AggregateClassLoadingTest.class,
 										"AggregateClassLoadingTest")) {
+                            
+                            /**
+                             * Save the class loader upon entry to the
+                             * suite, some JVM's install the main loader
+                             * as the context loader.
+                             */
+                            private ClassLoader originalLoader;
+                            protected void setUp() throws Exception {                   

+                                originalLoader = Thread.currentThread().getContextClassLoader();
+                                super.setUp();
+                            }
 							protected void tearDown() throws Exception {
-								Thread.currentThread().setContextClassLoader(null);
+								Thread.currentThread().setContextClassLoader(originalLoader);
 								super.tearDown();
 							}
 
@@ -102,7 +111,7 @@
 								 * connection. The rest of the engine will be at
 								 * the same location!
 								 */
-								derbyURL = s.getConnection().getClass().getProtectionDomain().getCodeSource()
+								URL derbyURL = s.getConnection().getClass().getProtectionDomain().getCodeSource()
 										.getLocation();
 
 								/*
@@ -115,7 +124,7 @@
 								 * the bug would not show, as all the derby
 								 * engine classes would be from a single loader.
 								 */
-								cl = new URLClassLoader(new URL[] { derbyURL }, null);
+                                URLClassLoader cl = new URLClassLoader(new URL[] { derbyURL
}, null);
 								Thread.currentThread().setContextClassLoader(cl);
 
 								super.decorateSQL(s);
@@ -153,9 +162,9 @@
      */
     private void testAggregate(String query) throws SQLException {
 		Statement s = createStatement();
-		ResultSet rs = s.executeQuery(query);
-			
-		rs.next();
-		rs.close();
+        
+        JDBC.assertDrainResults(s.executeQuery(query), 1);
+
+        s.close();
    }	
 }

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AggregateClassLoadingTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java?view=diff&rev=551732&r1=551731&r2=551732
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
Thu Jun 28 16:22:03 2007
@@ -110,6 +110,7 @@
         suite.addTest(SpillHashTest.suite());
         suite.addTest(CaseExpressionTest.suite());
         suite.addTest(CharUTF8Test.suite());
+        suite.addTest(AggregateClassLoadingTest.suite());
 
         // Add the XML tests, which exist as a separate suite
         // so that users can "run all XML tests" easily.



Mime
View raw message