From a0b9d98cd466130d2a11cd2f60f53b4a7fa96b93 Mon Sep 17 00:00:00 2001 From: fhanik Date: Tue, 23 Jun 2009 14:47:28 +0000 Subject: [PATCH] Only test timeout git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@787694 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/tomcat/jdbc/test/TestTimeout.java | 73 ++-------------------- 1 file changed, 6 insertions(+), 67 deletions(-) diff --git a/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/TestTimeout.java b/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/TestTimeout.java index b59c58dc4..6697e9a1c 100644 --- a/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/TestTimeout.java +++ b/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/TestTimeout.java @@ -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(); - } - } - } -- 2.11.0