Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 97875 invoked from network); 25 Aug 2006 05:03:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 25 Aug 2006 05:03:19 -0000 Received: (qmail 6727 invoked by uid 500); 25 Aug 2006 05:03:19 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 6695 invoked by uid 500); 25 Aug 2006 05:03:19 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 6682 invoked by uid 99); 25 Aug 2006 05:03:19 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Aug 2006 22:03:19 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Aug 2006 22:03:18 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 348061A981A; Thu, 24 Aug 2006 22:02:58 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r436660 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting: functionTests/tests/jdbc4/AutoloadBooting.java functionTests/tests/jdbc4/AutoloadTest.java junit/SecurityManagerSetup.java junit/TestConfiguration.java Date: Fri, 25 Aug 2006 05:02:57 -0000 To: derby-commits@db.apache.org From: djd@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060825050258.348061A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: djd Date: Thu Aug 24 22:02:56 2006 New Revision: 436660 URL: http://svn.apache.org/viewvc?rev=436660&view=rev Log: Provide a consistent mechanism to test if the classes are being loaded by jars or not in JUnit tests. Uses the SecurityManagerSetup class which basically already determined this information at its startup. Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/AutoloadBooting.java db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/AutoloadTest.java db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/AutoloadBooting.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/AutoloadBooting.java?rev=436660&r1=436659&r2=436660&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/AutoloadBooting.java (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/AutoloadBooting.java Thu Aug 24 22:02:56 2006 @@ -36,6 +36,7 @@ import org.apache.derby.iapi.services.monitor.Monitor; import org.apache.derby.drda.NetworkServerControl; import org.apache.derbyTesting.junit.BaseJDBCTestCase; +import org.apache.derbyTesting.junit.TestConfiguration; public class AutoloadBooting extends BaseJDBCTestCase { @@ -355,7 +356,7 @@ // This test is only run in JDBC 4 or higher which means the // drivers will always be auto-loading when the classes are // being loaded from the jars. - boolean isAutoloading = getTestConfiguration().loadingFromJars(); + boolean isAutoloading = TestConfiguration.loadingFromJars(); // // Forcibly load the network client if we are not autoloading it. Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/AutoloadTest.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/AutoloadTest.java?rev=436660&r1=436659&r2=436660&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/AutoloadTest.java (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/AutoloadTest.java Thu Aug 24 22:02:56 2006 @@ -110,18 +110,18 @@ } catch (PrivilegedActionException e) { // can't read property, assume not autoloading. } - + // Also auto loading if this is JDBC 4 and loading from the // jar files, due to the required manifest entry. if (JDBC.vmSupportsJDBC4() && - TestConfiguration.getCurrent().loadingFromJars()) + TestConfiguration.loadingFromJars()) autoloadingCurrentDriver = true; if (autoloadingCurrentDriver) suite.addTestSuite(AutoloadTest.class); } - + return suite; } Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java?rev=436660&r1=436659&r2=436660&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java Thu Aug 24 22:02:56 2006 @@ -37,8 +37,12 @@ */ public final class SecurityManagerSetup extends TestSetup { - private static final Properties classPathSet = new Properties(); + + /** + * True if the classes are loaded from jars. + */ + static boolean isJars; /** * True if a security manager was installed outside of the @@ -214,13 +218,15 @@ if (isClasspath) { classPathSet.setProperty("derbyTesting.codeclasses", testing.toExternalForm()); + isJars = false; return false; } classPathSet.setProperty("derbyTesting.testjar", stripJar(testing)); + isJars = true; URL derby = null; try { - derby = getURL(org.apache.derby.jdbc.EmbeddedDataSource.class); + derby = getURL(org.apache.derby.jdbc.EmbeddedSimpleDataSource.class); } catch (java.lang.NoClassDefFoundError e) { derby = testing; } Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java?rev=436660&r1=436659&r2=436660&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java Thu Aug 24 22:02:56 2006 @@ -319,15 +319,9 @@ * the server) comes out of a jar file. *

*/ - public boolean loadingFromJars() + public static boolean loadingFromJars() { - // - // jvm.java sets this property to the build jar directory - // if we are using derbyTesting.jar. - // - // - - return ( !UNUSED.equals( getSystemStartupProperty( "derbyTesting.codejar" ) ) ); + return SecurityManagerSetup.isJars; } /**