Author: fhanik Date: Sat May 2 04:35:22 2009 New Revision: 770889 URL: http://svn.apache.org/viewvc?rev=770889&view=rev Log: Fix logger level to not show up by default Add fairness tests to all
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=770889&r1=770888&r2=770889&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:35:22 2009 @@ -76,6 +76,27 @@ tearDown(); } + public void testPoolThreads10Connections10Fair() throws Exception { + init(); + this.datasource.getPoolProperties().setMaxActive(10); + this.datasource.getPoolProperties().setFairQueue(true); + this.threadcount = 10; + this.transferProperties(); + this.datasource.getConnection().close(); + latch = new CountDownLatch(threadcount); + long start = System.currentTimeMillis(); + for (int i=0; i<threadcount; i++) { + TestThread t = new TestThread(); + t.setName("tomcat-pool-"+i); + t.d = this.datasource; + t.start(); + } + latch.await(); + long delta = System.currentTimeMillis() - start; + System.out.println("[testPoolThreads10Connections10Fair]Test complete:"+delta+" ms. Iterations:"+(threadcount*this.iterations)); + tearDown(); + } + public void testC3P0Threads10Connections10() throws Exception { init(); this.datasource.getPoolProperties().setMaxActive(10); @@ -205,6 +226,7 @@ this.datasource.getPoolProperties().setMaxActive(10); this.datasource.getPoolProperties().setValidationQuery("SELECT 1"); this.datasource.getPoolProperties().setTestOnBorrow(true); + this.datasource.getPoolProperties().setFairQueue(false); this.threadcount = 10; this.transferProperties(); this.datasource.getConnection().close(); @@ -222,6 +244,29 @@ tearDown(); } + public void testPoolThreads10Connections10ValidateFair() throws Exception { + init(); + this.datasource.getPoolProperties().setMaxActive(10); + this.datasource.getPoolProperties().setValidationQuery("SELECT 1"); + this.datasource.getPoolProperties().setTestOnBorrow(true); + this.datasource.getPoolProperties().setFairQueue(true); + this.threadcount = 10; + this.transferProperties(); + this.datasource.getConnection().close(); + latch = new CountDownLatch(threadcount); + long start = System.currentTimeMillis(); + for (int i=0; i<threadcount; i++) { + TestThread t = new TestThread(); + t.setName("tomcat-pool-validate-"+i); + t.d = this.datasource; + t.start(); + } + latch.await(); + long delta = System.currentTimeMillis() - start; + System.out.println("[testPoolThreads10Connections10ValidateFair]Test complete:"+delta+" ms. Iterations:"+(threadcount*this.iterations)); + tearDown(); + } + public void testC3P0Threads10Connections10Validate() throws Exception { init(); this.datasource.getPoolProperties().setMaxActive(10); @@ -271,6 +316,7 @@ this.datasource.getPoolProperties().setMaxActive(10); this.datasource.getPoolProperties().setValidationQuery("SELECT 1"); this.datasource.getPoolProperties().setTestOnBorrow(true); + this.datasource.getPoolProperties().setFairQueue(false); this.threadcount = 20; this.transferProperties(); this.datasource.getConnection().close(); @@ -288,6 +334,29 @@ tearDown(); } + public void testPoolThreads10Connections20ValidateFair() throws Exception { + init(); + this.datasource.getPoolProperties().setMaxActive(10); + this.datasource.getPoolProperties().setValidationQuery("SELECT 1"); + this.datasource.getPoolProperties().setTestOnBorrow(true); + this.datasource.getPoolProperties().setFairQueue(true); + this.threadcount = 20; + this.transferProperties(); + this.datasource.getConnection().close(); + latch = new CountDownLatch(threadcount); + long start = System.currentTimeMillis(); + for (int i=0; i<threadcount; i++) { + TestThread t = new TestThread(); + t.setName("tomcat-pool-validate-"+i); + t.d = this.datasource; + t.start(); + } + latch.await(); + long delta = System.currentTimeMillis() - start; + System.out.println("[testPoolThreads20Connections10ValidateFair]Test complete:"+delta+" ms. Iterations:"+(threadcount*this.iterations)); + tearDown(); + } + public void testC3P0Threads10Connections20Validate() throws Exception { init(); this.datasource.getPoolProperties().setMaxActive(10); 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=770889&r1=770888&r2=770889&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:35:22 2009 @@ -106,6 +106,7 @@ protected void transferPropertiesToC3P0() throws Exception { System.setProperty("com.mchange.v2.log.FallbackMLog.DEFAULT_CUTOFF_LEVEL", "WARNING"); MLog.getLogger().setLevel(MLevel.WARNING); + MLog.getLogger("com").setLevel(MLevel.WARNING); //http://www.mchange.com/projects/c3p0/index.html#automaticTestTable ComboPooledDataSource c3p0 = new ComboPooledDataSource(); c3p0.setAcquireIncrement(1); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org