db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fuzzylo...@apache.org
Subject svn commit: r407396 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting: functionTests/suites/derbyall.properties functionTests/tests/upgradeTests/UpgradeTester.java upgradeTests/
Date Wed, 17 May 2006 23:07:35 GMT
Author: fuzzylogic
Date: Wed May 17 16:07:35 2006
New Revision: 407396

URL: http://svn.apache.org/viewvc?rev=407396&view=rev
Log:
DERBY-514: Enable upgrade tests to work with unpackaged classes. Add upgrade
tests to derbyall.

Committed for Deepa Remesh <dremesh@gmail.com>

Removed:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/upgradeTests/
Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbyall.properties
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/UpgradeTester.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbyall.properties
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbyall.properties?rev=407396&r1=407395&r2=407396&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbyall.properties
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbyall.properties
Wed May 17 16:07:35 2006
@@ -1,3 +1,3 @@
-suites=derbylang derbynetmats storeall xa derbytools jdbc20 jdbc40 jdk14 jdbcapi derbynetclientmats
encryptionAll nist demo multi unit i18nTest
+suites=derbylang derbynetmats storeall xa derbytools jdbc20 jdbc40 jdk14 jdbcapi derbynetclientmats
encryptionAll nist demo multi unit i18nTest upgrade
 derby.debug.true=enableBtreeConsistencyCheck
 derby.stream.error.logSeverityLevel=0

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/UpgradeTester.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/UpgradeTester.java?rev=407396&r1=407395&r2=407396&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/UpgradeTester.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/UpgradeTester.java
Wed May 17 16:07:35 2006
@@ -139,6 +139,10 @@
 	// Test jar
 	private String testJar = "derbyTesting.jar";
 	
+	// Boolean to indicate if the test is run using jars or classes folder 
+	// in classpath
+	private boolean[] isJar = new boolean[1];
+	
 	/**
 	 * Constructor
 	 * 
@@ -198,19 +202,25 @@
 	 * @return location of jars of new release
 	 */
 	private String getNewJarLocation() {
-		boolean[] isJar = new boolean[1];
 		return jvm.findCodeBase(isJar);
 	}
 	
 	/**
 	 * This method creates two class loaders - one for old release and
-	 * other for new release.
+	 * other for new release. It calls the appropriate create methods
+	 * depending on what is used in the user's classpath - jars or 
+	 * classes folder
 	 *  
 	 * @throws MalformedURLException
 	 */
 	private void createClassLoaders() throws MalformedURLException{
-		oldClassLoader = createClassLoader(oldJarLoc);
-		newClassLoader = createClassLoader(newJarLoc);
+		if(isJar[0]){
+			oldClassLoader = createClassLoader(oldJarLoc);
+			newClassLoader = createClassLoader(newJarLoc);
+		} else {
+		  // classes folder in classpath
+		  createLoadersUsingClasses();	
+		}
 	}
 	
 	/**
@@ -236,7 +246,33 @@
 		// jars specified in the system classpath
 		return new URLClassLoader(url, null);		
 	}
-	                                                                                       
 
+	
+	/**
+	 * Create old and new class loader. This method is used when classes folder
+	 *  is specified in the user's classpath.
+	 * 
+	 * @throws MalformedURLException
+	 */
+	private void createLoadersUsingClasses() 
+							throws MalformedURLException {
+		URL[] oldUrl = new URL[jarFiles.length + 1];
+
+		for(int i=0; i < jarFiles.length; i++) {
+			oldUrl[i] = new File(oldJarLoc + File.separator + jarFiles[i]).toURL();
+		}
+
+		// Use derby testing classes from newer release. To get the
+		// testing classes from newer release, we need to add the whole 
+		// classes folder. So the oldClassLoader may contain extra classes
+		// from the newer version
+		oldUrl[jarFiles.length] = new File(newJarLoc).toURL();
+
+		oldClassLoader = new URLClassLoader(oldUrl, null);
+		
+		URL[] newUrl = new URL[] {new File(newJarLoc).toURL()};
+		newClassLoader = new URLClassLoader(newUrl, null);
+	}
+	
 	/**
 	 * Set the context class loader
 	 * @param classLoader class loader



Mime
View raw message