List:Commits« Previous MessageNext Message »
From:mmatthews Date:March 14 2007 6:52pm
Subject:Connector/J commit: r6345 - in trunk/connector-j/src/testsuite: . regression simple
View as plain text  
Modified:
   trunk/connector-j/src/testsuite/BaseTestCase.java
   trunk/connector-j/src/testsuite/regression/CallableStatementRegressionTest.java
   trunk/connector-j/src/testsuite/regression/ConnectionRegressionTest.java
   trunk/connector-j/src/testsuite/regression/StatementRegressionTest.java
   trunk/connector-j/src/testsuite/simple/ConnectionTest.java
   trunk/connector-j/src/testsuite/simple/StatementsTest.java
Log:
Added a new variant of getConnectionWithProps() that takes a comma-delimited string of
key-value pairs.

Modified: trunk/connector-j/src/testsuite/BaseTestCase.java
===================================================================
--- trunk/connector-j/src/testsuite/BaseTestCase.java	2007-03-14 17:33:54 UTC (rev 6344)
+++ trunk/connector-j/src/testsuite/BaseTestCase.java	2007-03-14 17:52:26 UTC (rev 6345)
@@ -36,11 +36,13 @@
 import java.sql.SQLException;
 import java.sql.Statement;
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
 import java.util.Properties;
 
 import com.mysql.jdbc.NonRegisteringDriver;
+import com.mysql.jdbc.StringUtils;
 
 import junit.framework.TestCase;
 
@@ -199,6 +201,28 @@
 		}
 	}
 
+	protected Connection getConnectionWithProps(String propsList) throws SQLException {
+		return getConnectionWithProps(dbUrl, propsList);
+	}
+
+	protected Connection getConnectionWithProps(String url, String propsList) throws
SQLException {
+		Properties props = new Properties();
+		
+		if (propsList != null) {
+			List keyValuePairs = StringUtils.split(propsList, ",", false);
+			
+			Iterator iter = keyValuePairs.iterator();
+			
+			while (iter.hasNext()) {
+				String kvp = (String)iter.next();
+				List splitUp = StringUtils.split(kvp, "=", false);
+				props.setProperty(splitUp.get(0).toString().trim(), splitUp.get(1).toString());
+			}
+		}
+		
+		return getConnectionWithProps(url, props);
+	}
+	
 	/**
 	 * Returns a new connection with the given properties
 	 * 

Modified: trunk/connector-j/src/testsuite/regression/CallableStatementRegressionTest.java
===================================================================
---
trunk/connector-j/src/testsuite/regression/CallableStatementRegressionTest.java	2007-03-14
17:33:54 UTC (rev 6344)
+++
trunk/connector-j/src/testsuite/regression/CallableStatementRegressionTest.java	2007-03-14
17:52:26 UTC (rev 6345)
@@ -587,7 +587,7 @@
 						.executeUpdate("DROP PROCEDURE IF EXISTS testBug12417");
 				this.stmt.executeUpdate("CREATE PROCEDURE testBug12417()\n"
 						+ "BEGIN\n" + "SELECT 1;" + "end\n");
-				ucCatalogConn = getConnectionWithProps(null);
+				ucCatalogConn = getConnectionWithProps((String)null);
 				ucCatalogConn.setCatalog(this.conn.getCatalog().toUpperCase());
 				ucCatalogConn.prepareCall("{call testBug12417()}");
 			} finally {

Modified: trunk/connector-j/src/testsuite/regression/ConnectionRegressionTest.java
===================================================================
--- trunk/connector-j/src/testsuite/regression/ConnectionRegressionTest.java	2007-03-14
17:33:54 UTC (rev 6344)
+++ trunk/connector-j/src/testsuite/regression/ConnectionRegressionTest.java	2007-03-14
17:52:26 UTC (rev 6345)
@@ -311,7 +311,7 @@
 
 		boolean isReadOnly = reconnectableConn.isReadOnly();
 
-		Connection killConn = getConnectionWithProps(null);
+		Connection killConn = getConnectionWithProps((String)null);
 
 		killConn.createStatement().executeUpdate("KILL " + connectionId);
 		Thread.sleep(2000);
@@ -710,7 +710,7 @@
 		props.setProperty("maxReconnects", "1");
 
 		Connection failoverConnection = null;
-		Connection killerConnection = getConnectionWithProps(null);
+		Connection killerConnection = getConnectionWithProps((String)null);
 
 		try {
 			failoverConnection = getConnectionWithProps("jdbc:mysql://"
@@ -1877,7 +1877,7 @@
 	public void testBug25514() throws Exception {
 
 		for (int i = 0; i < 10; i++) {
-			getConnectionWithProps(null).close();
+			getConnectionWithProps((String)null).close();
 		}
 		
 		ThreadGroup root = Thread.currentThread().getThreadGroup().getParent();

Modified: trunk/connector-j/src/testsuite/regression/StatementRegressionTest.java
===================================================================
--- trunk/connector-j/src/testsuite/regression/StatementRegressionTest.java	2007-03-14
17:33:54 UTC (rev 6344)
+++ trunk/connector-j/src/testsuite/regression/StatementRegressionTest.java	2007-03-14
17:52:26 UTC (rev 6345)
@@ -440,7 +440,7 @@
 		Statement stmt2 = null;
 
 		try {
-			conn2 = getConnectionWithProps(null);
+			conn2 = getConnectionWithProps((String)null);
 			stmt2 = conn2.createStatement();
 
 			conn2.close();
@@ -2742,7 +2742,7 @@
 
 	public void testServerPrepStmtDeadlock() throws Exception {
 
-		Connection c = getConnectionWithProps(null);
+		Connection c = getConnectionWithProps((String)null);
 
 		Thread testThread1 = new PrepareThread(c);
 		Thread testThread2 = new PrepareThread(c);
@@ -3364,7 +3364,7 @@
 		Statement cancelStmt = null;
 		
 		try {
-			closedConn = getConnectionWithProps(null);
+			closedConn = getConnectionWithProps((String)null);
 			cancelStmt = closedConn.createStatement();
 		
 			closedConn.close();

Modified: trunk/connector-j/src/testsuite/simple/ConnectionTest.java
===================================================================
--- trunk/connector-j/src/testsuite/simple/ConnectionTest.java	2007-03-14 17:33:54 UTC
(rev 6344)
+++ trunk/connector-j/src/testsuite/simple/ConnectionTest.java	2007-03-14 17:52:26 UTC
(rev 6345)
@@ -1099,7 +1099,7 @@
 	}
 
 	public void testPing() throws SQLException {
-		Connection conn2 = getConnectionWithProps(null);
+		Connection conn2 = getConnectionWithProps((String)null);
 
 		((com.mysql.jdbc.Connection) conn2).ping();
 		conn2.close();

Modified: trunk/connector-j/src/testsuite/simple/StatementsTest.java
===================================================================
--- trunk/connector-j/src/testsuite/simple/StatementsTest.java	2007-03-14 17:33:54 UTC
(rev 6344)
+++ trunk/connector-j/src/testsuite/simple/StatementsTest.java	2007-03-14 17:52:26 UTC
(rev 6345)
@@ -540,7 +540,7 @@
 			Connection cancelConn = null;
 	
 			try {
-				cancelConn = getConnectionWithProps(null);
+				cancelConn = getConnectionWithProps((String)null);
 				final Statement cancelStmt = cancelConn.createStatement();
 			
 				cancelStmt.setQueryTimeout(1);

Thread
Connector/J commit: r6345 - in trunk/connector-j/src/testsuite: . regression simplemmatthews14 Mar