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 Thu, 07 Nov 2002 21:06:58 GMT
rwaldhoff    2002/11/07 13:06:58

  Modified:    dbcp/src/test/org/apache/commons/dbcp TestManual.java
  Log:
  add a test that corresponds to the sample code at http://issues.apache.org/bugzilla/show_bug.cgi?id=12400,
but I don't see any problems here
  
  Revision  Changes    Path
  1.11      +44 -9     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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- TestManual.java	1 Nov 2002 15:42:33 -0000	1.10
  +++ TestManual.java	7 Nov 2002 21:06:57 -0000	1.11
  @@ -228,8 +228,8 @@
       }
       
       public void testAutoCommitBehavior() throws Exception {
  -    	
  -    	final String strDriverUrl = "jdbc:apache:commons:dbcp:test";
  +        
  +        final String strDriverUrl = "jdbc:apache:commons:dbcp:test";
           Connection conn = DriverManager.getConnection(strDriverUrl);
           assertTrue(conn != null);
           assertTrue(conn.getAutoCommit());
  @@ -242,9 +242,44 @@
           Connection conn3 = DriverManager.getConnection(strDriverUrl);
           assertTrue( conn3.getAutoCommit() );
   
  -		conn2.close();
  -		
  -		conn3.close();
  +        conn2.close();
  +        
  +        conn3.close();
  +    }
  +    
  +    /** @see http://issues.apache.org/bugzilla/show_bug.cgi?id=12400 */
  +    public void testReportedBug12400() throws Exception {
  +        ObjectPool connectionPool = new GenericObjectPool(
  +            null,
  +            70,
  +            GenericObjectPool.WHEN_EXHAUSTED_BLOCK,
  +            60000,
  +            10);
  +        ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(
  +            "jdbc:apache:commons:testdriver", 
  +            "username", 
  +            "password");
  +        PoolableConnectionFactory poolableConnectionFactory = 
  +            new PoolableConnectionFactory(
  +                connectionFactory,
  +                connectionPool,
  +                null,
  +                null,
  +                false,
  +                true);
  +        PoolingDriver driver = new PoolingDriver();
  +        driver.registerPool("neusoftim",connectionPool);
  +        Connection[] conn = new Connection[25];
  +        for(int i=0;i<25;i++) {
  +            conn[i] = DriverManager.getConnection("jdbc:apache:commons:dbcp:neusoftim");
  +            for(int j=0;j<i;j++) {
  +                assertTrue(conn[j] != conn[i]);
  +                assertTrue(!conn[j].equals(conn[i]));
  +            }
  +        }
  +        for(int i=0;i<25;i++) {
  +            conn[i].close();
  +        }
       }
       
   }
  
  
  

--
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