commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From di...@apache.org
Subject cvs commit: jakarta-commons/dbcp/src/test/org/apache/commons/dbcp TestPStmtPoolingBasicDataSource.java
Date Sun, 07 Mar 2004 15:29:06 GMT
dirkv       2004/03/07 07:29:06

  Modified:    dbcp/src/test/org/apache/commons/dbcp
                        TestPStmtPoolingBasicDataSource.java
  Log:
  JUnit test for Bugzilla Bug 27246
  PreparedStatement cache should be different depending on the Catalog
  
  Revision  Changes    Path
  1.5       +27 -1     jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/TestPStmtPoolingBasicDataSource.java
  
  Index: TestPStmtPoolingBasicDataSource.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/TestPStmtPoolingBasicDataSource.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestPStmtPoolingBasicDataSource.java	7 Mar 2004 10:53:56 -0000	1.4
  +++ TestPStmtPoolingBasicDataSource.java	7 Mar 2004 15:29:06 -0000	1.5
  @@ -87,6 +87,32 @@
           assertNotNull(stmt4);
       }
   
  +    // Bugzilla Bug 27246
  +    // PreparedStatement cache should be different depending on the Catalog    
  +    public void testPStmtCatalog() throws Exception {
  +        Connection conn = getConnection();
  +        conn.setCatalog("catalog1");
  +        DelegatingPreparedStatement stmt1 = (DelegatingPreparedStatement) conn.prepareStatement("select
'a' from dual");
  +        TesterPreparedStatement inner1 = (TesterPreparedStatement) stmt1.getInnermostDelegate();
  +        assertEquals("catalog1", inner1.getCatalog());
  +        stmt1.close();
  +        
  +        conn.setCatalog("catalog2");
  +        DelegatingPreparedStatement stmt2 = (DelegatingPreparedStatement) conn.prepareStatement("select
'a' from dual");
  +        TesterPreparedStatement inner2 = (TesterPreparedStatement) stmt2.getInnermostDelegate();
  +        assertEquals("catalog2", inner2.getCatalog());
  +        stmt2.close();
  +
  +        conn.setCatalog("catalog1");
  +        DelegatingPreparedStatement stmt3 = (DelegatingPreparedStatement) conn.prepareStatement("select
'a' from dual");
  +        TesterPreparedStatement inner3 = (TesterPreparedStatement) stmt1.getInnermostDelegate();
  +        assertEquals("catalog1", inner3.getCatalog());
  +        stmt3.close();
  +        
  +        assertNotSame(inner1, inner2);
  +        assertSame(inner1, inner3);
  +    }
  +
       public void testPStmtPoolingWithNoClose() throws Exception {
           ds.setMaxActive(1); // only one connection in pool needed
           ds.setMaxIdle(1);
  
  
  

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


Mime
View raw message