Author: fhanik
Date: Tue Jun 23 14:47:28 2009
New Revision: 787694
URL: http://svn.apache.org/viewvc?rev=787694&view=rev
Log:
Only test timeout
Modified:
tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/TestTimeout.java
Modified:
tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/TestTimeout.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/TestTimeout.java?rev=787694&r1=787693&r2=787694&view=diff
==============================================================================
---
tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/TestTimeout.java
(original)
+++
tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/TestTimeout.java
Tue Jun 23 14:47:28 2009
@@ -50,10 +50,11 @@
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 @@
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();
- }
- }
-
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]