db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r126461 - in incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests: master tests/jdbcapi
Date Wed, 26 Jan 2005 03:54:07 GMT
Author: djd
Date: Tue Jan 25 19:54:05 2005
New Revision: 126461

URL: http://svn.apache.org/viewcvs?view=rev&rev=126461
Log:
Add test cases for changes made in svn revision 126039 for fix to Derby-130

Modified:
   incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource.out
   incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource30.out
   incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource.out
Url: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource.out?view=diff&rev=126461&p1=incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource.out&r1=126460&p2=incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource.out&r2=126461
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource.out
(original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource.out
Tue Jan 25 19:54:05 2005
@@ -55,6 +55,11 @@
 EVENT(1):connectionClosed
 expected SQL Exception: No current connection.
 expected SQL Exception: No current connection.
+Start testPoolReset EmbeddedConnectionPoolDataSource
+IDENTITY_VAL_LOCAL=1
+IDENTITY_VAL_LOCAL=2
+IDENTITY_VAL_LOCAL=3
+End testPoolReset EmbeddedConnectionPoolDataSource
 Running connection checks on EmbeddedXADataSource
   isolation level 2
   auto commit     true
@@ -70,6 +75,11 @@
 EmbeddedXADataSource <closedstmt>.execute() XJ012 - 'Statement' already closed.
 Changes rolled back OK in auto closed local XAConnection
 EVENT(3):connectionClosed
+Start testPoolReset EmbeddedXADataSource
+IDENTITY_VAL_LOCAL=1
+IDENTITY_VAL_LOCAL=2
+IDENTITY_VAL_LOCAL=3
+End testPoolReset EmbeddedXADataSource
 ERROR XJ015: Derby system shutdown.
 Running connection checks on Nested
   isolation level 2

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource30.out
Url: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource30.out?view=diff&rev=126461&p1=incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource30.out&r1=126460&p2=incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource30.out&r2=126461
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource30.out
(original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource30.out
Tue Jan 25 19:54:05 2005
@@ -67,6 +67,11 @@
 EVENT(1):connectionClosed
 expected SQL Exception: No current connection.
 expected SQL Exception: No current connection.
+Start testPoolReset EmbeddedConnectionPoolDataSource
+IDENTITY_VAL_LOCAL=1
+IDENTITY_VAL_LOCAL=2
+IDENTITY_VAL_LOCAL=3
+End testPoolReset EmbeddedConnectionPoolDataSource
 Running JDBC 3.0 connection checks on EmbeddedXADataSource
   holdability     true
 JDBC 3.0 savepoint SQL Exception: Cannot issue savepoint when autoCommit is on.
@@ -85,6 +90,11 @@
 EmbeddedXADataSource <closedstmt>.execute() XJ012 - 'Statement' already closed.
 Changes rolled back OK in auto closed local XAConnection
 EVENT(3):connectionClosed
+Start testPoolReset EmbeddedXADataSource
+IDENTITY_VAL_LOCAL=1
+IDENTITY_VAL_LOCAL=2
+IDENTITY_VAL_LOCAL=3
+End testPoolReset EmbeddedXADataSource
 ERROR XJ015: Derby system shutdown.
 Running connection checks on Nested
   isolation level 2

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java
Url: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java?view=diff&rev=126461&p1=incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java&r1=126460&p2=incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java&r2=126461
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java
(original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java
Tue Jan 25 19:54:05 2005
@@ -143,7 +143,7 @@
 		pc.close();
 		pc = null;
 
-
+		testPoolReset("EmbeddedConnectionPoolDataSource", dsp.getPooledConnection());
 
 
 		EmbeddedXADataSource dscsx = new EmbeddedXADataSource();
@@ -183,6 +183,9 @@
 		xac.close();
 		xac = null;
 
+		testPoolReset("EmbeddedXADataSource", dsx.getXAConnection());
+
+
 
 		try {
 			DriverManager.getConnection("jdbc:derby:;shutdown=true");
@@ -1214,6 +1217,57 @@
 		return "unknown";
 	}
 
+	/**
+		When a connection is being pooled, the underlying JDBC embedded
+		connection object is re-used. As each application gets a new
+		Connection object, that is really a wrapper around the old connection
+		it should reset any connection spoecific state on the embedded connection
+		object.
+	*/
+	private static void testPoolReset(String type, PooledConnection pc) throws SQLException
+	{
+		System.out.println("Start testPoolReset " + type);
+		testPoolResetWork("C", pc.getConnection());
+		testPoolResetWork("", pc.getConnection());
+		testPoolResetWork("D", pc.getConnection());
+
+		pc.close();
+		System.out.println("End testPoolReset " + type);
+	}
+
+	private static void testPoolResetWork(String tableAction, Connection conn) throws SQLException
+	{
+		Statement s = conn.createStatement();
+		if (tableAction.equals("C"))
+		{
+			s.execute("CREATE TABLE testPoolResetWork (id int generated always as identity, name varchar(25))");
+		}
+
+		ResultSet rs = s.executeQuery("VALUES IDENTITY_VAL_LOCAL()");
+		rs.next();
+		String val = rs.getString(1);
+		if (!rs.wasNull() || (val != null))
+			System.out.println("FAIL - initial call to IDENTITY_VAL_LOCAL is not NULL!" + val);
+		rs.close();
+
+		s.executeUpdate("INSERT INTO testPoolResetWork(name) values ('derby-222')");
+
+		rs = s.executeQuery("VALUES IDENTITY_VAL_LOCAL()");
+		rs.next();
+		val = rs.getString(1);
+		System.out.println("IDENTITY_VAL_LOCAL=" + val);
+		rs.close();
+
+		if (tableAction.equals("D"))
+		{
+			s.execute("DROP TABLE testPoolResetWork");
+		}
+
+
+		s.close();
+		conn.close();
+
+	}
 
 }
 class cdsXid implements Xid, Serializable

Mime
View raw message