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 TestBasicDataSource.java
Date Sat, 20 Sep 2003 17:31:38 GMT
dirkv       2003/09/20 10:31:38

  Modified:    dbcp/src/test/org/apache/commons/dbcp
                        TestBasicDataSource.java
  Log:
  Bugzilla Bug 23291:  impossible to turn off all validation tests when a validationQuery
is present
  => junit test
  
  Revision  Changes    Path
  1.12      +38 -3     jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/TestBasicDataSource.java
  
  Index: TestBasicDataSource.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/TestBasicDataSource.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- TestBasicDataSource.java	20 Sep 2003 16:59:41 -0000	1.11
  +++ TestBasicDataSource.java	20 Sep 2003 17:31:38 -0000	1.12
  @@ -217,6 +217,41 @@
               }
           }
       }
  +
  +    public void testSetValidationTestProperties() {
  +        // defaults
  +        assertEquals(true, ds.getTestOnBorrow());
  +        assertEquals(false, ds.getTestOnReturn());
  +        assertEquals(false, ds.getTestWhileIdle());
  +
  +        ds.setTestOnBorrow(true);
  +        ds.setTestOnReturn(true);
  +        ds.setTestWhileIdle(true);
  +        assertEquals(true, ds.getTestOnBorrow());
  +        assertEquals(true, ds.getTestOnReturn());
  +        assertEquals(true, ds.getTestWhileIdle());
  +
  +        ds.setTestOnBorrow(false);
  +        ds.setTestOnReturn(false);
  +        ds.setTestWhileIdle(false);
  +        assertEquals(false, ds.getTestOnBorrow());
  +        assertEquals(false, ds.getTestOnReturn());
  +        assertEquals(false, ds.getTestWhileIdle());
  +    }
  +
  +    public void testNoValidationQuery() throws Exception {
  +        ds.setTestOnBorrow(true);
  +        ds.setTestOnReturn(true);
  +        ds.setTestWhileIdle(true);
  +        ds.setValidationQuery("");
  +        
  +        Connection conn = ds.getConnection();
  +        conn.close();
  +
  +        assertEquals(false, ds.getTestOnBorrow());
  +        assertEquals(false, ds.getTestOnReturn());
  +        assertEquals(false, ds.getTestWhileIdle());
  +    }
       
       public void testDefaultCatalog() throws Exception {
           Connection[] c = new Connection[getMaxActive()];
  
  
  

Mime
View raw message