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/08/18 19:20:31 UTC

svn commit: r432651 - in /db/derby/code/branches/10.2: java/client/org/apache/derby/jdbc/ java/engine/org/apache/derby/loc/ java/shared/org/apache/derby/shared/common/reference/ java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/ ...

Author: rhillegas
Date: Fri Aug 18 10:20:30 2006
New Revision: 432651

URL: http://svn.apache.org/viewvc?rev=432651&view=rev
Log:
DERBY-1725: Merge trunk into 10.2 branch from 430858 through 430945.

Added:
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java
      - copied unchanged from r430945, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/util/CleanDatabaseTestSetup.java
      - copied unchanged from r430945, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/CleanDatabaseTestSetup.java
Removed:
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ConcurrencyTest_app.properties
Modified:
    db/derby/code/branches/10.2/java/client/org/apache/derby/jdbc/ClientBaseDataSource.java
    db/derby/code/branches/10.2/java/client/org/apache/derby/jdbc/ClientDataSource.java
    db/derby/code/branches/10.2/java/engine/org/apache/derby/loc/messages_en.properties
    db/derby/code/branches/10.2/java/shared/org/apache/derby/shared/common/reference/SQLState.java
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource.out
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource30.out
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ConcurrencyTest.java
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ScrollResultSetTest.java
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/build.xml
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LangScripts.java
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/util/BaseTestCase.java
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/util/ScriptTestCase.java
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/util/SecurityManagerSetup.java
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/util/TestConfiguration.java
    db/derby/code/branches/10.2/tools/release/build.xml

Modified: db/derby/code/branches/10.2/java/client/org/apache/derby/jdbc/ClientBaseDataSource.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/client/org/apache/derby/jdbc/ClientBaseDataSource.java?rev=432651&r1=432650&r2=432651&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/client/org/apache/derby/jdbc/ClientBaseDataSource.java (original)
+++ db/derby/code/branches/10.2/java/client/org/apache/derby/jdbc/ClientBaseDataSource.java Fri Aug 18 10:20:30 2006
@@ -31,7 +31,6 @@
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
-import java.sql.SQLException;
 
 import javax.naming.RefAddr;
 import javax.naming.Referenceable;
@@ -800,24 +799,15 @@
      * Any attributes that can be set using a property of this DataSource implementation
      * (e.g user, password) should not be set in connectionAttributes. Conflicting
      * settings in connectionAttributes and properties of the DataSource will lead to
-     * unexpected behaviour. Specifically, databaseName attribute cannot be set using 
-     * this method. (DERBY-1130). databaseName has to be set using the DataSource 
-     * property.
+     * unexpected behaviour. 
      *
      * @param prop set to the list of Cloudscape connection attributes separated by semi-colons.   E.g., to specify an
      *             encryption bootPassword of "x8hhk2adf", and set upgrade to true, do the following: <PRE>
      *             ds.setConnectionAttributes("bootPassword=x8hhk2adf;upgrade=true"); </PRE> See Derby documentation for
      *             complete list.
-     * @throws SQLException if we attempt to set databaseName property in the connection attributes
      */
-    public final void setConnectionAttributes(String prop) throws SQLException {
+    public final void setConnectionAttributes(String prop) {
         connectionAttributes = prop;
-        
-        try {
-        	updateDataSourceValues(tokenizeAttributes(prop, null));
-        }  catch(SqlException se) {
-        	throw se.getSQLException();
-        }
     }
 
     /**
@@ -895,15 +885,9 @@
      * The dataSource keeps individual fields for the values that are relevant to the client. These need to be updated
      * when set connection attributes is called.
      */
-    void updateDataSourceValues(Properties prop) throws SqlException {
+    void updateDataSourceValues(Properties prop) {
         if (prop == null) {
             return;
-        }
-        
-        if (prop.containsKey(Attribute.DBNAME_ATTR)) {
-        	throw new SqlException(null, 
-                    new ClientMessageId(SQLState.ATTRIBUTE_NOT_ALLOWED),
-					Attribute.DBNAME_ATTR);
         }
         
         if (prop.containsKey(Attribute.USERNAME_ATTR)) {

Modified: db/derby/code/branches/10.2/java/client/org/apache/derby/jdbc/ClientDataSource.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/client/org/apache/derby/jdbc/ClientDataSource.java?rev=432651&r1=432650&r2=432651&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/client/org/apache/derby/jdbc/ClientDataSource.java (original)
+++ db/derby/code/branches/10.2/java/client/org/apache/derby/jdbc/ClientDataSource.java Fri Aug 18 10:20:30 2006
@@ -182,6 +182,7 @@
         try
         {
             LogWriter dncLogWriter = super.computeDncLogWriterForNewConnection("_sds");
+            updateDataSourceValues(tokenizeAttributes(getConnectionAttributes(), null));
             return ClientDriver.getFactory().newNetConnection
                     ((NetLogWriter) dncLogWriter, user,
                     password, this, -1, false);

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/loc/messages_en.properties
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/loc/messages_en.properties?rev=432651&r1=432650&r2=432651&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/loc/messages_en.properties (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/loc/messages_en.properties Fri Aug 18 10:20:30 2006
@@ -1281,7 +1281,6 @@
 XJ213.C=The traceLevel connection property does not have a valid format for a number.
 XJ214.S=An IO Error occurred when calling free() on a CLOB or BLOB.
 XJ215.S=You cannot invoke other Clob/Blob methods after calling free.
-XJ216.S={0} attribute cannot be set using the DataSource method setConnectionAttributes. 
 
 #XN - Network level messages
 XN001.S=Connection reset is not allowed when inside a unit of work.

Modified: db/derby/code/branches/10.2/java/shared/org/apache/derby/shared/common/reference/SQLState.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/shared/org/apache/derby/shared/common/reference/SQLState.java?rev=432651&r1=432650&r2=432651&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/shared/org/apache/derby/shared/common/reference/SQLState.java (original)
+++ db/derby/code/branches/10.2/java/shared/org/apache/derby/shared/common/reference/SQLState.java Fri Aug 18 10:20:30 2006
@@ -1490,7 +1490,6 @@
     String TRACELEVEL_FORMAT_INVALID = "XJ213.C";
     String IO_ERROR_UPON_LOB_FREE = "XJ214.S";
     String LOB_OBJECT_INVALID = "XJ215.S";
-    String ATTRIBUTE_NOT_ALLOWED = "XJ216.S";
     
     //XN - Network-level messages
     String NET_CONNECTION_RESET_NOT_ALLOWED_IN_UNIT_OF_WORK         = "XN001.S";

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource.out?rev=432651&r1=432650&r2=432651&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource.out (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource.out Fri Aug 18 10:20:30 2006
@@ -555,41 +555,4 @@
 acxs 3
 testing jira 95 for DataSource; ok - expected exception: XCY00
 testing jira 95 for XADataSource; ok - expected exception: XCY00
-DataSource - EMPTY
-  getConnection() - 08001:Required property databaseName not set.
-  getConnection(null, null) - 08001:Required property databaseName not set.
-  getConnection(fred, null) - 08001:Required property databaseName not set.
-  getConnection(fred, wilma) - 08001:Required property databaseName not set.
-  getConnection(null, wilma) - 08001:Required property databaseName not set.
-  getConnection(null, databaseName=wombat) - 08001:Required property databaseName not set.
-  getConnection(fred, databaseName=wombat) - 08001:Required property databaseName not set.
-  getConnection(fred, databaseName=wombat;password=wilma) - 08001:Required property databaseName not set.
-  getConnection(fred, databaseName=wombat;password=betty) - 08001:Required property databaseName not set.
-DataSource - connectionAttributes=databaseName=wombat
-Expected exception - databaseName attribute cannot be set using the DataSource method setConnectionAttributes. 
-ConnectionPoolDataSource - EMPTY
-  getPooledConnection() - 08001:Required property databaseName not set.
-  getPooledConnection(null, null) - 08001:Required property databaseName not set.
-  getPooledConnection(fred, null) - 08001:Required property databaseName not set.
-  getPooledConnection(fred, wilma) - 08001:Required property databaseName not set.
-  getPooledConnection(null, wilma) - 08001:Required property databaseName not set.
-  getPooledConnection(null, databaseName=wombat) - 08001:Required property databaseName not set.
-  getPooledConnection(fred, databaseName=wombat) - 08001:Required property databaseName not set.
-  getPooledConnection(fred, databaseName=wombat;password=wilma) - 08001:Required property databaseName not set.
-  getPooledConnection(fred, databaseName=wombat;password=betty) - 08001:Required property databaseName not set.
-ConnectionPoolDataSource - connectionAttributes=databaseName=wombat
-Expected exception - databaseName attribute cannot be set using the DataSource method setConnectionAttributes. 
-XADataSource - EMPTY
-  getXAConnection() - 08001:Required property databaseName not set.
-  getXAConnection(null, null) - 08001:Required property databaseName not set.
-  getXAConnection(fred, null) - 08001:Required property databaseName not set.
-  getXAConnection(fred, wilma) - 08001:Required property databaseName not set.
-  getXAConnection(null, wilma) - 08001:Required property databaseName not set.
-  getXAConnection(null, databaseName=wombat) - 08001:Required property databaseName not set.
-  getXAConnection(fred, databaseName=wombat) - 08001:Required property databaseName not set.
-  getXAConnection(fred, databaseName=wombat;password=wilma) - 08001:Required property databaseName not set.
-  getXAConnection(fred, databaseName=wombat;password=betty) - 08001:Required property databaseName not set.
-XADataSource - connectionAttributes=databaseName=wombat
-Expected exception - databaseName attribute cannot be set using the DataSource method setConnectionAttributes. 
-Checked class declared as: javax.sql.DataSource
 Completed checkDataSource

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource30.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource30.out?rev=432651&r1=432650&r2=432651&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource30.out (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource30.out Fri Aug 18 10:20:30 2006
@@ -672,42 +672,6 @@
 acxs 3
 testing jira 95 for DataSource; ok - expected exception: XCY00
 testing jira 95 for XADataSource; ok - expected exception: XCY00
-DataSource - EMPTY
-  getConnection() - 08001:Required property databaseName not set.
-  getConnection(null, null) - 08001:Required property databaseName not set.
-  getConnection(fred, null) - 08001:Required property databaseName not set.
-  getConnection(fred, wilma) - 08001:Required property databaseName not set.
-  getConnection(null, wilma) - 08001:Required property databaseName not set.
-  getConnection(null, databaseName=wombat) - 08001:Required property databaseName not set.
-  getConnection(fred, databaseName=wombat) - 08001:Required property databaseName not set.
-  getConnection(fred, databaseName=wombat;password=wilma) - 08001:Required property databaseName not set.
-  getConnection(fred, databaseName=wombat;password=betty) - 08001:Required property databaseName not set.
-DataSource - connectionAttributes=databaseName=wombat
-Expected exception - databaseName attribute cannot be set using the DataSource method setConnectionAttributes. 
-ConnectionPoolDataSource - EMPTY
-  getPooledConnection() - 08001:Required property databaseName not set.
-  getPooledConnection(null, null) - 08001:Required property databaseName not set.
-  getPooledConnection(fred, null) - 08001:Required property databaseName not set.
-  getPooledConnection(fred, wilma) - 08001:Required property databaseName not set.
-  getPooledConnection(null, wilma) - 08001:Required property databaseName not set.
-  getPooledConnection(null, databaseName=wombat) - 08001:Required property databaseName not set.
-  getPooledConnection(fred, databaseName=wombat) - 08001:Required property databaseName not set.
-  getPooledConnection(fred, databaseName=wombat;password=wilma) - 08001:Required property databaseName not set.
-  getPooledConnection(fred, databaseName=wombat;password=betty) - 08001:Required property databaseName not set.
-ConnectionPoolDataSource - connectionAttributes=databaseName=wombat
-Expected exception - databaseName attribute cannot be set using the DataSource method setConnectionAttributes. 
-XADataSource - EMPTY
-  getXAConnection() - 08001:Required property databaseName not set.
-  getXAConnection(null, null) - 08001:Required property databaseName not set.
-  getXAConnection(fred, null) - 08001:Required property databaseName not set.
-  getXAConnection(fred, wilma) - 08001:Required property databaseName not set.
-  getXAConnection(null, wilma) - 08001:Required property databaseName not set.
-  getXAConnection(null, databaseName=wombat) - 08001:Required property databaseName not set.
-  getXAConnection(fred, databaseName=wombat) - 08001:Required property databaseName not set.
-  getXAConnection(fred, databaseName=wombat;password=wilma) - 08001:Required property databaseName not set.
-  getXAConnection(fred, databaseName=wombat;password=betty) - 08001:Required property databaseName not set.
-XADataSource - connectionAttributes=databaseName=wombat
-Expected exception - databaseName attribute cannot be set using the DataSource method setConnectionAttributes. 
 START XA HOLDABILITY TEST
 By default, autocommit is true for a connection
 Default holdability for a connection is HOLD_CURSORS_OVER_COMMIT
@@ -776,5 +740,4 @@
 Get a new connection with XAConnection.getConnection()
 Isolation level should be reset to READ_COMMITTED
 PASS: Expected lock timeout for READ_COMMITTED
-Checked class declared as: javax.sql.DataSource
 Completed checkDataSource30

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ConcurrencyTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ConcurrencyTest.java?rev=432651&r1=432650&r2=432651&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ConcurrencyTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ConcurrencyTest.java Fri Aug 18 10:20:30 2006
@@ -21,6 +21,8 @@
 import junit.framework.*;
 import java.sql.*;
 
+import org.apache.derbyTesting.functionTests.util.JDBC;
+
 /**
  * Testing concurrency behaviour in derby when creating the resultsets with
  * different parameters.
@@ -812,6 +814,9 @@
     
     public static Test suite() {
         TestSuite suite = new TestSuite();
+                
+        // Requires holdability
+        if (JDBC.vmSupportsJDBC3() || JDBC.vmSupportsJSR169()) {
         
         suite.addTest(new ConcurrencyTest("testUpdateLockDownGrade1"));
         suite.addTest(new ConcurrencyTest("testAquireUpdateLock1"));
@@ -836,6 +841,7 @@
 //         suite.addTest(new ConcurrencyTest("testTruncateDuringScan"));
         /// ---------------
                 
+        }
             
         return suite;
     }

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java?rev=432651&r1=432650&r2=432651&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java Fri Aug 18 10:20:30 2006
@@ -31,6 +31,7 @@
 import junit.framework.TestSuite;
 import org.apache.derbyTesting.functionTests.util.BaseJDBCTestCase;
 import org.apache.derbyTesting.functionTests.util.BaseJDBCTestSetup;
+import org.apache.derbyTesting.functionTests.util.JDBC;
 
 /**
  * Tests of stored procedures.
@@ -662,7 +663,12 @@
      * @return test suite
      */
     public static Test suite() {
-        TestSuite suite = new TestSuite(ProcedureTest.class);
+        TestSuite suite = new TestSuite();
+        
+        // Need JDBC 2 DriverManager to run these tests
+        if (JDBC.vmSupportsJDBC2()) {        	
+        
+        suite.addTestSuite(ProcedureTest.class);
         if (!usingDerbyNet()) {
             suite.addTest
                 (new ProcedureTest
@@ -697,6 +703,7 @@
                 (new ProcedureTest
                  ("xtestRollbackStoredProcWhenExecuteUpdateReturnsResults" +
                   "_prepared"));
+        }
         }
         return new BaseJDBCTestSetup(suite) {
             /**

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ScrollResultSetTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ScrollResultSetTest.java?rev=432651&r1=432650&r2=432651&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ScrollResultSetTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ScrollResultSetTest.java Fri Aug 18 10:20:30 2006
@@ -20,8 +20,10 @@
 package org.apache.derbyTesting.functionTests.tests.jdbcapi;
 
 import org.apache.derbyTesting.functionTests.util.BaseJDBCTestCase;
+import org.apache.derbyTesting.functionTests.util.JDBC;
 import org.apache.derbyTesting.functionTests.util.SQLStateConstants;
 import junit.framework.*;
+
 import java.sql.*;
 
 /**
@@ -45,6 +47,17 @@
     /** Creates a new instance of ScrollResultSetTest */
     public ScrollResultSetTest(String name) {
         super(name);
+    }
+    
+    public static Test suite() {
+        TestSuite suite = new TestSuite();
+                
+        // Requires holdability
+        if (JDBC.vmSupportsJDBC3() || JDBC.vmSupportsJSR169()) {
+        	suite.addTestSuite(ScrollResultSetTest.class);
+        }
+        
+        return suite;
     }
 
     /**

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/build.xml?rev=432651&r1=432650&r2=432651&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/build.xml (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/build.xml Fri Aug 18 10:20:30 2006
@@ -58,14 +58,37 @@
 
 <!--             ============ Begin Targets ==============                -->
  
-  <target name="FTOtestsubdir" depends="compilex,compilet2,compilet1,copyfiles"/>
+  <target name="FTOtestsubdir" depends="compileSuite,copyfiles"/>
 
   <!-- mkdir / init target may not be necessary, just here for reference... -->
   <target name="init">
     <mkdir dir="${out.dir}/${derby.testing.functest.dir}/tests/jdbcapi"/>
   </target>
 
-  <target name="compilet1" depends="compilet2">
+	  <target name="compileSuite" depends="compilet2">
+	    <javac
+	      source="1.3"
+	      target="1.3"
+	      bootclasspath="${empty}"
+	      nowarn="on"
+	      debug="${debug}"
+	      depend="${depend}"
+	      deprecation="${deprecation}"
+	      optimize="${optimize}"
+	      proceed="${proceed}"
+	      verbose="${verbose}" 
+	      srcdir="${derby.testing.src.dir}"
+	      destdir="${out.dir}">
+	      <classpath>
+	        <!--pathelement location="${oro}"/-->
+	        <pathelement path="${compile.classpath}"/>
+			<pathelement path="${junit}"/>
+	      </classpath>
+	      <include name="${this.dir}/_Suite.java"/>
+	    </javac>
+	  </target>
+	
+  <target name="compilet1">
     <javac
       source="1.3"
       target="1.3"
@@ -99,10 +122,11 @@
       <exclude name="${this.dir}/lobStreams.java"/>
       <exclude name="${this.dir}/XATest.java"/>
       <exclude name="${this.dir}/ScrollResultSetTest.java"/>
+      <exclude name="${this.dir}/_Suite.java"/>
     </javac>
   </target>
 
-  <target name="compilet2">
+  <target name="compilet2" depends="compilet1,compilex">
     <javac
       source="1.4"
       target="1.4"

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java?rev=432651&r1=432650&r2=432651&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java Fri Aug 18 10:20:30 2006
@@ -47,10 +47,6 @@
 import org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource;
 import org.apache.derby.jdbc.EmbeddedDataSource;
 import org.apache.derby.jdbc.EmbeddedXADataSource;
-import org.apache.derby.jdbc.ClientConnectionPoolDataSource;
-import org.apache.derby.jdbc.ClientDataSource;
-import org.apache.derby.jdbc.ClientXADataSource;
-
 import org.apache.derby.tools.JDBCDisplayUtil;
 import org.apache.derby.tools.ij;
 import org.apache.derbyTesting.functionTests.util.SecurityCheck;
@@ -690,12 +686,10 @@
 		} catch (Exception e) {
 				System.out.println("; wrong, unexpected exception: " + e.toString());
 		}
-		
-		// DERBY-1130 - Client should not allow databaseName to be set with setConnectionAttributes
-		if (TestUtil.isDerbyNetClientFramework())
-			testClientDSConnectionAttributes();
-		
-		// skip testDSRequestAuthentication for  client because of this issue: 
+		// skip testDSRequestAuthentication for  client because of these 
+		// two issues:
+		// DERBY-1130 : Client should not allow databaseName to be set with
+		// setConnectionAttributes
 		// DERBY-1131 : Deprecate  Derby DataSource property attributesAsPassword
 		if (TestUtil.isDerbyNetClientFramework())
 			return;
@@ -1389,53 +1383,6 @@
 		xads.setDatabaseName(null);
 	}
 
-	/**
-	 * Check that database name cannot be set using setConnectionAttributes 
-	 * for Derby client data sources. This method tests DERBY-1130.
-	 * 
-	 * @throws SQLException
-	 */
-	private static void testClientDSConnectionAttributes() throws SQLException {
-
-		ClientDataSource ds = new ClientDataSource();
-
-		System.out.println("DataSource - EMPTY");
-		dsConnectionRequests(ds);
-
-		System.out.println("DataSource - connectionAttributes=databaseName=wombat");
-		try{ 
-			ds.setConnectionAttributes("databaseName=wombat");
-		} catch (SQLException sqle) {
-			System.out.println("Expected exception - " + sqle.getMessage());
-		}
-		
-		
-		// now with ConnectionPoolDataSource
-		ClientConnectionPoolDataSource cpds = new ClientConnectionPoolDataSource();
-		System.out.println("ConnectionPoolDataSource - EMPTY");
-		dsConnectionRequests((ConnectionPoolDataSource)cpds);
-
-		System.out.println("ConnectionPoolDataSource - connectionAttributes=databaseName=wombat");
-		try {
-			cpds.setConnectionAttributes("databaseName=wombat");
-		} catch (SQLException sqle) {
-			System.out.println("Expected exception - " + sqle.getMessage());
-		}
-		
-		// now with XADataSource
-		ClientXADataSource xads = new ClientXADataSource();
-		System.out.println("XADataSource - EMPTY");
-		dsConnectionRequests((XADataSource) xads);
-
-		System.out.println("XADataSource - connectionAttributes=databaseName=wombat");
-		try {
-			xads.setConnectionAttributes("databaseName=wombat");
-		} catch (SQLException sqle) {
-			System.out.println("Expected exception - " + sqle.getMessage());
-		}
-		
-	}
-	
 	private static void dsConnectionRequests(DataSource ds) {
 		
 		SecurityCheck.inspect(ds, "javax.sql.DataSource");

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LangScripts.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LangScripts.java?rev=432651&r1=432650&r2=432651&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LangScripts.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LangScripts.java Fri Aug 18 10:20:30 2006
@@ -22,6 +22,7 @@
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
+import org.apache.derbyTesting.functionTests.util.CleanDatabaseTestSetup;
 import org.apache.derbyTesting.functionTests.util.ScriptTestCase;
 
 public final class LangScripts extends ScriptTestCase {
@@ -33,6 +34,9 @@
 		"arithmetic",
 		"bit2",
 		"case",
+		"constantExpression",
+		"depend",
+		"derived",
 		"union",
 		};
 	
@@ -65,13 +69,16 @@
 	
     /**
      * Return a suite of language SQL tests from the list of
-     * script names.
+     * script names. Each test is surrounded in a decorator
+     * that cleans the database.
       */
 	private static Test getSuite(String[] list)
 	{
         TestSuite suite = new TestSuite();
         for (int i = 0; i < list.length; i++)
-            suite.addTest(new LangScripts(list[i]));
+            suite.addTest(
+            		new CleanDatabaseTestSetup(
+            		new LangScripts(list[i])));
 
         return getIJConfig(suite);
     }

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/util/BaseTestCase.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/util/BaseTestCase.java?rev=432651&r1=432650&r2=432651&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/util/BaseTestCase.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/util/BaseTestCase.java Fri Aug 18 10:20:30 2006
@@ -20,8 +20,9 @@
 package org.apache.derbyTesting.functionTests.util;
 
 import junit.framework.TestCase;
-import java.io.InputStream;
+
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.Reader;
 import java.io.PrintStream;
 import java.net.URL;
@@ -76,10 +77,20 @@
      * setUp, tearDown methods and decorators.
      */
     public final void runBare() throws Throwable {
-    	// Not ready for prime time!
-    	// SecurityManagerSetup.installSecurityManager();
+        // still not ready for prime time
+    	//if (getTestConfiguration().defaultSecurityManagerSetup())
+    	//	assertSecurityManager();
+    	
     	super.runBare();
     }
+
+    /**
+     * Return the current configuration for the test.
+     */
+    public final TestConfiguration getTestConfiguration()
+    {
+    	return CONFIG;
+    }
     
     /**
      * Print alarm string
@@ -204,6 +215,27 @@
 		}
 	     );
     }  
+  
+    /**
+     * Open the URL for a a test resource, e.g. a policy
+     * file or a SQL script.
+     * @param url URL obtained from getTestResource
+     * @return An open stream
+    */
+    protected static InputStream openTestResource(final URL url)
+        throws PrivilegedActionException
+    {
+    	return (InputStream)AccessController.doPrivileged
+	    (new java.security.PrivilegedExceptionAction(){
+
+		    public Object run() throws IOException{
+			return url.openStream();
+
+		    }
+
+		}
+	     );    	
+    }
     
     /**
      * Assert a security manager is installed.

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/util/ScriptTestCase.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/util/ScriptTestCase.java?rev=432651&r1=432650&r2=432651&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/util/ScriptTestCase.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/util/ScriptTestCase.java Fri Aug 18 10:20:30 2006
@@ -40,9 +40,15 @@
 	
 	private final String inputEncoding;
 	private final String outputEncoding = "US-ASCII";
+	
+    /**
+     * Default connection.
+     */
+	private Connection conn;
 
 	/**
-	 * Create a ScriptTestCase to run a single test. 
+	 * Create a ScriptTestCase to run a single test
+     * using a connection obtained from getConnection()
 	 * @param script Base name of the .sql script
 	 * excluding the .sql suffix.
 	 */
@@ -105,14 +111,14 @@
 		URL sql = getTestResource(resource);
 		assertNotNull("SQL script missing: " + resource, sql);
 		
-		InputStream sqlIn = sql.openStream();
+		InputStream sqlIn = openTestResource(sql);
 		
 		ByteArrayOutputStream rawBytes =
 			new ByteArrayOutputStream(20 * 1024);
 		
 		PrintStream printOut = new PrintStream(rawBytes);
 	
-		Connection conn = getConnection();
+		conn = getConnection();
 		org.apache.derby.tools.ij.runScript(
 				conn,
 				sqlIn,
@@ -120,7 +126,8 @@
 				printOut,
 				outputEncoding);
 		
-		conn.close();
+		if (!conn.isClosed() && !conn.getAutoCommit())
+		    conn.commit();
 		
 		printOut.flush();
 		printOut.close();
@@ -176,5 +183,14 @@
 			outFile.close();
 			throw t;
 		}
+	}
+	
+    /**
+     * Clean up the connection on teardown.
+     */
+	protected void tearDown() throws Exception
+	{
+		JDBC.cleanup(conn);
+        super.tearDown();
 	}
 }

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/util/SecurityManagerSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/util/SecurityManagerSetup.java?rev=432651&r1=432650&r2=432651&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/util/SecurityManagerSetup.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/util/SecurityManagerSetup.java Fri Aug 18 10:20:30 2006
@@ -77,6 +77,17 @@
 	}
 	
 	/**
+	 * Install a SecurityManager with the default test policy
+	 * file:
+	 * org/apache/derbyTesting/functionTests/util/derby_tests.policy
+	 * 
+	 */
+	static void noSecurityManager() throws PrivilegedActionException
+	{
+		installSecurityManager("<NONE>");
+	}
+	
+	/**
 	 * Install specific polciy file with the security manager
 	 * including the special case of no security manager.
 	 */
@@ -148,6 +159,10 @@
 	private static void setSecurityPolicy(Properties set,
 			String policyResource) throws PrivilegedActionException
 	{
+		if ("<NONE>".equals(policyResource)) {
+			set.setProperty("java.security.policy", policyResource);
+			return;
+		}
 		URL policyURL = BaseTestCase.getTestResource(policyResource);
 
 		if (policyURL != null)

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/util/TestConfiguration.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/util/TestConfiguration.java?rev=432651&r1=432650&r2=432651&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/util/TestConfiguration.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/util/TestConfiguration.java Fri Aug 18 10:20:30 2006
@@ -425,5 +425,29 @@
                                     driverClass + "': " + ie.getMessage());
         }
     }
+    
+    /*
+     * SecurityManager related configuration.
+     */
+    
+    /**
+     * Install the default security manager setup,
+     * for the current configuration.
+     * @throws PrivilegedActionException 
+     */
+    boolean defaultSecurityManagerSetup() throws PrivilegedActionException {
+    	
+    	// Testing with the DB2 client has not been performed
+    	// under the security manager since it's not part
+    	// of Derby so no real interest in tracking down issues.
+    	if (jdbcClient.isDB2Client()) {
+    		SecurityManagerSetup.noSecurityManager();
+    		return false;
+    	} else {
+    		SecurityManagerSetup.installSecurityManager();
+    		return true;
+    	}
+    }
+    
         
 }

Modified: db/derby/code/branches/10.2/tools/release/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/tools/release/build.xml?rev=432651&r1=432650&r2=432651&view=diff
==============================================================================
--- db/derby/code/branches/10.2/tools/release/build.xml (original)
+++ db/derby/code/branches/10.2/tools/release/build.xml Fri Aug 18 10:20:30 2006
@@ -105,6 +105,10 @@
       <!-- lib -->
       <zipfileset dir="${basedir}/jars/insane" prefix="${derby.bin}/lib" includes="derby*.*"
 	              excludes="derby_core_plugin*"/>
+      <zipfileset dir="${basedir}/java/testing" prefix="${derby.bin}/test" 
+                  includes="README.htm"/>
+      <zipfileset dir="${basedir}/tools/java" prefix="${derby.bin}/test" 
+                  includes="jakarta-oro-2.0.8.jar"/>
     </zip>
   </target>
 
@@ -144,6 +148,10 @@
       <!-- lib -->
       <tarfileset dir="${basedir}/jars/insane" prefix="${derby.bin}/lib" includes="derby*.*"
 	              excludes="derby_core_plugin*"/>
+      <tarfileset dir="${basedir}/java/testing" prefix="${derby.bin}/test" 
+                  includes="README.htm"/>
+      <tarfileset dir="${basedir}/tools/java" prefix="${derby.bin}/test" 
+                  includes="jakarta-oro-2.0.8.jar"/>
     </tar>
   </target>
 
@@ -156,6 +164,10 @@
       			  prefix="${derby.lib}/"/>
       <zipfileset dir="${basedir}/jars/insane" prefix="${derby.lib}/lib" includes="derby*.*"
 	              excludes="derby_core_plugin*"/>
+      <zipfileset dir="${basedir}/java/testing" prefix="${derby.bin}/test" 
+                  includes="README.htm"/>
+      <zipfileset dir="${basedir}/tools/java" prefix="${derby.bin}/test" 
+                  includes="jakarta-oro-2.0.8.jar"/>
     </zip>
   </target>
   <target name="lib.tgz">
@@ -165,6 +177,10 @@
       			  prefix="${derby.lib}/"/>
       <tarfileset dir="${basedir}/jars/insane" prefix="${derby.lib}/lib" includes="derby*.*"
 	              excludes="derby_core_plugin*"/>
+      <tarfileset dir="${basedir}/java/testing" prefix="${derby.bin}/test" 
+                  includes="README.htm"/>
+      <tarfileset dir="${basedir}/tools/java" prefix="${derby.bin}/test" 
+                  includes="jakarta-oro-2.0.8.jar"/>
     </tar>
   </target>
 
@@ -177,6 +193,10 @@
       			  prefix="${derby.lib-debug}/"/>
       <zipfileset dir="${basedir}/jars/sane" prefix="${derby.lib-debug}/lib" includes="derby*.*"
 	              excludes="derby_core_plugin*"/>
+      <zipfileset dir="${basedir}/java/testing" prefix="${derby.bin}/test" 
+                  includes="README.htm"/>
+      <zipfileset dir="${basedir}/tools/java" prefix="${derby.bin}/test" 
+                  includes="jakarta-oro-2.0.8.jar"/>
     </zip>
   </target>
   <target name="lib-debug.tgz">
@@ -186,6 +206,10 @@
       			  prefix="${derby.lib-debug}/"/>
       <tarfileset dir="${basedir}/jars/sane" prefix="${derby.lib-debug}/lib" includes="derby*.*"
 	              excludes="derby_core_plugin*"/>
+      <tarfileset dir="${basedir}/java/testing" prefix="${derby.bin}/test" 
+                  includes="README.htm"/>
+      <tarfileset dir="${basedir}/tools/java" prefix="${derby.bin}/test" 
+                  includes="jakarta-oro-2.0.8.jar"/>
     </tar>
   </target>