db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r376904 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests: master/ suites/ tests/jdbcapi/
Date Sat, 11 Feb 2006 01:29:11 GMT
Author: kmarsden
Date: Fri Feb 10 17:29:09 2006
New Revision: 376904

URL: http://svn.apache.org/viewcvs?rev=376904&view=rev
Log:
DERBY-210 test case checkin in preparation for DERBY-210 fix
 Attaching second patch 'derby-210-patch2.diff' which adds a test to jdbcapi suite for this
issue. Patch does the following:

* Adds a test derbyStress.java to jdbcapi suite. This test is based on the repro for this
patch.
* Excludes the new test from running with client driver, jcc and j9 because it gives out of
memory error. Once derby-210 is resolved, this test should pass with client driver and the
exclude must be removed from DerbyNetClient.exclude
* Creates 'derbyStress_app.properties' with following property 'jvmflags=-Xmx64M' to guarantee
the test fails on all machines with the current client driver.

I ran jdbcapi suite with all frameworks using Sun JDK1.4.2 on Windows XP. Verified that the
new test gets run with embedded and is skipped for client and jcc frameworks. Also ran the
new test with j9 vms. Verified it passes with j9_foundation and is skipped for other j9s.
Please take a look at this patch.

Contributed by Deepa Remesh


Added:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/derbyStress.out
  (with props)
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/derbyStress.java
  (with props)
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/derbyStress_app.properties
  (with props)
Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNet.exclude
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClient.exclude
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdbcapi.runall
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/copyfiles.ant

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/derbyStress.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/derbyStress.out?rev=376904&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/derbyStress.out
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/derbyStress.out
Fri Feb 10 17:29:09 2006
@@ -0,0 +1,4 @@
+Test derbyStress starting
+Testing with 2000 prepared statements
+PASS -- Prepared statement test
+Test derbyStress finished.
\ No newline at end of file

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/derbyStress.out
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNet.exclude
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNet.exclude?rev=376904&r1=376903&r2=376904&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNet.exclude
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNet.exclude
Fri Feb 10 17:29:09 2006
@@ -30,3 +30,6 @@
 jdbcapi/dataSourceReference.java
 #no XA for JCC
 jdbcapi/savepointJdbc30_XA.java
+# excluding jdbcapi/derbyStress.java - jcc runs out of memory with this test
+jdbcapi/derbyStress.java
+

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClient.exclude
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClient.exclude?rev=376904&r1=376903&r2=376904&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClient.exclude
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClient.exclude
Fri Feb 10 17:29:09 2006
@@ -7,6 +7,7 @@
 # excluding jdbcapi/checkDataSource30.java - Client behaves differently. Need to look into
this
 # excluding jdbcapi/statementJdbc30.java - Client behaves differently. Need to look into
this
 # excluding jdbcapi/dataSourceReference.java - client side only tests, tests all data sources
+# excluding jdbcapi/derbyStress.java - till DERBY-210 is fixed
 #           regardless of framework
 lang/errorStream.java
 # lang/scrollCursors2.java
@@ -16,4 +17,5 @@
 jdbcapi/resultsetJdbc30.java
 jdbcapi/checkDataSource30.java
 jdbcapi/statementJdbc30.java
-jdbcapi/dataSourceReference.java
\ No newline at end of file
+jdbcapi/dataSourceReference.java
+jdbcapi/derbyStress.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdbcapi.runall
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdbcapi.runall?rev=376904&r1=376903&r2=376904&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdbcapi.runall
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdbcapi.runall
Fri Feb 10 17:29:09 2006
@@ -1,6 +1,7 @@
 jdbcapi/bestrowidentifier.sql
 jdbcapi/characterStreams.java
 jdbcapi/checkDriver.java
+jdbcapi/derbyStress.java
 jdbcapi/nullSQLText.java
 jdbcapi/prepStmtMetaData.java
 jdbcapi/resultset.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=376904&r1=376903&r2=376904&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
Fri Feb 10 17:29:09 2006
@@ -14,6 +14,7 @@
 dbMetaDataJdbc30_sed.properties
 default_app.properties
 default_derby.properties
+derbyStress_app.properties
 empty.txt
 getCurConnJdbc20_app.properties
 getCurConnJdbc20.sql

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/derbyStress.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/derbyStress.java?rev=376904&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/derbyStress.java
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/derbyStress.java
Fri Feb 10 17:29:09 2006
@@ -0,0 +1,120 @@
+/*
+
+Derby - Class org.apache.derbyTesting.functionTests.tests.jdbcapi.derbyStress
+
+Copyright 1999, 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.
+
+*/
+
+package org.apache.derbyTesting.functionTests.tests.jdbcapi;
+
+import java.sql.Connection;
+import java.sql.Statement;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import org.apache.derby.tools.ij;
+import org.apache.derbyTesting.functionTests.util.TestUtil;
+
+public class derbyStress {
+	
+	private static String[] testObjects = {"table t1"};
+	
+	private static int numConn = 1;
+	private static int numRows = 100;
+	private static int numPreparedStmts = 2000; 
+
+	public static void main(String[] args) {
+		try {
+			System.out.println("Test derbyStress starting");
+
+			// use the ij utility to read the property file and
+			// make the initial connection.
+			ij.getPropertyArg(args);
+			Connection conn = null;
+			
+			for (int i = 0; i < numConn; i++) {
+				 conn = ij.startJBMS();
+				 System.out.println("Testing with " + numPreparedStmts + " prepared statements");
+				 prepStmtTest(conn, numRows, numPreparedStmts);
+				 System.out.println("PASS -- Prepared statement test");
+				 conn.close();
+			}
+			System.out.println("Test derbyStress finished.");
+		} catch (SQLException se) {
+			TestUtil.dumpSQLExceptions(se);
+		} catch (Throwable e) {
+			System.out.println("FAIL -- unexpected exception caught in main():\n");
+			System.out.println(e.getMessage());
+			e.printStackTrace();
+		}
+	}
+	
+	private static void createTables(Connection conn, int numRows) throws SQLException{
+		Statement stmt = conn.createStatement();
+		
+		TestUtil.cleanUpTest(stmt, testObjects);
+		
+		stmt.execute("create table t1 (lvc  LONG VARCHAR)");
+		stmt.close();
+		
+		String insertTabSql = "insert into t1 values(?)";
+		PreparedStatement ps = conn.prepareStatement(insertTabSql);
+		 for (int i = 0; i < numRows; i++)
+		 {
+			 ps.setString(1,"Hello" + i);
+			 ps.executeUpdate();
+		 }
+		 ps.close();
+	}
+	
+	// Tests prepared statements are not leaked if not explicitly closed by
+	// user (DERBY-210)
+	private static void prepStmtTest(Connection conn, int numRows, int numPreparedStmts) throws
Exception
+	{
+		PreparedStatement ps = null;
+		ResultSet rs = null;
+		conn.setAutoCommit(false);
+		 
+		try {
+		
+			createTables(conn, numRows);
+			
+			String selTabSql = "select * from t1";
+			
+			for (int i = 0 ; i  < numPreparedStmts; i++)
+			{
+				ps = conn.prepareStatement(selTabSql);
+				rs = ps.executeQuery();
+
+				while (rs.next())
+				{
+					rs.getString(1);
+				}
+
+				rs.close();
+			
+				// Do not close the prepared statement
+				//ps.close();
+			}
+			conn.commit();
+		} 
+		catch (SQLException e) {
+			TestUtil.dumpSQLExceptions(e);
+			conn.rollback();
+		}
+	}
+}

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/derbyStress.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/derbyStress_app.properties
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/derbyStress_app.properties?rev=376904&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/derbyStress_app.properties
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/derbyStress_app.properties
Fri Feb 10 17:29:09 2006
@@ -0,0 +1,5 @@
+usedefaults=true
+jvmflags=-Xmx64M
+
+#OutOfMemoryError when run with j9. It passes with j9 foundation profile
+runwithj9=false

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/derbyStress_app.properties
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message