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 TesterConnection.java TesterResultSet.java TesterStatement.java
Date Sun, 07 Mar 2004 10:54:55 GMT
dirkv       2004/03/07 02:54:55

  Modified:    dbcp/src/test/org/apache/commons/dbcp TesterConnection.java
                        TesterResultSet.java TesterStatement.java
  Log:
  infrastructure for testing "broken" connections
  
  Revision  Changes    Path
  1.12      +8 -1      jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/TesterConnection.java
  
  Index: TesterConnection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/TesterConnection.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- TesterConnection.java	28 Feb 2004 11:47:52 -0000	1.11
  +++ TesterConnection.java	7 Mar 2004 10:54:55 -0000	1.12
  @@ -140,6 +140,13 @@
   
       public PreparedStatement prepareStatement(String sql) throws SQLException {
           checkOpen();
  +        if("null".equals(sql)) {
  +            return null;
  +        } if("invalid".equals(sql)) {
  +            throw new SQLException("invalid query");
  +        } if ("broken".equals(sql)) {
  +            throw new SQLException("broken connection");
  +        }
           return new TesterPreparedStatement(this, sql);
       }
   
  
  
  
  1.12      +4 -1      jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/TesterResultSet.java
  
  Index: TesterResultSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/TesterResultSet.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- TesterResultSet.java	28 Feb 2004 11:47:52 -0000	1.11
  +++ TesterResultSet.java	7 Mar 2004 10:54:55 -0000	1.12
  @@ -90,6 +90,9 @@
   
       public String getString(int columnIndex) throws SQLException {
           checkOpen();
  +        if (columnIndex == -1) {
  +            throw new SQLException("broken connection");
  +        }
           if (_data != null) {
               return (String) getObject(columnIndex);
           }
  
  
  
  1.15      +3 -1      jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/TesterStatement.java
  
  Index: TesterStatement.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/TesterStatement.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- TesterStatement.java	28 Feb 2004 11:47:52 -0000	1.14
  +++ TesterStatement.java	7 Mar 2004 10:54:55 -0000	1.15
  @@ -61,6 +61,8 @@
               return null;
           } if("invalid".equals(sql)) {
               throw new SQLException("invalid query");
  +        } if ("broken".equals(sql)) {
  +            throw new SQLException("broken connection");
           } if("select username".equals(sql)) {
               String username = ((TesterConnection) _connection).getUsername();
               Object[][] data = {{username}};
  
  
  

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