commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwaldh...@apache.org
Subject cvs commit: jakarta-commons/dbcp/src/test/org/apache/commons/dbcp TestManual.java
Date Wed, 03 Apr 2002 11:57:16 GMT
rwaldhoff    02/04/03 03:57:16

  Modified:    dbcp/src/java/org/apache/commons/dbcp
                        DelegatingConnection.java
               dbcp/src/test/org/apache/commons/dbcp TestManual.java
  Log:
  fix isClosed bug reported by Anjan on commons-dev
  add test for it
  
  Revision  Changes    Path
  1.3       +5 -5      jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/DelegatingConnection.java
  
  Index: DelegatingConnection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/DelegatingConnection.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DelegatingConnection.java	19 Mar 2002 06:05:34 -0000	1.2
  +++ DelegatingConnection.java	3 Apr 2002 11:57:16 -0000	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/DelegatingConnection.java,v
1.2 2002/03/19 06:05:34 craigmcc Exp $
  - * $Revision: 1.2 $
  - * $Date: 2002/03/19 06:05:34 $
  + * $Header: /home/cvs/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/DelegatingConnection.java,v
1.3 2002/04/03 11:57:16 rwaldhoff Exp $
  + * $Revision: 1.3 $
  + * $Date: 2002/04/03 11:57:16 $
    *
    * ====================================================================
    *
  @@ -73,7 +73,7 @@
    * provided in my constructor.
    *
    * @author Rodney Waldhoff
  - * @version $Id: DelegatingConnection.java,v 1.2 2002/03/19 06:05:34 craigmcc Exp $
  + * @version $Id: DelegatingConnection.java,v 1.3 2002/04/03 11:57:16 rwaldhoff Exp $
    */
   public class DelegatingConnection implements Connection {
       /** My delegate {@link Connection}. */
  @@ -139,7 +139,7 @@
       public int getTransactionIsolation() throws SQLException { checkOpen(); return _conn.getTransactionIsolation();}
       public Map getTypeMap() throws SQLException { checkOpen(); return _conn.getTypeMap();}
       public SQLWarning getWarnings() throws SQLException { checkOpen(); return _conn.getWarnings();}
  -    public boolean isClosed() throws SQLException { return _conn.isClosed();}
  +    public boolean isClosed() throws SQLException { return _closed || _conn.isClosed();}
       public boolean isReadOnly() throws SQLException { checkOpen(); return _conn.isReadOnly();}
       public String nativeSQL(String sql) throws SQLException { checkOpen(); return _conn.nativeSQL(sql);}
       public CallableStatement prepareCall(String sql) throws SQLException { checkOpen();
return _conn.prepareCall(sql);}
  
  
  
  1.3       +22 -5     jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/TestManual.java
  
  Index: TestManual.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/TestManual.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestManual.java	16 Mar 2002 13:29:49 -0000	1.2
  +++ TestManual.java	3 Apr 2002 11:57:16 -0000	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/TestManual.java,v
1.2 2002/03/16 13:29:49 rwaldhoff Exp $
  - * $Revision: 1.2 $
  - * $Date: 2002/03/16 13:29:49 $
  + * $Header: /home/cvs/jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/TestManual.java,v
1.3 2002/04/03 11:57:16 rwaldhoff Exp $
  + * $Revision: 1.3 $
  + * $Date: 2002/04/03 11:57:16 $
    *
    * ====================================================================
    *
  @@ -68,7 +68,7 @@
   
   /**
    * @author Rodney Waldhoff
  - * @version $Id: TestManual.java,v 1.2 2002/03/16 13:29:49 rwaldhoff Exp $
  + * @version $Id: TestManual.java,v 1.3 2002/04/03 11:57:16 rwaldhoff Exp $
    */
   public class TestManual extends TestCase {
       public TestManual(String testName) {
  @@ -91,7 +91,24 @@
           PoolableConnectionFactory pcf = new PoolableConnectionFactory(cf, pool, opf, "SELECT
COUNT(*) FROM DUAL", false, true);
           PoolingDriver driver = new PoolingDriver();
           driver.registerPool("test",pool);
  -        DriverManager.registerDriver(driver);
  +        DriverManager.registerDritestSimplever(driver);
  +    }
  +
  +    public void testIsClosed() throws Exception {
  +        for(int i=0;i<10;i++) {
  +            Connection conn = DriverManager.getConnection("jdbc:apache:commons:dbcp:test");
  +            assertTrue(null != conn);
  +            assertTrue(!conn.isClosed());
  +            PreparedStatement stmt = conn.prepareStatement("select * from dual");
  +            assertTrue(null != stmt);
  +            ResultSet rset = stmt.executeQuery();
  +            assertTrue(null != rset);
  +            assertTrue(rset.next());
  +            rset.close();
  +            stmt.close();
  +            conn.close();
  +            assertTrue(conn.isClosed());
  +        }
       }
   
       public void testSimple() throws Exception {
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message