Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 1841 invoked from network); 9 Nov 2005 17:47:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 9 Nov 2005 17:47:40 -0000 Received: (qmail 59732 invoked by uid 500); 9 Nov 2005 17:47:40 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 59698 invoked by uid 500); 9 Nov 2005 17:47:39 -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 59687 invoked by uid 99); 9 Nov 2005 17:47:39 -0000 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 09 Nov 2005 09:47:37 -0800 Received: (qmail 1745 invoked by uid 65534); 9 Nov 2005 17:47:17 -0000 Message-ID: <20051109174717.1744.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r332090 - in /db/derby/code/trunk/java/testing: ./ org/apache/derbyTesting/functionTests/harness/ org/apache/derbyTesting/functionTests/master/ org/apache/derbyTesting/functionTests/suites/ org/apache/derbyTesting/functionTests/tests/compat... Date: Wed, 09 Nov 2005 17:47:13 -0000 To: derby-commits@db.apache.org From: davidvc@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: davidvc Date: Wed Nov 9 09:46:52 2005 New Revision: 332090 URL: http://svn.apache.org/viewcvs?rev=332090&view=rev Log: Changes for DERBY-689, contributed by Rick Hillegas (rick.hillegas@sun.com) Rick says: Various improvements to compatibility test: 1) Moved all JUnit tests under a ...functionTests/tests/junitTests as Myrna and John requested. 2) Made the test harness sanity check the classpath as David requested. 3) Abstracted a CompatibilitySuite out of the original test to make it easier to add more test classes, as Francois requested. 4) Added combinations for the 10.1.2.0 client and server 5) The derbyall diff tool was enhanced to fabricate an empty canon file if one doesn't exist in the codeline. This eliminates the need to create empty canons for JUnit tests. === David says: I made a slight modification -- I moved the CompatibilityTest to derbynetclientmats instead of derbynetmats, as it's intended only for the network client, not for the DB2 driver I'd also like to clarify that the "empty canon file" is not created on disk -- it's only created as an InputStream within the test harness. Nice fix, no more empty files to create for tests that have no output. Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/ - copied from r331635, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/CompatibilitySuite.java (with props) db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/JDBCDriverTest.java - copied, changed from r332087, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/JDBCDriverTest.java db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/Pinger.java - copied, changed from r332087, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/Pinger.java db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/README.html - copied, changed from r332087, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/README.html db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/build.xml - copied, changed from r332087, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/build.xml db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/testScript.xml - copied, changed from r332087, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/testScript.xml db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/derbyNet/ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/derbyNet/CompatibilityTest.java - copied, changed from r331635, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/CompatibilityTest.java db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/derbyNet/CompatibilityTest_app.properties - copied, changed from r331635, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/CompatibilityTest_app.properties db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/derbyNet/build.xml (with props) db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/derbyNet/copyfiles.ant (with props) Removed: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/CompatibilityTest.out db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/JDBCDriverTest.java db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/Pinger.java db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/README.html db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/build.xml db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/testScript.xml db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/CompatibilityTest.java db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/CompatibilityTest_app.properties Modified: db/derby/code/trunk/java/testing/README.htm db/derby/code/trunk/java/testing/build.xml db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/FileCompare.java db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetclientmats.runall db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/copyfiles.ant db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/build.xml db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/DerbyJUnitTest.java Modified: db/derby/code/trunk/java/testing/README.htm URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/README.htm?rev=332090&r1=332089&r2=332090&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/README.htm (original) +++ db/derby/code/trunk/java/testing/README.htm Wed Nov 9 09:46:52 2005 @@ -68,7 +68,7 @@
  • 4.12 Some test harness properties

  • 4.13 SecuirtyManager testing by default

    -
  • 5. Compatibility Tests
  • +
  • 5. Compatibility Tests


  • Modified: db/derby/code/trunk/java/testing/build.xml URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/build.xml?rev=332090&r1=332089&r2=332090&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/build.xml (original) +++ db/derby/code/trunk/java/testing/build.xml Wed Nov 9 09:46:52 2005 @@ -39,10 +39,12 @@ + - + + Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/FileCompare.java URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/FileCompare.java?rev=332090&r1=332089&r2=332090&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/FileCompare.java (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/FileCompare.java Wed Nov 9 09:46:52 2005 @@ -179,13 +179,10 @@ is = master; } - // If the master is still not found, print an error and return + // If the master is still not found, create an empty master if ( is == null ) { - System.out.println("No master file was found."); - pwDiff.println("No master file was found."); - pwDiff.flush(); - return true; + is = new ByteArrayInputStream( new byte[] {} ); } // compress blanks in output columns to make up for column width differences // for JCC output Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetclientmats.runall URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetclientmats.runall?rev=332090&r1=332089&r2=332090&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetclientmats.runall (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetclientmats.runall Wed Nov 9 09:46:52 2005 @@ -1,3 +1,4 @@ +junitTests/derbynet/CompatibilityTest.java jdbcapi/xaSimplePositive.sql jdbcapi/xaStateTran.sql jdbcapi/lobStreams.java Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall?rev=332090&r1=332089&r2=332090&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall Wed Nov 9 09:46:52 2005 @@ -19,7 +19,6 @@ derbynet/testij.java derbynet/timeslice.java derbynet/testSecMec.java -jdbcapi/CompatibilityTest.java jdbcapi/autoGeneratedJdbc30.java jdbcapi/dbMetaDataJdbc30.java jdbcapi/metadata.java Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/copyfiles.ant URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/copyfiles.ant?rev=332090&r1=332089&r2=332090&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/copyfiles.ant (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/copyfiles.ant Wed Nov 9 09:46:52 2005 @@ -1,4 +1,3 @@ -CompatibilityTest_app.properties aclob.txt autoGeneratedJdbc30_app.properties batchUpdate_app.properties Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/CompatibilitySuite.java URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/CompatibilitySuite.java?rev=332090&view=auto ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/CompatibilitySuite.java (added) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/CompatibilitySuite.java Wed Nov 9 09:46:52 2005 @@ -0,0 +1,599 @@ +/* + + Derby - Class org.apache.derbyTesting.functionTests.tests.compatibility.CompatibilitySuite + + Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + */ +/** + *

    + * This is the JUnit suite verifying compatibility of Derby clients and + * servers across Derby version levels and supported VMs. When you want + * to add a new class of tests to this suite, just add the classname to + * the accumulator in suite(). + *

    + * + * @author Rick + */ + +package org.apache.derbyTesting.functionTests.tests.junitTests.compatibility; + +import java.io.*; +import java.sql.*; +import java.util.*; + +import junit.framework.*; + +import org.apache.derbyTesting.functionTests.util.DerbyJUnitTest; + +public class CompatibilitySuite extends DerbyJUnitTest +{ + ///////////////////////////////////////////////////////////// + // + // CONSTANTS + // + ///////////////////////////////////////////////////////////// + + // Supported versions of the db2jcc client. + public static final Version IBM_2_4 = new Version( 2, 4 ); + + // Supported versions of Derby. + public static final Version DRB_10_0 = new Version( 10, 0 ); + public static final Version DRB_10_1 = new Version( 10, 1 ); + public static final Version DRB_10_2 = new Version( 10, 2 ); + + // Supported VM versions. + public static final Version VM_1_3 = new Version( 1, 3 ); + public static final Version VM_1_4 = new Version( 1, 4 ); + public static final Version VM_1_5 = new Version( 1, 5 ); + + public static final String DEFAULT_USER_NAME = "APP"; + public static final String DEFAULT_PASSWORD = "APP"; + + // + // These are properties for the Derby connection URL. + // + private static final String VERSION_PROPERTY = "java.version"; + private static final String SERVER_URL = "jdbc:derby://localhost:1527/"; + private static final String CREATE_PROPERTY = "create=true"; + + private static final int EXPECTED_CLIENT_COUNT = 1; + + // + // Indexes into the array of client-specific strings. E.g., DB2JCC_CLIENT, + // DERBY_CLIENT, and EMBEDDED_CLIENT. + // + private static final int DATABASE_URL = 0; + private static final int DRIVER_NAME = DATABASE_URL + 1; + + // indexed by DATABASE_URL and DRIVER_NAME + private static final String[] DB2JCC_CLIENT = + { + "jdbc:derby:net://localhost:1527/", + "com.ibm.db2.jcc.DB2Driver" + }; + private static final String[] DERBY_CLIENT = + { + "jdbc:derby://localhost:1527/", + "org.apache.derby.jdbc.ClientDriver" + }; + private static final String[] EMBEDDED_CLIENT = + { + "jdbc:derby:", + "org.apache.derby.jdbc.EmbeddedDriver" + }; + + private static final String[][] LEGAL_CLIENTS = + { + DB2JCC_CLIENT, + DERBY_CLIENT, + EMBEDDED_CLIENT + }; + + ///////////////////////////////////////////////////////////// + // + // STATE + // + ///////////////////////////////////////////////////////////// + + private static String[] _defaultClientSettings; // one of the clients in LEGAL_CLIENTS + private static Driver _driver; // the corresponding jdbc driver + private static String _databaseName; // sandbox for tests + private static Version _clientVMLevel; // level of client-side vm + private static Version _driverLevel; // client rev level + private static Version _serverLevel; // server rev level + + ///////////////////////////////////////////////////////////// + // + // JUnit BEHAVIOR + // + ///////////////////////////////////////////////////////////// + + /** + *

    + * JUnit boilerplate which adds as test cases all public methods + * whose names start with the string "test" in the named classes. + * When you want to add a new class of tests, just wire it into + * this suite. + *

    + */ + public static Test suite() + { + TestSuite testSuite = new TestSuite(); + + testSuite.addTestSuite( JDBCDriverTest.class ); + + return testSuite; + } + + + ///////////////////////////////////////////////////////////// + // + // ENTRY POINT + // + ///////////////////////////////////////////////////////////// + + /** + *

    + * Run JDBC compatibility tests using either the specified client or + * the client that is visible + * on the classpath. If there is more than one client on the classpath, + * exits with an error. + *

    + * + *
      + *
    • arg[ 0 ] = required name of database to connect to
    • + *
    • arg[ 1 ] = optional driver to use. if not specified, we'll look for a + * client on the classpath
    • + *
    + */ + public static void main( String args[] ) + throws Exception + { + int exitStatus = FAILURE_EXIT; + + if ( + parseDebug() && + parseArgs( args ) && + parseVMLevel() && + findClient() && + findServer() + ) + { + TestResult result = junit.textui.TestRunner.run( suite() ); + + exitStatus = result.errorCount() + result.failureCount(); + } + + Runtime.getRuntime().exit( exitStatus ); + } + + ///////////////////////////////////////////////////////////// + // + // PUBLIC BEHAVIOR + // + ///////////////////////////////////////////////////////////// + + /** + *

    + * Get the version of the server. + *

    + */ + public Version getServerVersion() { return _serverLevel; } + + /** + *

    + * Get the version of the client. + *

    + */ + public Version getDriverVersion() { return _driverLevel; } + + /** + *

    + * Get the vm level of the client. + *

    + */ + public Version getClientVMVersion() { return _clientVMLevel; } + + /** + *

    + * Return true if we're using the embedded driver. + *

    + */ + public boolean usingEmbeddedClient() { return ( _defaultClientSettings == EMBEDDED_CLIENT ); } + + ///////////////////////////////////////////////////////////// + // + // MINIONS + // + ///////////////////////////////////////////////////////////// + + /////////////////// + // + // GENERAL MINIONS + // + /////////////////// + + ////////////////////////// + // + // INITIALIZATION MINIONS + // + ////////////////////////// + + // + // Initialize client settings based on the client found. + // Return true if one and only one client found, false otherwise. + // We allow for the special case when we're running the embedded client + // off the current compiled class tree rather than off product jars. + // + private static boolean findClient() + throws Exception + { + // + // The client may have been specified on the command line. + // In that case, we don't bother looking for a client on + // the classpath. + // + if ( _defaultClientSettings != null ) { faultInDriver( _defaultClientSettings ); } + else + { + String currentClientName = null; + int legalCount = LEGAL_CLIENTS.length; + int foundCount = 0; + + for ( int i = 0; i < legalCount; i++ ) + { + String[] candidate = LEGAL_CLIENTS[ i ]; + + if ( faultInDriver( candidate ) ) + { + _defaultClientSettings = candidate; + foundCount++; + } + } + + if ( foundCount != EXPECTED_CLIENT_COUNT ) + { + throw new Exception( "Wrong number of drivers: " + foundCount ); + } + } + + // Now make sure that the JDBC driver is what we expect + + try { + _driver = DriverManager.getDriver( _defaultClientSettings[ DATABASE_URL ] ); + _driverLevel = new Version( _driver.getMajorVersion(), _driver.getMinorVersion() ); + } + catch (SQLException e) + { + printStackTrace( e ); + + throw new Exception + ( "Driver doesn't understand expected URL: " + _defaultClientSettings[ DATABASE_URL ] ); + } + + println + ( + "Driver " + _driver.getClass().getName() + + " Version = " + _driverLevel + ); + + return true; + } + + // + // Initialize server settings. Assumes that you have called + // findClient(). + // + private static boolean findServer() + throws Exception + { + try { + Connection conn = getConnection(); + DatabaseMetaData dmd = conn.getMetaData(); + String dbProductVersion = dmd.getDatabaseProductVersion(); + + _serverLevel = new Version( dbProductVersion ); + } + catch (Exception e) + { + printStackTrace( e ); + + throw new Exception( "Error lookup up server info: " + e.getMessage() ); + } + + println( "Server Version = " + _serverLevel ); + + return true; + } + + protected static boolean faultInDriver( String[] clientSettings ) + { + String currentClientName = clientSettings[ DRIVER_NAME ]; + + try { + Class.forName( currentClientName ); + + return true; + } + catch (Exception e) + { + println( "Could not find " + currentClientName ); + return false; + } + } + + private static boolean parseVMLevel() + throws Exception + { + String vmVersion = System.getProperty( VERSION_PROPERTY ); + + try { + _clientVMLevel = new Version( vmVersion ); + } + catch (NumberFormatException e) + { + throw new Exception( "Badly formatted vm version: " + vmVersion ); + } + + println( "VM Version = " + _clientVMLevel ); + + return true; + } + + private static boolean parseArgs( String args[] ) + throws Exception + { + if ( ( args == null ) || (args.length == 0 ) ) + { throw new Exception( "Missing database name." ); } + + _databaseName = args[ 0 ]; + + if ( (args.length > 1) && !"".equals( args[ 1 ] ) ) + { + String desiredClientName = args[ 1 ]; + int count = LEGAL_CLIENTS.length; + + for ( int i = 0; i < count; i++ ) + { + String[] candidate = LEGAL_CLIENTS[ i ]; + + if ( desiredClientName.equals( candidate[ DRIVER_NAME ] ) ) + { + _defaultClientSettings = candidate; + break; + } + } + + if ( _defaultClientSettings == null ) + { + throw new Exception + ( "Could not find client " + desiredClientName + " on the classpath." ); + } + } + + return true; + } + + ////////////////////////// + // + // CONNECTION MINIONS + // + ////////////////////////// + + // Get a connection to the server. + protected static Connection getConnection() + throws Exception + { + return getConnection( _defaultClientSettings, _databaseName, new Properties() ); + } + protected static Connection getConnection + ( + String[] clientSettings, + String databaseName, + Properties properties + ) + throws Exception + { + faultInDriver( clientSettings ); + + properties.put( "user", DEFAULT_USER_NAME ); + properties.put( "password", DEFAULT_PASSWORD ); + properties.put( "retreiveMessagesFromServerOnGetMessage", "true" ); + + Connection conn = DriverManager.getConnection + ( makeDatabaseURL( clientSettings, databaseName ), properties ); + + println( "Connection is a " + conn.getClass().getName() ); + + return conn; + } + + // Build the connection URL. + private static String makeDatabaseURL( String[] clientSettings, String databaseName ) + { + return clientSettings[ DATABASE_URL ] + databaseName; + } + + + /////////////// + // + // SQL MINIONS + // + /////////////// + + /** + *

    + * Create an empty database. + *

    + */ + protected void createDB( String databaseName ) + throws Exception + { + String[] clientSettings = _defaultClientSettings; + String dbURL = makeDatabaseURL( clientSettings, databaseName ); + + dbURL = dbURL + ';' + CREATE_PROPERTY; + + Properties properties = new Properties(); + + properties.put( "user", DEFAULT_USER_NAME ); + properties.put( "password", DEFAULT_PASSWORD ); + + faultInDriver( clientSettings ); + + Connection conn = DriverManager.getConnection( dbURL, properties ); + + conn.close(); + } + + // + // Thin wrapper around jdbc layer to support debugging. + // + protected PreparedStatement prepare( Connection conn, String text ) + throws SQLException + { + println( "Preparing: " + text ); + + return conn.prepareStatement( text ); + } + + ///////////////////////////////////////////////////////////// + // + // INNER CLASSES + // + ///////////////////////////////////////////////////////////// + + /** + *

    + * This helper class exposes an entry point for creating an empty database. + *

    + */ + public static final class Creator + { + private static CompatibilitySuite _driver = new CompatibilitySuite(); + + /** + *

    + * Wait for server to come up, then create the database. + *

    + * + *
      + *
    • args[ 0 ] = name of database to create.
    • + *
    + */ + public static void main( String[] args ) + throws Exception + { + String databaseName = args[ 0 ]; + + CompatibilitySuite.findClient(); + + _driver.createDB( databaseName ); + } + + } + + /** + *

    + * A class for storing a major and minor version number. This class + * assumes that more capable versions compare greater than less capable versions. + *

    + */ + public static final class Version implements Comparable + { + private int _major; + private int _minor; + + public Version( int major, int minor ) + { + constructorMinion( major, minor ); + } + + public Version( String desc ) + throws NumberFormatException + { + StringTokenizer tokens = new StringTokenizer( desc, "." ); + + constructorMinion + ( + java.lang.Integer.parseInt( tokens.nextToken() ), + java.lang.Integer.parseInt( tokens.nextToken() ) + ); + } + + private void constructorMinion( int major, int minor ) + { + _major = major; + _minor = minor; + } + + /** + *

    + * Returns true if this Version is at least as advanced + * as that Version. + *

    + */ + public boolean atLeast( Version that ) + { + return this.compareTo( that ) > -1; + } + + + //////////////////////////////////////////////////////// + // + // Comparable BEHAVIOR + // + //////////////////////////////////////////////////////// + + public int compareTo( Object other ) + { + if ( other == null ) { return -1; } + if ( !( other instanceof Version ) ) { return -1; } + + Version that = (Version) other; + + if ( this._major < that._major ) { return -1; } + if ( this._major > that._major ) { return 1; } + + return this._minor - that._minor; + } + + //////////////////////////////////////////////////////// + // + // Object OVERLOADS + // + //////////////////////////////////////////////////////// + + public String toString() + { + return Integer.toString( _major ) + '.' + Integer.toString( _minor ); + } + + public boolean equals( Object other ) + { + return (compareTo( other ) == 0); + } + + public int hashCode() + { + return _major ^ _minor; + } + + } + + + +} Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/CompatibilitySuite.java ------------------------------------------------------------------------------ svn:eol-style = native Copied: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/JDBCDriverTest.java (from r332087, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/JDBCDriverTest.java) URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/JDBCDriverTest.java?p2=db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/JDBCDriverTest.java&p1=db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/JDBCDriverTest.java&r1=332087&r2=332090&rev=332090&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/JDBCDriverTest.java (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/JDBCDriverTest.java Wed Nov 9 09:46:52 2005 @@ -26,7 +26,7 @@ * @author Rick */ -package org.apache.derbyTesting.functionTests.tests.compatibility; +package org.apache.derbyTesting.functionTests.tests.junitTests.compatibility; import java.io.*; import java.math.*; @@ -37,7 +37,7 @@ import org.apache.derbyTesting.functionTests.util.DerbyJUnitTest; -public class JDBCDriverTest extends DerbyJUnitTest +public class JDBCDriverTest extends CompatibilitySuite { ///////////////////////////////////////////////////////////// // @@ -45,31 +45,9 @@ // ///////////////////////////////////////////////////////////// - /** If you set this startup property to true, you will get chatty output. */ - public static final String DEBUG_FLAG = "drb.tests.debug"; - - public static final int SUCCESS_EXIT = 0; - public static final int FAILURE_EXIT = 1; - - // - // These are properties for the Derby connection URL. - // - private static final String VERSION_PROPERTY = "java.version"; - private static final String SERVER_URL = "jdbc:derby://localhost:1527/"; - private static final String CREATE_PROPERTY = "create=true"; - private static final String ALL_TYPES_TABLE = "allTypesTable"; private static final String KEY_COLUMN = "keyCol"; - private static final int EXPECTED_CLIENT_COUNT = 1; - - // - // Indexes into the array of client-specific strings. E.g., DB2JCC_CLIENT, - // DERBY_CLIENT, and EMBEDDED_CLIENT. - // - private static final int DATABASE_URL = 0; - private static final int DRIVER_NAME = DATABASE_URL + 1; - // // Data values to be stuffed into columns of ALL_TYPES_TABLE. // @@ -84,46 +62,6 @@ private static final boolean Y = true; private static final boolean _ = false; - // indexed by DATABASE_URL and DRIVER_NAME - private static final String[] DB2JCC_CLIENT = - { - "jdbc:derby:net://localhost:1527/", - "com.ibm.db2.jcc.DB2Driver" - }; - private static final String[] DERBY_CLIENT = - { - "jdbc:derby://localhost:1527/", - "org.apache.derby.jdbc.ClientDriver" - }; - private static final String[] EMBEDDED_CLIENT = - { - "jdbc:derby:", - "org.apache.derby.jdbc.EmbeddedDriver" - }; - - private static final String[][] LEGAL_CLIENTS = - { - DB2JCC_CLIENT, - DERBY_CLIENT, - EMBEDDED_CLIENT - }; - - private static final String DEFAULT_USER_NAME = "APP"; - private static final String DEFAULT_PASSWORD = "APP"; - - // Supported versions of the db2jcc client. - private static final Version IBM_2_4 = new Version( 2, 4 ); - - // Supported versions of Derby. - private static final Version DRB_10_0 = new Version( 10, 0 ); - private static final Version DRB_10_1 = new Version( 10, 1 ); - private static final Version DRB_10_2 = new Version( 10, 2 ); - - // Supported VM versions. - private static final Version VM_1_3 = new Version( 1, 3 ); - private static final Version VM_1_4 = new Version( 1, 4 ); - private static final Version VM_1_5 = new Version( 1, 5 ); - // // This table declares the datatypes supported by Derby and the earliest // versions of the Derby and the db2jcc client which support these @@ -265,17 +203,6 @@ // ///////////////////////////////////////////////////////////// - private static boolean _debug; // if true, we print chatty diagnostics - - private static PrintStream _outputStream = System.out; // where to print debug output - - private static String[] _defaultClientSettings; // one of the clients in LEGAL_CLIENTS - private static Driver _driver; // the corresponding jdbc driver - private static String _databaseName; // sandbox for tests - private static Version _clientVMLevel; // level of client-side vm - private static Version _driverLevel; // client rev level - private static Version _serverLevel; // server rev level - // map derby type name to type descriptor private static HashMap _types = new HashMap(); // maps Derby type names to TypeDescriptors @@ -292,65 +219,6 @@ ///////////////////////////////////////////////////////////// // - // JUnit BEHAVIOR - // - ///////////////////////////////////////////////////////////// - - /** - *

    - * JUnit boilerplate which adds as test cases all public methods - * whose names start with the string "test". - *

    - */ - public static Test suite() - { - return new TestSuite( JDBCDriverTest.class ); - } - - - ///////////////////////////////////////////////////////////// - // - // ENTRY POINT - // - ///////////////////////////////////////////////////////////// - - /** - *

    - * Run JDBC compatibility tests using either the specified client or - * the client that is visible - * on the classpath. If there is more than one client on the classpath, - * exits with an error. - *

    - * - *
      - *
    • arg[ 0 ] = required name of database to connect to
    • - *
    • arg[ 1 ] = optional driver to use. if not specified, we'll look for a - * client on the classpath
    • - *
    - */ - public static void main( String args[] ) - throws Exception - { - int exitStatus = FAILURE_EXIT; - - if ( - parseDebug() && - parseArgs( args ) && - parseVMLevel() && - findClient() && - findServer() - ) - { - TestResult result = junit.textui.TestRunner.run( suite() ); - - exitStatus = result.errorCount() + result.failureCount(); - } - - Runtime.getRuntime().exit( exitStatus ); - } - - ///////////////////////////////////////////////////////////// - // // TEST ENTRY POINTS // ///////////////////////////////////////////////////////////// @@ -473,7 +341,7 @@ { TypeDescriptor type = ALL_TYPES[ i ]; - if ( _serverLevel.atLeast( type.getDerbyVersion() ) ) + if ( getServerVersion().atLeast( type.getDerbyVersion() ) ) { String typeName = type.getDerbyTypeName(); String columnDesc = doubleQuote( typeName ); @@ -520,7 +388,7 @@ { TypeDescriptor type = ALL_TYPES[ i ]; - if ( _serverLevel.atLeast( type.getDerbyVersion() ) ) + if ( getServerVersion().atLeast( type.getDerbyVersion() ) ) { String typeName = type.getDerbyTypeName(); String columnDesc = doubleQuote( typeName ); @@ -600,7 +468,7 @@ { TypeDescriptor type = ALL_TYPES[ i ]; - if ( _serverLevel.atLeast( type.getDerbyVersion() ) ) + if ( getServerVersion().atLeast( type.getDerbyVersion() ) ) { String columnName = type.getDerbyTypeName(); Object expectedValue = row[ i ]; @@ -647,7 +515,7 @@ private int rsmdTypeKludge( int originalJDbcType ) { // The embedded client does the right thing. - if ( _defaultClientSettings == EMBEDDED_CLIENT ) { return originalJDbcType; } + if ( usingEmbeddedClient() ) { return originalJDbcType; } switch( originalJDbcType ) { @@ -674,7 +542,7 @@ TypeDescriptor type = ALL_TYPES[ i ]; Object value = row[ i ]; - if ( _serverLevel.atLeast( type.getDerbyVersion() ) ) + if ( getServerVersion().atLeast( type.getDerbyVersion() ) ) { setParameter( ps, param++, type, value ); } @@ -782,7 +650,7 @@ { TypeDescriptor type = ALL_TYPES[ i ]; - if ( _serverLevel.atLeast( type.getDerbyVersion() ) ) + if ( getServerVersion().atLeast( type.getDerbyVersion() ) ) { String typeName = type.getDerbyTypeName(); String columnDesc = doubleQuote( typeName ) + '\t' + typeName; @@ -840,82 +708,6 @@ close( ps ); } - /////////////// - // - // SQL MINIONS - // - /////////////// - - /** - *

    - * Create an empty database. - *

    - */ - public void createDB( String databaseName ) - throws Exception - { - String[] clientSettings = _defaultClientSettings; - String dbURL = makeDatabaseURL( clientSettings, databaseName ); - - dbURL = dbURL + ';' + CREATE_PROPERTY; - - Properties properties = new Properties(); - - properties.put( "user", DEFAULT_USER_NAME ); - properties.put( "password", DEFAULT_PASSWORD ); - - faultInDriver( clientSettings ); - - Connection conn = DriverManager.getConnection( dbURL, properties ); - - conn.close(); - } - - // Get a connection to the server. - private static Connection getConnection() - throws Exception - { - return getConnection( _defaultClientSettings, _databaseName, new Properties() ); - } - private static Connection getConnection - ( - String[] clientSettings, - String databaseName, - Properties properties - ) - throws Exception - { - faultInDriver( clientSettings ); - - properties.put( "user", DEFAULT_USER_NAME ); - properties.put( "password", DEFAULT_PASSWORD ); - properties.put( "retreiveMessagesFromServerOnGetMessage", "true" ); - - Connection conn = DriverManager.getConnection - ( makeDatabaseURL( clientSettings, databaseName ), properties ); - - println( "Connection is a " + conn.getClass().getName() ); - - return conn; - } - - // Build the connection URL. - private static String makeDatabaseURL( String[] clientSettings, String databaseName ) - { - return clientSettings[ DATABASE_URL ] + databaseName; - } - - // - // Thin wrapper around jdbc layer to support debugging. - // - private PreparedStatement prepare( Connection conn, String text ) - throws SQLException - { - println( "Preparing: " + text ); - - return conn.prepareStatement( text ); - } - // // Logic for stuffing a data value into a column, given its type. // @@ -1113,335 +905,11 @@ catch (SQLException e) {} } - /////////////////// - // - // GENERAL MINIONS - // - /////////////////// - - // Debug code to print chatty informational messages. - private static void println( String text ) - { - if ( _debug ) - { - _outputStream.println( text ); - _outputStream.flush(); - } - } - - // Print out a stack trace - private static void printStackTrace( Throwable t ) - { - while ( t != null ) - { - t.printStackTrace( _outputStream ); - - if ( t instanceof SQLException ) { t = ((SQLException) t).getNextException(); } - else { break; } - } - } - - // - // Return a meaningful exit status so that calling scripts can take - // evasive action. - // - private void exit( int exitStatus ) - { - Runtime.getRuntime().exit( exitStatus ); - } - - ////////////////////////// - // - // INITIALIZATION MINIONS - // - ////////////////////////// - - // - // Initialize client settings based on the client found. - // Return true if one and only one client found, false otherwise. - // We allow for the special case when we're running the embedded client - // off the current compiled class tree rather than off product jars. - // - private static boolean findClient() - throws Exception - { - // - // The client may have been specified on the command line. - // In that case, we don't bother looking for a client on - // the classpath. - // - if ( _defaultClientSettings != null ) { faultInDriver( _defaultClientSettings ); } - else - { - String currentClientName = null; - int legalCount = LEGAL_CLIENTS.length; - int foundCount = 0; - - for ( int i = 0; i < legalCount; i++ ) - { - String[] candidate = LEGAL_CLIENTS[ i ]; - - if ( faultInDriver( candidate ) ) - { - _defaultClientSettings = candidate; - foundCount++; - } - } - - if ( foundCount != EXPECTED_CLIENT_COUNT ) - { - throw new Exception( "Wrong number of drivers: " + foundCount ); - } - } - - // Now make sure that the JDBC driver is what we expect - - try { - _driver = DriverManager.getDriver( _defaultClientSettings[ DATABASE_URL ] ); - _driverLevel = new Version( _driver.getMajorVersion(), _driver.getMinorVersion() ); - } - catch (SQLException e) - { - printStackTrace( e ); - - throw new Exception - ( "Driver doesn't understand expected URL: " + _defaultClientSettings[ DATABASE_URL ] ); - } - - println - ( - "Driver " + _driver.getClass().getName() + - " Version = " + _driverLevel - ); - - return true; - } - - // - // Initialize server settings. Assumes that you have called - // findClient(). - // - private static boolean findServer() - throws Exception - { - try { - Connection conn = getConnection(); - DatabaseMetaData dmd = conn.getMetaData(); - String dbProductVersion = dmd.getDatabaseProductVersion(); - - _serverLevel = new Version( dbProductVersion ); - } - catch (Exception e) - { - printStackTrace( e ); - - throw new Exception( "Error lookup up server info: " + e.getMessage() ); - } - - println( "Server Version = " + _serverLevel ); - - return true; - } - - private static boolean faultInDriver( String[] clientSettings ) - { - String currentClientName = clientSettings[ DRIVER_NAME ]; - - try { - Class.forName( currentClientName ); - - return true; - } - catch (Exception e) - { - println( "Could not find " + currentClientName ); - return false; - } - } - - private static boolean parseDebug() - { - _debug = Boolean.getBoolean( DEBUG_FLAG ); - - return true; - } - - private static boolean parseVMLevel() - throws Exception - { - String vmVersion = System.getProperty( VERSION_PROPERTY ); - - try { - _clientVMLevel = new Version( vmVersion ); - } - catch (NumberFormatException e) - { - throw new Exception( "Badly formatted vm version: " + vmVersion ); - } - - println( "VM Version = " + _clientVMLevel ); - - return true; - } - - private static boolean parseArgs( String args[] ) - throws Exception - { - if ( ( args == null ) || (args.length == 0 ) ) - { throw new Exception( "Missing database name." ); } - - _databaseName = args[ 0 ]; - - if ( (args.length > 1) && !"".equals( args[ 1 ] ) ) - { - String desiredClientName = args[ 1 ]; - int count = LEGAL_CLIENTS.length; - - for ( int i = 0; i < count; i++ ) - { - String[] candidate = LEGAL_CLIENTS[ i ]; - - if ( desiredClientName.equals( candidate[ DRIVER_NAME ] ) ) - { - _defaultClientSettings = candidate; - break; - } - } - - if ( _defaultClientSettings == null ) - { - throw new Exception - ( "Could not find client " + desiredClientName + " on the classpath." ); - } - } - - return true; - } - - ///////////////////////////////////////////////////////////// // // INNER CLASSES // ///////////////////////////////////////////////////////////// - - /** - *

    - * This helper class exposes an entry point for creating an empty database. - *

    - */ - public static final class Creator - { - private static JDBCDriverTest _driver = new JDBCDriverTest(); - - /** - *

    - * Wait for server to come up, then create the database. - *

    - * - *
      - *
    • args[ 0 ] = name of database to create.
    • - *
    - */ - public static void main( String[] args ) - throws Exception - { - String databaseName = args[ 0 ]; - - JDBCDriverTest.findClient(); - - _driver.createDB( databaseName ); - } - - } - - /** - *

    - * A class for storing a major and minor version number. This class - * assumes that more capable versions compare greater than less capable versions. - *

    - */ - public static final class Version implements Comparable - { - private int _major; - private int _minor; - - public Version( int major, int minor ) - { - constructorMinion( major, minor ); - } - - public Version( String desc ) - throws NumberFormatException - { - StringTokenizer tokens = new StringTokenizer( desc, "." ); - - constructorMinion - ( - java.lang.Integer.parseInt( tokens.nextToken() ), - java.lang.Integer.parseInt( tokens.nextToken() ) - ); - } - - private void constructorMinion( int major, int minor ) - { - _major = major; - _minor = minor; - } - - /** - *

    - * Returns true if this Version is at least as advanced - * as that Version. - *

    - */ - public boolean atLeast( Version that ) - { - return this.compareTo( that ) > -1; - } - - - //////////////////////////////////////////////////////// - // - // Comparable BEHAVIOR - // - //////////////////////////////////////////////////////// - - public int compareTo( Object other ) - { - if ( other == null ) { return -1; } - if ( !( other instanceof Version ) ) { return -1; } - - Version that = (Version) other; - - if ( this._major < that._major ) { return -1; } - if ( this._major > that._major ) { return 1; } - - return this._minor - that._minor; - } - - //////////////////////////////////////////////////////// - // - // Object OVERLOADS - // - //////////////////////////////////////////////////////// - - public String toString() - { - return Integer.toString( _major ) + '.' + Integer.toString( _minor ); - } - - public boolean equals( Object other ) - { - return (compareTo( other ) == 0); - } - - public int hashCode() - { - return _major ^ _minor; - } - - } /** *

    Copied: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/Pinger.java (from r332087, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/Pinger.java) URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/Pinger.java?p2=db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/Pinger.java&p1=db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/Pinger.java&r1=332087&r2=332090&rev=332090&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/Pinger.java (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/Pinger.java Wed Nov 9 09:46:52 2005 @@ -24,7 +24,7 @@ * * @author Rick */ -package org.apache.derbyTesting.functionTests.tests.compatibility; +package org.apache.derbyTesting.functionTests.tests.junitTests.compatibility; import org.apache.derby.drda.NetworkServerControl; Copied: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/README.html (from r332087, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/README.html) URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/README.html?p2=db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/README.html&p1=db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/README.html&r1=332087&r2=332090&rev=332090&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/README.html (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/README.html Wed Nov 9 09:46:52 2005 @@ -118,7 +118,7 @@ outDir=$1 trunkDir=$2 -COMPAT_DIR=$trunkDir/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility +COMPAT_DIR=$trunkDir/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility rm -rf $outDir mkdir $outDir Copied: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/build.xml (from r332087, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/build.xml) URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/build.xml?p2=db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/build.xml&p1=db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/build.xml&r1=332087&r2=332090&rev=332090&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/build.xml (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/build.xml Wed Nov 9 09:46:52 2005 @@ -4,7 +4,7 @@ - + @@ -34,7 +34,7 @@ - + Copied: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/testScript.xml (from r332087, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/testScript.xml) URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/testScript.xml?p2=db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/testScript.xml&p1=db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/testScript.xml&r1=332087&r2=332090&rev=332090&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/testScript.xml (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/testScript.xml Wed Nov 9 09:46:52 2005 @@ -1,7 +1,7 @@ - + Driver for running compatibility tests, mixing and matching clients and servers at different Derby rev levels on different @@ -39,6 +39,7 @@ 10.0.2.1_lib Directory containing the released 10.0.2.1 jars. 10.1.1.0_lib Directory containing the released 10.1.1.0 jars. + 10.1.2.0_lib Directory containing the released 10.1.2.0 jars. trunk_lib Directory containing jars built from the development mainline (trunk). db2jcc_lib Directory containing the db2jcc jars (see trunk/java/testing/README.htm). @@ -65,6 +66,8 @@ bring down server } } + + Note that the test exits as soon as one combination fails. @@ -80,10 +83,12 @@ + + @@ -93,7 +98,7 @@ - + @@ -109,6 +114,7 @@ @@ -121,14 +127,14 @@ description="Run all compatibility tests." > - + @@ -228,6 +234,12 @@ + + + + + + @@ -298,6 +310,12 @@ + + + + + + @@ -450,7 +468,7 @@ - + @@ -523,6 +541,121 @@ ${summaryMessage} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Cannot find jar file ${vjJar} in directory ${vjLib}. + Make sure that your ant.properties contains the correct + values for all properties described in the header comment + (-projecthelp) of this script. + + + + + + + + + + + + + + + + + + + + + + + Cannot find VM ${vv}. + Make sure that your ant.properties contains the correct + values for all properties described in the header comment + (-projecthelp) of this script. + Copied: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/derbyNet/CompatibilityTest.java (from r331635, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/CompatibilityTest.java) URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/derbyNet/CompatibilityTest.java?p2=db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/derbyNet/CompatibilityTest.java&p1=db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/CompatibilityTest.java&r1=331635&r2=332090&rev=332090&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/CompatibilityTest.java (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/derbyNet/CompatibilityTest.java Wed Nov 9 09:46:52 2005 @@ -25,12 +25,12 @@ * * @author Rick */ -package org.apache.derbyTesting.functionTests.tests.jdbcapi; +package org.apache.derbyTesting.functionTests.tests.junitTests.derbynet; import java.sql.*; import org.apache.derby.tools.ij; -import org.apache.derbyTesting.functionTests.tests.compatibility.JDBCDriverTest; +import org.apache.derbyTesting.functionTests.tests.junitTests.compatibility.CompatibilitySuite; public class CompatibilityTest { @@ -68,7 +68,7 @@ ij.getPropertyArg( args ); Connection conn = ij.startJBMS(); - JDBCDriverTest.main( new String[] { DATABASE_NAME, NETWORK_CLIENT_NAME } ); + CompatibilitySuite.main( new String[] { DATABASE_NAME, NETWORK_CLIENT_NAME } ); } ///////////////////////////////////////////////////////////// Copied: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/derbyNet/CompatibilityTest_app.properties (from r331635, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/CompatibilityTest_app.properties) URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/derbyNet/CompatibilityTest_app.properties?p2=db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/derbyNet/CompatibilityTest_app.properties&p1=db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/CompatibilityTest_app.properties&r1=331635&r2=332090&rev=332090&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/CompatibilityTest_app.properties (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/derbyNet/CompatibilityTest_app.properties Wed Nov 9 09:46:52 2005 @@ -1,2 +1,3 @@ usedefaults=true +ij.database=wombat;create=true noSecurityManager=true Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/derbyNet/build.xml URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/derbyNet/build.xml?rev=332090&view=auto ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/derbyNet/build.xml (added) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/derbyNet/build.xml Wed Nov 9 09:46:52 2005 @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/derbyNet/build.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/derbyNet/copyfiles.ant URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/derbyNet/copyfiles.ant?rev=332090&view=auto ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/derbyNet/copyfiles.ant (added) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/derbyNet/copyfiles.ant Wed Nov 9 09:46:52 2005 @@ -0,0 +1 @@ +CompatibilityTest_app.properties Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/derbyNet/copyfiles.ant ------------------------------------------------------------------------------ svn:eol-style = native Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/build.xml URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/build.xml?rev=332090&r1=332089&r2=332090&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/build.xml (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/build.xml Wed Nov 9 09:46:52 2005 @@ -84,6 +84,7 @@ destdir="${out.dir}"> + Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/DerbyJUnitTest.java URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/DerbyJUnitTest.java?rev=332090&r1=332089&r2=332090&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/DerbyJUnitTest.java (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/DerbyJUnitTest.java Wed Nov 9 09:46:52 2005 @@ -29,6 +29,9 @@ package org.apache.derbyTesting.functionTests.util; +import java.io.*; +import java.sql.*; + import junit.framework.*; public class DerbyJUnitTest extends TestCase @@ -39,12 +42,22 @@ // ///////////////////////////////////////////////////////////// + /** If you set this startup property to true, you will get chatty output. */ + public static final String DEBUG_FLAG = "drb.tests.debug"; + + public static final int SUCCESS_EXIT = 0; + public static final int FAILURE_EXIT = 1; + ///////////////////////////////////////////////////////////// // // STATE // ///////////////////////////////////////////////////////////// + private static boolean _debug; // if true, we print chatty diagnostics + + private static PrintStream _outputStream = System.out; // where to print debug output + ///////////////////////////////////////////////////////////// // // CONSTRUCTOR @@ -52,6 +65,66 @@ ///////////////////////////////////////////////////////////// public DerbyJUnitTest() {} + + ///////////////////////////////////////////////////////////// + // + // PUBLIC BEHAVIOR + // + ///////////////////////////////////////////////////////////// + + /** + *

    + * Look for the system property which tells us whether to run + * chattily. + *

    + */ + public static boolean parseDebug() + { + _debug = Boolean.getBoolean( DEBUG_FLAG ); + + return true; + } + + /** + *

    + * Debug code to print chatty informational messages. + *

    + */ + public static void println( String text ) + { + if ( _debug ) + { + _outputStream.println( text ); + _outputStream.flush(); + } + } + + /** + *

    + * Print out a stack trace. + *

    + */ + public static void printStackTrace( Throwable t ) + { + while ( t != null ) + { + t.printStackTrace( _outputStream ); + + if ( t instanceof SQLException ) { t = ((SQLException) t).getNextException(); } + else { break; } + } + } + + /** + *

    + * Return a meaningful exit status so that calling scripts can take + * evasive action. + *

    + */ + public void exit( int exitStatus ) + { + Runtime.getRuntime().exit( exitStatus ); + } ///////////////////////////////////////////////////////////// //