tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1166735 - /tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/
Date Thu, 08 Sep 2011 15:14:44 GMT
Author: markt
Date: Thu Sep  8 15:14:43 2011
New Revision: 1166735

URL: http://svn.apache.org/viewvc?rev=1166735&view=rev
Log:
Fix remaining Eclipse warnings in jdbc-pool unit tests

Modified:
    tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultProperties.java
    tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultTestCase.java
    tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/FairnessTest.java
    tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestConcurrency.java
    tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestSizePreservation.java
    tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestSlowQueryReport.java
    tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestStatementCache.java

Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultProperties.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultProperties.java?rev=1166735&r1=1166734&r2=1166735&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultProperties.java
(original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultProperties.java
Thu Sep  8 15:14:43 2011
@@ -45,8 +45,8 @@ public class DefaultProperties extends P
         username = System.getProperty("username","root");
         
         validationQuery = System.getProperty("validationQuery","SELECT 1");
-        defaultAutoCommit = true;
-        defaultReadOnly = false;
+        defaultAutoCommit = Boolean.TRUE;
+        defaultReadOnly = Boolean.FALSE;
         defaultTransactionIsolation = DataSourceFactory.UNKNOWN_TRANSACTIONISOLATION;
         connectionProperties = null;
         defaultCatalog = null;
@@ -67,7 +67,7 @@ public class DefaultProperties extends P
         logAbandoned = true;
         validationInterval = 0; //always validate
         initSQL = null;
-        testOnConnect = false;;
+        testOnConnect = false;
         dbProperties.setProperty("user",username);
         dbProperties.setProperty("password",password);
     }

Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultTestCase.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultTestCase.java?rev=1166735&r1=1166734&r2=1166735&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultTestCase.java
(original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultTestCase.java
Thu Sep  8 15:14:43 2011
@@ -236,6 +236,8 @@ public class DefaultTestCase extends Tes
         PROP_REMOVEABANDONED,
         PROP_REMOVEABANDONEDTIMEOUT,
         PROP_LOGABANDONED,
+        PROP_POOLPREPAREDSTATEMENTS,
+        PROP_MAXOPENPREPAREDSTATEMENTS,
         PROP_CONNECTIONPROPERTIES
     };
 

Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/FairnessTest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/FairnessTest.java?rev=1166735&r1=1166734&r2=1166735&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/FairnessTest.java
(original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/FairnessTest.java
Thu Sep  8 15:14:43 2011
@@ -37,14 +37,13 @@ public class FairnessTest extends Defaul
     }
     
     protected boolean run = true;
-    protected long sleep = Long.getLong("sleep", 10);
-    protected long complete = Long.getLong("complete",20000);
+    protected long sleep = Long.getLong("sleep", 10).longValue();
+    protected long complete = Long.getLong("complete",20000).longValue();
     protected boolean printthread = Boolean.getBoolean("printthread");
     CountDownLatch latch = null;
     protected void printThreadResults(TestThread[] threads, String name, int active, int
expected) {
         long minfetch = Long.MAX_VALUE, maxfetch = Long.MIN_VALUE, totalfetch = 0;
-        long maxwait = 0, minwait = Long.MAX_VALUE, averagewait = 0, totalwait = 0;
-        float avgfetch = 0;
+        long maxwait = 0, minwait = Long.MAX_VALUE, totalwait = 0;
         for (int i=0; i<threads.length; i++) {
             TestThread t = threads[i];
             totalfetch += t.nroffetch;
@@ -54,11 +53,11 @@ public class FairnessTest extends Defaul
             minfetch = Math.min(minfetch, t.nroffetch);
             maxfetch = Math.max(maxfetch, t.nroffetch);
             if (FairnessTest.this.printthread)
-                System.out.println(t.getName()+" : Nr-of-fetch:"+t.nroffetch+ " Max fetch
Time:"+(((float)t.maxwait)/1000000f)+"ms. :Max close time:"+(((float)t.cmax)/1000000f)+"ms.");
+                System.out.println(t.getName()+" : Nr-of-fetch:"+t.nroffetch+ " Max fetch
Time:"+t.maxwait/1000000f+"ms. :Max close time:"+t.cmax/1000000f+"ms.");
         }
         System.out.println("["+name+"] Max fetch:"+(maxfetch)+" Min fetch:"+(minfetch)+"
Average fetch:"+
                            (((float)totalfetch))/(float)threads.length);
-        System.out.println("["+name+"] Max wait:"+(((float)maxwait)/1000000f)+"ms. Min wait:"+(((float)minwait)/1000000f)+"ms.
Average wait:"+(((((float)totalwait))/(float)totalfetch)/1000000f)+" ms.");
+        System.out.println("["+name+"] Max wait:"+maxwait/1000000f+"ms. Min wait:"+minwait/1000000f+"ms.
Average wait:"+(((((float)totalwait))/(float)totalfetch)/1000000f)+" ms.");
         System.out.println("["+name+"] Max active:"+active+" Expected Active:"+expected);
         
         
@@ -89,6 +88,7 @@ public class FairnessTest extends Defaul
         this.run = false;
         long delta = System.currentTimeMillis() - start;
         printThreadResults(threads,"testDBCPThreads20Connections10",this.tDatasource.getNumActive(),10);
+        System.out.println("Test completed in: " + delta + "ms.");
         tearDown();
     }
 
@@ -118,8 +118,8 @@ public class FairnessTest extends Defaul
         this.run = false;
         long delta = System.currentTimeMillis() - start;
         printThreadResults(threads,"testPoolThreads20Connections10",this.datasource.getSize(),10);
+        System.out.println("Test completed in: " + delta + "ms.");
         tearDown();
-
     }
 
     public void testPoolThreads20Connections10Fair() throws Exception {
@@ -148,6 +148,7 @@ public class FairnessTest extends Defaul
         this.run = false;
         long delta = System.currentTimeMillis() - start;
         printThreadResults(threads,"testPoolThreads20Connections10Fair",this.datasource.getSize(),10);
+        System.out.println("Test completed in: " + delta + "ms.");
         tearDown();
     }
  
@@ -178,6 +179,7 @@ public class FairnessTest extends Defaul
         this.run = false;
         long delta = System.currentTimeMillis() - start;
         printThreadResults(threads,"testPoolThreads20Connections10FairAsync",this.datasource.getSize(),10);
+        System.out.println("Test completed in: " + delta + "ms.");
         tearDown();
     }
     
@@ -268,13 +270,13 @@ public class FairnessTest extends Defaul
             }
             if (System.getProperty("print-thread-stats")!=null) {
                 System.out.println("["+getName()+"] "+
-                    "\n\tMax time to retrieve connection:"+(((float)maxwait)/1000f/1000f)+"
ms."+
-                    "\n\tTotal time to retrieve connection:"+(((float)totalwait)/1000f/1000f)+"
ms."+
-                    "\n\tAverage time to retrieve connection:"+(((float)totalwait)/1000f/1000f)/(float)nroffetch+"
ms."+
-                    "\n\tMax time to close connection:"+(((float)cmax)/1000f/1000f)+" ms."+
-                    "\n\tTotal time to close connection:"+(((float)totalcmax)/1000f/1000f)+"
ms."+
-                    "\n\tAverage time to close connection:"+(((float)totalcmax)/1000f/1000f)/(float)nroffetch+"
ms."+
-                    "\n\tRun time:"+(((float)totalruntime)/1000f/1000f)+" ms."+
+                    "\n\tMax time to retrieve connection:"+maxwait/1000000f+" ms."+
+                    "\n\tTotal time to retrieve connection:"+totalwait/1000000f+" ms."+
+                    "\n\tAverage time to retrieve connection:"+totalwait/1000000f/nroffetch+"
ms."+
+                    "\n\tMax time to close connection:"+cmax/1000000f+" ms."+
+                    "\n\tTotal time to close connection:"+totalcmax/1000000f+" ms."+
+                    "\n\tAverage time to close connection:"+totalcmax/1000000f/nroffetch+"
ms."+
+                    "\n\tRun time:"+totalruntime/1000000f+" ms."+
                     "\n\tNr of fetch:"+nroffetch);
             }
         }

Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestConcurrency.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestConcurrency.java?rev=1166735&r1=1166734&r2=1166735&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestConcurrency.java
(original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestConcurrency.java
Thu Sep  8 15:14:43 2011
@@ -63,6 +63,7 @@ public class TestConcurrency extends Def
         final int iter = 1000 * 10;
         final AtomicInteger loopcount = new AtomicInteger(0);
         final Runnable run = new Runnable() {
+            @Override
             public void run() {
                 try {
                     while (loopcount.incrementAndGet() < iter) {
@@ -117,6 +118,7 @@ public class TestConcurrency extends Def
         final int iter = 100000 * 10;
         final AtomicInteger loopcount = new AtomicInteger(0);
         final Runnable run = new Runnable() {
+            @Override
             public void run() {
                 try {
                     while (loopcount.incrementAndGet() < iter) {
@@ -167,6 +169,7 @@ public class TestConcurrency extends Def
         final int iter = 100000 * 10;
         final AtomicInteger loopcount = new AtomicInteger(0);
         final Runnable run = new Runnable() {
+            @Override
             public void run() {
                 try {
                     while (loopcount.incrementAndGet() < iter) {

Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestSizePreservation.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestSizePreservation.java?rev=1166735&r1=1166734&r2=1166735&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestSizePreservation.java
(original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestSizePreservation.java
Thu Sep  8 15:14:43 2011
@@ -90,6 +90,7 @@ public class TestSizePreservation extend
         final int iterations = 1000;
         final AtomicInteger loopcount = new AtomicInteger(0);
         final Runnable run = new Runnable() {
+            @Override
             public void run() {
                 try {
                     while (loopcount.incrementAndGet() < iterations) {

Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestSlowQueryReport.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestSlowQueryReport.java?rev=1166735&r1=1166734&r2=1166735&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestSlowQueryReport.java
(original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestSlowQueryReport.java
Thu Sep  8 15:14:43 2011
@@ -159,14 +159,13 @@ public class TestSlowQueryReport extends
         this.datasource.setJdbcInterceptors(SlowQueryReport.class.getName());
         Connection con = this.datasource.getConnection();
         String slowSql = "select 1 from non_existent";
-        int exceptionCount = 0;
         for (int i=0; i<count; i++) {
             Statement st = con.createStatement();
             try {
                 ResultSet rs = st.executeQuery(slowSql);
                 rs.close();
             }catch (Exception x) {
-                exceptionCount++;
+                // NO-OP
             }
             st.close();
             
@@ -186,6 +185,7 @@ public class TestSlowQueryReport extends
     
     public class ClientListener implements NotificationListener {
         volatile int notificationCount = 0;
+        @Override
         public void handleNotification(Notification notification,
                                        Object handback) {
             notificationCount++;

Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestStatementCache.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestStatementCache.java?rev=1166735&r1=1166734&r2=1166735&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestStatementCache.java
(original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestStatementCache.java
Thu Sep  8 15:14:43 2011
@@ -33,8 +33,7 @@ public class TestStatementCache extends 
     
     @Override
     protected void tearDown() throws Exception {
-        // TODO Auto-generated method stub
-        this.interceptor = null;
+        interceptor = null;
         super.tearDown();
     }
 



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


Mime
View raw message