Only test timeout
authorfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 23 Jun 2009 14:47:28 +0000 (14:47 +0000)
committerfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 23 Jun 2009 14:47:28 +0000 (14:47 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@787694 13f79535-47bb-0310-9956-ffa450edef68

modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/TestTimeout.java

index b59c58d..6697e9a 100644 (file)
@@ -50,10 +50,11 @@ public class TestTimeout extends DefaultTestCase {
                 long delta = System.currentTimeMillis()-now;
                 System.out.println("Got connection #"+i+" in "+delta+" ms.");
             }
+            assertTrue(false);
         } catch ( Exception x ) {
-            x.printStackTrace();
+            assertTrue(true);
         }finally {
-            Thread.sleep(20000);
+            Thread.sleep(2000);
             tearDown();
         }
     }
@@ -80,75 +81,13 @@ public class TestTimeout extends DefaultTestCase {
                 long delta = System.currentTimeMillis()-now;
                 System.out.println("Got connection #"+i+" in "+delta+" ms.");
             }
+            assertTrue(false);
         } catch ( Exception x ) {
-            x.printStackTrace();
+            assertTrue(true);
         }finally {
-            Thread.sleep(20000);
+            Thread.sleep(2000);
             tearDown();
         }
     }
-    
-
-    public void testRemoveAbandoned() throws Exception {
-        try {
-            init();
-            this.datasource.getPoolProperties().setTestWhileIdle(true);
-            this.datasource.getPoolProperties().setTestOnBorrow(false);
-            this.datasource.getPoolProperties().setTestOnReturn(false);
-            this.datasource.getPoolProperties().setValidationInterval(30000);
-            this.datasource.getPoolProperties().setTimeBetweenEvictionRunsMillis(1000);
-            this.datasource.getPoolProperties().setMaxActive(20);
-            this.datasource.getPoolProperties().setMaxWait(3000);
-            this.datasource.getPoolProperties().setRemoveAbandonedTimeout(5);
-            this.datasource.getPoolProperties().setMinEvictableIdleTimeMillis(5000);
-            this.datasource.getPoolProperties().setMinIdle(5);
-            this.datasource.getPoolProperties().setRemoveAbandoned(true);
-            this.datasource.getPoolProperties().setLogAbandoned(true);
-            System.out.println("About to test connection pool:"+datasource);
-            for (int i = 0; i < threadcount; i++) {
-                long now = System.currentTimeMillis();
-                this.datasource.getConnection();
-                long delta = System.currentTimeMillis()-now;
-                System.out.println("Got connection #"+i+" in "+delta+" ms.");
-            }
-        } catch ( Exception x ) {
-            x.printStackTrace();
-        }finally {
-            Thread.sleep(20000);
-            tearDown();
-        }
-    }
-    
-    public void testRemoveAbandonedFair() throws Exception {
-        try {
-            init();
-            this.datasource.getPoolProperties().setFairQueue(true);
-            this.datasource.getPoolProperties().setTestWhileIdle(true);
-            this.datasource.getPoolProperties().setTestOnBorrow(false);
-            this.datasource.getPoolProperties().setTestOnReturn(false);
-            this.datasource.getPoolProperties().setValidationInterval(30000);
-            this.datasource.getPoolProperties().setTimeBetweenEvictionRunsMillis(1000);
-            this.datasource.getPoolProperties().setMaxActive(20);
-            this.datasource.getPoolProperties().setMaxWait(3000);
-            this.datasource.getPoolProperties().setRemoveAbandonedTimeout(5);
-            this.datasource.getPoolProperties().setMinEvictableIdleTimeMillis(5000);
-            this.datasource.getPoolProperties().setMinIdle(5);
-            this.datasource.getPoolProperties().setRemoveAbandoned(true);
-            this.datasource.getPoolProperties().setLogAbandoned(true);
-            System.out.println("About to test connection pool:"+datasource);
-            for (int i = 0; i < threadcount; i++) {
-                long now = System.currentTimeMillis();
-                this.datasource.getConnection();
-                long delta = System.currentTimeMillis()-now;
-                System.out.println("Got connection #"+i+" in "+delta+" ms.");
-            }
-        } catch ( Exception x ) {
-            x.printStackTrace();
-        }finally {
-            Thread.sleep(20000);
-            tearDown();
-        }
-    }
-
 
 }