You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ma...@apache.org on 2009/10/27 14:30:50 UTC

svn commit: r830174 - in /commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp: TestAll.java TestDelegatingDatabaseMetaData.java TesterConnection.java TesterDatabaseMetaData.java TesterResultSet.java

Author: markt
Date: Tue Oct 27 13:30:50 2009
New Revision: 830174

URL: http://svn.apache.org/viewvc?rev=830174&view=rev
Log:
Add a test case for DBCP-265

Added:
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestDelegatingDatabaseMetaData.java   (with props)
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TesterDatabaseMetaData.java   (with props)
Modified:
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestAll.java
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TesterConnection.java
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TesterResultSet.java

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestAll.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestAll.java?rev=830174&r1=830173&r2=830174&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestAll.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestAll.java Tue Oct 27 13:30:50 2009
@@ -52,6 +52,7 @@
         suite.addTest(TestBasicDataSourceFactory.suite());
         // TestConnectionPool is abstract
         suite.addTest(TestDelegatingConnection.suite());
+        suite.addTest(TestDelegatingDatabaseMetaData.suite());
         suite.addTest(TestDelegatingPreparedStatement.suite());
         suite.addTest(TestDelegatingStatement.suite());
         suite.addTest(TestJndi.suite());

Added: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestDelegatingDatabaseMetaData.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestDelegatingDatabaseMetaData.java?rev=830174&view=auto
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestDelegatingDatabaseMetaData.java (added)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestDelegatingDatabaseMetaData.java Tue Oct 27 13:30:50 2009
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.dbcp;
+
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Test suite for {@link DelegatingDatabaseMetaData}.
+ */
+public class TestDelegatingDatabaseMetaData extends TestCase {
+    public TestDelegatingDatabaseMetaData(String testName) {
+        super(testName);
+    }
+
+    public static Test suite() {
+        return new TestSuite(TestDelegatingDatabaseMetaData.class);
+    }
+
+    private DelegatingConnection conn = null;
+    private Connection delegateConn = null;
+    private DelegatingDatabaseMetaData meta = null;
+    private DatabaseMetaData delegateMeta = null;
+
+    public void setUp() throws Exception {
+        delegateConn = new TesterConnection("test", "test");
+        delegateMeta = delegateConn.getMetaData();
+        conn = new DelegatingConnection(delegateConn);
+        meta = new DelegatingDatabaseMetaData(conn,delegateMeta);
+    }
+
+    public void testGetDelegate() throws Exception {
+        assertEquals(delegateMeta,meta.getDelegate());
+    }
+
+    public void testHashCode() {
+        try {
+            delegateMeta = conn.getMetaData();
+        } catch (SQLException e) {
+            fail("No exception expected retrieving meta data");
+        }
+        DelegatingDatabaseMetaData meta =
+            new DelegatingDatabaseMetaData(conn,delegateMeta);
+        DelegatingDatabaseMetaData meta2 =
+            new DelegatingDatabaseMetaData(conn,delegateMeta);
+        assertEquals(meta.hashCode(), meta2.hashCode());
+    }
+    
+    public void testEquals() {
+        try {
+            delegateMeta = conn.getMetaData();
+        } catch (SQLException e) {
+            fail("No exception expected retrieving meta data");
+        }
+        DelegatingDatabaseMetaData meta =
+            new DelegatingDatabaseMetaData(conn,delegateMeta);
+        DelegatingDatabaseMetaData meta2 =
+            new DelegatingDatabaseMetaData(conn,delegateMeta);
+        DelegatingDatabaseMetaData meta3 =
+            new DelegatingDatabaseMetaData(conn,null);
+        
+        assertTrue(!meta.equals(null));
+        assertTrue(meta.equals(meta2));
+        assertTrue(!meta.equals(meta3));
+    }
+    
+    public void testCheckOpen() throws Exception {
+        ResultSet rst = meta.getSchemas();
+        assertTrue(!rst.isClosed());
+        conn.close();
+        assertTrue(rst.isClosed());
+    }
+}

Propchange: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestDelegatingDatabaseMetaData.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestDelegatingDatabaseMetaData.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TesterConnection.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TesterConnection.java?rev=830174&r1=830173&r2=830174&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TesterConnection.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TesterConnection.java Tue Oct 27 13:30:50 2009
@@ -47,7 +47,7 @@
     protected boolean _open = true;
     protected boolean _autoCommit = true;
     protected int _transactionIsolation = 1;
-    protected DatabaseMetaData _metaData = null;
+    protected DatabaseMetaData _metaData = new TesterDatabaseMetaData();
     protected String _catalog = null;
     protected Map _typeMap = null;
     protected boolean _readOnly = false;

Added: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TesterDatabaseMetaData.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TesterDatabaseMetaData.java?rev=830174&view=auto
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TesterDatabaseMetaData.java (added)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TesterDatabaseMetaData.java Tue Oct 27 13:30:50 2009
@@ -0,0 +1,747 @@
+package org.apache.commons.dbcp;
+
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+/* JDBC_4_ANT_KEY_BEGIN */
+import java.sql.RowIdLifetime;
+/* JDBC_4_ANT_KEY_END */
+import java.sql.SQLException;
+
+/**
+ * Dummy {@link DatabaseMetaData} for tetsing purposes. Implements only those
+ * methods required by the test cases.
+ */
+public class TesterDatabaseMetaData implements DatabaseMetaData {
+
+    public boolean allProceduresAreCallable() throws SQLException {
+        return false;
+    }
+
+    public boolean allTablesAreSelectable() throws SQLException {
+        return false;
+    }
+
+    public boolean dataDefinitionCausesTransactionCommit() throws SQLException {
+        return false;
+    }
+
+    public boolean dataDefinitionIgnoredInTransactions() throws SQLException {
+        return false;
+    }
+
+    public boolean deletesAreDetected(int type) throws SQLException {
+        return false;
+    }
+
+    public boolean doesMaxRowSizeIncludeBlobs() throws SQLException {
+        return false;
+    }
+
+    public ResultSet getAttributes(String catalog, String schemaPattern,
+            String typeNamePattern, String attributeNamePattern)
+            throws SQLException {
+        return null;
+    }
+
+    public ResultSet getBestRowIdentifier(String catalog, String schema,
+            String table, int scope, boolean nullable) throws SQLException {
+        return null;
+    }
+
+    public String getCatalogSeparator() throws SQLException {
+        return null;
+    }
+    
+    public String getCatalogTerm() throws SQLException {
+        return null;
+    }
+    
+    public ResultSet getCatalogs() throws SQLException {
+        return null;
+    }
+    
+    public ResultSet getColumnPrivileges(String catalog, String schema,
+            String table, String columnNamePattern) throws SQLException {
+        return null;
+    }
+
+    public ResultSet getColumns(String catalog, String schemaPattern,
+            String tableNamePattern, String columnNamePattern)
+            throws SQLException {
+        return null;
+    }
+
+    public Connection getConnection() throws SQLException {
+        return null;
+    }
+
+    public ResultSet getCrossReference(String parentCatalog,
+            String parentSchema, String parentTable, String foreignCatalog,
+            String foreignSchema, String foreignTable) throws SQLException {
+        return null;
+    }
+
+    public int getDatabaseMajorVersion() throws SQLException {
+        return 0;
+    }
+
+    public int getDatabaseMinorVersion() throws SQLException {
+        return 0;
+    }
+
+    public String getDatabaseProductName() throws SQLException {
+        return null;
+    }
+
+    public String getDatabaseProductVersion() throws SQLException {
+        return null;
+    }
+
+    public int getDefaultTransactionIsolation() throws SQLException {
+        return 0;
+    }
+
+    public int getDriverMajorVersion() {
+        return 0;
+    }
+
+    public int getDriverMinorVersion() {
+        return 0;
+    }
+
+    public String getDriverName() throws SQLException {
+        return null;
+    }
+
+    public String getDriverVersion() throws SQLException {
+        return null;
+    }
+
+    public ResultSet getExportedKeys(String catalog, String schema, String table)
+            throws SQLException {
+        return null;
+    }
+
+    public String getExtraNameCharacters() throws SQLException {
+        return null;
+    }
+
+    public String getIdentifierQuoteString() throws SQLException {
+        return null;
+    }
+
+    public ResultSet getImportedKeys(String catalog, String schema, String table)
+            throws SQLException {
+        return null;
+    }
+
+    public ResultSet getIndexInfo(String catalog, String schema, String table,
+            boolean unique, boolean approximate) throws SQLException {
+        return null;
+    }
+
+    public int getJDBCMajorVersion() throws SQLException {
+        return 0;
+    }
+
+    public int getJDBCMinorVersion() throws SQLException {
+        return 0;
+    }
+
+    public int getMaxBinaryLiteralLength() throws SQLException {
+        return 0;
+    }
+
+    public int getMaxCatalogNameLength() throws SQLException {
+        return 0;
+    }
+
+    public int getMaxCharLiteralLength() throws SQLException {
+        return 0;
+    }
+
+    public int getMaxColumnNameLength() throws SQLException {
+        return 0;
+    }
+
+    public int getMaxColumnsInGroupBy() throws SQLException {
+        return 0;
+    }
+
+    public int getMaxColumnsInIndex() throws SQLException {
+        return 0;
+    }
+
+    public int getMaxColumnsInOrderBy() throws SQLException {
+        return 0;
+    }
+
+    public int getMaxColumnsInSelect() throws SQLException {
+        return 0;
+    }
+
+    public int getMaxColumnsInTable() throws SQLException {
+        return 0;
+    }
+
+    public int getMaxConnections() throws SQLException {
+        return 0;
+    }
+
+    public int getMaxCursorNameLength() throws SQLException {
+        return 0;
+    }
+
+    public int getMaxIndexLength() throws SQLException {
+        return 0;
+    }
+
+    public int getMaxProcedureNameLength() throws SQLException {
+        return 0;
+    }
+
+    public int getMaxRowSize() throws SQLException {
+        return 0;
+    }
+
+    public int getMaxSchemaNameLength() throws SQLException {
+        return 0;
+    }
+
+    public int getMaxStatementLength() throws SQLException {
+        return 0;
+    }
+
+    public int getMaxStatements() throws SQLException {
+        return 0;
+    }
+
+    public int getMaxTableNameLength() throws SQLException {
+        return 0;
+    }
+
+    public int getMaxTablesInSelect() throws SQLException {
+        return 0;
+    }
+
+    public int getMaxUserNameLength() throws SQLException {
+        return 0;
+    }
+
+    public String getNumericFunctions() throws SQLException {
+        return null;
+    }
+
+    public ResultSet getPrimaryKeys(String catalog, String schema, String table)
+            throws SQLException {
+        return null;
+    }
+
+    public ResultSet getProcedureColumns(String catalog, String schemaPattern,
+            String procedureNamePattern, String columnNamePattern)
+            throws SQLException {
+        return null;
+    }
+
+    public String getProcedureTerm() throws SQLException {
+        return null;
+    }
+
+    public ResultSet getProcedures(String catalog, String schemaPattern,
+            String procedureNamePattern) throws SQLException {
+        return null;
+    }
+
+    public int getResultSetHoldability() throws SQLException {
+        return 0;
+    }
+
+    public String getSQLKeywords() throws SQLException {
+        return null;
+    }
+
+    public int getSQLStateType() throws SQLException {
+        return 0;
+    }
+
+    public String getSchemaTerm() throws SQLException {
+        return null;
+    }
+
+    public ResultSet getSchemas() throws SQLException {
+        return new TesterResultSet(null);
+    }
+
+    public String getSearchStringEscape() throws SQLException {
+        return null;
+    }
+
+    public String getStringFunctions() throws SQLException {
+        return null;
+    }
+
+    public ResultSet getSuperTables(String catalog, String schemaPattern,
+            String tableNamePattern) throws SQLException {
+        return null;
+    }
+
+    public ResultSet getSuperTypes(String catalog, String schemaPattern,
+            String typeNamePattern) throws SQLException {
+        return null;
+    }
+
+    public String getSystemFunctions() throws SQLException {
+        return null;
+    }
+
+    public ResultSet getTablePrivileges(String catalog, String schemaPattern,
+            String tableNamePattern) throws SQLException {
+        return null;
+    }
+
+    public ResultSet getTableTypes() throws SQLException {
+        return null;
+    }
+
+    public ResultSet getTables(String catalog, String schemaPattern,
+            String tableNamePattern, String[] types) throws SQLException {
+        return null;
+    }
+
+    public String getTimeDateFunctions() throws SQLException {
+        return null;
+    }
+
+    public ResultSet getTypeInfo() throws SQLException {
+        return null;
+    }
+
+    public ResultSet getUDTs(String catalog, String schemaPattern,
+            String typeNamePattern, int[] types) throws SQLException {
+        return null;
+    }
+
+    public String getURL() throws SQLException {
+        return null;
+    }
+
+    public String getUserName() throws SQLException {
+        return null;
+    }
+
+    public ResultSet getVersionColumns(String catalog, String schema,
+            String table) throws SQLException {
+        return null;
+    }
+
+    public boolean insertsAreDetected(int type) throws SQLException {
+        return false;
+    }
+
+    public boolean isCatalogAtStart() throws SQLException {
+        return false;
+    }
+
+    public boolean isReadOnly() throws SQLException {
+        return false;
+    }
+
+    public boolean locatorsUpdateCopy() throws SQLException {
+        return false;
+    }
+
+    public boolean nullPlusNonNullIsNull() throws SQLException {
+        return false;
+    }
+
+    public boolean nullsAreSortedAtEnd() throws SQLException {
+        return false;
+    }
+
+    public boolean nullsAreSortedAtStart() throws SQLException {
+        return false;
+    }
+
+    public boolean nullsAreSortedHigh() throws SQLException {
+        return false;
+    }
+
+    public boolean nullsAreSortedLow() throws SQLException {
+        return false;
+    }
+
+    public boolean othersDeletesAreVisible(int type) throws SQLException {
+        return false;
+    }
+
+    public boolean othersInsertsAreVisible(int type) throws SQLException {
+        return false;
+    }
+
+    public boolean othersUpdatesAreVisible(int type) throws SQLException {
+        return false;
+    }
+
+    public boolean ownDeletesAreVisible(int type) throws SQLException {
+        return false;
+    }
+
+    public boolean ownInsertsAreVisible(int type) throws SQLException {
+        return false;
+    }
+
+    public boolean ownUpdatesAreVisible(int type) throws SQLException {
+        return false;
+    }
+
+    public boolean storesLowerCaseIdentifiers() throws SQLException {
+        return false;
+    }
+
+    public boolean storesLowerCaseQuotedIdentifiers() throws SQLException {
+        return false;
+    }
+
+    public boolean storesMixedCaseIdentifiers() throws SQLException {
+        return false;
+    }
+
+    public boolean storesMixedCaseQuotedIdentifiers() throws SQLException {
+        return false;
+    }
+
+    public boolean storesUpperCaseIdentifiers() throws SQLException {
+        return false;
+    }
+
+    public boolean storesUpperCaseQuotedIdentifiers() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsANSI92EntryLevelSQL() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsANSI92FullSQL() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsANSI92IntermediateSQL() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsAlterTableWithAddColumn() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsAlterTableWithDropColumn() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsBatchUpdates() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsCatalogsInDataManipulation() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsCatalogsInIndexDefinitions() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsCatalogsInProcedureCalls() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsCatalogsInTableDefinitions() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsColumnAliasing() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsConvert() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsConvert(int fromType, int toType)
+            throws SQLException {
+        return false;
+    }
+
+    public boolean supportsCoreSQLGrammar() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsCorrelatedSubqueries() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsDataDefinitionAndDataManipulationTransactions()
+            throws SQLException {
+        return false;
+    }
+
+    public boolean supportsDataManipulationTransactionsOnly()
+            throws SQLException {
+        return false;
+    }
+
+    public boolean supportsDifferentTableCorrelationNames() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsExpressionsInOrderBy() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsExtendedSQLGrammar() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsFullOuterJoins() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsGetGeneratedKeys() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsGroupBy() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsGroupByBeyondSelect() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsGroupByUnrelated() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsIntegrityEnhancementFacility() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsLikeEscapeClause() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsLimitedOuterJoins() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsMinimumSQLGrammar() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsMixedCaseIdentifiers() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsMultipleOpenResults() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsMultipleResultSets() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsMultipleTransactions() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsNamedParameters() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsNonNullableColumns() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsOpenCursorsAcrossCommit() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsOpenCursorsAcrossRollback() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsOpenStatementsAcrossCommit() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsOpenStatementsAcrossRollback() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsOrderByUnrelated() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsOuterJoins() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsPositionedDelete() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsPositionedUpdate() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsResultSetConcurrency(int type, int concurrency)
+            throws SQLException {
+        return false;
+    }
+
+    public boolean supportsResultSetHoldability(int holdability)
+            throws SQLException {
+        return false;
+    }
+
+    public boolean supportsResultSetType(int type) throws SQLException {
+        return false;
+    }
+
+    public boolean supportsSavepoints() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsSchemasInDataManipulation() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsSchemasInIndexDefinitions() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsSchemasInProcedureCalls() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsSchemasInTableDefinitions() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsSelectForUpdate() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsStatementPooling() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsStoredProcedures() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsSubqueriesInComparisons() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsSubqueriesInExists() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsSubqueriesInIns() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsSubqueriesInQuantifieds() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsTableCorrelationNames() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsTransactionIsolationLevel(int level)
+            throws SQLException {
+        return false;
+    }
+
+    public boolean supportsTransactions() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsUnion() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsUnionAll() throws SQLException {
+        return false;
+    }
+
+    public boolean updatesAreDetected(int type) throws SQLException {
+        return false;
+    }
+
+    public boolean usesLocalFilePerTable() throws SQLException {
+        return false;
+    }
+
+    public boolean usesLocalFiles() throws SQLException {
+        return false;
+    }
+
+    /* JDBC_4_ANT_KEY_BEGIN */
+
+    public boolean isWrapperFor(Class<?> iface) throws SQLException {
+        return false;
+    }
+
+    public <T> T unwrap(Class<T> iface) throws SQLException {
+        return null;
+    }
+
+    public RowIdLifetime getRowIdLifetime() throws SQLException {
+        return null;
+    }
+
+    public ResultSet getSchemas(String catalog, String schemaPattern)
+    throws SQLException {
+        return null;
+    }
+
+    public boolean autoCommitFailureClosesAllResultSets() throws SQLException {
+        return false;
+    }
+
+    public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException {
+        return false;
+    }
+
+    public ResultSet getClientInfoProperties() throws SQLException {
+        return null;
+    }
+    
+    public ResultSet getFunctionColumns(String catalog, String schemaPattern,
+            String functionNamePattern, String columnNamePattern)
+            throws SQLException {
+        return null;
+    }
+
+    public ResultSet getFunctions(String catalog, String schemaPattern,
+            String functionNamePattern) throws SQLException {
+        return null;
+    }
+
+    /* JDBC_4_ANT_KEY_END */
+}

Propchange: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TesterDatabaseMetaData.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TesterDatabaseMetaData.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TesterResultSet.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TesterResultSet.java?rev=830174&r1=830173&r2=830174&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TesterResultSet.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TesterResultSet.java Tue Oct 27 13:30:50 2009
@@ -89,7 +89,12 @@
         if (!_open) {
             return;
         }
-        ((TesterStatement)_statement)._resultSet = null;
+        
+        // Not all result sets are generated from statements eg DatabaseMetaData
+        if (_statement != null) {
+            ((TesterStatement)_statement)._resultSet = null;
+        }
+        
         _open = false;
     }
 
@@ -798,7 +803,7 @@
     }
 
     public boolean isClosed() throws SQLException {
-        throw new SQLException("Not implemented.");
+        return !_open;
     }
 
     public void updateNString(int columnIndex, String value) throws SQLException {



Re: svn commit: r830174 - in /commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp: TestAll.java TestDelegatingDatabaseMetaData.java TesterConnection.java TesterDatabaseMetaData.java TesterResultSet.java

Posted by sebb <se...@gmail.com>.
On 27/10/2009, markt@apache.org <ma...@apache.org> wrote:
> Author: markt
>  Date: Tue Oct 27 13:30:50 2009
>  New Revision: 830174
>
>  URL: http://svn.apache.org/viewvc?rev=830174&view=rev
>  Log:
>  Add a test case for DBCP-265
>
>  Added:
>     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestDelegatingDatabaseMetaData.java   (with props)
>     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TesterDatabaseMetaData.java   (with props)
>  Modified:
>     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestAll.java
>     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TesterConnection.java
>     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TesterResultSet.java
>
>  Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestAll.java
>  URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestAll.java?rev=830174&r1=830173&r2=830174&view=diff
>  ==============================================================================
>  --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestAll.java (original)
>  +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestAll.java Tue Oct 27 13:30:50 2009
>  @@ -52,6 +52,7 @@
>          suite.addTest(TestBasicDataSourceFactory.suite());
>          // TestConnectionPool is abstract
>          suite.addTest(TestDelegatingConnection.suite());
>  +        suite.addTest(TestDelegatingDatabaseMetaData.suite());
>          suite.addTest(TestDelegatingPreparedStatement.suite());
>          suite.addTest(TestDelegatingStatement.suite());
>          suite.addTest(TestJndi.suite());
>

Would it not be simpler to drop the TestAll classes?
It's very easy for tests to get omitted by mistake.

Also, is there any point in having singleton test suites?

If certain tests have to be run in a particular order, then a suite is
useful, but otherwise they don't really add anything useful as far as
I can tell.

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