commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r897215 - /commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java
Date Fri, 08 Jan 2010 14:36:36 GMT
Author: sebb
Date: Fri Jan  8 14:36:35 2010
New Revision: 897215

URL: http://svn.apache.org/viewvc?rev=897215&view=rev
Log:
Check for threads that did not run the connect test code

Modified:
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java?rev=897215&r1=897214&r2=897215&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java Fri
Jan  8 14:36:35 2010
@@ -712,6 +712,7 @@
                  */
                 int done=0;
                 int failed=0;
+                int didNotRun = 0;
                 for (int i = 0; i < pts.length; i++) {
                     final PoolTest poolTest = pts[i];
                     poolTest.thread.join();
@@ -719,6 +720,9 @@
                     if (DONE.equals(state)){
                         done++;
                     }
+                    if (poolTest.loops == 0){
+                        didNotRun++;
+                    }
                     final Throwable thrown = poolTest.thrown;
                     if (thrown != null) {
                         failed++;
@@ -734,6 +738,7 @@
                         + ". Hold time: " + holdTime
                         + ". Maxwait: " + maxWait
                         + ". Done: " + done
+                        + ". Did not run: " + didNotRun
                         + ". Failed: " + failed
                         + ". expectError: " + expectError
                         );
@@ -754,7 +759,11 @@
                                     );
                         }                        
                     }
-                    assertEquals("WARNING: Expected half the threads to fail",pts.length/2,failed);
+                    if (didNotRun > 0){
+                        System.out.println("NOTE: some threads did not run the code: "+didNotRun);
+                    }
+                    // Assume that threads that did not run would have timed out.
+                    assertEquals("WARNING: Expected half the threads to fail",pts.length/2,failed+didNotRun);
                 } else {
                     assertEquals("Did not expect any threads to fail",0,failed);
                 }



Mime
View raw message