You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ma...@apache.org on 2012/04/29 22:37:35 UTC

svn commit: r1331992 - in /commons/proper/dbcp/trunk/src: java/org/apache/commons/dbcp2/datasources/ site/xdoc/ site/xdoc/guide/ test/org/apache/commons/dbcp2/ test/org/apache/commons/dbcp2/datasources/ test/org/apache/commons/dbcp2/managed/

Author: markt
Date: Sun Apr 29 20:37:35 2012
New Revision: 1331992

URL: http://svn.apache.org/viewvc?rev=1331992&view=rev
Log:
More maxWait -> maxWaitMillis

Modified:
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/package.html
    commons/proper/dbcp/trunk/src/site/xdoc/configuration.xml
    commons/proper/dbcp/trunk/src/site/xdoc/guide/jndi-howto.xml
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestBasicDataSource.java
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestConnectionPool.java
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestPoolingDataSource.java
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestPoolingDriver.java
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestPerUserPoolDataSource.java
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestSharedPoolDataSource.java
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/managed/TestManagedDataSource.java

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/package.html
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/package.html?rev=1331992&r1=1331991&r2=1331992&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/package.html (original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/package.html Sun Apr 29 20:37:35 2012
@@ -151,7 +151,7 @@ public class Pool
         SharedPoolDataSource tds = new SharedPoolDataSource();
         tds.setConnectionPoolDataSource(cpds);
         tds.setMaxActive(10);
-        tds.setMaxWait(50);
+        tds.setMaxWaitMillis(50);
 
         ds = tds;
     }

Modified: commons/proper/dbcp/trunk/src/site/xdoc/configuration.xml
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/site/xdoc/configuration.xml?rev=1331992&r1=1331991&r2=1331992&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/site/xdoc/configuration.xml (original)
+++ commons/proper/dbcp/trunk/src/site/xdoc/configuration.xml Sun Apr 29 20:37:35 2012
@@ -35,7 +35,7 @@
 maxActive
 maxIdle
 minIdle
-maxWait
+maxWaitMillis
 testOnBorrow
 testOnReturn
 timeBetweenEvictionRunsMillis
@@ -162,7 +162,7 @@ testWhileIdle
    </td>
 </tr>
 <tr>
-   <td>maxWait</td>
+   <td>maxWaitMillis</td>
    <td>indefinitely</td>
    <td>
       The maximum number of milliseconds that the pool will wait (when there

Modified: commons/proper/dbcp/trunk/src/site/xdoc/guide/jndi-howto.xml
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/site/xdoc/guide/jndi-howto.xml?rev=1331992&r1=1331991&r2=1331992&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/site/xdoc/guide/jndi-howto.xml (original)
+++ commons/proper/dbcp/trunk/src/site/xdoc/guide/jndi-howto.xml Sun Apr 29 20:37:35 2012
@@ -93,7 +93,7 @@
   ref.add(new StringRefAddr("dataSourceName", "jdbc/cpds"));
   ref.add(new StringRefAddr("defaultMaxActive", "100"));
   ref.add(new StringRefAddr("defaultMaxIdle", "30"));
-  ref.add(new StringRefAddr("defaultMaxWait", "10000"));
+  ref.add(new StringRefAddr("defaultMaxWaitMillis", "10000"));
   ic.rebind("jdbc/peruser", ref);
      
   // Use

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestBasicDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestBasicDataSource.java?rev=1331992&r1=1331991&r2=1331992&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestBasicDataSource.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestBasicDataSource.java Sun Apr 29 20:37:35 2012
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You 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.
@@ -30,7 +30,7 @@ import junit.framework.TestSuite;
 
 /**
  * TestSuite for BasicDataSource
- * 
+ *
  * @author Dirk Verbeeck
  * @version $Revision$ $Date$
  */
@@ -58,7 +58,7 @@ public class TestBasicDataSource extends
         ds.setDriverClassName("org.apache.commons.dbcp2.TesterDriver");
         ds.setUrl("jdbc:apache:commons:testdriver");
         ds.setMaxTotal(getMaxTotal());
-        ds.setMaxWaitMillis(getMaxWait());
+        ds.setMaxWaitMillis(getMaxWaitMillis());
         ds.setDefaultAutoCommit(true);
         ds.setDefaultReadOnly(false);
         ds.setDefaultTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
@@ -116,7 +116,7 @@ public class TestBasicDataSource extends
         // both wrapper and raw active connection should be closed
         assertTrue(activeConnection.isClosed());
         assertTrue(rawActiveConnection.isClosed());
-        
+
         // Verify SQLException on getConnection after close
         try {
             getConnection();
@@ -124,10 +124,10 @@ public class TestBasicDataSource extends
         } catch (SQLException ex) {
             // Expected
         }
-        
+
         // Redundant close is OK
         ds.close();
-        
+
     }
 
     public void testSetProperties() throws Exception {
@@ -180,22 +180,22 @@ public class TestBasicDataSource extends
             // expected
         }
     }
-    
+
     public void testTransactionIsolationBehavior() throws Exception {
         Connection conn = getConnection();
         assertNotNull(conn);
         assertEquals(Connection.TRANSACTION_READ_COMMITTED, conn.getTransactionIsolation());
         conn.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
         conn.close();
-        
+
         Connection conn2 = getConnection();
         assertEquals(Connection.TRANSACTION_READ_COMMITTED, conn2.getTransactionIsolation());
-        
+
         Connection conn3 = getConnection();
         assertEquals(Connection.TRANSACTION_READ_COMMITTED, conn3.getTransactionIsolation());
 
         conn2.close();
-        
+
         conn3.close();
     }
 
@@ -204,16 +204,16 @@ public class TestBasicDataSource extends
         // this also needs access to the underlying connection
         ds.setAccessToUnderlyingConnectionAllowed(true);
         super.testPooling();
-    }    
-    
+    }
+
     public void testNoAccessToUnderlyingConnectionAllowed() throws Exception {
         // default: false
         assertEquals(false, ds.isAccessToUnderlyingConnectionAllowed());
-        
+
         Connection conn = getConnection();
         Connection dconn = ((DelegatingConnection) conn).getDelegate();
         assertNull(dconn);
-        
+
         dconn = ((DelegatingConnection) conn).getInnermostDelegate();
         assertNull(dconn);
     }
@@ -221,20 +221,20 @@ public class TestBasicDataSource extends
     public void testAccessToUnderlyingConnectionAllowed() throws Exception {
         ds.setAccessToUnderlyingConnectionAllowed(true);
         assertEquals(true, ds.isAccessToUnderlyingConnectionAllowed());
-        
+
         Connection conn = getConnection();
         Connection dconn = ((DelegatingConnection) conn).getDelegate();
         assertNotNull(dconn);
-        
+
         dconn = ((DelegatingConnection) conn).getInnermostDelegate();
         assertNotNull(dconn);
-        
+
         assertTrue(dconn instanceof TesterConnection);
     }
-    
+
     public void testEmptyValidationQuery() throws Exception {
         assertNotNull(ds.getValidationQuery());
-        
+
         ds.setValidationQuery("");
         assertNull(ds.getValidationQuery());
 
@@ -254,7 +254,7 @@ public class TestBasicDataSource extends
             }
         }
     }
-    
+
     public void testValidationQueryTimoutFail() {
         ds.setTestOnBorrow(true);
         ds.setValidationQueryTimeout(3); // Too fast for TesterStatement
@@ -267,7 +267,7 @@ public class TestBasicDataSource extends
             }
         }
     }
-    
+
     public void testValidationQueryTimeoutZero() throws Exception {
         ds.setTestOnBorrow(true);
         ds.setTestOnReturn(true);
@@ -275,7 +275,7 @@ public class TestBasicDataSource extends
         Connection con = ds.getConnection();
         con.close();
     }
-    
+
     public void testValidationQueryTimeoutNegative() throws Exception {
         ds.setTestOnBorrow(true);
         ds.setTestOnReturn(true);
@@ -283,7 +283,7 @@ public class TestBasicDataSource extends
         Connection con = ds.getConnection();
         con.close();
     }
-    
+
     public void testValidationQueryTimeoutSucceed() throws Exception {
         ds.setTestOnBorrow(true);
         ds.setTestOnReturn(true);
@@ -341,7 +341,7 @@ public class TestBasicDataSource extends
         ds.setTestOnReturn(true);
         ds.setTestWhileIdle(true);
         ds.setValidationQuery("");
-        
+
         Connection conn = ds.getConnection();
         conn.close();
 
@@ -349,35 +349,35 @@ public class TestBasicDataSource extends
         assertEquals(false, ds.getTestOnReturn());
         assertEquals(false, ds.getTestWhileIdle());
     }
-    
+
     public void testDefaultCatalog() throws Exception {
         Connection[] c = new Connection[getMaxTotal()];
         for (int i = 0; i < c.length; i++) {
             c[i] = getConnection();
             assertTrue(c[i] != null);
-            assertEquals(CATALOG, c[i].getCatalog()); 
+            assertEquals(CATALOG, c[i].getCatalog());
         }
 
         for (int i = 0; i < c.length; i++) {
             c[i].setCatalog("error");
             c[i].close();
         }
-        
+
         for (int i = 0; i < c.length; i++) {
             c[i] = getConnection();
             assertTrue(c[i] != null);
-            assertEquals(CATALOG, c[i].getCatalog()); 
-        }        
+            assertEquals(CATALOG, c[i].getCatalog());
+        }
 
         for (int i = 0; i < c.length; i++) {
             c[i].close();
         }
     }
-    
+
     public void testSetAutoCommitTrueOnClose() throws Exception {
         ds.setAccessToUnderlyingConnectionAllowed(true);
         ds.setDefaultAutoCommit(false);
-        
+
         Connection conn = getConnection();
         assertNotNull(conn);
         assertEquals(false, conn.getAutoCommit());
@@ -405,17 +405,17 @@ public class TestBasicDataSource extends
     }
 
     // Bugzilla Bug 28251:  Returning dead database connections to BasicDataSource
-    // isClosed() failure blocks returning a connection to the pool 
+    // isClosed() failure blocks returning a connection to the pool
     public void testIsClosedFailure() throws SQLException {
         ds.setAccessToUnderlyingConnectionAllowed(true);
         Connection conn = ds.getConnection();
         assertNotNull(conn);
         assertEquals(1, ds.getNumActive());
-        
+
         // set an IO failure causing the isClosed mathod to fail
         TesterConnection tconn = (TesterConnection) ((DelegatingConnection)conn).getInnermostDelegate();
         tconn.setFailure(new IOException("network error"));
-        
+
         try {
             conn.close();
             fail("Expected SQLException");
@@ -424,40 +424,40 @@ public class TestBasicDataSource extends
 
         assertEquals(0, ds.getNumActive());
     }
-    
-    /** 
-     * Bugzilla Bug 29054: 
-     * The BasicDataSource.setTestOnReturn(boolean) is not carried through to 
+
+    /**
+     * Bugzilla Bug 29054:
+     * The BasicDataSource.setTestOnReturn(boolean) is not carried through to
      * the GenericObjectPool variable _testOnReturn.
-     */ 
+     */
     public void testPropertyTestOnReturn() throws Exception {
         ds.setValidationQuery("select 1 from dual");
         ds.setTestOnBorrow(false);
         ds.setTestWhileIdle(false);
         ds.setTestOnReturn(true);
-        
+
         Connection conn = ds.getConnection();
         assertNotNull(conn);
-        
+
         assertEquals(false, ds.connectionPool.getTestOnBorrow());
         assertEquals(false, ds.connectionPool.getTestWhileIdle());
         assertEquals(true, ds.connectionPool.getTestOnReturn());
     }
-    
+
     /**
      * Bugzilla Bug 29055: AutoCommit and ReadOnly
-     * The DaffodilDB driver throws an SQLException if 
-     * trying to commit or rollback a readOnly connection. 
+     * The DaffodilDB driver throws an SQLException if
+     * trying to commit or rollback a readOnly connection.
      */
     public void testRollbackReadOnly() throws Exception {
         ds.setDefaultReadOnly(true);
         ds.setDefaultAutoCommit(false);
-        
+
         Connection conn = ds.getConnection();
         assertNotNull(conn);
         conn.close();
     }
-    
+
     /**
      * Bugzilla Bug 29832: Broken behaviour for BasicDataSource.setMaxTotal(0)
      * MaxTotal == 0 should throw SQLException on getConnection.
@@ -465,12 +465,12 @@ public class TestBasicDataSource extends
      */
     public void testMaxTotalZero() throws Exception {
         ds.setMaxTotal(0);
-        
+
         try {
             Connection conn = ds.getConnection();
             assertNotNull(conn);
             fail("SQLException expected");
-            
+
         } catch (SQLException e) {
             // test OK
         }
@@ -486,7 +486,7 @@ public class TestBasicDataSource extends
         ds.setDriverClassName("org.apache.commons.dbcp2.TesterDriver");
         ds.setUrl("jdbc:apache:commons:testdriver");
         ds.setMaxTotal(getMaxTotal());
-        ds.setMaxWaitMillis(getMaxWait());
+        ds.setMaxWaitMillis(getMaxWaitMillis());
         ds.setDefaultAutoCommit(true);
         ds.setDefaultReadOnly(false);
         ds.setDefaultTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
@@ -508,10 +508,10 @@ public class TestBasicDataSource extends
         // Allow one extra thread for JRockit compatibility
         assertTrue(Thread.activeCount() <= threadCount + 1);
     }
-    
+
     /**
      * JIRA DBCP-333: Check that a custom class loader is used.
-     * @throws Exception 
+     * @throws Exception
      */
     public void testDriverClassLoader() throws Exception {
         getConnection();
@@ -520,7 +520,7 @@ public class TestBasicDataSource extends
         assertTrue(cl instanceof TesterClassLoader);
         assertTrue(((TesterClassLoader) cl).didLoad(ds.getDriverClassName()));
     }
-    
+
     /**
      * JIRA: DBCP-342, DBCP-93
      * Verify that when errors occur during BasicDataSource initialization, GenericObjectPool
@@ -542,7 +542,7 @@ public class TestBasicDataSource extends
         // Set min idle > 0, so evictor will try to make connection as many as idle count
         ds.setMinIdle(2);
 
-        // Prevent concurrent execution of threads executing test subclasses 
+        // Prevent concurrent execution of threads executing test subclasses
         synchronized (TesterConnRequestCountDriver.class) {
     	    TesterConnRequestCountDriver.initConnRequestCount();
 
@@ -555,14 +555,14 @@ public class TestBasicDataSource extends
     	            // Ignore
     	        }
     	    }
- 
+
     	    // sleep 1000ms. evictor will be invoked 10 times if running.
     	    Thread.sleep(1000);
 
     	    // Make sure there have been no Evictor-generated requests (count should be 10, from requests above)
     	    assertEquals(10, TesterConnRequestCountDriver.getConnectionRequestCount());
         }
-    	
+
         // make sure cleanup is complete
         assertNull(ds.connectionPool);
     }

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestConnectionPool.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestConnectionPool.java?rev=1331992&r1=1331991&r2=1331992&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestConnectionPool.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestConnectionPool.java Sun Apr 29 20:37:35 2012
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You 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.
@@ -35,7 +35,7 @@ import junit.framework.TestCase;
 
 /**
  * Base test suite for DBCP pools.
- * 
+ *
  * @author Rodney Waldhoff
  * @author Sean C. Sullivan
  * @author John McNally
@@ -55,7 +55,7 @@ public abstract class TestConnectionPool
             Connection conn = (Connection) connections.pop();
             try {
                 conn.close();
-            } catch (Exception ex) { 
+            } catch (Exception ex) {
                 // ignore
             } finally {
                 conn = null;
@@ -64,18 +64,18 @@ public abstract class TestConnectionPool
     }
 
     protected abstract Connection getConnection() throws Exception;
-    
+
     protected int getMaxTotal() {
         return 10;
     }
-    
-    protected long getMaxWait() {
+
+    protected long getMaxWaitMillis() {
         return 100L;
     }
-    
+
     /** Connections opened during the course of a test */
     protected Stack connections = new Stack();
-    
+
     /** Acquire a connection and push it onto the connections stack */
     protected Connection newConnection() throws Exception {
         Connection connection = getConnection();
@@ -83,7 +83,7 @@ public abstract class TestConnectionPool
         return connection;
     }
 
-    // ----------- Utility Methods --------------------------------- 
+    // ----------- Utility Methods ---------------------------------
 
     protected String getUsername(Connection conn) throws SQLException {
         Statement stmt = conn.createStatement();
@@ -94,14 +94,14 @@ public abstract class TestConnectionPool
         return null;
     }
 
-    // ----------- tests --------------------------------- 
+    // ----------- tests ---------------------------------
 
     public void testClearWarnings() throws Exception {
         Connection[] c = new Connection[getMaxTotal()];
         for (int i = 0; i < c.length; i++) {
             c[i] = newConnection();
             assertTrue(c[i] != null);
-            
+
             // generate SQLWarning on connection
             c[i].prepareCall("warning");
         }
@@ -113,10 +113,10 @@ public abstract class TestConnectionPool
         for (int i = 0; i < c.length; i++) {
             c[i].close();
         }
-        
+
         for (int i = 0; i < c.length; i++) {
             c[i] = newConnection();
-        }        
+        }
 
         for (int i = 0; i < c.length; i++) {
             // warnings should have been cleared by putting the connection back in the pool
@@ -391,7 +391,7 @@ public abstract class TestConnectionPool
         conn = null;
     }
 
-    public void testPooling() throws Exception {  
+    public void testPooling() throws Exception {
         // Grab a maximal set of open connections from the pool
         Connection[] c = new Connection[getMaxTotal()];
         Connection[] u = new Connection[getMaxTotal()];
@@ -403,15 +403,15 @@ public abstract class TestConnectionPool
                 for (int j = 0; j <= i; j++) {
                     c[j].close();
                 }
-                return; // skip this test   
+                return; // skip this test
             }
-        }        
+        }
         // Close connections one at a time and get new ones, making sure
         // the new ones come from the pool
         for (int i = 0; i < c.length; i++) {
             c[i].close();
             Connection con = newConnection();
-            Connection underCon = 
+            Connection underCon =
                 ((DelegatingConnection) con).getInnermostDelegate();
             assertTrue("Failed to get connection", underCon != null);
             boolean found = false;
@@ -425,25 +425,25 @@ public abstract class TestConnectionPool
             con.close();
         }
     }
-    
+
     public void testAutoCommitBehavior() throws Exception {
         Connection conn = newConnection();
         assertNotNull(conn);
         assertTrue(conn.getAutoCommit());
         conn.setAutoCommit(false);
         conn.close();
-        
+
         Connection conn2 = newConnection();
         assertTrue( conn2.getAutoCommit() );
-        
+
         Connection conn3 = newConnection();
         assertTrue( conn3.getAutoCommit() );
 
         conn2.close();
-        
+
         conn3.close();
     }
-    
+
     /** @see "http://issues.apache.org/bugzilla/show_bug.cgi?id=12400" */
     public void testConnectionsAreDistinct() throws Exception {
         Connection[] conn = new Connection[getMaxTotal()];
@@ -514,10 +514,10 @@ public abstract class TestConnectionPool
             c[i].close();
         }
     }
-    
+
     /**
      * DBCP-128: BasicDataSource.getConnection()
-     * Connections don't work as hashtable keys 
+     * Connections don't work as hashtable keys
      */
     public void testHashing() throws Exception {
         Connection con = getConnection();
@@ -525,7 +525,7 @@ public abstract class TestConnectionPool
         hash.put(con, "test");
         assertEquals("test", hash.get(con));
         assertTrue(hash.containsKey(con));
-        assertTrue(hash.contains("test")); 
+        assertTrue(hash.contains("test"));
         hash.clear();
         con.close();
     }
@@ -613,23 +613,23 @@ public abstract class TestConnectionPool
         }
     }
 
-    // Bugzilla Bug 24328: PooledConnectionImpl ignores resultsetType 
+    // Bugzilla Bug 24328: PooledConnectionImpl ignores resultsetType
     // and Concurrency if statement pooling is not enabled
     // http://issues.apache.org/bugzilla/show_bug.cgi?id=24328
-    public void testPrepareStatementOptions() throws Exception 
+    public void testPrepareStatementOptions() throws Exception
     {
         Connection conn = newConnection();
         assertNotNull(conn);
-        PreparedStatement stmt = conn.prepareStatement("select * from dual", 
+        PreparedStatement stmt = conn.prepareStatement("select * from dual",
             ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
         assertNotNull(stmt);
         ResultSet rset = stmt.executeQuery();
         assertNotNull(rset);
         assertTrue(rset.next());
-        
+
         assertEquals(ResultSet.TYPE_SCROLL_SENSITIVE, rset.getType());
         assertEquals(ResultSet.CONCUR_UPDATABLE, rset.getConcurrency());
-        
+
         rset.close();
         stmt.close();
         conn.close();
@@ -648,7 +648,7 @@ public abstract class TestConnectionPool
         stmt.close();
         conn.close();
     }
-    
+
     // Bugzilla Bug 26966: Connectionpool's connections always returns same
     public void testHashCode() throws Exception {
         Connection conn1 = newConnection();
@@ -690,23 +690,24 @@ public abstract class TestConnectionPool
     // To pass this to a Maven test, use:
     // mvn test -DargLine="-DTestConnectionPool.display.thread.details=true"
     // @see http://jira.codehaus.org/browse/SUREFIRE-121
-    
+
     /**
      * Launches a group of 2 * getMaxTotal() threads, each of which will attempt to obtain a connection
      * from the pool, hold it for <holdTime> ms, and then return it to the pool.  If <loopOnce> is false,
      * threads will continue this process indefinitely.  If <expectError> is true, exactly 1/2 of the
      * threads are expected to either throw exceptions or fail to complete. If <expectError> is false,
      * all threads are expected to complete successfully.
-     * 
+     *
      * @param holdTime time in ms that a thread holds a connection before returning it to the pool
      * @param expectError whether or not an error is expected
      * @param loopOnce whether threads should complete the borrow - hold - return cycle only once, or loop indefinitely
-     * @param maxWait passed in by client - has no impact on the test itself, but does get reported
-     * 
+     * @param maxWaitMillis passed in by client - has no impact on the test itself, but does get reported
+     *
      * @throws Exception
      */
-    protected void multipleThreads(final int holdTime, final boolean expectError, final boolean loopOnce, final long maxWait)
-            throws Exception {
+    protected void multipleThreads(final int holdTime,
+            final boolean expectError, final boolean loopOnce,
+            final long maxWaitMillis) throws Exception {
                 long startTime = timeStamp();
                 final PoolTest[] pts = new PoolTest[2 * getMaxTotal()];
                 // Catch Exception so we can stop all threads if one fails
@@ -720,11 +721,11 @@ public abstract class TestConnectionPool
                 };
                 // Create all the threads
                 for (int i = 0; i < pts.length; i++) {
-                    pts[i] = new PoolTest(threadGroup, holdTime, expectError, loopOnce);    
+                    pts[i] = new PoolTest(threadGroup, holdTime, expectError, loopOnce);
                 }
                 // Start all the threads
                 for (int i = 0; i < pts.length; i++) {
-                    pts[i].start();    
+                    pts[i].start();
                 }
 
                 // Give all threads a chance to start and succeed
@@ -733,8 +734,8 @@ public abstract class TestConnectionPool
                 // Stop threads
                 for (int i = 0; i < pts.length; i++) {
                     pts[i].stop();
-                }   
-                
+                }
+
                 /*
                  * Wait for all threads to terminate.
                  * This is essential to ensure that all threads have a chance to update success[0]
@@ -763,13 +764,13 @@ public abstract class TestConnectionPool
                         }
                     }
                 }
-            
+
                 long time = timeStamp() - startTime;
                 System.out.println("Multithread test time = " + time
                         + " ms. Threads: " + pts.length
                         + ". Loops: " + loops
                         + ". Hold time: " + holdTime
-                        + ". Maxwait: " + maxWait
+                        + ". maxWaitMillis: " + maxWaitMillis
                         + ". Done: " + done
                         + ". Did not run: " + didNotRun
                         + ". Failed: " + failed
@@ -794,7 +795,7 @@ public abstract class TestConnectionPool
                                     + ". thrown: "+ pt.thrown
                                     + "."
                                     );
-                        }                        
+                        }
                     }
                     if (didNotRun > 0){
                         System.out.println("NOTE: some threads did not run the code: "+didNotRun);
@@ -836,7 +837,7 @@ public abstract class TestConnectionPool
         private int connHash = 0; // Connection identity hashCode (to see which one is reused)
 
         private final boolean stopOnException; // If true, don't rethrow Exception
-        
+
         private final boolean loopOnce; // If true, don't repeat loop
 
         public PoolTest(ThreadGroup threadGroup, int connHoldTime, boolean isStopOnException) {
@@ -899,7 +900,7 @@ public abstract class TestConnectionPool
                     throw new RuntimeException();
                 }
             } finally {
-                ended = timeStamp();                
+                ended = timeStamp();
             }
         }
 
@@ -913,6 +914,6 @@ public abstract class TestConnectionPool
     }
 
     long timeStamp() {
-        return System.currentTimeMillis();// JVM 1.5+ System.nanoTime() / 1000000; 
+        return System.currentTimeMillis();// JVM 1.5+ System.nanoTime() / 1000000;
     }
 }

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestPoolingDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestPoolingDataSource.java?rev=1331992&r1=1331991&r2=1331992&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestPoolingDataSource.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestPoolingDataSource.java Sun Apr 29 20:37:35 2012
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You 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.
@@ -27,7 +27,7 @@ import org.apache.commons.pool2.impl.Gen
 
 /**
  * TestSuite for PoolingDataSource
- * 
+ *
  * @version $Revision: 392677 $ $Date: 2006-04-08 21:42:24 -0700 (Sat, 08 Apr 2006) $
  */
 public class TestPoolingDataSource extends TestConnectionPool {
@@ -53,7 +53,7 @@ public class TestPoolingDataSource exten
         Properties props = new Properties();
         props.setProperty("user", "username");
         props.setProperty("password", "password");
-        PoolableConnectionFactory factory = 
+        PoolableConnectionFactory factory =
             new PoolableConnectionFactory(
                 new DriverConnectionFactory(new TesterDriver(),
                         "jdbc:apache:commons:testdriver", props));
@@ -63,7 +63,7 @@ public class TestPoolingDataSource exten
         pool = new GenericObjectPool(factory);
         factory.setPool(pool);
         pool.setMaxTotal(getMaxTotal());
-        pool.setMaxWaitMillis(getMaxWait());
+        pool.setMaxWaitMillis(getMaxWaitMillis());
         ds = new PoolingDataSource(pool);
         ds.setAccessToUnderlyingConnectionAllowed(true);
     }
@@ -73,16 +73,16 @@ public class TestPoolingDataSource exten
         pool.close();
         super.tearDown();
     }
-    
+
     public void testPoolGuardConnectionWrapperEqualsSameDelegate() throws Exception {
-        // Get a maximal set of connections from the pool 
+        // Get a maximal set of connections from the pool
         Connection[] c = new Connection[getMaxTotal()];
         for (int i = 0; i < c.length; i++) {
             c[i] = newConnection();
         }
         // Close the delegate of one wrapper in the pool
         ((DelegatingConnection) c[0]).getDelegate().close();
-        
+
         // Grab a new connection - should get c[0]'s closed connection
         // so should be delegate-equivalent, so equal
         Connection con = newConnection();
@@ -92,7 +92,7 @@ public class TestPoolingDataSource exten
             c[i].close();
         }
     }
-    
+
     /*
      * JIRA: DBCP-198
      */
@@ -104,7 +104,7 @@ public class TestPoolingDataSource exten
         assertTrue(con.equals(con2));
         con.close();
     }
-    
+
     public void testPoolGuardConnectionWrapperEqualsFail() throws Exception {
         Connection con1 = ds.getConnection();
         Connection con2 = ds.getConnection();
@@ -112,21 +112,21 @@ public class TestPoolingDataSource exten
         con1.close();
         con2.close();
     }
-    
+
     public void testPoolGuardConnectionWrapperEqualsNull() throws Exception {
         Connection con1 = ds.getConnection();
         Connection con2 = null;
         assertFalse(con1.equals(con2));
         con1.close();
     }
-    
+
     public void testPoolGuardConnectionWrapperEqualsType() throws Exception {
         Connection con1 = ds.getConnection();
         Integer con2 = new Integer(0);
         assertFalse(con1.equals(con2));
         con1.close();
     }
-    
+
     public void testestPoolGuardConnectionWrapperEqualInnermost() throws Exception {
         ds.setAccessToUnderlyingConnectionAllowed(true);
         DelegatingConnection con = (DelegatingConnection) ds.getConnection();

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestPoolingDriver.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestPoolingDriver.java?rev=1331992&r1=1331991&r2=1331992&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestPoolingDriver.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestPoolingDriver.java Sun Apr 29 20:37:35 2012
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You 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.
@@ -52,7 +52,7 @@ public class TestPoolingDriver extends T
     }
 
     private PoolingDriver driver = null;
-    
+
     @Override
     public void setUp() throws Exception {
         super.setUp();
@@ -67,7 +67,7 @@ public class TestPoolingDriver extends T
 
         GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig();
         poolConfig.setMaxTotal(getMaxTotal());
-        poolConfig.setMaxWaitMillis(getMaxWait());
+        poolConfig.setMaxWaitMillis(getMaxWaitMillis());
         poolConfig.setMinIdle(10);
         poolConfig.setTestOnBorrow(true);
         poolConfig.setTestOnReturn(true);
@@ -75,7 +75,7 @@ public class TestPoolingDriver extends T
         poolConfig.setTimeBetweenEvictionRunsMillis(10000L);
         poolConfig.setNumTestsPerEvictionRun(5);
         poolConfig.setMinEvictableIdleTimeMillis(5000L);
-        
+
         GenericObjectPool pool = new GenericObjectPool(pcf, poolConfig);
         pcf.setPool(pool);
 
@@ -90,7 +90,7 @@ public class TestPoolingDriver extends T
         driver.closePool("test");
         super.tearDown();
     }
-    
+
     public void test1() {
         ConnectionFactory connectionFactory = new DriverManagerConnectionFactory("jdbc:some:connect:string","username","password");
         PoolableConnectionFactory pcf =
@@ -118,7 +118,7 @@ public class TestPoolingDriver extends T
         Connection conn1 = getConnection();
         assertNotNull(conn1);
         assertFalse(conn1.isClosed());
-        conn1.close();        
+        conn1.close();
 
         Connection conn2 = getConnection();
         assertNotNull(conn2);
@@ -132,7 +132,7 @@ public class TestPoolingDriver extends T
         assertTrue(conn1.isClosed());
         assertFalse(conn2.isClosed());
     }
-    
+
     /** @see "http://issues.apache.org/bugzilla/show_bug.cgi?id=12400" */
     public void testReportedBug12400() throws Exception {
         GenericObjectPoolConfig config = new GenericObjectPoolConfig();
@@ -140,10 +140,10 @@ public class TestPoolingDriver extends T
         config.setMaxWaitMillis(60000);
         config.setMaxIdle(10);
         ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(
-            "jdbc:apache:commons:testdriver", 
-            "username", 
+            "jdbc:apache:commons:testdriver",
+            "username",
             "password");
-        PoolableConnectionFactory poolableConnectionFactory = 
+        PoolableConnectionFactory poolableConnectionFactory =
             new PoolableConnectionFactory(connectionFactory);
         poolableConnectionFactory.setDefaultReadOnly(false);
         poolableConnectionFactory.setDefaultAutoCommit(true);
@@ -165,12 +165,12 @@ public class TestPoolingDriver extends T
             conn[i].close();
         }
     }
-    
+
     public void testClosePool() throws Exception {
         Connection conn = DriverManager.getConnection("jdbc:apache:commons:dbcp:test");
         assertNotNull(conn);
         conn.close();
-        
+
         PoolingDriver driver2 = (PoolingDriver) DriverManager.getDriver("jdbc:apache:commons:dbcp:");
         driver2.closePool("test");
 
@@ -182,7 +182,7 @@ public class TestPoolingDriver extends T
             // OK
         }
     }
-    
+
     public void testInvalidateConnection() throws Exception {
         Connection conn = DriverManager.getConnection("jdbc:apache:commons:dbcp:test");
         assertNotNull(conn);
@@ -204,7 +204,7 @@ public class TestPoolingDriver extends T
         PrintWriter pw = new PrintWriter(new ByteArrayOutputStream());
         System.setErr(new PrintStream(new ByteArrayOutputStream()));
         SQLException ex;
-        
+
         DriverManager.setLogWriter(pw);
         ex = new SQLException("A", new Exception("a"));
         ex.printStackTrace();

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestPerUserPoolDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestPerUserPoolDataSource.java?rev=1331992&r1=1331991&r2=1331992&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestPerUserPoolDataSource.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestPerUserPoolDataSource.java Sun Apr 29 20:37:35 2012
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You 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.
@@ -69,9 +69,9 @@ public class TestPerUserPoolDataSource e
         PerUserPoolDataSource tds = new PerUserPoolDataSource();
         tds.setConnectionPoolDataSource(pcds);
         tds.setDefaultMaxTotal(getMaxTotal());
-        tds.setDefaultMaxWaitMillis((int)(getMaxWait()));
+        tds.setDefaultMaxWaitMillis((int)(getMaxWaitMillis()));
         tds.setPerUserMaxTotal("foo",new Integer(getMaxTotal()));
-        tds.setPerUserMaxWaitMillis("foo",new Integer((int)(getMaxWait())));
+        tds.setPerUserMaxWaitMillis("foo",new Integer((int)(getMaxWaitMillis())));
         tds.setDefaultTransactionIsolation(
             Connection.TRANSACTION_READ_COMMITTED);
 
@@ -85,10 +85,10 @@ public class TestPerUserPoolDataSource e
 
     /**
      * Switching 'u1 -> 'u2' and 'p1' -> 'p2' will
-     * exhibit the bug detailed in 
+     * exhibit the bug detailed in
      * http://issues.apache.org/bugzilla/show_bug.cgi?id=18905
      */
-    public void testIncorrectPassword() throws Exception 
+    public void testIncorrectPassword() throws Exception
     {
         try {
             // Use bad password
@@ -98,26 +98,26 @@ public class TestPerUserPoolDataSource e
             // should fail
 
         }
-        
+
         // Use good password
         ds.getConnection("u1", "p1").close();
-        try 
+        try
         {
             ds.getConnection("u1", "x");
             fail("Able to retrieve connection with incorrect password");
         }
         catch (SQLException e)
         {
-            if (!e.getMessage().startsWith("Given password did not match")) 
+            if (!e.getMessage().startsWith("Given password did not match"))
             {
                 throw e;
             }
             // else the exception was expected
         }
-        
+
         // Make sure we can still use our good password.
         ds.getConnection("u1", "p1").close();
-        
+
         // Try related users and passwords
         ds.getConnection("foo", "bar").close();
         try {
@@ -134,7 +134,7 @@ public class TestPerUserPoolDataSource e
 
 
     @Override
-    public void testSimple() throws Exception 
+    public void testSimple() throws Exception
     {
         Connection conn = ds.getConnection();
         assertNotNull(conn);
@@ -148,7 +148,7 @@ public class TestPerUserPoolDataSource e
         conn.close();
     }
 
-    public void testSimpleWithUsername() throws Exception 
+    public void testSimpleWithUsername() throws Exception
     {
         Connection conn = ds.getConnection("u1", "p1");
         assertNotNull(conn);
@@ -162,12 +162,12 @@ public class TestPerUserPoolDataSource e
         conn.close();
     }
 
-    public void testClosingWithUserName() 
-        throws Exception 
+    public void testClosingWithUserName()
+        throws Exception
     {
         Connection[] c = new Connection[getMaxTotal()];
         // open the maximum connections
-        for (int i=0; i<c.length; i++) 
+        for (int i=0; i<c.length; i++)
         {
             c[i] = ds.getConnection("u1", "p1");
         }
@@ -178,30 +178,30 @@ public class TestPerUserPoolDataSource e
         // get a new connection
         c[0] = ds.getConnection("u1", "p1");
 
-        for (int i=0; i<c.length; i++) 
+        for (int i=0; i<c.length; i++)
         {
             c[i].close();
         }
 
         // open the maximum connections
-        for (int i=0; i<c.length; i++) 
+        for (int i=0; i<c.length; i++)
         {
             c[i] = ds.getConnection("u1", "p1");
         }
-        for (int i=0; i<c.length; i++) 
+        for (int i=0; i<c.length; i++)
         {
             c[i].close();
         }
     }
 
     @Override
-    public void testSimple2() 
-        throws Exception 
+    public void testSimple2()
+        throws Exception
     {
         Connection conn = ds.getConnection();
         assertNotNull(conn);
 
-        PreparedStatement stmt = 
+        PreparedStatement stmt =
             conn.prepareStatement("select * from dual");
         assertNotNull(stmt);
         ResultSet rset = stmt.executeQuery();
@@ -209,7 +209,7 @@ public class TestPerUserPoolDataSource e
         assertTrue(rset.next());
         rset.close();
         stmt.close();
-        
+
         stmt = conn.prepareStatement("select * from dual");
         assertNotNull(stmt);
         rset = stmt.executeQuery();
@@ -217,14 +217,14 @@ public class TestPerUserPoolDataSource e
         assertTrue(rset.next());
         rset.close();
         stmt.close();
-        
+
         conn.close();
-        try 
+        try
         {
             conn.createStatement();
             fail("Can't use closed connections");
-        } 
-        catch(SQLException e) 
+        }
+        catch(SQLException e)
         {
             // expected
         }
@@ -247,40 +247,40 @@ public class TestPerUserPoolDataSource e
         assertTrue(rset.next());
         rset.close();
         stmt.close();
-        
+
         conn.close();
         conn = null;
     }
 
     @Override
-    public void testOpening() 
-        throws Exception 
+    public void testOpening()
+        throws Exception
     {
         Connection[] c = new Connection[getMaxTotal()];
         // test that opening new connections is not closing previous
-        for (int i=0; i<c.length; i++) 
+        for (int i=0; i<c.length; i++)
         {
             c[i] = ds.getConnection();
             assertTrue(c[i] != null);
-            for (int j=0; j<=i; j++) 
+            for (int j=0; j<=i; j++)
             {
                 assertTrue(!c[j].isClosed());
             }
         }
 
-        for (int i=0; i<c.length; i++) 
+        for (int i=0; i<c.length; i++)
         {
             c[i].close();
         }
     }
 
     @Override
-    public void testClosing() 
-        throws Exception 
+    public void testClosing()
+        throws Exception
     {
         Connection[] c = new Connection[getMaxTotal()];
         // open the maximum connections
-        for (int i=0; i<c.length; i++) 
+        for (int i=0; i<c.length; i++)
         {
             c[i] = ds.getConnection();
         }
@@ -288,25 +288,25 @@ public class TestPerUserPoolDataSource e
         // close one of the connections
         c[0].close();
         assertTrue(c[0].isClosed());
-        
+
         // get a new connection
         c[0] = ds.getConnection();
 
-        for (int i=0; i<c.length; i++) 
+        for (int i=0; i<c.length; i++)
         {
             c[i].close();
         }
     }
 
     @Override
-    public void testMaxTotal() 
-        throws Exception 
+    public void testMaxTotal()
+        throws Exception
     {
         Connection[] c = new Connection[getMaxTotal()];
-        for (int i=0; i<c.length; i++) 
+        for (int i=0; i<c.length; i++)
         {
             c[i] = ds.getConnection();
-            assertTrue(c[i] != null);            
+            assertTrue(c[i] != null);
         }
 
         try
@@ -320,17 +320,17 @@ public class TestPerUserPoolDataSource e
             // throw an exception
         }
 
-        for (int i=0; i<c.length; i++) 
+        for (int i=0; i<c.length; i++)
         {
             c[i].close();
         }
     }
-    
+
     /**
-     * Verify that defaultMaxWait = 0 means immediate failure when
+     * Verify that defaultMaxWaitMillis = 0 means immediate failure when
      * pool is exhausted.
      */
-    public void testMaxWaitZero() throws Exception {
+    public void testMaxWaitMillisZero() throws Exception {
         PerUserPoolDataSource tds = (PerUserPoolDataSource) ds;
         tds.setDefaultMaxWaitMillis(0);
         tds.setPerUserMaxTotal("u1", new Integer(1));
@@ -343,21 +343,21 @@ public class TestPerUserPoolDataSource e
         }
         conn.close();
     }
-    
+
     public void testPerUserMethods() throws Exception {
         PerUserPoolDataSource tds = (PerUserPoolDataSource) ds;
-        
+
         // you need to set maxActive otherwise there is no accounting
         tds.setPerUserMaxTotal("u1", new Integer(5));
         tds.setPerUserMaxTotal("u2", new Integer(5));
-        
+
         assertEquals(0, tds.getNumActive());
         assertEquals(0, tds.getNumActive("u1", "p1"));
         assertEquals(0, tds.getNumActive("u2", "p2"));
         assertEquals(0, tds.getNumIdle());
         assertEquals(0, tds.getNumIdle("u1", "p1"));
         assertEquals(0, tds.getNumIdle("u2", "p2"));
-        
+
         Connection conn = tds.getConnection();
         assertNotNull(conn);
         assertEquals(1, tds.getNumActive());
@@ -392,41 +392,41 @@ public class TestPerUserPoolDataSource e
         assertEquals(1, tds.getNumIdle("u1", "p1"));
         assertEquals(0, tds.getNumIdle("u2", "p2"));
     }
-    
+
     public void testMultipleThreads1() throws Exception {
         // Override wait time in order to allow for Thread.sleep(1) sometimes taking a lot longer on
         // some JVMs, e.g. Windows.
-        final int defaultMaxWait = 430;
-        ((PerUserPoolDataSource) ds).setDefaultMaxWaitMillis(defaultMaxWait);
-        ((PerUserPoolDataSource) ds).setPerUserMaxWaitMillis("foo",new Integer(defaultMaxWait));
-        multipleThreads(1, false, false, defaultMaxWait);
+        final int defaultMaxWaitMillis = 430;
+        ((PerUserPoolDataSource) ds).setDefaultMaxWaitMillis(defaultMaxWaitMillis);
+        ((PerUserPoolDataSource) ds).setPerUserMaxWaitMillis("foo",new Integer(defaultMaxWaitMillis));
+        multipleThreads(1, false, false, defaultMaxWaitMillis);
     }
 
     public void testMultipleThreads2() throws Exception {
-        final int defaultMaxWait = 500;
-        ((PerUserPoolDataSource) ds).setDefaultMaxWaitMillis(defaultMaxWait);
-        ((PerUserPoolDataSource) ds).setPerUserMaxWaitMillis("foo",new Integer(defaultMaxWait));
-        multipleThreads(2 * defaultMaxWait, true, true, defaultMaxWait);
+        final int defaultMaxWaitMillis = 500;
+        ((PerUserPoolDataSource) ds).setDefaultMaxWaitMillis(defaultMaxWaitMillis);
+        ((PerUserPoolDataSource) ds).setPerUserMaxWaitMillis("foo",new Integer(defaultMaxWaitMillis));
+        multipleThreads(2 * defaultMaxWaitMillis, true, true, defaultMaxWaitMillis);
     }
 
     public void testTransactionIsolationBehavior() throws Exception {
         Connection conn = getConnection();
         assertNotNull(conn);
-        assertEquals(Connection.TRANSACTION_READ_COMMITTED, 
+        assertEquals(Connection.TRANSACTION_READ_COMMITTED,
                      conn.getTransactionIsolation());
         conn.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
         conn.close();
-        
+
         Connection conn2 = getConnection();
-        assertEquals(Connection.TRANSACTION_READ_COMMITTED, 
+        assertEquals(Connection.TRANSACTION_READ_COMMITTED,
                      conn2.getTransactionIsolation());
-        
+
         Connection conn3 = getConnection();
-        assertEquals(Connection.TRANSACTION_READ_COMMITTED, 
+        assertEquals(Connection.TRANSACTION_READ_COMMITTED,
                      conn3.getTransactionIsolation());
         conn2.close();
         conn3.close();
-    }     
+    }
 
     public void testSerialization() throws Exception {
         // make sure the pool has initialized
@@ -449,13 +449,13 @@ public class TestPerUserPoolDataSource e
     }
 
     // see issue http://issues.apache.org/bugzilla/show_bug.cgi?id=23843
-    // unregistered user is in the same pool as without username 
+    // unregistered user is in the same pool as without username
     public void testUnregisteredUser() throws Exception {
         PerUserPoolDataSource tds = (PerUserPoolDataSource) ds;
-        
+
         assertEquals(0, tds.getNumActive());
         assertEquals(0, tds.getNumIdle());
-        
+
         Connection conn = tds.getConnection();
         assertNotNull(conn);
         assertEquals(1, tds.getNumActive());
@@ -498,7 +498,7 @@ public class TestPerUserPoolDataSource e
             c[i].close();
         }
     }
-    
+
     // see issue http://issues.apache.org/bugzilla/show_bug.cgi?id=23843
     public void testDefaultUser2() throws Exception {
         TesterDriver.addUser("mkh", "password");
@@ -535,21 +535,21 @@ public class TestPerUserPoolDataSource e
         try {
             Connection con4 = ds.getConnection("foo", "bay"); // new password
             // Idle instances with old password should have been cleared
-            assertEquals("Should be no idle connections in the pool", 
+            assertEquals("Should be no idle connections in the pool",
                     0, ((PerUserPoolDataSource) ds).getNumIdle("foo", "bar"));
             con4.close();
             // Should be one idle instance with new pwd
-            assertEquals("Should be one idle connection in the pool", 
+            assertEquals("Should be one idle connection in the pool",
                     1, ((PerUserPoolDataSource) ds).getNumIdle("foo", "bay"));
             try {
                 ds.getConnection("foo", "bar"); // old password
-                fail("Should have generated SQLException"); 
+                fail("Should have generated SQLException");
             } catch (SQLException expected) {
             }
             Connection con5 = ds.getConnection("foo", "bay"); // take the idle one
             con3.close(); // Return a connection with the old password
             ds.getConnection("foo", "bay").close();  // will try bad returned connection and destroy it
-            assertEquals("Should be one idle connection in the pool", 
+            assertEquals("Should be one idle connection in the pool",
                     1, ((PerUserPoolDataSource) ds).getNumIdle("foo", "bar"));
             con5.close();
         } finally {

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestSharedPoolDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestSharedPoolDataSource.java?rev=1331992&r1=1331991&r2=1331992&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestSharedPoolDataSource.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestSharedPoolDataSource.java Sun Apr 29 20:37:35 2012
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You 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.
@@ -67,7 +67,7 @@ public class TestSharedPoolDataSource ex
         SharedPoolDataSource tds = new SharedPoolDataSource();
         tds.setConnectionPoolDataSource(pcds);
         tds.setMaxTotal(getMaxTotal());
-        tds.setMaxWaitMillis((int)(getMaxWait()));
+        tds.setMaxWaitMillis((int)(getMaxWaitMillis()));
         tds.setDefaultTransactionIsolation(
             Connection.TRANSACTION_READ_COMMITTED);
 
@@ -82,14 +82,14 @@ public class TestSharedPoolDataSource ex
 
     /**
      * Switching 'u1 -> 'u2' and 'p1' -> 'p2' will
-     * exhibit the bug detailed in 
+     * exhibit the bug detailed in
      * http://issues.apache.org/bugzilla/show_bug.cgi?id=18905
-     * 
+     *
      * Starting with a successful connection, then incorrect password,
      * then correct password for same user illustrates
      * JIRA: DBCP-245
      */
-    public void testIncorrectPassword() throws Exception 
+    public void testIncorrectPassword() throws Exception
     {
         ds.getConnection("u2", "p2").close();
         try {
@@ -100,26 +100,26 @@ public class TestSharedPoolDataSource ex
             // should fail
 
         }
-        
+
         // Use good password
         ds.getConnection("u1", "p1").close();
-        try 
+        try
         {
             ds.getConnection("u1", "x");
             fail("Able to retrieve connection with incorrect password");
         }
         catch (SQLException e)
         {
-            if (!e.getMessage().startsWith("Given password did not match")) 
+            if (!e.getMessage().startsWith("Given password did not match"))
             {
                 throw e;
             }
             // else the exception was expected
         }
-        
+
         // Make sure we can still use our good password.
         ds.getConnection("u1", "p1").close();
-        
+
         // Try related users and passwords
         ds.getConnection("foo", "bar").close();
         try {
@@ -136,7 +136,7 @@ public class TestSharedPoolDataSource ex
 
 
     @Override
-    public void testSimple() throws Exception 
+    public void testSimple() throws Exception
     {
         Connection conn = ds.getConnection();
         assertNotNull(conn);
@@ -150,7 +150,7 @@ public class TestSharedPoolDataSource ex
         conn.close();
     }
 
-    public void testSimpleWithUsername() throws Exception 
+    public void testSimpleWithUsername() throws Exception
     {
         Connection conn = ds.getConnection("u1", "p1");
         assertNotNull(conn);
@@ -164,12 +164,12 @@ public class TestSharedPoolDataSource ex
         conn.close();
     }
 
-    public void testClosingWithUserName() 
-        throws Exception 
+    public void testClosingWithUserName()
+        throws Exception
     {
         Connection[] c = new Connection[getMaxTotal()];
         // open the maximum connections
-        for (int i=0; i<c.length; i++) 
+        for (int i=0; i<c.length; i++)
         {
             c[i] = ds.getConnection("u1", "p1");
         }
@@ -180,30 +180,30 @@ public class TestSharedPoolDataSource ex
         // get a new connection
         c[0] = ds.getConnection("u1", "p1");
 
-        for (int i=0; i<c.length; i++) 
+        for (int i=0; i<c.length; i++)
         {
             c[i].close();
         }
 
         // open the maximum connections
-        for (int i=0; i<c.length; i++) 
+        for (int i=0; i<c.length; i++)
         {
             c[i] = ds.getConnection("u1", "p1");
         }
-        for (int i=0; i<c.length; i++) 
+        for (int i=0; i<c.length; i++)
         {
             c[i].close();
         }
     }
 
     @Override
-    public void testSimple2() 
-        throws Exception 
+    public void testSimple2()
+        throws Exception
     {
         Connection conn = ds.getConnection();
         assertNotNull(conn);
 
-        PreparedStatement stmt = 
+        PreparedStatement stmt =
             conn.prepareStatement("select * from dual");
         assertNotNull(stmt);
         ResultSet rset = stmt.executeQuery();
@@ -211,7 +211,7 @@ public class TestSharedPoolDataSource ex
         assertTrue(rset.next());
         rset.close();
         stmt.close();
-        
+
         stmt = conn.prepareStatement("select * from dual");
         assertNotNull(stmt);
         rset = stmt.executeQuery();
@@ -219,14 +219,14 @@ public class TestSharedPoolDataSource ex
         assertTrue(rset.next());
         rset.close();
         stmt.close();
-        
+
         conn.close();
-        try 
+        try
         {
             conn.createStatement();
             fail("Can't use closed connections");
-        } 
-        catch(SQLException e) 
+        }
+        catch(SQLException e)
         {
             // expected
         }
@@ -249,40 +249,40 @@ public class TestSharedPoolDataSource ex
         assertTrue(rset.next());
         rset.close();
         stmt.close();
-        
+
         conn.close();
         conn = null;
     }
 
     @Override
-    public void testOpening() 
-        throws Exception 
+    public void testOpening()
+        throws Exception
     {
         Connection[] c = new Connection[getMaxTotal()];
         // test that opening new connections is not closing previous
-        for (int i=0; i<c.length; i++) 
+        for (int i=0; i<c.length; i++)
         {
             c[i] = ds.getConnection();
             assertTrue(c[i] != null);
-            for (int j=0; j<=i; j++) 
+            for (int j=0; j<=i; j++)
             {
                 assertTrue(!c[j].isClosed());
             }
         }
 
-        for (int i=0; i<c.length; i++) 
+        for (int i=0; i<c.length; i++)
         {
             c[i].close();
         }
     }
 
     @Override
-    public void testClosing() 
-        throws Exception 
+    public void testClosing()
+        throws Exception
     {
         Connection[] c = new Connection[getMaxTotal()];
         // open the maximum connections
-        for (int i=0; i<c.length; i++) 
+        for (int i=0; i<c.length; i++)
         {
             c[i] = ds.getConnection();
         }
@@ -290,37 +290,37 @@ public class TestSharedPoolDataSource ex
         // close one of the connections
         c[0].close();
         assertTrue(c[0].isClosed());
-        
+
         // get a new connection
         c[0] = ds.getConnection();
 
-        for (int i=0; i<c.length; i++) 
+        for (int i=0; i<c.length; i++)
         {
             c[i].close();
         }
     }
-    
+
     /**
      * Test pool close.  Illustrates BZ 37359.
-     * 
+     *
      * @throws Exception
      */
     public void testClosePool() throws Exception {
       ((SharedPoolDataSource)ds).close();
       SharedPoolDataSource tds = new SharedPoolDataSource();
-      // NPE before BZ 37359 fix 
+      // NPE before BZ 37359 fix
       tds.close();
     }
 
     @Override
-    public void testMaxTotal() 
-        throws Exception 
+    public void testMaxTotal()
+        throws Exception
     {
         Connection[] c = new Connection[getMaxTotal()];
-        for (int i=0; i<c.length; i++) 
+        for (int i=0; i<c.length; i++)
         {
             c[i] = ds.getConnection();
-            assertTrue(c[i] != null);            
+            assertTrue(c[i] != null);
         }
 
         try
@@ -334,49 +334,50 @@ public class TestSharedPoolDataSource ex
             // throw an exception
         }
 
-        for (int i=0; i<c.length; i++) 
+        for (int i=0; i<c.length; i++)
         {
             c[i].close();
         }
     }
-    
-    public void testMaxWait() throws Exception {
-        final int maxWait = 1000;
+
+    public void testMaxWaitMillis() throws Exception {
+        final int maxWaitMillis = 1000;
         final int theadCount = 20;
-        
-        ((SharedPoolDataSource)ds).setMaxWaitMillis(maxWait);
+
+        ((SharedPoolDataSource)ds).setMaxWaitMillis(maxWaitMillis);
         // Obtain all the connections from the pool
         Connection[] c = new Connection[getMaxTotal()];
         for (int i=0; i<c.length; i++) {
             c[i] = ds.getConnection("foo","bar");
-            assertTrue(c[i] != null);            
+            assertTrue(c[i] != null);
         }
 
         long start = System.currentTimeMillis();
-        
+
         // Run a thread test with minimal hold time
-        // All threads should end after maxWait - DBCP-291
+        // All threads should end after maxWaitMillis - DBCP-291
         final PoolTest[] pts = new PoolTest[theadCount];
-        ThreadGroup threadGroup = new ThreadGroup("testMaxWait");
+        ThreadGroup threadGroup = new ThreadGroup("testMaxWaitMillis");
 
-        // Should take ~maxWait for threads to stop 
+        // Should take ~maxWaitMillis for threads to stop
         for (int i = 0; i < pts.length; i++) {
             (pts[i] = new PoolTest(threadGroup, 1, true)).start();
         }
-        
+
         // Wait for all the threads to complete
         for (int i = 0; i < pts.length; i++) {
             final PoolTest poolTest = pts[i];
             poolTest.getThread().join();
         }
 
-        
+
         long end = System.currentTimeMillis();
-        
-        System.out.println("testMaxWait took " + (end-start) + " ms. Maxwait: "+maxWait);
-        
+
+        System.out.println("testMaxWaitMillis took " + (end-start) +
+                " ms. maxWaitMillis: "+maxWaitMillis);
+
         // Threads should time out in parallel - allow double that to be safe
-        assertTrue((end-start) < (2 * maxWait)); 
+        assertTrue((end-start) < (2 * maxWaitMillis));
 
         // Put all the connections back in the pool
         for (int i=0; i<c.length; i++) {
@@ -387,39 +388,39 @@ public class TestSharedPoolDataSource ex
     public void testMultipleThreads1() throws Exception {
         // Override wait time in order to allow for Thread.sleep(1) sometimes taking a lot longer on
         // some JVMs, e.g. Windows.
-        final int defaultMaxWait = 430;
-        ((SharedPoolDataSource) ds).setMaxWaitMillis(defaultMaxWait);
-        multipleThreads(1, false, false, defaultMaxWait);
+        final int defaultMaxWaitMillis = 430;
+        ((SharedPoolDataSource) ds).setMaxWaitMillis(defaultMaxWaitMillis);
+        multipleThreads(1, false, false, defaultMaxWaitMillis);
     }
 
     public void testMultipleThreads2() throws Exception {
-        final int defaultMaxWait = 500;
-        ((SharedPoolDataSource) ds).setMaxWaitMillis(defaultMaxWait);
-        multipleThreads(2 * defaultMaxWait, true, true, defaultMaxWait);
+        final int defaultMaxWaitMillis = 500;
+        ((SharedPoolDataSource) ds).setMaxWaitMillis(defaultMaxWaitMillis);
+        multipleThreads(2 * defaultMaxWaitMillis, true, true, defaultMaxWaitMillis);
     }
 
     public void testTransactionIsolationBehavior() throws Exception {
         Connection conn = getConnection();
         assertNotNull(conn);
-        assertEquals(Connection.TRANSACTION_READ_COMMITTED, 
+        assertEquals(Connection.TRANSACTION_READ_COMMITTED,
                      conn.getTransactionIsolation());
         conn.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
         conn.close();
-        
+
         Connection conn2 = getConnection();
-        assertEquals(Connection.TRANSACTION_READ_COMMITTED, 
+        assertEquals(Connection.TRANSACTION_READ_COMMITTED,
                      conn2.getTransactionIsolation());
-        
+
         Connection conn3 = getConnection();
-        assertEquals(Connection.TRANSACTION_READ_COMMITTED, 
+        assertEquals(Connection.TRANSACTION_READ_COMMITTED,
                      conn3.getTransactionIsolation());
         conn2.close();
         conn3.close();
-    }     
+    }
 
-    // Bugzilla Bug 24136 ClassCastException in DriverAdapterCPDS 
+    // Bugzilla Bug 24136 ClassCastException in DriverAdapterCPDS
     // when setPoolPreparedStatements(true)
-    public void testPoolPrepareStatement() throws Exception 
+    public void testPoolPrepareStatement() throws Exception
     {
         pcds.setPoolPreparedStatements(true);
 
@@ -494,7 +495,7 @@ public class TestSharedPoolDataSource ex
         SharedPoolDataSource tds = new SharedPoolDataSource();
         tds.setConnectionPoolDataSource(mypcds);
         tds.setMaxTotal(getMaxTotal());
-        tds.setMaxWaitMillis((int)(getMaxWait()));
+        tds.setMaxWaitMillis((int)(getMaxWaitMillis()));
         tds.setDefaultTransactionIsolation(
             Connection.TRANSACTION_READ_COMMITTED);
 
@@ -581,21 +582,21 @@ public class TestSharedPoolDataSource ex
         try {
             Connection con4 = ds.getConnection("foo", "bay"); // new password
             // Idle instances with old password should have been cleared
-            assertEquals("Should be no idle connections in the pool", 
+            assertEquals("Should be no idle connections in the pool",
                    0, ((SharedPoolDataSource) ds).getNumIdle());
             con4.close();
             // Should be one idle instance with new pwd
-            assertEquals("Should be one idle connection in the pool", 
+            assertEquals("Should be one idle connection in the pool",
                     1, ((SharedPoolDataSource) ds).getNumIdle());
             try {
                 ds.getConnection("foo", "bar"); // old password
-                fail("Should have generated SQLException"); 
+                fail("Should have generated SQLException");
             } catch (SQLException expected) {
             }
             Connection con5 = ds.getConnection("foo", "bay"); // take the idle one
             con3.close(); // Return a connection with the old password
             ds.getConnection("foo", "bay").close();  // will try bad returned connection and destroy it
-            assertEquals("Should be one idle connection in the pool", 
+            assertEquals("Should be one idle connection in the pool",
                     1, ((SharedPoolDataSource) ds).getNumIdle());
             con5.close();
         } finally {

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/managed/TestManagedDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/managed/TestManagedDataSource.java?rev=1331992&r1=1331991&r2=1331992&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/managed/TestManagedDataSource.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/managed/TestManagedDataSource.java Sun Apr 29 20:37:35 2012
@@ -84,7 +84,7 @@ public class TestManagedDataSource exten
         pool = new GenericObjectPool(factory);
         factory.setPool(pool);
         pool.setMaxTotal(getMaxTotal());
-        pool.setMaxWaitMillis(getMaxWait());
+        pool.setMaxWaitMillis(getMaxWaitMillis());
 
         // finally create the datasource
         ds = new ManagedDataSource(pool, xaConnectionFactory.getTransactionRegistry());