This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 7.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 9e612f96ecfd96e3e96f2ea95ce9500d03f96691 Author: Mark Thomas <ma...@apache.org> AuthorDate: Fri Oct 25 13:13:06 2019 +0200 Fix warnings with Java 6 caused by missing @Override annotations --- .../dbcp/dbcp/AbstractConnectionPoolTest.java | 90 +++++----- .../tomcat/dbcp/dbcp/TestBasicDataSource.java | 112 ++++++------ .../tomcat/dbcp/dbcp/TesterCallableStatement.java | 111 ++++++++++++ .../apache/tomcat/dbcp/dbcp/TesterConnection.java | 49 ++++++ .../tomcat/dbcp/dbcp/TesterDatabaseMetaData.java | 174 +++++++++++++++++++ test/org/apache/tomcat/dbcp/dbcp/TesterDriver.java | 6 + .../tomcat/dbcp/dbcp/TesterPreparedStatement.java | 74 +++++++- .../apache/tomcat/dbcp/dbcp/TesterResultSet.java | 191 ++++++++++++++++++++- .../apache/tomcat/dbcp/dbcp/TesterStatement.java | 42 +++++ 9 files changed, 747 insertions(+), 102 deletions(-) diff --git a/test/org/apache/tomcat/dbcp/dbcp/AbstractConnectionPoolTest.java b/test/org/apache/tomcat/dbcp/dbcp/AbstractConnectionPoolTest.java index 758f4e5..7a5db76 100644 --- a/test/org/apache/tomcat/dbcp/dbcp/AbstractConnectionPoolTest.java +++ b/test/org/apache/tomcat/dbcp/dbcp/AbstractConnectionPoolTest.java @@ -5,9 +5,9 @@ * 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. @@ -35,7 +35,7 @@ import junit.framework.TestCase; /** * Base test suite for DBCP pools. - * + * * @author Rodney Waldhoff * @author Sean C. Sullivan * @author John McNally @@ -47,6 +47,7 @@ public abstract class AbstractConnectionPoolTest extends TestCase { super(testName); } + @Override public void tearDown() throws Exception { super.tearDown(); // Close any connections opened by the test @@ -54,7 +55,7 @@ public abstract class AbstractConnectionPoolTest extends TestCase { Connection conn = (Connection) connections.pop(); try { conn.close(); - } catch (Exception ex) { + } catch (Exception ex) { // ignore } finally { conn = null; @@ -63,18 +64,18 @@ public abstract class AbstractConnectionPoolTest extends TestCase { } protected abstract Connection getConnection() throws Exception; - + protected int getMaxActive() { return 10; } - + protected long getMaxWait() { return 100L; } - + /** Connections opened during the course of a test */ protected Stack<Connection> connections = new Stack<Connection>(); - + /** Acquire a connection and push it onto the connections stack */ protected Connection newConnection() throws Exception { Connection connection = getConnection(); @@ -82,7 +83,7 @@ public abstract class AbstractConnectionPoolTest extends TestCase { return connection; } - // ----------- Utility Methods --------------------------------- + // ----------- Utility Methods --------------------------------- protected String getUsername(Connection conn) throws SQLException { Statement stmt = conn.createStatement(); @@ -93,14 +94,14 @@ public abstract class AbstractConnectionPoolTest extends TestCase { return null; } - // ----------- tests --------------------------------- + // ----------- tests --------------------------------- public void testClearWarnings() throws Exception { Connection[] c = new Connection[getMaxActive()]; for (int i = 0; i < c.length; i++) { c[i] = newConnection(); assertTrue(c[i] != null); - + // generate SQLWarning on connection c[i].prepareCall("warning"); } @@ -112,10 +113,10 @@ public abstract class AbstractConnectionPoolTest extends TestCase { for (int i = 0; i < c.length; i++) { c[i].close(); } - + for (int i = 0; i < c.length; i++) { c[i] = newConnection(); - } + } for (int i = 0; i < c.length; i++) { // warnings should have been cleared by putting the connection back in the pool @@ -390,7 +391,7 @@ public abstract class AbstractConnectionPoolTest extends TestCase { conn = null; } - public void testPooling() throws Exception { + public void testPooling() throws Exception { // Grab a maximal set of open connections from the pool Connection[] c = new Connection[getMaxActive()]; Connection[] u = new Connection[getMaxActive()]; @@ -402,15 +403,15 @@ public abstract class AbstractConnectionPoolTest extends TestCase { for (int j = 0; j <= i; j++) { c[j].close(); } - return; // skip this test + return; // skip this test } - } + } // Close connections one at a time and get new ones, making sure // the new ones come from the pool for (int i = 0; i < c.length; i++) { c[i].close(); Connection con = newConnection(); - Connection underCon = + Connection underCon = ((DelegatingConnection) con).getInnermostDelegate(); assertTrue("Failed to get connection", underCon != null); boolean found = false; @@ -424,25 +425,25 @@ public abstract class AbstractConnectionPoolTest extends TestCase { con.close(); } } - + public void testAutoCommitBehavior() throws Exception { Connection conn = newConnection(); assertNotNull(conn); assertTrue(conn.getAutoCommit()); conn.setAutoCommit(false); conn.close(); - + Connection conn2 = newConnection(); assertTrue( conn2.getAutoCommit() ); - + Connection conn3 = newConnection(); assertTrue( conn3.getAutoCommit() ); conn2.close(); - + conn3.close(); } - + /** @see "http://issues.apache.org/bugzilla/show_bug.cgi?id=12400" */ public void testConnectionsAreDistinct() throws Exception { Connection[] conn = new Connection[getMaxActive()]; @@ -513,10 +514,10 @@ public abstract class AbstractConnectionPoolTest extends TestCase { c[i].close(); } } - + /** * DBCP-128: BasicDataSource.getConnection() - * Connections don't work as hashtable keys + * Connections don't work as hashtable keys */ public void testHashing() throws Exception { Connection con = getConnection(); @@ -524,7 +525,7 @@ public abstract class AbstractConnectionPoolTest extends TestCase { hash.put(con, "test"); assertEquals("test", hash.get(con)); assertTrue(hash.containsKey(con)); - assertTrue(hash.contains("test")); + assertTrue(hash.contains("test")); hash.clear(); con.close(); } @@ -577,6 +578,7 @@ public abstract class AbstractConnectionPoolTest extends TestCase { return _failed; } + @Override public void run() { for(int i=0;i<_iter;i++) { try { @@ -611,23 +613,23 @@ public abstract class AbstractConnectionPoolTest extends TestCase { } } - // Bugzilla Bug 24328: PooledConnectionImpl ignores resultsetType + // Bugzilla Bug 24328: PooledConnectionImpl ignores resultsetType // and Concurrency if statement pooling is not enabled // http://issues.apache.org/bugzilla/show_bug.cgi?id=24328 - public void testPrepareStatementOptions() throws Exception + public void testPrepareStatementOptions() throws Exception { Connection conn = newConnection(); assertNotNull(conn); - PreparedStatement stmt = conn.prepareStatement("select * from dual", + PreparedStatement stmt = conn.prepareStatement("select * from dual", ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); assertNotNull(stmt); ResultSet rset = stmt.executeQuery(); assertNotNull(rset); assertTrue(rset.next()); - + assertEquals(ResultSet.TYPE_SCROLL_SENSITIVE, rset.getType()); assertEquals(ResultSet.CONCUR_UPDATABLE, rset.getConcurrency()); - + rset.close(); stmt.close(); conn.close(); @@ -646,7 +648,7 @@ public abstract class AbstractConnectionPoolTest extends TestCase { stmt.close(); conn.close(); } - + // Bugzilla Bug 26966: Connectionpool's connections always returns same public void testHashCode() throws Exception { Connection conn1 = newConnection(); @@ -688,19 +690,19 @@ public abstract class AbstractConnectionPoolTest extends TestCase { // To pass this to a Maven test, use: // mvn test -DargLine="-DTestConnectionPool.display.thread.details=true" // @see http://jira.codehaus.org/browse/SUREFIRE-121 - + /** * Launches a group of 2 * getMaxActive() threads, each of which will attempt to obtain a connection * from the pool, hold it for <holdTime> ms, and then return it to the pool. If <loopOnce> is false, * threads will continue this process indefinitely. If <expectError> is true, exactly 1/2 of the * threads are expected to either throw exceptions or fail to complete. If <expectError> is false, * all threads are expected to complete successfully. - * + * * @param holdTime time in ms that a thread holds a connection before returning it to the pool * @param expectError whether or not an error is expected * @param loopOnce whether threads should complete the borrow - hold - return cycle only once, or loop indefinitely * @param maxWait passed in by client - has no impact on the test itself, but does get reported - * + * * @throws Exception */ protected void multipleThreads(final int holdTime, final boolean expectError, final boolean loopOnce, final long maxWait) @@ -709,6 +711,7 @@ public abstract class AbstractConnectionPoolTest extends TestCase { final PoolTest[] pts = new PoolTest[2 * getMaxActive()]; // Catch Exception so we can stop all threads if one fails ThreadGroup threadGroup = new ThreadGroup("foo") { + @Override public void uncaughtException(Thread t, Throwable e) { for (int i = 0; i < pts.length; i++) { pts[i].stop(); @@ -717,11 +720,11 @@ public abstract class AbstractConnectionPoolTest extends TestCase { }; // Create all the threads for (int i = 0; i < pts.length; i++) { - pts[i] = new PoolTest(threadGroup, holdTime, expectError, loopOnce); + pts[i] = new PoolTest(threadGroup, holdTime, expectError, loopOnce); } // Start all the threads for (int i = 0; i < pts.length; i++) { - pts[i].start(); + pts[i].start(); } // Give all threads a chance to start and succeed @@ -730,8 +733,8 @@ public abstract class AbstractConnectionPoolTest extends TestCase { // Stop threads for (int i = 0; i < pts.length; i++) { pts[i].stop(); - } - + } + /* * Wait for all threads to terminate. * This is essential to ensure that all threads have a chance to update success[0] @@ -760,7 +763,7 @@ public abstract class AbstractConnectionPoolTest extends TestCase { } } } - + long time = timeStamp() - startTime; System.out.println("Multithread test time = " + time + " ms. Threads: " + pts.length @@ -791,7 +794,7 @@ public abstract class AbstractConnectionPoolTest extends TestCase { + ". thrown: "+ pt.thrown + "." ); - } + } } if (didNotRun > 0){ System.out.println("NOTE: some threads did not run the code: "+didNotRun); @@ -833,7 +836,7 @@ public abstract class AbstractConnectionPoolTest extends TestCase { private int connHash = 0; // Connection identity hashCode (to see which one is reused) private final boolean stopOnException; // If true, don't rethrow Exception - + private final boolean loopOnce; // If true, don't repeat loop public PoolTest(ThreadGroup threadGroup, int connHoldTime, boolean isStopOnException) { @@ -856,6 +859,7 @@ public abstract class AbstractConnectionPoolTest extends TestCase { thread.start(); } + @Override public void run() { started = timeStamp(); try { @@ -895,7 +899,7 @@ public abstract class AbstractConnectionPoolTest extends TestCase { throw new RuntimeException(); } } finally { - ended = timeStamp(); + ended = timeStamp(); } } @@ -909,6 +913,6 @@ public abstract class AbstractConnectionPoolTest extends TestCase { } long timeStamp() { - return System.currentTimeMillis();// JVM 1.5+ System.nanoTime() / 1000000; + return System.currentTimeMillis();// JVM 1.5+ System.nanoTime() / 1000000; } } diff --git a/test/org/apache/tomcat/dbcp/dbcp/TestBasicDataSource.java b/test/org/apache/tomcat/dbcp/dbcp/TestBasicDataSource.java index 79e5d76..39f30d7 100644 --- a/test/org/apache/tomcat/dbcp/dbcp/TestBasicDataSource.java +++ b/test/org/apache/tomcat/dbcp/dbcp/TestBasicDataSource.java @@ -5,9 +5,9 @@ * 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. @@ -30,7 +30,7 @@ import junit.framework.TestSuite; /** * TestSuite for BasicDataSource - * + * * @author Dirk Verbeeck * @version $Revision$ $Date$ */ @@ -43,6 +43,7 @@ public class TestBasicDataSource extends AbstractConnectionPoolTest { return new TestSuite(TestBasicDataSource.class); } + @Override protected Connection getConnection() throws Exception { return ds.getConnection(); } @@ -50,6 +51,7 @@ public class TestBasicDataSource extends AbstractConnectionPoolTest { protected BasicDataSource ds = null; private static final String CATALOG = "test catalog"; + @Override public void setUp() throws Exception { super.setUp(); ds = createDataSource(); @@ -72,6 +74,7 @@ public class TestBasicDataSource extends AbstractConnectionPoolTest { return new BasicDataSource(); } + @Override public void tearDown() throws Exception { super.tearDown(); ds.close(); @@ -113,7 +116,7 @@ public class TestBasicDataSource extends AbstractConnectionPoolTest { // both wrapper and raw active connection should be closed assertTrue(activeConnection.isClosed()); assertTrue(rawActiveConnection.isClosed()); - + // Verify SQLException on getConnection after close try { getConnection(); @@ -121,10 +124,10 @@ public class TestBasicDataSource extends AbstractConnectionPoolTest { } catch (SQLException ex) { // Expected } - + // Redundant close is OK ds.close(); - + } public void testSetProperties() throws Exception { @@ -177,39 +180,40 @@ public class TestBasicDataSource extends AbstractConnectionPoolTest { // expected } } - + public void testTransactionIsolationBehavior() throws Exception { Connection conn = getConnection(); assertNotNull(conn); assertEquals(Connection.TRANSACTION_READ_COMMITTED, conn.getTransactionIsolation()); conn.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED); conn.close(); - + Connection conn2 = getConnection(); assertEquals(Connection.TRANSACTION_READ_COMMITTED, conn2.getTransactionIsolation()); - + Connection conn3 = getConnection(); assertEquals(Connection.TRANSACTION_READ_COMMITTED, conn3.getTransactionIsolation()); conn2.close(); - + conn3.close(); } + @Override public void testPooling() throws Exception { // this also needs access to the underlying connection ds.setAccessToUnderlyingConnectionAllowed(true); super.testPooling(); - } - + } + public void testNoAccessToUnderlyingConnectionAllowed() throws Exception { // default: false assertEquals(false, ds.isAccessToUnderlyingConnectionAllowed()); - + Connection conn = getConnection(); Connection dconn = ((DelegatingConnection) conn).getDelegate(); assertNull(dconn); - + dconn = ((DelegatingConnection) conn).getInnermostDelegate(); assertNull(dconn); } @@ -217,20 +221,20 @@ public class TestBasicDataSource extends AbstractConnectionPoolTest { public void testAccessToUnderlyingConnectionAllowed() throws Exception { ds.setAccessToUnderlyingConnectionAllowed(true); assertEquals(true, ds.isAccessToUnderlyingConnectionAllowed()); - + Connection conn = getConnection(); Connection dconn = ((DelegatingConnection) conn).getDelegate(); assertNotNull(dconn); - + dconn = ((DelegatingConnection) conn).getInnermostDelegate(); assertNotNull(dconn); - + assertTrue(dconn instanceof TesterConnection); } - + public void testEmptyValidationQuery() throws Exception { assertNotNull(ds.getValidationQuery()); - + ds.setValidationQuery(""); assertNull(ds.getValidationQuery()); @@ -250,7 +254,7 @@ public class TestBasicDataSource extends AbstractConnectionPoolTest { } } } - + public void testValidationQueryTimoutFail() { ds.setTestOnBorrow(true); ds.setValidationQueryTimeout(3); // Too fast for TesterStatement @@ -263,7 +267,7 @@ public class TestBasicDataSource extends AbstractConnectionPoolTest { } } } - + public void testValidationQueryTimeoutZero() throws Exception { ds.setTestOnBorrow(true); ds.setTestOnReturn(true); @@ -271,7 +275,7 @@ public class TestBasicDataSource extends AbstractConnectionPoolTest { Connection con = ds.getConnection(); con.close(); } - + public void testValidationQueryTimeoutNegative() throws Exception { ds.setTestOnBorrow(true); ds.setTestOnReturn(true); @@ -279,7 +283,7 @@ public class TestBasicDataSource extends AbstractConnectionPoolTest { Connection con = ds.getConnection(); con.close(); } - + public void testValidationQueryTimeoutSucceed() throws Exception { ds.setTestOnBorrow(true); ds.setTestOnReturn(true); @@ -337,7 +341,7 @@ public class TestBasicDataSource extends AbstractConnectionPoolTest { ds.setTestOnReturn(true); ds.setTestWhileIdle(true); ds.setValidationQuery(""); - + Connection conn = ds.getConnection(); conn.close(); @@ -345,35 +349,35 @@ public class TestBasicDataSource extends AbstractConnectionPoolTest { assertEquals(false, ds.getTestOnReturn()); assertEquals(false, ds.getTestWhileIdle()); } - + 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()); + 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()); - } + assertEquals(CATALOG, c[i].getCatalog()); + } for (int i = 0; i < c.length; i++) { c[i].close(); } } - + public void testSetAutoCommitTrueOnClose() throws Exception { ds.setAccessToUnderlyingConnectionAllowed(true); ds.setDefaultAutoCommit(false); - + Connection conn = getConnection(); assertNotNull(conn); assertEquals(false, conn.getAutoCommit()); @@ -401,17 +405,17 @@ public class TestBasicDataSource extends AbstractConnectionPoolTest { } // Bugzilla Bug 28251: Returning dead database connections to BasicDataSource - // isClosed() failure blocks returning a connection to the pool + // isClosed() failure blocks returning a connection to the pool public void testIsClosedFailure() throws SQLException { ds.setAccessToUnderlyingConnectionAllowed(true); Connection conn = ds.getConnection(); assertNotNull(conn); assertEquals(1, ds.getNumActive()); - + // set an IO failure causing the isClosed mathod to fail TesterConnection tconn = (TesterConnection) ((DelegatingConnection)conn).getInnermostDelegate(); tconn.setFailure(new IOException("network error")); - + try { conn.close(); fail("Expected SQLException"); @@ -420,40 +424,40 @@ public class TestBasicDataSource extends AbstractConnectionPoolTest { assertEquals(0, ds.getNumActive()); } - - /** - * Bugzilla Bug 29054: - * The BasicDataSource.setTestOnReturn(boolean) is not carried through to + + /** + * Bugzilla Bug 29054: + * The BasicDataSource.setTestOnReturn(boolean) is not carried through to * the GenericObjectPool variable _testOnReturn. - */ + */ public void testPropertyTestOnReturn() throws Exception { ds.setValidationQuery("select 1 from dual"); ds.setTestOnBorrow(false); ds.setTestWhileIdle(false); ds.setTestOnReturn(true); - + Connection conn = ds.getConnection(); assertNotNull(conn); - + assertEquals(false, ds.connectionPool.getTestOnBorrow()); assertEquals(false, ds.connectionPool.getTestWhileIdle()); assertEquals(true, ds.connectionPool.getTestOnReturn()); } - + /** * Bugzilla Bug 29055: AutoCommit and ReadOnly - * The DaffodilDB driver throws an SQLException if - * trying to commit or rollback a readOnly connection. + * The DaffodilDB driver throws an SQLException if + * trying to commit or rollback a readOnly connection. */ public void testRollbackReadOnly() throws Exception { ds.setDefaultReadOnly(true); ds.setDefaultAutoCommit(false); - + Connection conn = ds.getConnection(); assertNotNull(conn); conn.close(); } - + /** * Bugzilla Bug 29832: Broken behaviour for BasicDataSource.setMaxActive(0) * MaxActive == 0 should throw SQLException on getConnection. @@ -461,12 +465,12 @@ public class TestBasicDataSource extends AbstractConnectionPoolTest { */ public void testMaxActiveZero() throws Exception { ds.setMaxActive(0); - + try { Connection conn = ds.getConnection(); assertNotNull(conn); fail("SQLException expected"); - + } catch (SQLException e) { // test OK } @@ -504,10 +508,10 @@ public class TestBasicDataSource extends AbstractConnectionPoolTest { // Allow one extra thread for JRockit compatibility assertTrue(Thread.activeCount() <= threadCount + 1); } - + /** * JIRA DBCP-333: Check that a custom class loader is used. - * @throws Exception + * @throws Exception */ public void testDriverClassLoader() throws Exception { getConnection(); @@ -516,7 +520,7 @@ public class TestBasicDataSource extends AbstractConnectionPoolTest { assertTrue(cl instanceof TesterClassLoader); assertTrue(((TesterClassLoader) cl).didLoad(ds.getDriverClassName())); } - + /** * JIRA: DBCP-342, DBCP-93 * Verify that when errors occur during BasicDataSource initialization, GenericObjectPool @@ -538,7 +542,7 @@ public class TestBasicDataSource extends AbstractConnectionPoolTest { // Set min idle > 0, so evictor will try to make connection as many as idle count ds.setMinIdle(2); - // Prevent concurrent execution of threads executing test subclasses + // Prevent concurrent execution of threads executing test subclasses synchronized (TesterConnRequestCountDriver.class) { TesterConnRequestCountDriver.initConnRequestCount(); @@ -551,14 +555,14 @@ public class TestBasicDataSource extends AbstractConnectionPoolTest { // Ignore } } - + // sleep 1000ms. evictor will be invoked 10 times if running. Thread.sleep(1000); // Make sure there have been no Evictor-generated requests (count should be 10, from requests above) assertEquals(10, TesterConnRequestCountDriver.getConnectionRequestCount()); } - + // make sure cleanup is complete assertNull(ds.connectionPool); } diff --git a/test/org/apache/tomcat/dbcp/dbcp/TesterCallableStatement.java b/test/org/apache/tomcat/dbcp/dbcp/TesterCallableStatement.java index 4b9601b..0c5a4dd 100644 --- a/test/org/apache/tomcat/dbcp/dbcp/TesterCallableStatement.java +++ b/test/org/apache/tomcat/dbcp/dbcp/TesterCallableStatement.java @@ -59,44 +59,55 @@ public class TesterCallableStatement extends TesterPreparedStatement implements super(conn, sql, resultSetType, resultSetConcurrency); } + @Override public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException { } + @Override public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException { } + @Override public boolean wasNull() throws SQLException { return false; } + @Override public String getString(int parameterIndex) throws SQLException { return null; } + @Override public boolean getBoolean(int parameterIndex) throws SQLException { return false; } + @Override public byte getByte(int parameterIndex) throws SQLException { return 0; } + @Override public short getShort(int parameterIndex) throws SQLException { return 0; } + @Override public int getInt(int parameterIndex) throws SQLException { return 0; } + @Override public long getLong(int parameterIndex) throws SQLException { return 0; } + @Override public float getFloat(int parameterIndex) throws SQLException { return 0; } + @Override public double getDouble(int parameterIndex) throws SQLException { return 0; } @@ -104,355 +115,455 @@ public class TesterCallableStatement extends TesterPreparedStatement implements /** * @deprecated */ + @Override public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException { return null; } + @Override public byte[] getBytes(int parameterIndex) throws SQLException { return new byte[0]; } + @Override public Date getDate(int parameterIndex) throws SQLException { return null; } + @Override public Time getTime(int parameterIndex) throws SQLException { return null; } + @Override public Timestamp getTimestamp(int parameterIndex) throws SQLException { return null; } + @Override public Object getObject(int parameterIndex) throws SQLException { return null; } + @Override public BigDecimal getBigDecimal(int parameterIndex) throws SQLException { return null; } + @Override public Object getObject(int i, Map<String,Class<?>> map) throws SQLException { return null; } + @Override public Ref getRef(int i) throws SQLException { return null; } + @Override public Blob getBlob(int i) throws SQLException { return null; } + @Override public Clob getClob(int i) throws SQLException { return null; } + @Override public Array getArray(int i) throws SQLException { return null; } + @Override public Date getDate(int parameterIndex, Calendar cal) throws SQLException { return null; } + @Override public Time getTime(int parameterIndex, Calendar cal) throws SQLException { return null; } + @Override public Timestamp getTimestamp(int parameterIndex, Calendar cal) throws SQLException { return null; } + @Override public void registerOutParameter(int paramIndex, int sqlType, String typeName) throws SQLException { } + @Override public void registerOutParameter(String parameterName, int sqlType) throws SQLException { } + @Override public void registerOutParameter(String parameterName, int sqlType, int scale) throws SQLException { } + @Override public void registerOutParameter(String parameterName, int sqlType, String typeName) throws SQLException { } + @Override public URL getURL(int parameterIndex) throws SQLException { return null; } + @Override public void setURL(String parameterName, URL val) throws SQLException { } + @Override public void setNull(String parameterName, int sqlType) throws SQLException { } + @Override public void setBoolean(String parameterName, boolean x) throws SQLException { } + @Override public void setByte(String parameterName, byte x) throws SQLException { } + @Override public void setShort(String parameterName, short x) throws SQLException { } + @Override public void setInt(String parameterName, int x) throws SQLException { } + @Override public void setLong(String parameterName, long x) throws SQLException { } + @Override public void setFloat(String parameterName, float x) throws SQLException { } + @Override public void setDouble(String parameterName, double x) throws SQLException { } + @Override public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException { } + @Override public void setString(String parameterName, String x) throws SQLException { } + @Override public void setBytes(String parameterName, byte x[]) throws SQLException { } + @Override public void setDate(String parameterName, Date x) throws SQLException { } + @Override public void setTime(String parameterName, Time x) throws SQLException { } + @Override public void setTimestamp(String parameterName, Timestamp x) throws SQLException { } + @Override public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException { } + @Override public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException { } + @Override public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException { } + @Override public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException { } + @Override public void setObject(String parameterName, Object x) throws SQLException { } + @Override public void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException { } + @Override public void setDate(String parameterName, Date x, Calendar cal) throws SQLException { } + @Override public void setTime(String parameterName, Time x, Calendar cal) throws SQLException { } + @Override public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException { } + @Override public void setNull(String parameterName, int sqlType, String typeName) throws SQLException { } + @Override public String getString(String parameterName) throws SQLException { return null; } + @Override public boolean getBoolean(String parameterName) throws SQLException { return false; } + @Override public byte getByte(String parameterName) throws SQLException { return 0; } + @Override public short getShort(String parameterName) throws SQLException { return 0; } + @Override public int getInt(String parameterName) throws SQLException { return 0; } + @Override public long getLong(String parameterName) throws SQLException { return 0; } + @Override public float getFloat(String parameterName) throws SQLException { return 0; } + @Override public double getDouble(String parameterName) throws SQLException { return 0; } + @Override public byte[] getBytes(String parameterName) throws SQLException { return new byte[0]; } + @Override public Date getDate(String parameterName) throws SQLException { return null; } + @Override public Time getTime(String parameterName) throws SQLException { return null; } + @Override public Timestamp getTimestamp(String parameterName) throws SQLException { return null; } + @Override public Object getObject(String parameterName) throws SQLException { return null; } + @Override public BigDecimal getBigDecimal(String parameterName) throws SQLException { return null; } + @Override public Object getObject(String parameterName, Map<String,Class<?>> map) throws SQLException { return null; } + @Override public Ref getRef(String parameterName) throws SQLException { return null; } + @Override public Blob getBlob(String parameterName) throws SQLException { return null; } + @Override public Clob getClob(String parameterName) throws SQLException { return null; } + @Override public Array getArray(String parameterName) throws SQLException { return null; } + @Override public Date getDate(String parameterName, Calendar cal) throws SQLException { return null; } + @Override public Time getTime(String parameterName, Calendar cal) throws SQLException { return null; } + @Override public Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException { return null; } + @Override public URL getURL(String parameterName) throws SQLException { return null; } /* JDBC_4_ANT_KEY_BEGIN */ + @Override public RowId getRowId(int parameterIndex) throws SQLException { return null; } + @Override public RowId getRowId(String parameterName) throws SQLException { return null; } + @Override public void setRowId(String parameterName, RowId value) throws SQLException { } + @Override public void setNString(String parameterName, String value) throws SQLException { } + @Override public void setNCharacterStream(String parameterName, Reader reader, long length) throws SQLException { } + @Override public void setNClob(String parameterName, NClob value) throws SQLException { } + @Override public void setClob(String parameterName, Reader reader, long length) throws SQLException { } + @Override public void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException { } + @Override public void setNClob(String parameterName, Reader reader, long length) throws SQLException { } + @Override public NClob getNClob(int parameterIndex) throws SQLException { return null; } + @Override public NClob getNClob(String parameterName) throws SQLException { return null; } + @Override public void setSQLXML(String parameterName, SQLXML value) throws SQLException { } + @Override public SQLXML getSQLXML(int parameterIndex) throws SQLException { return null; } + @Override public SQLXML getSQLXML(String parameterName) throws SQLException { return null; } + @Override public String getNString(int parameterIndex) throws SQLException { return null; } + @Override public String getNString(String parameterName) throws SQLException { return null; } + @Override public Reader getNCharacterStream(int parameterIndex) throws SQLException { return null; } + @Override public Reader getNCharacterStream(String parameterName) throws SQLException { return null; } + @Override public Reader getCharacterStream(int parameterIndex) throws SQLException { return null; } + @Override public Reader getCharacterStream(String parameterName) throws SQLException { return null; } + @Override public void setBlob(String parameterName, Blob blob) throws SQLException { } + @Override public void setClob(String parameterName, Clob clob) throws SQLException { } + @Override public void setAsciiStream(String parameterName, InputStream inputStream, long length) throws SQLException { } + @Override public void setBinaryStream(String parameterName, InputStream inputStream, long length) throws SQLException { } + @Override public void setCharacterStream(String parameterName, Reader reader, long length) throws SQLException { } + @Override public void setAsciiStream(String parameterName, InputStream inputStream) throws SQLException { } + @Override public void setBinaryStream(String parameterName, InputStream inputStream) throws SQLException { } + @Override public void setCharacterStream(String parameterName, Reader reader) throws SQLException { } + @Override public void setNCharacterStream(String parameterName, Reader reader) throws SQLException { } + @Override public void setClob(String parameterName, Reader reader) throws SQLException { } + @Override public void setBlob(String parameterName, InputStream inputStream) throws SQLException { } + @Override public void setNClob(String parameterName, Reader reader) throws SQLException { } /* JDBC_4_ANT_KEY_END */ diff --git a/test/org/apache/tomcat/dbcp/dbcp/TesterConnection.java b/test/org/apache/tomcat/dbcp/dbcp/TesterConnection.java index 8834c71..44212fa 100644 --- a/test/org/apache/tomcat/dbcp/dbcp/TesterConnection.java +++ b/test/org/apache/tomcat/dbcp/dbcp/TesterConnection.java @@ -70,16 +70,19 @@ public class TesterConnection implements Connection { this.warnings = warning; } + @Override public void clearWarnings() throws SQLException { checkOpen(); warnings = null; } + @Override public void close() throws SQLException { checkFailure(); _open = false; } + @Override public void commit() throws SQLException { checkOpen(); if (isReadOnly()) { @@ -87,61 +90,73 @@ public class TesterConnection implements Connection { } } + @Override public Statement createStatement() throws SQLException { checkOpen(); return new TesterStatement(this); } + @Override public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { checkOpen(); return new TesterStatement(this); } + @Override public boolean getAutoCommit() throws SQLException { checkOpen(); return _autoCommit; } + @Override public String getCatalog() throws SQLException { checkOpen(); return _catalog; } + @Override public DatabaseMetaData getMetaData() throws SQLException { checkOpen(); return _metaData; } + @Override public int getTransactionIsolation() throws SQLException { checkOpen(); return _transactionIsolation; } + @Override public Map<String,Class<?>> getTypeMap() throws SQLException { checkOpen(); return _typeMap; } + @Override public SQLWarning getWarnings() throws SQLException { checkOpen(); return warnings; } + @Override public boolean isClosed() throws SQLException { checkFailure(); return !_open; } + @Override public boolean isReadOnly() throws SQLException { checkOpen(); return _readOnly; } + @Override public String nativeSQL(String sql) throws SQLException { checkOpen(); return sql; } + @Override public CallableStatement prepareCall(String sql) throws SQLException { checkOpen(); if ("warning".equals(sql)) { @@ -150,11 +165,13 @@ public class TesterConnection implements Connection { return new TesterCallableStatement(this); } + @Override public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { checkOpen(); return new TesterCallableStatement(this); } + @Override public PreparedStatement prepareStatement(String sql) throws SQLException { checkOpen(); if("null".equals(sql)) { @@ -167,11 +184,13 @@ public class TesterConnection implements Connection { return new TesterPreparedStatement(this, sql); } + @Override public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { checkOpen(); return new TesterPreparedStatement(this, sql, resultSetType, resultSetConcurrency); } + @Override public void rollback() throws SQLException { checkOpen(); if (isReadOnly()) { @@ -179,26 +198,31 @@ public class TesterConnection implements Connection { } } + @Override public void setAutoCommit(boolean autoCommit) throws SQLException { checkOpen(); _autoCommit = autoCommit; } + @Override public void setCatalog(String catalog) throws SQLException { checkOpen(); _catalog = catalog; } + @Override public void setReadOnly(boolean readOnly) throws SQLException { checkOpen(); _readOnly = readOnly; } + @Override public void setTransactionIsolation(int level) throws SQLException { checkOpen(); _transactionIsolation = level; } + @Override public void setTypeMap(Map<String,Class<?>> map) throws SQLException { checkOpen(); _typeMap = map; @@ -221,30 +245,37 @@ public class TesterConnection implements Connection { this.failure = failure; } + @Override public int getHoldability() throws SQLException { throw new SQLException("Not implemented."); } + @Override public void setHoldability(int holdability) throws SQLException { throw new SQLException("Not implemented."); } + @Override public java.sql.Savepoint setSavepoint() throws SQLException { throw new SQLException("Not implemented."); } + @Override public java.sql.Savepoint setSavepoint(String name) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void rollback(java.sql.Savepoint savepoint) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void releaseSavepoint(java.sql.Savepoint savepoint) throws SQLException { throw new SQLException("Not implemented."); } + @Override public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) @@ -252,6 +283,7 @@ public class TesterConnection implements Connection { return createStatement(); } + @Override public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) @@ -259,6 +291,7 @@ public class TesterConnection implements Connection { return prepareStatement(sql); } + @Override public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) @@ -266,16 +299,19 @@ public class TesterConnection implements Connection { return prepareCall(sql); } + @Override public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException { return prepareStatement(sql); } + @Override public PreparedStatement prepareStatement(String sql, int columnIndexes[]) throws SQLException { return prepareStatement(sql); } + @Override public PreparedStatement prepareStatement(String sql, String columnNames[]) throws SQLException { return prepareStatement(sql); @@ -283,54 +319,67 @@ public class TesterConnection implements Connection { /* JDBC_4_ANT_KEY_BEGIN */ + @Override public boolean isWrapperFor(Class<?> iface) throws SQLException { throw new SQLException("Not implemented."); } + @Override public <T> T unwrap(Class<T> iface) throws SQLException { throw new SQLException("Not implemented."); } + @Override public Array createArrayOf(String typeName, Object[] elements) throws SQLException { throw new SQLException("Not implemented."); } + @Override public Blob createBlob() throws SQLException { throw new SQLException("Not implemented."); } + @Override public Clob createClob() throws SQLException { throw new SQLException("Not implemented."); } + @Override public NClob createNClob() throws SQLException { throw new SQLException("Not implemented."); } + @Override public SQLXML createSQLXML() throws SQLException { throw new SQLException("Not implemented."); } + @Override public Struct createStruct(String typeName, Object[] attributes) throws SQLException { throw new SQLException("Not implemented."); } + @Override public boolean isValid(int timeout) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void setClientInfo(String name, String value) throws SQLClientInfoException { throw new SQLClientInfoException(); } + @Override public void setClientInfo(Properties properties) throws SQLClientInfoException { throw new SQLClientInfoException(); } + @Override public Properties getClientInfo() throws SQLException { throw new SQLException("Not implemented."); } + @Override public String getClientInfo(String name) throws SQLException { throw new SQLException("Not implemented."); } diff --git a/test/org/apache/tomcat/dbcp/dbcp/TesterDatabaseMetaData.java b/test/org/apache/tomcat/dbcp/dbcp/TesterDatabaseMetaData.java index fb571df..6d86469 100644 --- a/test/org/apache/tomcat/dbcp/dbcp/TesterDatabaseMetaData.java +++ b/test/org/apache/tomcat/dbcp/dbcp/TesterDatabaseMetaData.java @@ -31,730 +31,904 @@ import java.sql.SQLException; */ public class TesterDatabaseMetaData implements DatabaseMetaData { + @Override public boolean allProceduresAreCallable() throws SQLException { return false; } + @Override public boolean allTablesAreSelectable() throws SQLException { return false; } + @Override public boolean dataDefinitionCausesTransactionCommit() throws SQLException { return false; } + @Override public boolean dataDefinitionIgnoredInTransactions() throws SQLException { return false; } + @Override public boolean deletesAreDetected(int type) throws SQLException { return false; } + @Override public boolean doesMaxRowSizeIncludeBlobs() throws SQLException { return false; } + @Override public ResultSet getAttributes(String catalog, String schemaPattern, String typeNamePattern, String attributeNamePattern) throws SQLException { return null; } + @Override public ResultSet getBestRowIdentifier(String catalog, String schema, String table, int scope, boolean nullable) throws SQLException { return null; } + @Override public String getCatalogSeparator() throws SQLException { return null; } + @Override public String getCatalogTerm() throws SQLException { return null; } + @Override public ResultSet getCatalogs() throws SQLException { return null; } + @Override public ResultSet getColumnPrivileges(String catalog, String schema, String table, String columnNamePattern) throws SQLException { return null; } + @Override public ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) throws SQLException { return null; } + @Override public Connection getConnection() throws SQLException { return null; } + @Override public ResultSet getCrossReference(String parentCatalog, String parentSchema, String parentTable, String foreignCatalog, String foreignSchema, String foreignTable) throws SQLException { return null; } + @Override public int getDatabaseMajorVersion() throws SQLException { return 0; } + @Override public int getDatabaseMinorVersion() throws SQLException { return 0; } + @Override public String getDatabaseProductName() throws SQLException { return null; } + @Override public String getDatabaseProductVersion() throws SQLException { return null; } + @Override public int getDefaultTransactionIsolation() throws SQLException { return 0; } + @Override public int getDriverMajorVersion() { return 0; } + @Override public int getDriverMinorVersion() { return 0; } + @Override public String getDriverName() throws SQLException { return null; } + @Override public String getDriverVersion() throws SQLException { return null; } + @Override public ResultSet getExportedKeys(String catalog, String schema, String table) throws SQLException { return null; } + @Override public String getExtraNameCharacters() throws SQLException { return null; } + @Override public String getIdentifierQuoteString() throws SQLException { return null; } + @Override public ResultSet getImportedKeys(String catalog, String schema, String table) throws SQLException { return null; } + @Override public ResultSet getIndexInfo(String catalog, String schema, String table, boolean unique, boolean approximate) throws SQLException { return null; } + @Override public int getJDBCMajorVersion() throws SQLException { return 0; } + @Override public int getJDBCMinorVersion() throws SQLException { return 0; } + @Override public int getMaxBinaryLiteralLength() throws SQLException { return 0; } + @Override public int getMaxCatalogNameLength() throws SQLException { return 0; } + @Override public int getMaxCharLiteralLength() throws SQLException { return 0; } + @Override public int getMaxColumnNameLength() throws SQLException { return 0; } + @Override public int getMaxColumnsInGroupBy() throws SQLException { return 0; } + @Override public int getMaxColumnsInIndex() throws SQLException { return 0; } + @Override public int getMaxColumnsInOrderBy() throws SQLException { return 0; } + @Override public int getMaxColumnsInSelect() throws SQLException { return 0; } + @Override public int getMaxColumnsInTable() throws SQLException { return 0; } + @Override public int getMaxConnections() throws SQLException { return 0; } + @Override public int getMaxCursorNameLength() throws SQLException { return 0; } + @Override public int getMaxIndexLength() throws SQLException { return 0; } + @Override public int getMaxProcedureNameLength() throws SQLException { return 0; } + @Override public int getMaxRowSize() throws SQLException { return 0; } + @Override public int getMaxSchemaNameLength() throws SQLException { return 0; } + @Override public int getMaxStatementLength() throws SQLException { return 0; } + @Override public int getMaxStatements() throws SQLException { return 0; } + @Override public int getMaxTableNameLength() throws SQLException { return 0; } + @Override public int getMaxTablesInSelect() throws SQLException { return 0; } + @Override public int getMaxUserNameLength() throws SQLException { return 0; } + @Override public String getNumericFunctions() throws SQLException { return null; } + @Override public ResultSet getPrimaryKeys(String catalog, String schema, String table) throws SQLException { return null; } + @Override public ResultSet getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern) throws SQLException { return null; } + @Override public String getProcedureTerm() throws SQLException { return null; } + @Override public ResultSet getProcedures(String catalog, String schemaPattern, String procedureNamePattern) throws SQLException { return null; } + @Override public int getResultSetHoldability() throws SQLException { return 0; } + @Override public String getSQLKeywords() throws SQLException { return null; } + @Override public int getSQLStateType() throws SQLException { return 0; } + @Override public String getSchemaTerm() throws SQLException { return null; } + @Override public ResultSet getSchemas() throws SQLException { return new TesterResultSet(null); } + @Override public String getSearchStringEscape() throws SQLException { return null; } + @Override public String getStringFunctions() throws SQLException { return null; } + @Override public ResultSet getSuperTables(String catalog, String schemaPattern, String tableNamePattern) throws SQLException { return null; } + @Override public ResultSet getSuperTypes(String catalog, String schemaPattern, String typeNamePattern) throws SQLException { return null; } + @Override public String getSystemFunctions() throws SQLException { return null; } + @Override public ResultSet getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern) throws SQLException { return null; } + @Override public ResultSet getTableTypes() throws SQLException { return null; } + @Override public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) throws SQLException { return null; } + @Override public String getTimeDateFunctions() throws SQLException { return null; } + @Override public ResultSet getTypeInfo() throws SQLException { return null; } + @Override public ResultSet getUDTs(String catalog, String schemaPattern, String typeNamePattern, int[] types) throws SQLException { return null; } + @Override public String getURL() throws SQLException { return null; } + @Override public String getUserName() throws SQLException { return null; } + @Override public ResultSet getVersionColumns(String catalog, String schema, String table) throws SQLException { return null; } + @Override public boolean insertsAreDetected(int type) throws SQLException { return false; } + @Override public boolean isCatalogAtStart() throws SQLException { return false; } + @Override public boolean isReadOnly() throws SQLException { return false; } + @Override public boolean locatorsUpdateCopy() throws SQLException { return false; } + @Override public boolean nullPlusNonNullIsNull() throws SQLException { return false; } + @Override public boolean nullsAreSortedAtEnd() throws SQLException { return false; } + @Override public boolean nullsAreSortedAtStart() throws SQLException { return false; } + @Override public boolean nullsAreSortedHigh() throws SQLException { return false; } + @Override public boolean nullsAreSortedLow() throws SQLException { return false; } + @Override public boolean othersDeletesAreVisible(int type) throws SQLException { return false; } + @Override public boolean othersInsertsAreVisible(int type) throws SQLException { return false; } + @Override public boolean othersUpdatesAreVisible(int type) throws SQLException { return false; } + @Override public boolean ownDeletesAreVisible(int type) throws SQLException { return false; } + @Override public boolean ownInsertsAreVisible(int type) throws SQLException { return false; } + @Override public boolean ownUpdatesAreVisible(int type) throws SQLException { return false; } + @Override public boolean storesLowerCaseIdentifiers() throws SQLException { return false; } + @Override public boolean storesLowerCaseQuotedIdentifiers() throws SQLException { return false; } + @Override public boolean storesMixedCaseIdentifiers() throws SQLException { return false; } + @Override public boolean storesMixedCaseQuotedIdentifiers() throws SQLException { return false; } + @Override public boolean storesUpperCaseIdentifiers() throws SQLException { return false; } + @Override public boolean storesUpperCaseQuotedIdentifiers() throws SQLException { return false; } + @Override public boolean supportsANSI92EntryLevelSQL() throws SQLException { return false; } + @Override public boolean supportsANSI92FullSQL() throws SQLException { return false; } + @Override public boolean supportsANSI92IntermediateSQL() throws SQLException { return false; } + @Override public boolean supportsAlterTableWithAddColumn() throws SQLException { return false; } + @Override public boolean supportsAlterTableWithDropColumn() throws SQLException { return false; } + @Override public boolean supportsBatchUpdates() throws SQLException { return false; } + @Override public boolean supportsCatalogsInDataManipulation() throws SQLException { return false; } + @Override public boolean supportsCatalogsInIndexDefinitions() throws SQLException { return false; } + @Override public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException { return false; } + @Override public boolean supportsCatalogsInProcedureCalls() throws SQLException { return false; } + @Override public boolean supportsCatalogsInTableDefinitions() throws SQLException { return false; } + @Override public boolean supportsColumnAliasing() throws SQLException { return false; } + @Override public boolean supportsConvert() throws SQLException { return false; } + @Override public boolean supportsConvert(int fromType, int toType) throws SQLException { return false; } + @Override public boolean supportsCoreSQLGrammar() throws SQLException { return false; } + @Override public boolean supportsCorrelatedSubqueries() throws SQLException { return false; } + @Override public boolean supportsDataDefinitionAndDataManipulationTransactions() throws SQLException { return false; } + @Override public boolean supportsDataManipulationTransactionsOnly() throws SQLException { return false; } + @Override public boolean supportsDifferentTableCorrelationNames() throws SQLException { return false; } + @Override public boolean supportsExpressionsInOrderBy() throws SQLException { return false; } + @Override public boolean supportsExtendedSQLGrammar() throws SQLException { return false; } + @Override public boolean supportsFullOuterJoins() throws SQLException { return false; } + @Override public boolean supportsGetGeneratedKeys() throws SQLException { return false; } + @Override public boolean supportsGroupBy() throws SQLException { return false; } + @Override public boolean supportsGroupByBeyondSelect() throws SQLException { return false; } + @Override public boolean supportsGroupByUnrelated() throws SQLException { return false; } + @Override public boolean supportsIntegrityEnhancementFacility() throws SQLException { return false; } + @Override public boolean supportsLikeEscapeClause() throws SQLException { return false; } + @Override public boolean supportsLimitedOuterJoins() throws SQLException { return false; } + @Override public boolean supportsMinimumSQLGrammar() throws SQLException { return false; } + @Override public boolean supportsMixedCaseIdentifiers() throws SQLException { return false; } + @Override public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException { return false; } + @Override public boolean supportsMultipleOpenResults() throws SQLException { return false; } + @Override public boolean supportsMultipleResultSets() throws SQLException { return false; } + @Override public boolean supportsMultipleTransactions() throws SQLException { return false; } + @Override public boolean supportsNamedParameters() throws SQLException { return false; } + @Override public boolean supportsNonNullableColumns() throws SQLException { return false; } + @Override public boolean supportsOpenCursorsAcrossCommit() throws SQLException { return false; } + @Override public boolean supportsOpenCursorsAcrossRollback() throws SQLException { return false; } + @Override public boolean supportsOpenStatementsAcrossCommit() throws SQLException { return false; } + @Override public boolean supportsOpenStatementsAcrossRollback() throws SQLException { return false; } + @Override public boolean supportsOrderByUnrelated() throws SQLException { return false; } + @Override public boolean supportsOuterJoins() throws SQLException { return false; } + @Override public boolean supportsPositionedDelete() throws SQLException { return false; } + @Override public boolean supportsPositionedUpdate() throws SQLException { return false; } + @Override public boolean supportsResultSetConcurrency(int type, int concurrency) throws SQLException { return false; } + @Override public boolean supportsResultSetHoldability(int holdability) throws SQLException { return false; } + @Override public boolean supportsResultSetType(int type) throws SQLException { return false; } + @Override public boolean supportsSavepoints() throws SQLException { return false; } + @Override public boolean supportsSchemasInDataManipulation() throws SQLException { return false; } + @Override public boolean supportsSchemasInIndexDefinitions() throws SQLException { return false; } + @Override public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException { return false; } + @Override public boolean supportsSchemasInProcedureCalls() throws SQLException { return false; } + @Override public boolean supportsSchemasInTableDefinitions() throws SQLException { return false; } + @Override public boolean supportsSelectForUpdate() throws SQLException { return false; } + @Override public boolean supportsStatementPooling() throws SQLException { return false; } + @Override public boolean supportsStoredProcedures() throws SQLException { return false; } + @Override public boolean supportsSubqueriesInComparisons() throws SQLException { return false; } + @Override public boolean supportsSubqueriesInExists() throws SQLException { return false; } + @Override public boolean supportsSubqueriesInIns() throws SQLException { return false; } + @Override public boolean supportsSubqueriesInQuantifieds() throws SQLException { return false; } + @Override public boolean supportsTableCorrelationNames() throws SQLException { return false; } + @Override public boolean supportsTransactionIsolationLevel(int level) throws SQLException { return false; } + @Override public boolean supportsTransactions() throws SQLException { return false; } + @Override public boolean supportsUnion() throws SQLException { return false; } + @Override public boolean supportsUnionAll() throws SQLException { return false; } + @Override public boolean updatesAreDetected(int type) throws SQLException { return false; } + @Override public boolean usesLocalFilePerTable() throws SQLException { return false; } + @Override public boolean usesLocalFiles() throws SQLException { return false; } /* JDBC_4_ANT_KEY_BEGIN */ + @Override public boolean isWrapperFor(Class<?> iface) throws SQLException { return false; } + @Override public <T> T unwrap(Class<T> iface) throws SQLException { return null; } + @Override public RowIdLifetime getRowIdLifetime() throws SQLException { return null; } + @Override public ResultSet getSchemas(String catalog, String schemaPattern) throws SQLException { return null; } + @Override public boolean autoCommitFailureClosesAllResultSets() throws SQLException { return false; } + @Override public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException { return false; } + @Override public ResultSet getClientInfoProperties() throws SQLException { return null; } + @Override public ResultSet getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern, String columnNamePattern) throws SQLException { return null; } + @Override public ResultSet getFunctions(String catalog, String schemaPattern, String functionNamePattern) throws SQLException { return null; diff --git a/test/org/apache/tomcat/dbcp/dbcp/TesterDriver.java b/test/org/apache/tomcat/dbcp/dbcp/TesterDriver.java index f59847e..92f6c0f 100644 --- a/test/org/apache/tomcat/dbcp/dbcp/TesterDriver.java +++ b/test/org/apache/tomcat/dbcp/dbcp/TesterDriver.java @@ -65,6 +65,7 @@ public class TesterDriver implements Driver { } } + @Override public boolean acceptsURL(String url) throws SQLException { return CONNECT_STRING.startsWith(url); } @@ -83,6 +84,7 @@ public class TesterDriver implements Driver { } } + @Override public Connection connect(String url, Properties info) throws SQLException { //return (acceptsURL(url) ? new TesterConnection() : null); Connection conn = null; @@ -102,18 +104,22 @@ public class TesterDriver implements Driver { return conn; } + @Override public int getMajorVersion() { return MAJOR_VERSION; } + @Override public int getMinorVersion() { return MINOR_VERSION; } + @Override public boolean jdbcCompliant() { return true; } + @Override public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) { return new DriverPropertyInfo[0]; } diff --git a/test/org/apache/tomcat/dbcp/dbcp/TesterPreparedStatement.java b/test/org/apache/tomcat/dbcp/dbcp/TesterPreparedStatement.java index d210733..8c6e083 100644 --- a/test/org/apache/tomcat/dbcp/dbcp/TesterPreparedStatement.java +++ b/test/org/apache/tomcat/dbcp/dbcp/TesterPreparedStatement.java @@ -5,9 +5,9 @@ * 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. @@ -38,7 +38,7 @@ import java.sql.SQLXML; /** * A dummy {@link PreparedStatement}, for testing purposes. - * + * * @author Rodney Waldhoff * @author Dirk Verbeeck * @version $Revision$ $Date$ @@ -70,12 +70,13 @@ public class TesterPreparedStatement extends TesterStatement implements Prepared _catalog = conn.getCatalog(); } catch (SQLException e) { } } - + /** for junit test only */ public String getCatalog() { return _catalog; } + @Override public ResultSet executeQuery(String sql) throws SQLException { checkOpen(); if("null".equals(sql)) { @@ -85,11 +86,13 @@ public class TesterPreparedStatement extends TesterStatement implements Prepared } } + @Override public int executeUpdate(String sql) throws SQLException { checkOpen(); return _rowsUpdated; } + @Override public ResultSet executeQuery() throws SQLException { checkOpen(); if("null".equals(_sql)) { @@ -99,267 +102,330 @@ public class TesterPreparedStatement extends TesterStatement implements Prepared } } + @Override public int executeUpdate() throws SQLException { checkOpen(); return _rowsUpdated; } + @Override public void setNull(int parameterIndex, int sqlType) throws SQLException { checkOpen(); } + @Override public void setBoolean(int parameterIndex, boolean x) throws SQLException { checkOpen(); } + @Override public void setByte(int parameterIndex, byte x) throws SQLException { checkOpen(); } + @Override public void setShort(int parameterIndex, short x) throws SQLException { checkOpen(); } + @Override public void setInt(int parameterIndex, int x) throws SQLException { checkOpen(); } + @Override public void setLong(int parameterIndex, long x) throws SQLException { checkOpen(); } + @Override public void setFloat(int parameterIndex, float x) throws SQLException { checkOpen(); } + @Override public void setDouble(int parameterIndex, double x) throws SQLException { checkOpen(); } + @Override public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException { checkOpen(); } + @Override public void setString(int parameterIndex, String x) throws SQLException { checkOpen(); } + @Override public void setBytes(int parameterIndex, byte x[]) throws SQLException { checkOpen(); } + @Override public void setDate(int parameterIndex, java.sql.Date x) throws SQLException { checkOpen(); } + @Override public void setTime(int parameterIndex, java.sql.Time x) throws SQLException { checkOpen(); } + @Override public void setTimestamp(int parameterIndex, java.sql.Timestamp x) throws SQLException { checkOpen(); } + @Override public void setAsciiStream(int parameterIndex, java.io.InputStream x, int length) throws SQLException { checkOpen(); } /** @deprecated */ + @Override public void setUnicodeStream(int parameterIndex, java.io.InputStream x, int length) throws SQLException { checkOpen(); } + @Override public void setBinaryStream(int parameterIndex, java.io.InputStream x, int length) throws SQLException { checkOpen(); } + @Override public void clearParameters() throws SQLException { checkOpen(); } + @Override public void setObject(int parameterIndex, Object x, int targetSqlType, int scale) throws SQLException { checkOpen(); } + @Override public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException { checkOpen(); } + @Override public void setObject(int parameterIndex, Object x) throws SQLException { checkOpen(); } + @Override public boolean execute() throws SQLException { checkOpen(); return true; } + @Override public void addBatch() throws SQLException { checkOpen(); } + @Override public void setCharacterStream(int parameterIndex, java.io.Reader reader, int length) throws SQLException { checkOpen(); } + @Override public void setRef (int i, Ref x) throws SQLException { checkOpen(); } + @Override public void setBlob (int i, Blob x) throws SQLException { checkOpen(); } + @Override public void setClob (int i, Clob x) throws SQLException { checkOpen(); } + @Override public void setArray (int i, Array x) throws SQLException { checkOpen(); } + @Override public ResultSetMetaData getMetaData() throws SQLException { checkOpen(); return _resultSetMetaData; } + @Override public void setDate(int parameterIndex, java.sql.Date x, Calendar cal) throws SQLException { checkOpen(); } + @Override public void setTime(int parameterIndex, java.sql.Time x, Calendar cal) throws SQLException { checkOpen(); } + @Override public void setTimestamp(int parameterIndex, java.sql.Timestamp x, Calendar cal) throws SQLException { checkOpen(); } + @Override public void setNull (int paramIndex, int sqlType, String typeName) throws SQLException { checkOpen(); } + @Override public boolean getMoreResults(int current) throws SQLException { throw new SQLException("Not implemented."); } + @Override public ResultSet getGeneratedKeys() throws SQLException { return new TesterResultSet(this, null, _resultSetType, _resultSetConcurrency); } + @Override public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { checkOpen(); return 0; } + @Override public int executeUpdate(String sql, int columnIndexes[]) throws SQLException { checkOpen(); return 0; } + @Override public int executeUpdate(String sql, String columnNames[]) throws SQLException { checkOpen(); return 0; } + @Override public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { checkOpen(); return true; } + @Override public boolean execute(String sl, int columnIndexes[]) throws SQLException { checkOpen(); return true; } + @Override public boolean execute(String sql, String columnNames[]) throws SQLException { checkOpen(); return true; } + @Override public int getResultSetHoldability() throws SQLException { throw new SQLException("Not implemented."); } + @Override public void setURL(int parameterIndex, java.net.URL x) throws SQLException { throw new SQLException("Not implemented."); } + @Override public java.sql.ParameterMetaData getParameterMetaData() throws SQLException { throw new SQLException("Not implemented."); } /* JDBC_4_ANT_KEY_BEGIN */ + @Override public void setRowId(int parameterIndex, RowId value) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void setNString(int parameterIndex, String value) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void setNClob(int parameterIndex, NClob value) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void setClob(int parameterIndex, Reader reader, long length) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void setSQLXML(int parameterIndex, SQLXML value) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void setAsciiStream(int parameterIndex, InputStream inputStream, long length) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void setBinaryStream(int parameterIndex, InputStream inputStream, long length) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void setAsciiStream(int parameterIndex, InputStream inputStream) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void setBinaryStream(int parameterIndex, InputStream inputStream) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void setNCharacterStream(int parameterIndex, Reader reader) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void setClob(int parameterIndex, Reader reader) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void setNClob(int parameterIndex, Reader reader) throws SQLException { throw new SQLException("Not implemented."); } diff --git a/test/org/apache/tomcat/dbcp/dbcp/TesterResultSet.java b/test/org/apache/tomcat/dbcp/dbcp/TesterResultSet.java index 465fa86..c1c4a28 100644 --- a/test/org/apache/tomcat/dbcp/dbcp/TesterResultSet.java +++ b/test/org/apache/tomcat/dbcp/dbcp/TesterResultSet.java @@ -71,6 +71,7 @@ public class TesterResultSet implements ResultSet { protected int _rowsLeft = 2; protected boolean _open = true; + @Override public boolean next() throws SQLException { checkOpen(); if (_data != null) { @@ -86,6 +87,7 @@ public class TesterResultSet implements ResultSet { } } + @Override public void close() throws SQLException { if (!_open) { return; @@ -99,11 +101,13 @@ public class TesterResultSet implements ResultSet { _open = false; } + @Override public boolean wasNull() throws SQLException { checkOpen(); return false; } + @Override public String getString(int columnIndex) throws SQLException { checkOpen(); if (columnIndex == -1) { @@ -115,184 +119,220 @@ public class TesterResultSet implements ResultSet { return "String" + columnIndex; } + @Override public boolean getBoolean(int columnIndex) throws SQLException { checkOpen(); return true; } + @Override public byte getByte(int columnIndex) throws SQLException { checkOpen(); return (byte)columnIndex; } + @Override public short getShort(int columnIndex) throws SQLException { checkOpen(); return (short)columnIndex; } + @Override public int getInt(int columnIndex) throws SQLException { checkOpen(); return (short)columnIndex; } + @Override public long getLong(int columnIndex) throws SQLException { checkOpen(); return columnIndex; } + @Override public float getFloat(int columnIndex) throws SQLException { checkOpen(); return columnIndex; } + @Override public double getDouble(int columnIndex) throws SQLException { checkOpen(); return columnIndex; } /** @deprecated */ + @Override public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { checkOpen(); return new BigDecimal(columnIndex); } + @Override public byte[] getBytes(int columnIndex) throws SQLException { checkOpen(); return new byte[] { (byte)columnIndex }; } + @Override public java.sql.Date getDate(int columnIndex) throws SQLException { checkOpen(); return null; } + @Override public java.sql.Time getTime(int columnIndex) throws SQLException { checkOpen(); return null; } + @Override public java.sql.Timestamp getTimestamp(int columnIndex) throws SQLException { checkOpen(); return null; } + @Override public java.io.InputStream getAsciiStream(int columnIndex) throws SQLException { checkOpen(); return null; } /** @deprecated */ + @Override public java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException { checkOpen(); return null; } + @Override public java.io.InputStream getBinaryStream(int columnIndex) throws SQLException { checkOpen(); return null; } + @Override public String getString(String columnName) throws SQLException { checkOpen(); return columnName; } + @Override public boolean getBoolean(String columnName) throws SQLException { checkOpen(); return true; } + @Override public byte getByte(String columnName) throws SQLException { checkOpen(); return (byte)(columnName.hashCode()); } + @Override public short getShort(String columnName) throws SQLException { checkOpen(); return (short)(columnName.hashCode()); } + @Override public int getInt(String columnName) throws SQLException { checkOpen(); return (columnName.hashCode()); } + @Override public long getLong(String columnName) throws SQLException { checkOpen(); return columnName.hashCode(); } + @Override public float getFloat(String columnName) throws SQLException { checkOpen(); return columnName.hashCode(); } + @Override public double getDouble(String columnName) throws SQLException { checkOpen(); return columnName.hashCode(); } /** @deprecated */ + @Override public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException { checkOpen(); return new BigDecimal(columnName.hashCode()); } + @Override public byte[] getBytes(String columnName) throws SQLException { checkOpen(); return columnName.getBytes(); } + @Override public java.sql.Date getDate(String columnName) throws SQLException { checkOpen(); return null; } + @Override public java.sql.Time getTime(String columnName) throws SQLException { checkOpen(); return null; } + @Override public java.sql.Timestamp getTimestamp(String columnName) throws SQLException { checkOpen(); return null; } + @Override public java.io.InputStream getAsciiStream(String columnName) throws SQLException { checkOpen(); return null; } /** @deprecated */ + @Override public java.io.InputStream getUnicodeStream(String columnName) throws SQLException { checkOpen(); return null; } + @Override public java.io.InputStream getBinaryStream(String columnName) throws SQLException { checkOpen(); return null; } - public SQLWarning getWarnings() throws SQLException { + @Override +public SQLWarning getWarnings() throws SQLException { checkOpen(); return null; } + @Override public void clearWarnings() throws SQLException { checkOpen(); } + @Override public String getCursorName() throws SQLException { checkOpen(); return null; } + @Override public ResultSetMetaData getMetaData() throws SQLException { checkOpen(); return null; } + @Override public Object getObject(int columnIndex) throws SQLException { checkOpen(); if (_data != null) { @@ -301,413 +341,502 @@ public class TesterResultSet implements ResultSet { return new Object(); } + @Override public Object getObject(String columnName) throws SQLException { checkOpen(); return columnName; } + @Override public int findColumn(String columnName) throws SQLException { checkOpen(); return 1; } + @Override public java.io.Reader getCharacterStream(int columnIndex) throws SQLException { checkOpen(); return null; } + @Override public java.io.Reader getCharacterStream(String columnName) throws SQLException { checkOpen(); return null; } + @Override public BigDecimal getBigDecimal(int columnIndex) throws SQLException { checkOpen(); return new BigDecimal(columnIndex); } + @Override public BigDecimal getBigDecimal(String columnName) throws SQLException { checkOpen(); return new BigDecimal(columnName.hashCode()); } + @Override public boolean isBeforeFirst() throws SQLException { checkOpen(); return _rowsLeft == 2; } + @Override public boolean isAfterLast() throws SQLException { checkOpen(); return _rowsLeft < 0; } + @Override public boolean isFirst() throws SQLException { checkOpen(); return _rowsLeft == 1; } + @Override public boolean isLast() throws SQLException { checkOpen(); return _rowsLeft == 0; } + @Override public void beforeFirst() throws SQLException { checkOpen(); } + @Override public void afterLast() throws SQLException { checkOpen(); } + @Override public boolean first() throws SQLException { checkOpen(); return false; } + @Override public boolean last() throws SQLException { checkOpen(); return false; } + @Override public int getRow() throws SQLException { checkOpen(); return 3 - _rowsLeft; } + @Override public boolean absolute( int row ) throws SQLException { checkOpen(); return false; } + @Override public boolean relative( int rows ) throws SQLException { checkOpen(); return false; } + @Override public boolean previous() throws SQLException { checkOpen(); return false; } + @Override public void setFetchDirection(int direction) throws SQLException { checkOpen(); } + @Override public int getFetchDirection() throws SQLException { checkOpen(); return 1; } + @Override public void setFetchSize(int rows) throws SQLException { checkOpen(); } + @Override public int getFetchSize() throws SQLException { checkOpen(); return 2; } + @Override public int getType() throws SQLException { return this._type; } + @Override public int getConcurrency() throws SQLException { return this._concurrency; } + @Override public boolean rowUpdated() throws SQLException { checkOpen(); return false; } + @Override public boolean rowInserted() throws SQLException { checkOpen(); return false; } + @Override public boolean rowDeleted() throws SQLException { checkOpen(); return false; } + @Override public void updateNull(int columnIndex) throws SQLException { checkOpen(); } + @Override public void updateBoolean(int columnIndex, boolean x) throws SQLException { checkOpen(); } + @Override public void updateByte(int columnIndex, byte x) throws SQLException { checkOpen(); } + @Override public void updateShort(int columnIndex, short x) throws SQLException { checkOpen(); } + @Override public void updateInt(int columnIndex, int x) throws SQLException { checkOpen(); } + @Override public void updateLong(int columnIndex, long x) throws SQLException { checkOpen(); } + @Override public void updateFloat(int columnIndex, float x) throws SQLException { checkOpen(); } + @Override public void updateDouble(int columnIndex, double x) throws SQLException { checkOpen(); } + @Override public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException { checkOpen(); } + @Override public void updateString(int columnIndex, String x) throws SQLException { checkOpen(); } + @Override public void updateBytes(int columnIndex, byte x[]) throws SQLException { checkOpen(); } + @Override public void updateDate(int columnIndex, java.sql.Date x) throws SQLException { checkOpen(); } + @Override public void updateTime(int columnIndex, java.sql.Time x) throws SQLException { checkOpen(); } + @Override public void updateTimestamp(int columnIndex, java.sql.Timestamp x) throws SQLException { checkOpen(); } + @Override public void updateAsciiStream(int columnIndex, java.io.InputStream x, int length) throws SQLException { checkOpen(); } + @Override public void updateBinaryStream(int columnIndex, java.io.InputStream x, int length) throws SQLException { checkOpen(); } + @Override public void updateCharacterStream(int columnIndex, java.io.Reader x, int length) throws SQLException { checkOpen(); } + @Override public void updateObject(int columnIndex, Object x, int scale) throws SQLException { checkOpen(); } + @Override public void updateObject(int columnIndex, Object x) throws SQLException { checkOpen(); } + @Override public void updateNull(String columnName) throws SQLException { checkOpen(); } + @Override public void updateBoolean(String columnName, boolean x) throws SQLException { checkOpen(); } + @Override public void updateByte(String columnName, byte x) throws SQLException { checkOpen(); } + @Override public void updateShort(String columnName, short x) throws SQLException { checkOpen(); } + @Override public void updateInt(String columnName, int x) throws SQLException { checkOpen(); } + @Override public void updateLong(String columnName, long x) throws SQLException { checkOpen(); } + @Override public void updateFloat(String columnName, float x) throws SQLException { checkOpen(); } + @Override public void updateDouble(String columnName, double x) throws SQLException { checkOpen(); } + @Override public void updateBigDecimal(String columnName, BigDecimal x) throws SQLException { checkOpen(); } + @Override public void updateString(String columnName, String x) throws SQLException { checkOpen(); } + @Override public void updateBytes(String columnName, byte x[]) throws SQLException { checkOpen(); } + @Override public void updateDate(String columnName, java.sql.Date x) throws SQLException { checkOpen(); } + @Override public void updateTime(String columnName, java.sql.Time x) throws SQLException { checkOpen(); } + @Override public void updateTimestamp(String columnName, java.sql.Timestamp x) throws SQLException { checkOpen(); } + @Override public void updateAsciiStream(String columnName, java.io.InputStream x, int length) throws SQLException { checkOpen(); } + @Override public void updateBinaryStream(String columnName, java.io.InputStream x, int length) throws SQLException { checkOpen(); } + @Override public void updateCharacterStream(String columnName, java.io.Reader reader, int length) throws SQLException { checkOpen(); } + @Override public void updateObject(String columnName, Object x, int scale) throws SQLException { checkOpen(); } + @Override public void updateObject(String columnName, Object x) throws SQLException { checkOpen(); } + @Override public void insertRow() throws SQLException { checkOpen(); } + @Override public void updateRow() throws SQLException { checkOpen(); } + @Override public void deleteRow() throws SQLException { checkOpen(); } + @Override public void refreshRow() throws SQLException { checkOpen(); } + @Override public void cancelRowUpdates() throws SQLException { checkOpen(); } + @Override public void moveToInsertRow() throws SQLException { checkOpen(); } + @Override public void moveToCurrentRow() throws SQLException { checkOpen(); } + @Override public Statement getStatement() throws SQLException { checkOpen(); return _statement; } + @Override public Object getObject(int i, Map<String,Class<?>> map) throws SQLException { checkOpen(); return new Object(); } + @Override public Ref getRef(int i) throws SQLException { checkOpen(); return null; } + @Override public Blob getBlob(int i) throws SQLException { checkOpen(); return null; } + @Override public Clob getClob(int i) throws SQLException { checkOpen(); return null; } + @Override public Array getArray(int i) throws SQLException { checkOpen(); return null; } + @Override public Object getObject(String colName, Map<String,Class<?>> map) throws SQLException { checkOpen(); return colName; } + @Override public Ref getRef(String colName) throws SQLException { checkOpen(); return null; } + @Override public Blob getBlob(String colName) throws SQLException { checkOpen(); return null; } + @Override public Clob getClob(String colName) throws SQLException { checkOpen(); return null; } + @Override public Array getArray(String colName) throws SQLException { checkOpen(); return null; } + @Override public java.sql.Date getDate(int columnIndex, Calendar cal) throws SQLException { checkOpen(); return null; } + @Override public java.sql.Date getDate(String columnName, Calendar cal) throws SQLException { checkOpen(); return null; } + @Override public java.sql.Time getTime(int columnIndex, Calendar cal) throws SQLException { checkOpen(); return null; } + @Override public java.sql.Time getTime(String columnName, Calendar cal) throws SQLException { checkOpen(); return null; } + @Override public java.sql.Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException { checkOpen(); return null; } + @Override public java.sql.Timestamp getTimestamp(String columnName, Calendar cal) throws SQLException { checkOpen(); @@ -720,49 +849,59 @@ public class TesterResultSet implements ResultSet { } } + @Override public java.net.URL getURL(int columnIndex) throws SQLException { throw new SQLException("Not implemented."); } + @Override public java.net.URL getURL(String columnName) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateRef(int columnIndex, java.sql.Ref x) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateRef(String columnName, java.sql.Ref x) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateBlob(int columnIndex, java.sql.Blob x) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateBlob(String columnName, java.sql.Blob x) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateClob(int columnIndex, java.sql.Clob x) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateClob(String columnName, java.sql.Clob x) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateArray(int columnIndex, java.sql.Array x) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateArray(String columnName, java.sql.Array x) throws SQLException { throw new SQLException("Not implemented."); @@ -770,202 +909,252 @@ public class TesterResultSet implements ResultSet { /* JDBC_4_ANT_KEY_BEGIN */ + @Override public boolean isWrapperFor(Class<?> iface) throws SQLException { throw new SQLException("Not implemented."); } + @Override public <T> T unwrap(Class<T> iface) throws SQLException { throw new SQLException("Not implemented."); } + @Override public RowId getRowId(int columnIndex) throws SQLException { throw new SQLException("Not implemented."); } + @Override public RowId getRowId(String columnLabel) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateRowId(int columnIndex, RowId value) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateRowId(String columnLabel, RowId value) throws SQLException { throw new SQLException("Not implemented."); } + @Override public int getHoldability() throws SQLException { throw new SQLException("Not implemented."); } + @Override public boolean isClosed() throws SQLException { return !_open; } + @Override public void updateNString(int columnIndex, String value) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateNString(String columnLabel, String value) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateNClob(int columnIndex, NClob value) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateNClob(String columnLabel, NClob value) throws SQLException { throw new SQLException("Not implemented."); } + @Override public NClob getNClob(int columnIndex) throws SQLException { throw new SQLException("Not implemented."); } + @Override public NClob getNClob(String columnLabel) throws SQLException { throw new SQLException("Not implemented."); } + @Override public SQLXML getSQLXML(int columnIndex) throws SQLException { throw new SQLException("Not implemented."); } + @Override public SQLXML getSQLXML(String columnLabel) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateSQLXML(int columnIndex, SQLXML value) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateSQLXML(String columnLabel, SQLXML value) throws SQLException { throw new SQLException("Not implemented."); } + @Override public String getNString(int columnIndex) throws SQLException { throw new SQLException("Not implemented."); } + @Override public String getNString(String columnLabel) throws SQLException { throw new SQLException("Not implemented."); } + @Override public Reader getNCharacterStream(int columnIndex) throws SQLException { throw new SQLException("Not implemented."); } + @Override public Reader getNCharacterStream(String columnLabel) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateNCharacterStream(int columnIndex, Reader reader, long length) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateAsciiStream(int columnIndex, InputStream inputStream, long length) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateBinaryStream(int columnIndex, InputStream inputStream, long length) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateCharacterStream(int columnIndex, Reader reader, long length) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateAsciiStream(String columnLabel, InputStream inputStream, long length) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateBinaryStream(String columnLabel, InputStream inputStream, long length) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateClob(int columnIndex, Reader reader, long length) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateClob(String columnLabel, Reader reader, long length) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateNCharacterStream(int columnIndex, Reader reader) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateAsciiStream(int columnIndex, InputStream inputStream) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateBinaryStream(int columnIndex, InputStream inputStream) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateCharacterStream(int columnIndex, Reader reader) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateAsciiStream(String columnLabel, InputStream inputStream) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateBinaryStream(String columnLabel, InputStream inputStream) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateClob(int columnIndex, Reader reader) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateClob(String columnLabel, Reader reader) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateNClob(int columnIndex, Reader reader) throws SQLException { throw new SQLException("Not implemented."); } + @Override public void updateNClob(String columnLabel, Reader reader) throws SQLException { throw new SQLException("Not implemented."); } diff --git a/test/org/apache/tomcat/dbcp/dbcp/TesterStatement.java b/test/org/apache/tomcat/dbcp/dbcp/TesterStatement.java index 8d81e26..2d19dab 100644 --- a/test/org/apache/tomcat/dbcp/dbcp/TesterStatement.java +++ b/test/org/apache/tomcat/dbcp/dbcp/TesterStatement.java @@ -56,6 +56,7 @@ public class TesterStatement implements Statement { protected int _resultSetType = 1; protected ResultSet _resultSet = null; + @Override public ResultSet executeQuery(String sql) throws SQLException { checkOpen(); if("null".equals(sql)) { @@ -80,11 +81,13 @@ public class TesterStatement implements Statement { } } + @Override public int executeUpdate(String sql) throws SQLException { checkOpen(); return _rowsUpdated; } + @Override public void close() throws SQLException { // calling close twice has no effect if (!_open) { @@ -98,59 +101,71 @@ public class TesterStatement implements Statement { } } + @Override public int getMaxFieldSize() throws SQLException { checkOpen(); return _maxFieldSize; } + @Override public void setMaxFieldSize(int max) throws SQLException { checkOpen(); _maxFieldSize = max; } + @Override public int getMaxRows() throws SQLException { checkOpen(); return _maxRows; } + @Override public void setMaxRows(int max) throws SQLException { checkOpen(); _maxRows = max; } + @Override public void setEscapeProcessing(boolean enable) throws SQLException { checkOpen(); _escapeProcessing = enable; } + @Override public int getQueryTimeout() throws SQLException { checkOpen(); return _queryTimeout; } + @Override public void setQueryTimeout(int seconds) throws SQLException { checkOpen(); _queryTimeout = seconds; } + @Override public void cancel() throws SQLException { checkOpen(); } + @Override public SQLWarning getWarnings() throws SQLException { checkOpen(); return null; } + @Override public void clearWarnings() throws SQLException { checkOpen(); } + @Override public void setCursorName(String name) throws SQLException { checkOpen(); _cursorName = name; } + @Override public boolean execute(String sql) throws SQLException { checkOpen(); if("invalid".equals(sql)) { @@ -159,6 +174,7 @@ public class TesterStatement implements Statement { return _executeResponse; } + @Override public ResultSet getResultSet() throws SQLException { checkOpen(); if (_resultSet == null) { @@ -167,59 +183,71 @@ public class TesterStatement implements Statement { return _resultSet; } + @Override public int getUpdateCount() throws SQLException { checkOpen(); return _rowsUpdated; } + @Override public boolean getMoreResults() throws SQLException { checkOpen(); return false; } + @Override public void setFetchDirection(int direction) throws SQLException { checkOpen(); _fetchDirection = direction; } + @Override public int getFetchDirection() throws SQLException { checkOpen(); return _fetchDirection; } + @Override public void setFetchSize(int rows) throws SQLException { checkOpen(); _fetchSize = rows; } + @Override public int getFetchSize() throws SQLException { checkOpen(); return _fetchSize; } + @Override public int getResultSetConcurrency() throws SQLException { checkOpen(); return _resultSetConcurrency; } + @Override public int getResultSetType() throws SQLException { checkOpen(); return _resultSetType; } + @Override public void addBatch(String sql) throws SQLException { checkOpen(); } + @Override public void clearBatch() throws SQLException { checkOpen(); } + @Override public int[] executeBatch() throws SQLException { checkOpen(); return new int[0]; } + @Override public Connection getConnection() throws SQLException { checkOpen(); return _connection; @@ -231,44 +259,53 @@ public class TesterStatement implements Statement { } } + @Override public boolean getMoreResults(int current) throws SQLException { throw new SQLException("Not implemented."); } + @Override public ResultSet getGeneratedKeys() throws SQLException { return new TesterResultSet(this); } + @Override public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { throw new SQLException("Not implemented."); } + @Override public int executeUpdate(String sql, int columnIndexes[]) throws SQLException { throw new SQLException("Not implemented."); } + @Override public int executeUpdate(String sql, String columnNames[]) throws SQLException { throw new SQLException("Not implemented."); } + @Override public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { throw new SQLException("Not implemented."); } + @Override public boolean execute(String sql, int columnIndexes[]) throws SQLException { throw new SQLException("Not implemented."); } + @Override public boolean execute(String sql, String columnNames[]) throws SQLException { throw new SQLException("Not implemented."); } + @Override public int getResultSetHoldability() throws SQLException { checkOpen(); throw new SQLException("Not implemented."); @@ -276,22 +313,27 @@ public class TesterStatement implements Statement { /* JDBC_4_ANT_KEY_BEGIN */ + @Override public boolean isWrapperFor(Class<?> iface) throws SQLException { throw new SQLException("Not implemented."); } + @Override public <T> T unwrap(Class<T> iface) throws SQLException { throw new SQLException("Not implemented."); } + @Override public boolean isClosed() throws SQLException { return !_open; } + @Override public void setPoolable(boolean poolable) throws SQLException { throw new SQLException("Not implemented."); } + @Override public boolean isPoolable() throws SQLException { throw new SQLException("Not implemented."); } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org