commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r830125 - in /commons/proper/dbcp/trunk/src/test/org/apache/commons: dbcp/ dbcp/cpdsadapter/ dbcp/datasources/ dbcp/managed/ jocl/
Date Tue, 27 Oct 2009 10:36:26 GMT
Author: markt
Date: Tue Oct 27 10:36:25 2009
New Revision: 830125

URL: http://svn.apache.org/viewvc?rev=830125&view=rev
Log:
Fix various Checkstyle/Eclipse warnings in the test cases including
- remove unused imports
- remove unused local variables
- mark methods as deprecated if they override deprecated methods
- avoid auto-boxing

All unit tess still pass

Modified:
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestBasicDataSource.java
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestDriverManagerConnectionFactory.java
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestManual.java
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestPStmtPooling.java
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TesterCallableStatement.java
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/cpdsadapter/TestDriverAdapterCPDS.java
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/PooledConnectionProxy.java
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestCPDSConnectionFactory.java
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestInstanceKeyDataSource.java
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/managed/TestBasicManagedDataSource.java
    commons/proper/dbcp/trunk/src/test/org/apache/commons/jocl/TestAll.java
    commons/proper/dbcp/trunk/src/test/org/apache/commons/jocl/TestJOCLContentHandler.java

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestBasicDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestBasicDataSource.java?rev=830125&r1=830124&r2=830125&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestBasicDataSource.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestBasicDataSource.java Tue
Oct 27 10:36:25 2009
@@ -480,7 +480,7 @@
         int threadCount = Thread.activeCount();
         for (int i = 0; i < 10; i++) {
             try {
-                Connection con = ds.getConnection();
+                ds.getConnection();
             } catch (SQLException ex) {
                 // ignore
             }

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestDriverManagerConnectionFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestDriverManagerConnectionFactory.java?rev=830125&r1=830124&r2=830125&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestDriverManagerConnectionFactory.java
(original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestDriverManagerConnectionFactory.java
Tue Oct 27 10:36:25 2009
@@ -80,7 +80,7 @@
         }
     }
     
-    private static class ConnectionThread implements Runnable {
+    private static final class ConnectionThread implements Runnable {
         private DataSource ds;
         private volatile boolean result = true;
         

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestManual.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestManual.java?rev=830125&r1=830124&r2=830125&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestManual.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestManual.java Tue Oct 27
10:36:25 2009
@@ -74,14 +74,14 @@
     public void test1() {
         GenericObjectPool connectionPool = new GenericObjectPool(null);
         ConnectionFactory connectionFactory = new DriverManagerConnectionFactory("jdbc:some:connect:string","username","password");
-        PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory,connectionPool,null,null,false,true);
-        PoolingDataSource dataSource = new PoolingDataSource(connectionPool);
+        new PoolableConnectionFactory(connectionFactory,connectionPool,null,null,false,true);
+        new PoolingDataSource(connectionPool);
     }
 
     public void test2() {
         GenericObjectPool connectionPool = new GenericObjectPool(null);
         ConnectionFactory connectionFactory = new DriverManagerConnectionFactory("jdbc:some:connect:string","username","password");
-        PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory,connectionPool,null,null,false,true);
+        new PoolableConnectionFactory(connectionFactory,connectionPool,null,null,false,true);
         PoolingDriver driver = new PoolingDriver();
         driver.registerPool("example",connectionPool);
     }

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestPStmtPooling.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestPStmtPooling.java?rev=830125&r1=830124&r2=830125&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestPStmtPooling.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestPStmtPooling.java Tue Oct
27 10:36:25 2009
@@ -55,8 +55,7 @@
         ObjectPool connPool = new GenericObjectPool();
         KeyedObjectPoolFactory stmtPoolFactory = new GenericKeyedObjectPoolFactory(null);
 
-        PoolableConnectionFactory x = new PoolableConnectionFactory(
-                connFactory, connPool, stmtPoolFactory,
+        new PoolableConnectionFactory(connFactory, connPool, stmtPoolFactory,
                 null, false, true);
 
         DataSource ds = new PoolingDataSource(connPool);
@@ -79,22 +78,21 @@
         ObjectPool connPool = new GenericObjectPool();
         KeyedObjectPoolFactory stmtPoolFactory = new GenericKeyedObjectPoolFactory(null);
 
-        PoolableConnectionFactory x = new PoolableConnectionFactory(
-                connFactory, connPool, stmtPoolFactory,
+        new PoolableConnectionFactory(connFactory, connPool, stmtPoolFactory,
                 null, false, true);
 
         DataSource ds = new PoolingDataSource(connPool);
         ((PoolingDataSource) ds).setAccessToUnderlyingConnectionAllowed(true);
 
         Connection conn = ds.getConnection();
-        Statement stmt = conn.prepareStatement("select 1 from dual");
+        conn.prepareStatement("select 1 from dual");
         
         Connection poolableConnection = ((DelegatingConnection) conn).getDelegate();
         Connection poolingConnection = 
             ((DelegatingConnection) poolableConnection).getDelegate();
         poolingConnection.close();
         try {
-            stmt = conn.prepareStatement("select 1 from dual");
+            conn.prepareStatement("select 1 from dual");
             fail("Expecting SQLException");
         } catch (SQLException ex) {
             assertTrue(ex.getMessage().endsWith("invalid PoolingConnection."));

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TesterCallableStatement.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TesterCallableStatement.java?rev=830125&r1=830124&r2=830125&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TesterCallableStatement.java
(original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TesterCallableStatement.java
Tue Oct 27 10:36:25 2009
@@ -101,6 +101,9 @@
         return 0;
     }
 
+    /**
+     * @deprecated
+     */
     public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException {
         return null;
     }

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/cpdsadapter/TestDriverAdapterCPDS.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/cpdsadapter/TestDriverAdapterCPDS.java?rev=830125&r1=830124&r2=830125&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/cpdsadapter/TestDriverAdapterCPDS.java
(original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/cpdsadapter/TestDriverAdapterCPDS.java
Tue Oct 27 10:36:25 2009
@@ -28,8 +28,6 @@
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
-import org.apache.commons.dbcp.SQLNestedException;
-
 /**
  * Tests for DriverAdapterCPDS
  * 

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/PooledConnectionProxy.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/PooledConnectionProxy.java?rev=830125&r1=830124&r2=830125&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/PooledConnectionProxy.java
(original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/PooledConnectionProxy.java
Tue Oct 27 10:36:25 2009
@@ -21,7 +21,6 @@
 import java.sql.SQLException;
 
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.Vector;
 
 import javax.sql.ConnectionEvent;

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestCPDSConnectionFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestCPDSConnectionFactory.java?rev=830125&r1=830124&r2=830125&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestCPDSConnectionFactory.java
(original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestCPDSConnectionFactory.java
Tue Oct 27 10:36:25 2009
@@ -64,9 +64,9 @@
     public void testSharedPoolDSDestroyOnReturn() throws Exception {
        PerUserPoolDataSource ds = new PerUserPoolDataSource();
        ds.setConnectionPoolDataSource(cpds);
-       ds.setPerUserMaxActive("username",10);
-       ds.setPerUserMaxWait("username",50);
-       ds.setPerUserMaxIdle("username",2);
+       ds.setPerUserMaxActive("username",Integer.valueOf(10));
+       ds.setPerUserMaxWait("username",Integer.valueOf(50));
+       ds.setPerUserMaxIdle("username",Integer.valueOf(2));
        Connection conn1 = ds.getConnection("username", "password");
        Connection conn2 = ds.getConnection("username", "password");
        Connection conn3 = ds.getConnection("username", "password");

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestInstanceKeyDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestInstanceKeyDataSource.java?rev=830125&r1=830124&r2=830125&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestInstanceKeyDataSource.java
(original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestInstanceKeyDataSource.java
Tue Oct 27 10:36:25 2009
@@ -59,7 +59,7 @@
         tds.setConnectionPoolDataSource(pcds);
         int numConnections = tds.getNumActive();
         try {
-            Connection conn = tds.getConnection("foo", "bar");
+            tds.getConnection("foo", "bar");
             fail("Expecting SQLException");
         } catch (SQLException ex) {
            //Expected

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java?rev=830125&r1=830124&r2=830125&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java
(original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java
Tue Oct 27 10:36:25 2009
@@ -314,7 +314,7 @@
         tds.setPerUserMaxActive("u1", new Integer(1));
         Connection conn = tds.getConnection("u1", "p1");
         try {
-            Connection conn2 = tds.getConnection("u1", "p1");
+            tds.getConnection("u1", "p1");
             fail("Expecting Pool Exhausted exception");
         } catch (SQLException ex) {
             // expected

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/managed/TestBasicManagedDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/managed/TestBasicManagedDataSource.java?rev=830125&r1=830124&r2=830125&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/managed/TestBasicManagedDataSource.java
(original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/managed/TestBasicManagedDataSource.java
Tue Oct 27 10:36:25 2009
@@ -19,7 +19,6 @@
 
 import java.sql.SQLException;
 import org.apache.commons.dbcp.BasicDataSource;
-import org.apache.commons.dbcp.PoolableConnection;
 import org.apache.commons.dbcp.TestBasicDataSource;
 import org.apache.commons.dbcp.managed.LocalXAConnectionFactory.LocalXAResource;
 import org.apache.geronimo.transaction.manager.TransactionManagerImpl;

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/jocl/TestAll.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/jocl/TestAll.java?rev=830125&r1=830124&r2=830125&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/jocl/TestAll.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/jocl/TestAll.java Tue Oct 27 10:36:25
2009
@@ -17,7 +17,10 @@
 
 package org.apache.commons.jocl;
 
-import junit.framework.*;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
 
 /**
  * @version $Revision$ $Date$

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/jocl/TestJOCLContentHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/jocl/TestJOCLContentHandler.java?rev=830125&r1=830124&r2=830125&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/jocl/TestJOCLContentHandler.java
(original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/jocl/TestJOCLContentHandler.java
Tue Oct 27 10:36:25 2009
@@ -252,6 +252,6 @@
         throws IOException, SAXException
     {
         InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("testpool.jocl");
-        JOCLContentHandler jocl = JOCLContentHandler.parse(stream);
+        JOCLContentHandler.parse(stream);
     }
 }



Mime
View raw message