tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fha...@apache.org
Subject svn commit: r770888 - in /tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test: CheckOutThreadTest.java DefaultTestCase.java
Date Sat, 02 May 2009 04:24:59 GMT
Author: fhanik
Date: Sat May  2 04:24:59 2009
New Revision: 770888

URL: http://svn.apache.org/viewvc?rev=770888&view=rev
Log:
Fix closure of connections in test cases

Modified:
    tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/CheckOutThreadTest.java
    tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/DefaultTestCase.java

Modified: tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/CheckOutThreadTest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/CheckOutThreadTest.java?rev=770888&r1=770887&r2=770888&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/CheckOutThreadTest.java
(original)
+++ tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/CheckOutThreadTest.java
Sat May  2 04:24:59 2009
@@ -58,6 +58,7 @@
     public void testPoolThreads10Connections10() throws Exception {
         init();
         this.datasource.getPoolProperties().setMaxActive(10);
+        this.datasource.getPoolProperties().setFairQueue(false);
         this.threadcount = 10;
         this.transferProperties();
         this.datasource.getConnection().close();

Modified: tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/DefaultTestCase.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/DefaultTestCase.java?rev=770888&r1=770887&r2=770888&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/DefaultTestCase.java (original)
+++ tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/DefaultTestCase.java Sat
May  2 04:24:59 2009
@@ -29,6 +29,8 @@
 import org.apache.tomcat.jdbc.pool.DataSourceProxy;
 
 import com.mchange.v2.c3p0.ComboPooledDataSource;
+import com.mchange.v2.log.MLevel;
+import com.mchange.v2.log.MLog;
 
 /**
  * @author Filip Hanik
@@ -103,6 +105,7 @@
     
     protected void transferPropertiesToC3P0() throws Exception {
         System.setProperty("com.mchange.v2.log.FallbackMLog.DEFAULT_CUTOFF_LEVEL", "WARNING");
+        MLog.getLogger().setLevel(MLevel.WARNING);
         //http://www.mchange.com/projects/c3p0/index.html#automaticTestTable
         ComboPooledDataSource c3p0 = new ComboPooledDataSource();  
         c3p0.setAcquireIncrement(1);
@@ -126,6 +129,7 @@
         c3p0.setJdbcUrl(datasource.getPoolProperties().getUrl());
         c3p0.setDriverClass(datasource.getPoolProperties().getDriverClassName());
         this.c3p0Datasource = c3p0;
+        
       /**
         acquireIncrement
         acquireRetryAttempts
@@ -166,8 +170,11 @@
 
     protected void tearDown() throws Exception {
         try {datasource.close();}catch(Exception ignore){}
+        try {tDatasource.close();}catch(Exception ignore){}
+        try {((ComboPooledDataSource)c3p0Datasource).close(true);}catch(Exception ignore){}
         datasource = null;
         tDatasource = null;
+        c3p0Datasource = null;
         System.gc();
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message