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 km...@apache.org on 2006/02/18 21:18:34 UTC

svn commit: r378771 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java

Author: kmarsden
Date: Sat Feb 18 12:18:31 2006
New Revision: 378771

URL: http://svn.apache.org/viewcvs?rev=378771&view=rev
Log:
DERBY-435 patch 3 continuing work to bring checkDataSource into client testing
This patch disables some instances of setTransactionIsolation for client because it causes a statement closed exception in some contexts.
This bug makes it hard to analyse the isolation testing in this test with client.


Also exposes a bug that client returns an invalid connection for Statement.getConnection for connections obtained from a connection pool datasource.
 

No change to the embedded tests and not yet enabled for client.


Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java?rev=378771&r1=378770&r2=378771&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java Sat Feb 18 12:18:31 2006
@@ -78,7 +78,7 @@
 	// Embedded automatically rolls back any activity on the connection.
 	// Client requires the user to rollback and gives an SQLException  
 	// java.sql.Connection.close() requested while a transaction is in progress
-	// I think client is right here (kmarsden), the user should have to rollback 
+	// This has been filed as DERBY-1004 
 	private static boolean needRollbackBeforePCGetConnection = 
 		TestUtil.isDerbyNetClientFramework(); 
 		
@@ -111,6 +111,11 @@
 	 */
 	private final Object nogc = SecurityCheck.class;
   
+	// setTransactionIsolation in some contexts used in this test is 
+	// causing  java.sql.SQLException: Invalid operation: statement closed
+	// error on client. These cases are omitted for now where they cause the
+	// statement closed error
+	private static boolean  causesStmtClosedOnSetTransactionIsolation = TestUtil.isDerbyNetClientFramework();
 
 	public static void main(String[] args) throws Exception {
 
@@ -358,7 +363,8 @@
 		printState("initial local", cs1);
 		xar.start(xid, XAResource.TMNOFLAGS);
 		printState("initial  X1", cs1);
-		cs1.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
+		if (!causesStmtClosedOnSetTransactionIsolation)
+			cs1.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
 		cs1.setReadOnly(true);
 		setHoldability(cs1, false);
 		printState("modified X1", cs1);
@@ -366,6 +372,7 @@
 		// the underlying local transaction/connection must pick up the
 		// state of the Connection handle cs1
 		printState("modified local", cs1);
+		
 		cs1.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
 		cs1.setReadOnly(false);
 		setHoldability(cs1, false);
@@ -401,7 +408,10 @@
 		// attach to the global and commit it.
 		// state should be that of the local after the commit.
 		cs1 = xac.getConnection();
-		cs1.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
+		if (! causesStmtClosedOnSetTransactionIsolation)
+		{
+			cs1.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
+		}
 		printState("pre-X1 commit - local", cs1);
 		xar.start(xid, XAResource.TMJOIN);
 		printState("pre-X1 commit - X1", cs1);