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 14:29:59 GMT
dirkv       2003/09/20 07:29:59

  Modified:    dbcp/src/test/org/apache/commons/dbcp
                        TestBasicDataSource.java
  Log:
  Bugzilla Bug 23157: add defaultCatalog to BasicDataSource
  - junit test: testDefaultCatalog
  
  Revision  Changes    Path
  1.10      +29 -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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- TestBasicDataSource.java	14 Sep 2003 00:19:43 -0000	1.9
  +++ TestBasicDataSource.java	20 Sep 2003 14:29:59 -0000	1.10
  @@ -85,6 +85,7 @@
       }
   
       private BasicDataSource ds = null;
  +    private static String CATALOG = "test catalog";
       
       public void setUp() throws Exception {
           super.setUp();
  @@ -96,6 +97,7 @@
           ds.setDefaultAutoCommit(true);
           ds.setDefaultReadOnly(false);
           ds.setDefaultTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
  +        ds.setDefaultCatalog(CATALOG);
           ds.setUsername("username");
           ds.setPassword("password");
           ds.setValidationQuery("SELECT DUMMY FROM DUAL");
  @@ -213,6 +215,30 @@
               if (e.toString().indexOf("invalid") < 0) {
                   fail("expected detailed error message");
               }
  +        }
  +    }
  +    
  +    public void testDefaultCatalog() throws Exception {
  +        Connection[] c = new Connection[getMaxActive()];
  +        for (int i = 0; i < c.length; i++) {
  +            c[i] = getConnection();
  +            assertTrue(c[i] != null);
  +            assertEquals(CATALOG, c[i].getCatalog()); 
  +        }
  +
  +        for (int i = 0; i < c.length; i++) {
  +            c[i].setCatalog("error");
  +            c[i].close();
  +        }
  +        
  +        for (int i = 0; i < c.length; i++) {
  +            c[i] = getConnection();
  +            assertTrue(c[i] != null);
  +            assertEquals(CATALOG, c[i].getCatalog()); 
  +        }        
  +
  +        for (int i = 0; i < c.length; i++) {
  +            c[i].close();
           }
       }
   }
  
  
  

Mime
View raw message