From bd9d8b40090e4cceacdae50eab7e3fc398675302 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Prante?= Date: Wed, 3 Aug 2022 12:18:56 +0200 Subject: [PATCH] cosmetic changes --- gradle.properties | 2 +- .../org/xbib/jdbc/connection/pool/Pool.java | 10 - .../xbib/jdbc/connection/pool/PoolConfig.java | 2 +- .../jdbc/connection/pool/PoolDataSource.java | 30 - .../xbib/jdbc/connection/pool/PoolEntry.java | 12 - .../pool/ProxyCallableStatement.java | 1 + .../jdbc/connection/pool/ProxyConnection.java | 83 --- .../pool/ProxyDatabaseMetaData.java | 9 - .../jdbc/connection/pool/ProxyLeakTask.java | 3 - .../pool/ProxyPreparedStatement.java | 13 +- .../jdbc/connection/pool/ProxyResultSet.java | 22 +- .../jdbc/connection/pool/ProxyStatement.java | 63 -- .../pool/util/ClockSourceFactory.java | 4 + .../jdbc/connection/pool/util/FastList.java | 72 --- .../pool/util/NanosecondClockSource.java | 31 +- .../io/pool/jdbc/mock/StubBaseConnection.java | 6 - .../io/pool/jdbc/mock/StubConnection.java | 156 ----- .../io/pool/jdbc/mock/StubDataSource.java | 27 - .../xbib/io/pool/jdbc/mock/StubDriver.java | 22 +- .../pool/jdbc/mock/StubPreparedStatement.java | 288 --------- .../xbib/io/pool/jdbc/mock/StubResultSet.java | 573 ------------------ .../xbib/io/pool/jdbc/mock/StubStatement.java | 133 +--- .../main/java/org/xbib/jdbc/query/Schema.java | 3 + .../java/org/xbib/jdbc/query/SqlArgs.java | 6 +- .../org/xbib/jdbc/query/TransactionImpl.java | 5 + 25 files changed, 31 insertions(+), 1545 deletions(-) diff --git a/gradle.properties b/gradle.properties index 02c7627..47e0a7e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ group = org.xbib name = database -version = 0.0.4 +version = 0.0.5 org.gradle.warning.mode = ALL diff --git a/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/Pool.java b/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/Pool.java index e7b4fa7..b415cfa 100644 --- a/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/Pool.java +++ b/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/Pool.java @@ -168,9 +168,6 @@ public class Pool implements BagStateListener { return config; } - /** - * {@inheritDoc} - */ @Override public String toString() { return poolName; @@ -339,9 +336,6 @@ public class Pool implements BagStateListener { } } - /** - * {@inheritDoc} - */ @Override public void addBagItem(final int waiting) { final boolean shouldAdd = waiting - addConnectionQueueReadOnlyView.size() >= 0; @@ -955,13 +949,9 @@ public class Pool implements BagStateListener { } else if (paramClass == boolean.class || paramClass == Boolean.class) { writeMethod.invoke(target, Boolean.parseBoolean(propValue.toString())); } else if (paramClass == String.class) { - logger.log(Level.FINE, () -> - MessageFormat.format("write method {0} {1}", target, propValue)); writeMethod.invoke(target, propValue.toString()); } else { try { - logger.log(Level.FINE, () -> - MessageFormat.format("try to create a new instance of {0}", propValue)); writeMethod.invoke(target, Class.forName(propValue.toString()).getDeclaredConstructor().newInstance()); } catch (InstantiationException | ClassNotFoundException e) { logger.log(Level.FINE, () -> diff --git a/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/PoolConfig.java b/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/PoolConfig.java index 1a9bdac..a09e805 100644 --- a/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/PoolConfig.java +++ b/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/PoolConfig.java @@ -661,6 +661,6 @@ public class PoolConfig { } private static String generatePoolName() { - return "xbib-pool-jdbc-" + POOL_COUNTER.getAndIncrement(); + return "xbib-jdbc-" + POOL_COUNTER.getAndIncrement(); } } diff --git a/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/PoolDataSource.java b/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/PoolDataSource.java index a0d2bab..f3839b6 100644 --- a/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/PoolDataSource.java +++ b/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/PoolDataSource.java @@ -43,9 +43,6 @@ public class PoolDataSource implements DataSource, Closeable { return pool; } - /** - * {@inheritDoc} - */ @Override public Connection getConnection() throws SQLException { if (isClosed()) { @@ -70,26 +67,17 @@ public class PoolDataSource implements DataSource, Closeable { return result.getConnection(); } - /** - * {@inheritDoc} - */ @Override public Connection getConnection(String username, String password) throws SQLException { throw new SQLFeatureNotSupportedException(); } - /** - * {@inheritDoc} - */ @Override public PrintWriter getLogWriter() throws SQLException { Pool p = pool; return (p != null ? p.getUnwrappedDataSource().getLogWriter() : null); } - /** - * {@inheritDoc} - */ @Override public void setLogWriter(PrintWriter out) throws SQLException { Pool p = pool; @@ -98,9 +86,6 @@ public class PoolDataSource implements DataSource, Closeable { } } - /** - * {@inheritDoc} - */ @Override public void setLoginTimeout(int seconds) throws SQLException { Pool p = pool; @@ -109,26 +94,17 @@ public class PoolDataSource implements DataSource, Closeable { } } - /** - * {@inheritDoc} - */ @Override public int getLoginTimeout() throws SQLException { Pool p = pool; return (p != null ? p.getUnwrappedDataSource().getLoginTimeout() : 0); } - /** - * {@inheritDoc} - */ @Override public Logger getParentLogger() throws SQLFeatureNotSupportedException { throw new SQLFeatureNotSupportedException(); } - /** - * {@inheritDoc} - */ @Override @SuppressWarnings("unchecked") public T unwrap(Class iface) throws SQLException { @@ -148,9 +124,6 @@ public class PoolDataSource implements DataSource, Closeable { throw new SQLException("wrapped DataSource is not an instance of " + iface); } - /** - * {@inheritDoc} - */ @Override public boolean isWrapperFor(Class iface) throws SQLException { if (iface.isInstance(this)) { @@ -214,9 +187,6 @@ public class PoolDataSource implements DataSource, Closeable { return isShutdown.get(); } - /** - * {@inheritDoc} - */ @Override public String toString() { return "PoolDataSource (" + pool + ")"; diff --git a/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/PoolEntry.java b/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/PoolEntry.java index fa53695..3a83806 100644 --- a/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/PoolEntry.java +++ b/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/PoolEntry.java @@ -113,9 +113,6 @@ public class PoolEntry implements BagEntry { return ClockSource.elapsedMillis(lastBorrowed); } - /** - * {@inheritDoc} - */ @Override public String toString() { final long now = ClockSource.currentTime(); @@ -124,25 +121,16 @@ public class PoolEntry implements BagEntry { + stateToString(); } - /** - * {@inheritDoc} - */ @Override public int getState() { return stateUpdater.get(this); } - /** - * {@inheritDoc} - */ @Override public boolean compareAndSet(int expect, int update) { return stateUpdater.compareAndSet(this, expect, update); } - /** - * {@inheritDoc} - */ @Override public void setState(int update) { stateUpdater.set(this, update); diff --git a/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/ProxyCallableStatement.java b/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/ProxyCallableStatement.java index b7921ed..b1830a0 100644 --- a/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/ProxyCallableStatement.java +++ b/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/ProxyCallableStatement.java @@ -83,6 +83,7 @@ public class ProxyCallableStatement extends ProxyPreparedStatement implements Ca return ((CallableStatement) delegate).getDouble(parameterIndex); } + @SuppressWarnings("deprecation") @Override public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException { return ((CallableStatement) delegate).getBigDecimal(parameterIndex, scale); diff --git a/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/ProxyConnection.java b/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/ProxyConnection.java index 4093259..5b171fb 100644 --- a/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/ProxyConnection.java +++ b/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/ProxyConnection.java @@ -112,10 +112,6 @@ public class ProxyConnection implements Connection { return isCommitStateDirty; } - /** - * - * {@inheritDoc} - */ @Override public final String toString() { return getClass().getSimpleName() + '@' + System.identityHashCode(this) + " wrapping " + delegate; @@ -215,9 +211,6 @@ public class ProxyConnection implements Connection { } } - /** - * {@inheritDoc} - */ @Override public void close() throws SQLException { closeStatements(); @@ -249,42 +242,26 @@ public class ProxyConnection implements Connection { } } - /** - * {@inheritDoc} - */ @Override public boolean isClosed() throws SQLException { return delegate == CLOSED_CONNECTION; } - /** - * {@inheritDoc} - */ @Override public Statement createStatement() throws SQLException { return ProxyFactory.getProxyStatement(this, trackStatement(delegate.createStatement())); } - /** - * {@inheritDoc} - */ @Override public Statement createStatement(int resultSetType, int concurrency) throws SQLException { return ProxyFactory.getProxyStatement(this, trackStatement(delegate.createStatement(resultSetType, concurrency))); } - /** - * {@inheritDoc} - */ @Override public Statement createStatement(int resultSetType, int concurrency, int holdability) throws SQLException { return ProxyFactory.getProxyStatement(this, trackStatement(delegate.createStatement(resultSetType, concurrency, holdability))); } - - /** - * {@inheritDoc} - */ @Override public CallableStatement prepareCall(String sql) throws SQLException { return ProxyFactory.getProxyCallableStatement(this, trackStatement(delegate.prepareCall(sql))); @@ -295,9 +272,6 @@ public class ProxyConnection implements Connection { return delegate.nativeSQL(sql); } - /** - * {@inheritDoc} - */ @Override public CallableStatement prepareCall(String sql, int resultSetType, int concurrency) throws SQLException { return ProxyFactory.getProxyCallableStatement(this, trackStatement(delegate.prepareCall(sql, resultSetType, concurrency))); @@ -333,57 +307,36 @@ public class ProxyConnection implements Connection { return delegate.setSavepoint(name); } - /** - * {@inheritDoc} - */ @Override public CallableStatement prepareCall(String sql, int resultSetType, int concurrency, int holdability) throws SQLException { return ProxyFactory.getProxyCallableStatement(this, trackStatement(delegate.prepareCall(sql, resultSetType, concurrency, holdability))); } - /** - * {@inheritDoc} - */ @Override public PreparedStatement prepareStatement(String sql) throws SQLException { return ProxyFactory.getProxyPreparedStatement(this, trackStatement(delegate.prepareStatement(sql))); } - /** - * {@inheritDoc} - */ @Override public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException { return ProxyFactory.getProxyPreparedStatement(this, trackStatement(delegate.prepareStatement(sql, autoGeneratedKeys))); } - /** - * {@inheritDoc} - */ @Override public PreparedStatement prepareStatement(String sql, int resultSetType, int concurrency) throws SQLException { return ProxyFactory.getProxyPreparedStatement(this, trackStatement(delegate.prepareStatement(sql, resultSetType, concurrency))); } - /** - * {@inheritDoc} - */ @Override public PreparedStatement prepareStatement(String sql, int resultSetType, int concurrency, int holdability) throws SQLException { return ProxyFactory.getProxyPreparedStatement(this, trackStatement(delegate.prepareStatement(sql, resultSetType, concurrency, holdability))); } - /** - * {@inheritDoc} - */ @Override public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException { return ProxyFactory.getProxyPreparedStatement(this, trackStatement(delegate.prepareStatement(sql, columnIndexes))); } - /** - * {@inheritDoc} - */ @Override public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException { return ProxyFactory.getProxyPreparedStatement(this, trackStatement(delegate.prepareStatement(sql, columnNames))); @@ -444,18 +397,12 @@ public class ProxyConnection implements Connection { return delegate.createStruct(typeName, attributes); } - /** - * {@inheritDoc} - */ @Override public DatabaseMetaData getMetaData() throws SQLException { markCommitStateDirty(); return ProxyFactory.getProxyDatabaseMetaData(this, delegate.getMetaData()); } - /** - * {@inheritDoc} - */ @Override public void commit() throws SQLException { delegate.commit(); @@ -463,9 +410,6 @@ public class ProxyConnection implements Connection { lastAccess = ClockSource.currentTime(); } - /** - * {@inheritDoc} - */ @Override public void rollback() throws SQLException { delegate.rollback(); @@ -473,9 +417,6 @@ public class ProxyConnection implements Connection { lastAccess = ClockSource.currentTime(); } - /** - * {@inheritDoc} - */ @Override public void rollback(Savepoint savepoint) throws SQLException { delegate.rollback(savepoint); @@ -488,9 +429,6 @@ public class ProxyConnection implements Connection { delegate.releaseSavepoint(savepoint); } - /** - * {@inheritDoc} - */ @Override public void setAutoCommit(boolean autoCommit) throws SQLException { delegate.setAutoCommit(autoCommit); @@ -503,9 +441,6 @@ public class ProxyConnection implements Connection { return delegate.getAutoCommit(); } - /** - * {@inheritDoc} - */ @Override public void setReadOnly(boolean readOnly) throws SQLException { delegate.setReadOnly(readOnly); @@ -519,9 +454,6 @@ public class ProxyConnection implements Connection { return delegate.isReadOnly(); } - /** - * {@inheritDoc} - */ @Override public void setTransactionIsolation(int level) throws SQLException { delegate.setTransactionIsolation(level); @@ -544,9 +476,6 @@ public class ProxyConnection implements Connection { delegate.clearWarnings(); } - /** - * {@inheritDoc} - */ @Override public void setCatalog(String catalog) throws SQLException { delegate.setCatalog(catalog); @@ -559,9 +488,6 @@ public class ProxyConnection implements Connection { return delegate.getCatalog(); } - /** - * {@inheritDoc} - */ @Override public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException { delegate.setNetworkTimeout(executor, milliseconds); @@ -574,9 +500,6 @@ public class ProxyConnection implements Connection { return delegate.getNetworkTimeout(); } - /** - * {@inheritDoc} - */ @Override public void setSchema(String schema) throws SQLException { delegate.setSchema(schema); @@ -594,17 +517,11 @@ public class ProxyConnection implements Connection { delegate.abort(executor); } - /** - * {@inheritDoc} - */ @Override public final boolean isWrapperFor(Class iface) throws SQLException { return iface.isInstance(delegate) || (delegate != null && delegate.isWrapperFor(iface)); } - /** - * {@inheritDoc} - */ @Override @SuppressWarnings("unchecked") public T unwrap(Class iface) throws SQLException { diff --git a/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/ProxyDatabaseMetaData.java b/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/ProxyDatabaseMetaData.java index 7f099e6..63ea0c1 100644 --- a/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/ProxyDatabaseMetaData.java +++ b/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/ProxyDatabaseMetaData.java @@ -23,18 +23,12 @@ public class ProxyDatabaseMetaData implements DatabaseMetaData { return connection.checkException(e); } - /** - * {@inheritDoc} - */ @Override public String toString() { final String delegateToString = delegate.toString(); return this.getClass().getSimpleName() + '@' + System.identityHashCode(this) + " wrapping " + delegateToString; } - /** - * {@inheritDoc} - */ @Override public Connection getConnection() { return connection; @@ -1035,9 +1029,6 @@ public class ProxyDatabaseMetaData implements DatabaseMetaData { return delegate.generatedKeyAlwaysReturned(); } - /** - * {@inheritDoc} - */ @Override @SuppressWarnings("unchecked") public T unwrap(Class iface) throws SQLException { diff --git a/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/ProxyLeakTask.java b/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/ProxyLeakTask.java index 0ae99ac..3b44393 100644 --- a/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/ProxyLeakTask.java +++ b/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/ProxyLeakTask.java @@ -55,9 +55,6 @@ public class ProxyLeakTask implements Runnable { scheduledFuture = executorService.schedule(this, leakDetectionThreshold, TimeUnit.MILLISECONDS); } - /** - * {@inheritDoc} - */ @Override public void run() { isLeaked = true; diff --git a/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/ProxyPreparedStatement.java b/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/ProxyPreparedStatement.java index bf77159..0aa350a 100644 --- a/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/ProxyPreparedStatement.java +++ b/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/ProxyPreparedStatement.java @@ -30,9 +30,6 @@ public class ProxyPreparedStatement extends ProxyStatement implements PreparedSt super(connection, statement); } - /** - * {@inheritDoc} - */ @Override public boolean execute() throws SQLException { connection.markCommitStateDirty(); @@ -199,9 +196,6 @@ public class ProxyPreparedStatement extends ProxyStatement implements PreparedSt ((PreparedStatement) delegate).setNClob(parameterIndex, reader); } - /** - * {@inheritDoc} - */ @Override public ResultSet executeQuery() throws SQLException { connection.markCommitStateDirty(); @@ -209,9 +203,6 @@ public class ProxyPreparedStatement extends ProxyStatement implements PreparedSt return ProxyFactory.getProxyResultSet(connection, this, resultSet); } - /** - * {@inheritDoc} - */ @Override public int executeUpdate() throws SQLException { connection.markCommitStateDirty(); @@ -293,6 +284,7 @@ public class ProxyPreparedStatement extends ProxyStatement implements PreparedSt ((PreparedStatement) delegate).setAsciiStream(parameterIndex, x, length); } + @SuppressWarnings("deprecation") @Override public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException { ((PreparedStatement) delegate).setUnicodeStream(parameterIndex, x, length); @@ -318,9 +310,6 @@ public class ProxyPreparedStatement extends ProxyStatement implements PreparedSt ((PreparedStatement) delegate).setObject(parameterIndex, x); } - /** - * {@inheritDoc} - */ @Override public long executeLargeUpdate() throws SQLException { connection.markCommitStateDirty(); diff --git a/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/ProxyResultSet.java b/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/ProxyResultSet.java index aaecb95..9f7a467 100644 --- a/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/ProxyResultSet.java +++ b/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/ProxyResultSet.java @@ -43,17 +43,11 @@ public class ProxyResultSet implements ResultSet { return delegate; } - /** - * {@inheritDoc} - */ @Override public String toString() { return this.getClass().getSimpleName() + '@' + System.identityHashCode(this) + " wrapping " + delegate; } - /** - * {@inheritDoc} - */ @Override public Statement getStatement() throws SQLException { return statement; @@ -439,9 +433,6 @@ public class ProxyResultSet implements ResultSet { return delegate.getObject(columnLabel, type); } - /** - * {@inheritDoc} - */ @Override public void updateRow() throws SQLException { connection.markCommitStateDirty(); @@ -503,6 +494,7 @@ public class ProxyResultSet implements ResultSet { return delegate.getDouble(columnIndex); } + @SuppressWarnings("deprecation") @Override public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { return delegate.getBigDecimal(columnIndex); @@ -533,6 +525,7 @@ public class ProxyResultSet implements ResultSet { return delegate.getAsciiStream(columnIndex); } + @SuppressWarnings("deprecation") @Override public InputStream getUnicodeStream(int columnIndex) throws SQLException { return delegate.getUnicodeStream(columnIndex); @@ -583,6 +576,7 @@ public class ProxyResultSet implements ResultSet { return delegate.getDouble(columnLabel); } + @SuppressWarnings("deprecation") @Override public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException { return delegate.getBigDecimal(columnLabel, scale); @@ -613,6 +607,7 @@ public class ProxyResultSet implements ResultSet { return delegate.getAsciiStream(columnLabel); } + @SuppressWarnings("deprecation") @Override public InputStream getUnicodeStream(String columnLabel) throws SQLException { return delegate.getUnicodeStream(columnLabel); @@ -973,18 +968,12 @@ public class ProxyResultSet implements ResultSet { delegate.updateObject(columnLabel, x); } - /** - * {@inheritDoc} - */ @Override public void insertRow() throws SQLException { connection.markCommitStateDirty(); delegate.insertRow(); } - /** - * {@inheritDoc} - */ @Override public void deleteRow() throws SQLException { connection.markCommitStateDirty(); @@ -1011,9 +1000,6 @@ public class ProxyResultSet implements ResultSet { delegate.moveToCurrentRow(); } - /** - * {@inheritDoc} - */ @Override @SuppressWarnings("unchecked") public final T unwrap(Class iface) throws SQLException { diff --git a/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/ProxyStatement.java b/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/ProxyStatement.java index 04cf67b..3216935 100644 --- a/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/ProxyStatement.java +++ b/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/ProxyStatement.java @@ -33,18 +33,12 @@ public class ProxyStatement implements Statement { return connection.checkException(e); } - /** - * {@inheritDoc} - */ @Override public String toString() { final String delegateToString = delegate.toString(); return this.getClass().getSimpleName() + '@' + System.identityHashCode(this) + " wrapping " + delegateToString; } - /** - * {@inheritDoc} - */ @Override public void close() throws SQLException { synchronized (this) { @@ -116,9 +110,6 @@ public class ProxyStatement implements Statement { delegate.setCursorName(name); } - /** - * {@inheritDoc} - */ @Override public Connection getConnection() throws SQLException { return connection; @@ -129,27 +120,18 @@ public class ProxyStatement implements Statement { return delegate.getMoreResults(current); } - /** - * {@inheritDoc} - */ @Override public boolean execute(String sql) throws SQLException { connection.markCommitStateDirty(); return delegate.execute(sql); } - /** - * {@inheritDoc} - */ @Override public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { connection.markCommitStateDirty(); return delegate.execute(sql, autoGeneratedKeys); } - /** - * {@inheritDoc} - */ @Override public ResultSet executeQuery(String sql) throws SQLException { connection.markCommitStateDirty(); @@ -157,63 +139,42 @@ public class ProxyStatement implements Statement { return ProxyFactory.getProxyResultSet(connection, this, resultSet); } - /** - * {@inheritDoc} - */ @Override public int executeUpdate(String sql) throws SQLException { connection.markCommitStateDirty(); return delegate.executeUpdate(sql); } - /** - * {@inheritDoc} - */ @Override public int[] executeBatch() throws SQLException { connection.markCommitStateDirty(); return delegate.executeBatch(); } - /** - * {@inheritDoc} - */ @Override public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { connection.markCommitStateDirty(); return delegate.executeUpdate(sql, autoGeneratedKeys); } - /** - * {@inheritDoc} - */ @Override public int executeUpdate(String sql, int[] columnIndexes) throws SQLException { connection.markCommitStateDirty(); return delegate.executeUpdate(sql, columnIndexes); } - /** - * {@inheritDoc} - */ @Override public int executeUpdate(String sql, String[] columnNames) throws SQLException { connection.markCommitStateDirty(); return delegate.executeUpdate(sql, columnNames); } - /** - * {@inheritDoc} - */ @Override public boolean execute(String sql, int[] columnIndexes) throws SQLException { connection.markCommitStateDirty(); return delegate.execute(sql, columnIndexes); } - /** - * {@inheritDoc} - */ @Override public boolean execute(String sql, String[] columnNames) throws SQLException { connection.markCommitStateDirty(); @@ -250,54 +211,36 @@ public class ProxyStatement implements Statement { return delegate.isCloseOnCompletion(); } - /** - * {@inheritDoc} - */ @Override public long[] executeLargeBatch() throws SQLException { connection.markCommitStateDirty(); return delegate.executeLargeBatch(); } - /** - * {@inheritDoc} - */ @Override public long executeLargeUpdate(String sql) throws SQLException { connection.markCommitStateDirty(); return delegate.executeLargeUpdate(sql); } - /** - * {@inheritDoc} - */ @Override public long executeLargeUpdate(String sql, int autoGeneratedKeys) throws SQLException { connection.markCommitStateDirty(); return delegate.executeLargeUpdate(sql, autoGeneratedKeys); } - /** - * {@inheritDoc} - */ @Override public long executeLargeUpdate(String sql, int[] columnIndexes) throws SQLException { connection.markCommitStateDirty(); return delegate.executeLargeUpdate(sql, columnIndexes); } - /** - * {@inheritDoc} - */ @Override public long executeLargeUpdate(String sql, String[] columnNames) throws SQLException { connection.markCommitStateDirty(); return delegate.executeLargeUpdate(sql, columnNames); } - /** - * {@inheritDoc} - */ @Override public ResultSet getResultSet() throws SQLException { final ResultSet resultSet = delegate.getResultSet(); @@ -361,9 +304,6 @@ public class ProxyStatement implements Statement { delegate.clearBatch(); } - /** - * {@inheritDoc} - */ @Override public ResultSet getGeneratedKeys() throws SQLException { ResultSet resultSet = delegate.getGeneratedKeys(); @@ -373,9 +313,6 @@ public class ProxyStatement implements Statement { return proxyResultSet; } - /** - * {@inheritDoc} - */ @Override @SuppressWarnings("unchecked") public final T unwrap(Class iface) throws SQLException { diff --git a/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/util/ClockSourceFactory.java b/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/util/ClockSourceFactory.java index 8c5e7eb..01f2289 100644 --- a/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/util/ClockSourceFactory.java +++ b/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/util/ClockSourceFactory.java @@ -4,6 +4,10 @@ package org.xbib.jdbc.connection.pool.util; * Factory class used to create a platform-specific ClockSource. */ public class ClockSourceFactory { + + public ClockSourceFactory() { + } + public static ClockSource create() { return new NanosecondClockSource(); } diff --git a/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/util/FastList.java b/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/util/FastList.java index d6d4607..7904eb4 100644 --- a/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/util/FastList.java +++ b/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/util/FastList.java @@ -137,17 +137,11 @@ public final class FastList implements List, RandomAccess { return size; } - /** - * {@inheritDoc} - */ @Override public boolean isEmpty() { return size == 0; } - /** - * {@inheritDoc} - */ @Override public T set(int index, T element) { T old = elementData[index]; @@ -155,9 +149,6 @@ public final class FastList implements List, RandomAccess { return old; } - /** - * {@inheritDoc} - */ @Override public T remove(int index) { if (size == 0) { @@ -172,17 +163,11 @@ public final class FastList implements List, RandomAccess { return old; } - /** - * {@inheritDoc} - */ @Override public boolean contains(Object o) { throw new UnsupportedOperationException(); } - /** - * {@inheritDoc} - */ @Override public Iterator iterator() { return new Iterator<>() { @@ -203,153 +188,96 @@ public final class FastList implements List, RandomAccess { }; } - /** - * {@inheritDoc} - */ @Override public Object[] toArray() { throw new UnsupportedOperationException(); } - /** - * {@inheritDoc} - */ @Override public E[] toArray(E[] a) { throw new UnsupportedOperationException(); } - /** - * {@inheritDoc} - */ @Override public boolean containsAll(Collection c) { throw new UnsupportedOperationException(); } - /** - * {@inheritDoc} - */ @Override public boolean addAll(Collection c) { throw new UnsupportedOperationException(); } - /** - * {@inheritDoc} - */ @Override public boolean addAll(int index, Collection c) { throw new UnsupportedOperationException(); } - /** - * {@inheritDoc} - */ @Override public boolean removeAll(Collection c) { throw new UnsupportedOperationException(); } - /** - * {@inheritDoc} - */ @Override public boolean retainAll(Collection c) { throw new UnsupportedOperationException(); } - /** - * {@inheritDoc} - */ @Override public void add(int index, T element) { throw new UnsupportedOperationException(); } - /** - * {@inheritDoc} - */ @Override public int indexOf(Object o) { throw new UnsupportedOperationException(); } - /** - * {@inheritDoc} - */ @Override public int lastIndexOf(Object o) { throw new UnsupportedOperationException(); } - /** - * {@inheritDoc} - */ @Override public ListIterator listIterator() { throw new UnsupportedOperationException(); } - /** - * {@inheritDoc} - */ @Override public ListIterator listIterator(int index) { throw new UnsupportedOperationException(); } - /** - * {@inheritDoc} - */ @Override public List subList(int fromIndex, int toIndex) { throw new UnsupportedOperationException(); } - /** - * {@inheritDoc} - */ @Override public Object clone() { throw new UnsupportedOperationException(); } - /** - * {@inheritDoc} - */ @Override public void forEach(Consumer action) { throw new UnsupportedOperationException(); } - /** - * {@inheritDoc} - */ @Override public Spliterator spliterator() { throw new UnsupportedOperationException(); } - /** - * {@inheritDoc} - */ @Override public boolean removeIf(Predicate filter) { throw new UnsupportedOperationException(); } - /** - * {@inheritDoc} - */ @Override public void replaceAll(UnaryOperator operator) { throw new UnsupportedOperationException(); } - /** - * {@inheritDoc} - */ @Override public void sort(Comparator c) { throw new UnsupportedOperationException(); diff --git a/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/util/NanosecondClockSource.java b/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/util/NanosecondClockSource.java index aac3114..65eb6ca 100644 --- a/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/util/NanosecondClockSource.java +++ b/jdbc-connection-pool/src/main/java/org/xbib/jdbc/connection/pool/util/NanosecondClockSource.java @@ -3,73 +3,50 @@ package org.xbib.jdbc.connection.pool.util; import java.util.concurrent.TimeUnit; public class NanosecondClockSource implements ClockSource { - /** - * {@inheritDoc} - */ + + public NanosecondClockSource() { + } + @Override public long currentTime0() { return System.nanoTime(); } - /** - * {@inheritDoc} - */ @Override public long toMillis0(final long time) { return TimeUnit.NANOSECONDS.toMillis(time); } - /** - * {@inheritDoc} - */ @Override public long toNanos0(final long time) { return time; } - /** - * {@inheritDoc} - */ @Override public long elapsedMillis0(final long startTime) { return TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime); } - /** - * {@inheritDoc} - */ @Override public long elapsedMillis0(final long startTime, final long endTime) { return TimeUnit.NANOSECONDS.toMillis(endTime - startTime); } - /** - * {@inheritDoc} - */ @Override public long elapsedNanos0(final long startTime) { return System.nanoTime() - startTime; } - /** - * {@inheritDoc} - */ @Override public long elapsedNanos0(final long startTime, final long endTime) { return endTime - startTime; } - /** - * {@inheritDoc} - */ @Override public long plusMillis0(final long time, final long millis) { return time + TimeUnit.MILLISECONDS.toNanos(millis); } - /** - * {@inheritDoc} - */ @Override public TimeUnit getSourceTimeUnit0() { return TimeUnit.NANOSECONDS; diff --git a/jdbc-connection-pool/src/test/java/org/xbib/io/pool/jdbc/mock/StubBaseConnection.java b/jdbc-connection-pool/src/test/java/org/xbib/io/pool/jdbc/mock/StubBaseConnection.java index 42c91c7..db26e70 100644 --- a/jdbc-connection-pool/src/test/java/org/xbib/io/pool/jdbc/mock/StubBaseConnection.java +++ b/jdbc-connection-pool/src/test/java/org/xbib/io/pool/jdbc/mock/StubBaseConnection.java @@ -9,9 +9,6 @@ public abstract class StubBaseConnection implements Connection { public volatile boolean throwException; - /** - * {@inheritDoc} - */ @Override public Statement createStatement() throws SQLException { if (throwException) { @@ -20,9 +17,6 @@ public abstract class StubBaseConnection implements Connection { return new StubStatement(this); } - /** - * {@inheritDoc} - */ @Override public PreparedStatement prepareStatement(String sql) throws SQLException { if (throwException) { diff --git a/jdbc-connection-pool/src/test/java/org/xbib/io/pool/jdbc/mock/StubConnection.java b/jdbc-connection-pool/src/test/java/org/xbib/io/pool/jdbc/mock/StubConnection.java index 29a775f..8455638 100644 --- a/jdbc-connection-pool/src/test/java/org/xbib/io/pool/jdbc/mock/StubConnection.java +++ b/jdbc-connection-pool/src/test/java/org/xbib/io/pool/jdbc/mock/StubConnection.java @@ -48,9 +48,6 @@ public class StubConnection extends StubBaseConnection implements Connection { } } - /** - * {@inheritDoc} - */ @SuppressWarnings("unchecked") @Override public T unwrap(Class iface) throws SQLException { @@ -65,9 +62,6 @@ public class StubConnection extends StubBaseConnection implements Connection { throw new SQLException("Wrapped connection is not an instance of " + iface); } - /** - * {@inheritDoc} - */ @Override public boolean isWrapperFor(Class iface) throws SQLException { if (throwException) { @@ -76,9 +70,6 @@ public class StubConnection extends StubBaseConnection implements Connection { return false; } - /** - * {@inheritDoc} - */ @Override public CallableStatement prepareCall(String sql) throws SQLException { if (throwException) { @@ -87,17 +78,11 @@ public class StubConnection extends StubBaseConnection implements Connection { return null; } - /** - * {@inheritDoc} - */ @Override public String nativeSQL(String sql) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public void setAutoCommit(boolean autoCommit) throws SQLException { if (throwException) { @@ -106,41 +91,26 @@ public class StubConnection extends StubBaseConnection implements Connection { this.autoCommit = autoCommit; } - /** - * {@inheritDoc} - */ @Override public boolean getAutoCommit() throws SQLException { return autoCommit; } - /** - * {@inheritDoc} - */ @Override public void commit() throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void rollback() throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void close() throws SQLException { } - /** - * {@inheritDoc} - */ @Override public boolean isClosed() throws SQLException { if (throwException) { @@ -149,17 +119,11 @@ public class StubConnection extends StubBaseConnection implements Connection { return false; } - /** - * {@inheritDoc} - */ @Override public DatabaseMetaData getMetaData() throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public void setReadOnly(boolean readOnly) throws SQLException { if (throwException) { @@ -167,9 +131,6 @@ public class StubConnection extends StubBaseConnection implements Connection { } } - /** - * {@inheritDoc} - */ @Override public boolean isReadOnly() throws SQLException { if (throwException) { @@ -178,9 +139,6 @@ public class StubConnection extends StubBaseConnection implements Connection { return false; } - /** - * {@inheritDoc} - */ @Override public void setCatalog(String catalog) throws SQLException { if (throwException) { @@ -189,17 +147,11 @@ public class StubConnection extends StubBaseConnection implements Connection { this.catalog = catalog; } - /** - * {@inheritDoc} - */ @Override public String getCatalog() throws SQLException { return catalog; } - /** - * {@inheritDoc} - */ @Override public void setTransactionIsolation(int level) throws SQLException { if (throwException) { @@ -208,25 +160,16 @@ public class StubConnection extends StubBaseConnection implements Connection { this.isolation = level; } - /** - * {@inheritDoc} - */ @Override public int getTransactionIsolation() throws SQLException { return isolation; } - /** - * {@inheritDoc} - */ @Override public SQLWarning getWarnings() throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public void clearWarnings() throws SQLException { if (throwException) { @@ -234,9 +177,6 @@ public class StubConnection extends StubBaseConnection implements Connection { } } - /** - * {@inheritDoc} - */ @Override public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { if (throwException) { @@ -245,9 +185,6 @@ public class StubConnection extends StubBaseConnection implements Connection { return null; } - /** - * {@inheritDoc} - */ @Override public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { if (throwException) { @@ -256,9 +193,6 @@ public class StubConnection extends StubBaseConnection implements Connection { return new StubPreparedStatement(this); } - /** - * {@inheritDoc} - */ @Override public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { if (throwException) { @@ -267,69 +201,42 @@ public class StubConnection extends StubBaseConnection implements Connection { return null; } - /** - * {@inheritDoc} - */ @Override public Map> getTypeMap() throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public void setTypeMap(Map> map) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setHoldability(int holdability) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public int getHoldability() throws SQLException { return (int) foo; } - /** - * {@inheritDoc} - */ @Override public Savepoint setSavepoint() throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public Savepoint setSavepoint(String name) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public void rollback(Savepoint savepoint) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void releaseSavepoint(Savepoint savepoint) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { if (throwException) { @@ -338,9 +245,6 @@ public class StubConnection extends StubBaseConnection implements Connection { return null; } - /** - * {@inheritDoc} - */ @Override public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { if (throwException) { @@ -349,9 +253,6 @@ public class StubConnection extends StubBaseConnection implements Connection { return new StubPreparedStatement(this); } - /** - * {@inheritDoc} - */ @Override public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { if (throwException) { @@ -360,9 +261,6 @@ public class StubConnection extends StubBaseConnection implements Connection { return null; } - /** - * {@inheritDoc} - */ @Override public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException { if (throwException) { @@ -371,9 +269,6 @@ public class StubConnection extends StubBaseConnection implements Connection { return new StubPreparedStatement(this); } - /** - * {@inheritDoc} - */ @Override public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException { if (throwException) { @@ -382,9 +277,6 @@ public class StubConnection extends StubBaseConnection implements Connection { return new StubPreparedStatement(this); } - /** - * {@inheritDoc} - */ @Override public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException { if (throwException) { @@ -393,41 +285,26 @@ public class StubConnection extends StubBaseConnection implements Connection { return new StubPreparedStatement(this); } - /** - * {@inheritDoc} - */ @Override public Clob createClob() throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public Blob createBlob() throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public NClob createNClob() throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public SQLXML createSQLXML() throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public boolean isValid(int timeout) throws SQLException { if (throwException) { @@ -436,81 +313,48 @@ public class StubConnection extends StubBaseConnection implements Connection { return true; } - /** - * {@inheritDoc} - */ @Override public void setClientInfo(String name, String value) throws SQLClientInfoException { } - /** - * {@inheritDoc} - */ @Override public void setClientInfo(Properties properties) throws SQLClientInfoException { } - /** - * {@inheritDoc} - */ @Override public String getClientInfo(String name) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public Properties getClientInfo() throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public Array createArrayOf(String typeName, Object[] elements) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public Struct createStruct(String typeName, Object[] attributes) throws SQLException { return null; } - /** - * {@inheritDoc} - */ public void setSchema(String schema) throws SQLException { } - /** - * {@inheritDoc} - */ public String getSchema() throws SQLException { return null; } - /** - * {@inheritDoc} - */ public void abort(Executor executor) throws SQLException { throw new SQLException("Intentional exception during abort"); } - /** - * {@inheritDoc} - */ public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException { } - /** - * {@inheritDoc} - */ public int getNetworkTimeout() throws SQLException { if (oldDriver) { throw new AbstractMethodError(); diff --git a/jdbc-connection-pool/src/test/java/org/xbib/io/pool/jdbc/mock/StubDataSource.java b/jdbc-connection-pool/src/test/java/org/xbib/io/pool/jdbc/mock/StubDataSource.java index 3375766..bdf5cad 100644 --- a/jdbc-connection-pool/src/test/java/org/xbib/io/pool/jdbc/mock/StubDataSource.java +++ b/jdbc-connection-pool/src/test/java/org/xbib/io/pool/jdbc/mock/StubDataSource.java @@ -36,48 +36,30 @@ public class StubDataSource implements DataSource { // we don't care } - /** - * {@inheritDoc} - */ @Override public PrintWriter getLogWriter() throws SQLException { return logWriter; } - /** - * {@inheritDoc} - */ @Override public void setLogWriter(PrintWriter out) throws SQLException { this.logWriter = out; } - /** - * {@inheritDoc} - */ @Override public void setLoginTimeout(int seconds) throws SQLException { this.loginTimeout = seconds; } - /** - * {@inheritDoc} - */ @Override public int getLoginTimeout() throws SQLException { return loginTimeout; } - /** - * {@inheritDoc} - */ public Logger getParentLogger() throws SQLFeatureNotSupportedException { return null; } - /** - * {@inheritDoc} - */ @SuppressWarnings("unchecked") @Override public T unwrap(Class iface) throws SQLException { @@ -87,17 +69,11 @@ public class StubDataSource implements DataSource { throw new SQLException("wrapped DataSource is not an instance of " + iface); } - /** - * {@inheritDoc} - */ @Override public boolean isWrapperFor(Class iface) throws SQLException { return false; } - /** - * {@inheritDoc} - */ @Override public Connection getConnection() throws SQLException { if (throwException != null) { @@ -109,9 +85,6 @@ public class StubDataSource implements DataSource { return new StubConnection(); } - /** - * {@inheritDoc} - */ @Override public Connection getConnection(String username, String password) throws SQLException { return new StubConnection(); diff --git a/jdbc-connection-pool/src/test/java/org/xbib/io/pool/jdbc/mock/StubDriver.java b/jdbc-connection-pool/src/test/java/org/xbib/io/pool/jdbc/mock/StubDriver.java index fbadba5..d676b93 100644 --- a/jdbc-connection-pool/src/test/java/org/xbib/io/pool/jdbc/mock/StubDriver.java +++ b/jdbc-connection-pool/src/test/java/org/xbib/io/pool/jdbc/mock/StubDriver.java @@ -10,6 +10,7 @@ import java.util.Properties; import java.util.logging.Logger; public class StubDriver implements Driver { + private static final Driver driver; static { @@ -21,57 +22,36 @@ public class StubDriver implements Driver { } } - /** - * {@inheritDoc} - */ @Override public Connection connect(String url, Properties info) throws SQLException { return new StubConnection(); } - /** - * {@inheritDoc} - */ @Override public boolean acceptsURL(String url) throws SQLException { return "jdbc:stub".equals(url); } - /** - * {@inheritDoc} - */ @Override public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public int getMajorVersion() { return 0; } - /** - * {@inheritDoc} - */ @Override public int getMinorVersion() { return 0; } - /** - * {@inheritDoc} - */ @Override public boolean jdbcCompliant() { return true; } - /** - * {@inheritDoc} - */ public Logger getParentLogger() throws SQLFeatureNotSupportedException { return null; } diff --git a/jdbc-connection-pool/src/test/java/org/xbib/io/pool/jdbc/mock/StubPreparedStatement.java b/jdbc-connection-pool/src/test/java/org/xbib/io/pool/jdbc/mock/StubPreparedStatement.java index d2e00d9..b5b96f3 100644 --- a/jdbc-connection-pool/src/test/java/org/xbib/io/pool/jdbc/mock/StubPreparedStatement.java +++ b/jdbc-connection-pool/src/test/java/org/xbib/io/pool/jdbc/mock/StubPreparedStatement.java @@ -29,130 +29,79 @@ public class StubPreparedStatement extends StubStatement implements PreparedStat super(connection); } - /** - * {@inheritDoc} - */ @Override public ResultSet executeQuery(String sql) throws SQLException { return new StubResultSet(); } - /** - * {@inheritDoc} - */ @Override public int executeUpdate(String sql) throws SQLException { return 0; } - /** - * {@inheritDoc} - */ @Override public int getMaxFieldSize() throws SQLException { throw new SQLException("Simulated disconnection error", "08999"); } - /** - * {@inheritDoc} - */ @Override public void setMaxFieldSize(int max) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public int getMaxRows() throws SQLException { return 0; } - /** - * {@inheritDoc} - */ @Override public void setMaxRows(int max) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setEscapeProcessing(boolean enable) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public int getQueryTimeout() throws SQLException { return 0; } - /** - * {@inheritDoc} - */ @Override public void setQueryTimeout(int seconds) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void cancel() throws SQLException { } - /** - * {@inheritDoc} - */ @Override public SQLWarning getWarnings() throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public void clearWarnings() throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setCursorName(String name) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public boolean execute(String sql) throws SQLException { return false; } - /** - * {@inheritDoc} - */ @Override public ResultSet getResultSet() throws SQLException { return new StubResultSet(); } - /** - * {@inheritDoc} - */ @Override public int getUpdateCount() throws SQLException { return 0; } - /** - * {@inheritDoc} - */ @Override public boolean getMoreResults() throws SQLException { if (isClosed()) { @@ -161,179 +110,110 @@ public class StubPreparedStatement extends StubStatement implements PreparedStat return false; } - /** - * {@inheritDoc} - */ @Override public void setFetchDirection(int direction) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public int getFetchDirection() throws SQLException { return 0; } - /** - * {@inheritDoc} - */ @Override public void setFetchSize(int rows) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public int getFetchSize() throws SQLException { return 0; } - /** - * {@inheritDoc} - */ @Override public int getResultSetConcurrency() throws SQLException { return 0; } - /** - * {@inheritDoc} - */ @Override public int getResultSetType() throws SQLException { return 0; } - /** - * {@inheritDoc} - */ @Override public void addBatch(String sql) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void clearBatch() throws SQLException { } - /** - * {@inheritDoc} - */ @Override public int[] executeBatch() throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public boolean getMoreResults(int current) throws SQLException { return false; } - /** - * {@inheritDoc} - */ @Override public ResultSet getGeneratedKeys() throws SQLException { return new StubResultSet(); } - /** - * {@inheritDoc} - */ @Override public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { return 0; } - /** - * {@inheritDoc} - */ @Override public int executeUpdate(String sql, int[] columnIndexes) throws SQLException { return 0; } - /** - * {@inheritDoc} - */ @Override public int executeUpdate(String sql, String[] columnNames) throws SQLException { return 0; } - /** - * {@inheritDoc} - */ @Override public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { return false; } - /** - * {@inheritDoc} - */ @Override public boolean execute(String sql, int[] columnIndexes) throws SQLException { return false; } - /** - * {@inheritDoc} - */ @Override public boolean execute(String sql, String[] columnNames) throws SQLException { return false; } - /** - * {@inheritDoc} - */ @Override public int getResultSetHoldability() throws SQLException { return 0; } - /** - * {@inheritDoc} - */ @Override public void setPoolable(boolean poolable) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public boolean isPoolable() throws SQLException { return false; } - /** - * {@inheritDoc} - */ @Override public void closeOnCompletion() throws SQLException { } - /** - * {@inheritDoc} - */ @Override public boolean isCloseOnCompletion() throws SQLException { return false; } - /** - * {@inheritDoc} - */ @SuppressWarnings("unchecked") @Override public T unwrap(Class iface) throws SQLException { @@ -344,401 +224,233 @@ public class StubPreparedStatement extends StubStatement implements PreparedStat throw new SQLException("Wrapped connection is not an instance of " + iface); } - /** - * {@inheritDoc} - */ @Override public boolean isWrapperFor(Class iface) throws SQLException { return false; } - /** - * {@inheritDoc} - */ @Override public ResultSet executeQuery() throws SQLException { return new StubResultSet(); } - /** - * {@inheritDoc} - */ @Override public int executeUpdate() throws SQLException { return 0; } - /** - * {@inheritDoc} - */ @Override public void setNull(int parameterIndex, int sqlType) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setBoolean(int parameterIndex, boolean x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setByte(int parameterIndex, byte x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setShort(int parameterIndex, short x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setInt(int parameterIndex, int x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setLong(int parameterIndex, long x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setFloat(int parameterIndex, float x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setDouble(int parameterIndex, double x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setString(int parameterIndex, String x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setBytes(int parameterIndex, byte[] x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setDate(int parameterIndex, Date x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setTime(int parameterIndex, Time x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException { } - /** - * {@inheritDoc} - */ @Override @SuppressWarnings("deprecation") public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void clearParameters() throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setObject(int parameterIndex, Object x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public boolean execute() throws SQLException { return false; } - /** - * {@inheritDoc} - */ @Override public void addBatch() throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setRef(int parameterIndex, Ref x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setBlob(int parameterIndex, Blob x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setClob(int parameterIndex, Clob x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setArray(int parameterIndex, Array x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public ResultSetMetaData getMetaData() throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setURL(int parameterIndex, URL x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public ParameterMetaData getParameterMetaData() throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public void setRowId(int parameterIndex, RowId x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setNString(int parameterIndex, String value) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setNClob(int parameterIndex, NClob value) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setClob(int parameterIndex, Reader reader, long length) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setClob(int parameterIndex, Reader reader) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void setNClob(int parameterIndex, Reader reader) throws SQLException { } diff --git a/jdbc-connection-pool/src/test/java/org/xbib/io/pool/jdbc/mock/StubResultSet.java b/jdbc-connection-pool/src/test/java/org/xbib/io/pool/jdbc/mock/StubResultSet.java index fabca10..95d91a9 100644 --- a/jdbc-connection-pool/src/test/java/org/xbib/io/pool/jdbc/mock/StubResultSet.java +++ b/jdbc-connection-pool/src/test/java/org/xbib/io/pool/jdbc/mock/StubResultSet.java @@ -27,1439 +27,866 @@ public class StubResultSet implements ResultSet { private int counter; private boolean closed; - /** - * {@inheritDoc} - */ @Override public T unwrap(Class iface) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public boolean isWrapperFor(Class iface) throws SQLException { return false; } - /** - * {@inheritDoc} - */ @Override public boolean next() throws SQLException { return (counter > 100000); } - /** - * {@inheritDoc} - */ @Override public void close() throws SQLException { closed = true; } - /** - * {@inheritDoc} - */ @Override public boolean wasNull() throws SQLException { return false; } - /** - * {@inheritDoc} - */ @Override public String getString(int columnIndex) throws SQLException { return "aString"; } - /** - * {@inheritDoc} - */ @Override public boolean getBoolean(int columnIndex) throws SQLException { return false; } - /** - * {@inheritDoc} - */ @Override public byte getByte(int columnIndex) throws SQLException { return 0; } - /** - * {@inheritDoc} - */ @Override public short getShort(int columnIndex) throws SQLException { return 0; } - /** - * {@inheritDoc} - */ @Override public int getInt(int columnIndex) throws SQLException { return ++counter; } - /** - * {@inheritDoc} - */ @Override public long getLong(int columnIndex) throws SQLException { return 0; } - /** - * {@inheritDoc} - */ @Override public float getFloat(int columnIndex) throws SQLException { throw new SQLException("Simulated disconnection error", "08999"); } - /** - * {@inheritDoc} - */ @Override public double getDouble(int columnIndex) throws SQLException { return 0; } - /** - * {@inheritDoc} - */ @Override @SuppressWarnings("deprecation") public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public byte[] getBytes(int columnIndex) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public Date getDate(int columnIndex) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public Time getTime(int columnIndex) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public Timestamp getTimestamp(int columnIndex) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public InputStream getAsciiStream(int columnIndex) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override @SuppressWarnings("deprecation") public InputStream getUnicodeStream(int columnIndex) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public InputStream getBinaryStream(int columnIndex) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public String getString(String columnLabel) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public boolean getBoolean(String columnLabel) throws SQLException { return false; } - /** - * {@inheritDoc} - */ @Override public byte getByte(String columnLabel) throws SQLException { return 0; } - /** - * {@inheritDoc} - */ @Override public short getShort(String columnLabel) throws SQLException { return 0; } - /** - * {@inheritDoc} - */ @Override public int getInt(String columnLabel) throws SQLException { return 0; } - /** - * {@inheritDoc} - */ @Override public long getLong(String columnLabel) throws SQLException { return 0; } - /** - * {@inheritDoc} - */ @Override public float getFloat(String columnLabel) throws SQLException { return 0; } - /** - * {@inheritDoc} - */ @Override public double getDouble(String columnLabel) throws SQLException { return 0; } - /** - * {@inheritDoc} - */ @Override @SuppressWarnings("deprecation") public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public byte[] getBytes(String columnLabel) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public Date getDate(String columnLabel) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public Time getTime(String columnLabel) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public Timestamp getTimestamp(String columnLabel) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public InputStream getAsciiStream(String columnLabel) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override @SuppressWarnings("deprecation") public InputStream getUnicodeStream(String columnLabel) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public InputStream getBinaryStream(String columnLabel) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public SQLWarning getWarnings() throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public void clearWarnings() throws SQLException { } - /** - * {@inheritDoc} - */ @Override public String getCursorName() throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public ResultSetMetaData getMetaData() throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public Object getObject(int columnIndex) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public Object getObject(String columnLabel) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public int findColumn(String columnLabel) throws SQLException { return 0; } - /** - * {@inheritDoc} - */ @Override public Reader getCharacterStream(int columnIndex) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public Reader getCharacterStream(String columnLabel) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public BigDecimal getBigDecimal(int columnIndex) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public BigDecimal getBigDecimal(String columnLabel) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public boolean isBeforeFirst() throws SQLException { return false; } - /** - * {@inheritDoc} - */ @Override public boolean isAfterLast() throws SQLException { return false; } - /** - * {@inheritDoc} - */ @Override public boolean isFirst() throws SQLException { return false; } - /** - * {@inheritDoc} - */ @Override public boolean isLast() throws SQLException { return false; } - /** - * {@inheritDoc} - */ @Override public void beforeFirst() throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void afterLast() throws SQLException { } - /** - * {@inheritDoc} - */ @Override public boolean first() throws SQLException { return false; } - /** - * {@inheritDoc} - */ @Override public boolean last() throws SQLException { return false; } - /** - * {@inheritDoc} - */ @Override public int getRow() throws SQLException { return 0; } - /** - * {@inheritDoc} - */ @Override public boolean absolute(int row) throws SQLException { return false; } - /** - * {@inheritDoc} - */ @Override public boolean relative(int rows) throws SQLException { return false; } - /** - * {@inheritDoc} - */ @Override public boolean previous() throws SQLException { return false; } - /** - * {@inheritDoc} - */ @Override public void setFetchDirection(int direction) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public int getFetchDirection() throws SQLException { return 0; } - /** - * {@inheritDoc} - */ @Override public void setFetchSize(int rows) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public int getFetchSize() throws SQLException { return 0; } - /** - * {@inheritDoc} - */ @Override public int getType() throws SQLException { return 0; } - /** - * {@inheritDoc} - */ @Override public int getConcurrency() throws SQLException { return 0; } - /** - * {@inheritDoc} - */ @Override public boolean rowUpdated() throws SQLException { return false; } - /** - * {@inheritDoc} - */ @Override public boolean rowInserted() throws SQLException { return false; } - /** - * {@inheritDoc} - */ @Override public boolean rowDeleted() throws SQLException { return false; } - /** - * {@inheritDoc} - */ @Override public void updateNull(int columnIndex) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateBoolean(int columnIndex, boolean x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateByte(int columnIndex, byte x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateShort(int columnIndex, short x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateInt(int columnIndex, int x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateLong(int columnIndex, long x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateFloat(int columnIndex, float x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateDouble(int columnIndex, double x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateString(int columnIndex, String x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateBytes(int columnIndex, byte[] x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateDate(int columnIndex, Date x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateTime(int columnIndex, Time x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateObject(int columnIndex, Object x, int scaleOrLength) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateObject(int columnIndex, Object x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateNull(String columnLabel) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateBoolean(String columnLabel, boolean x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateByte(String columnLabel, byte x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateShort(String columnLabel, short x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateInt(String columnLabel, int x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateLong(String columnLabel, long x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateFloat(String columnLabel, float x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateDouble(String columnLabel, double x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateString(String columnLabel, String x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateBytes(String columnLabel, byte[] x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateDate(String columnLabel, Date x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateTime(String columnLabel, Time x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateTimestamp(String columnLabel, Timestamp x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateAsciiStream(String columnLabel, InputStream x, int length) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateBinaryStream(String columnLabel, InputStream x, int length) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateCharacterStream(String columnLabel, Reader reader, int length) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateObject(String columnLabel, Object x, int scaleOrLength) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateObject(String columnLabel, Object x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void insertRow() throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateRow() throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void deleteRow() throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void refreshRow() throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void cancelRowUpdates() throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void moveToInsertRow() throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void moveToCurrentRow() throws SQLException { } - /** - * {@inheritDoc} - */ @Override public Statement getStatement() throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public Object getObject(int columnIndex, Map> map) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public Ref getRef(int columnIndex) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public Blob getBlob(int columnIndex) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public Clob getClob(int columnIndex) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public Array getArray(int columnIndex) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public Object getObject(String columnLabel, Map> map) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public Ref getRef(String columnLabel) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public Blob getBlob(String columnLabel) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public Clob getClob(String columnLabel) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public Array getArray(String columnLabel) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public Date getDate(int columnIndex, Calendar cal) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public Date getDate(String columnLabel, Calendar cal) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public Time getTime(int columnIndex, Calendar cal) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public Time getTime(String columnLabel, Calendar cal) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public Timestamp getTimestamp(String columnLabel, Calendar cal) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public URL getURL(int columnIndex) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public URL getURL(String columnLabel) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public void updateRef(int columnIndex, Ref x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateRef(String columnLabel, Ref x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateBlob(int columnIndex, Blob x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateBlob(String columnLabel, Blob x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateClob(int columnIndex, Clob x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateClob(String columnLabel, Clob x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateArray(int columnIndex, Array x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateArray(String columnLabel, Array x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public RowId getRowId(int columnIndex) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public RowId getRowId(String columnLabel) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public void updateRowId(int columnIndex, RowId x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateRowId(String columnLabel, RowId x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public int getHoldability() throws SQLException { return 0; } - /** - * {@inheritDoc} - */ @Override public boolean isClosed() throws SQLException { return closed; } - /** - * {@inheritDoc} - */ @Override public void updateNString(int columnIndex, String nString) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateNString(String columnLabel, String nString) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateNClob(int columnIndex, NClob nClob) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateNClob(String columnLabel, NClob nClob) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public NClob getNClob(int columnIndex) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public NClob getNClob(String columnLabel) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public SQLXML getSQLXML(int columnIndex) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public SQLXML getSQLXML(String columnLabel) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public String getNString(int columnIndex) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public String getNString(String columnLabel) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public Reader getNCharacterStream(int columnIndex) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public Reader getNCharacterStream(String columnLabel) throws SQLException { return null; } - /** - * {@inheritDoc} - */ @Override public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateClob(int columnIndex, Reader reader, long length) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateClob(String columnLabel, Reader reader, long length) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateCharacterStream(int columnIndex, Reader x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateClob(int columnIndex, Reader reader) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateClob(String columnLabel, Reader reader) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateNClob(int columnIndex, Reader reader) throws SQLException { } - /** - * {@inheritDoc} - */ @Override public void updateNClob(String columnLabel, Reader reader) throws SQLException { } - /** - * {@inheritDoc} - */ public T getObject(int columnIndex, Class type) throws SQLException { return null; } - /** - * {@inheritDoc} - */ public T getObject(String columnLabel, Class type) throws SQLException { return null; } diff --git a/jdbc-connection-pool/src/test/java/org/xbib/io/pool/jdbc/mock/StubStatement.java b/jdbc-connection-pool/src/test/java/org/xbib/io/pool/jdbc/mock/StubStatement.java index 5c4df31..6299ba2 100644 --- a/jdbc-connection-pool/src/test/java/org/xbib/io/pool/jdbc/mock/StubStatement.java +++ b/jdbc-connection-pool/src/test/java/org/xbib/io/pool/jdbc/mock/StubStatement.java @@ -23,9 +23,6 @@ public class StubStatement implements Statement { simulatedQueryTime = time; } - /** - * {@inheritDoc} - */ @SuppressWarnings("unchecked") @Override public T unwrap(Class iface) throws SQLException { @@ -33,95 +30,62 @@ public class StubStatement implements Statement { return (T) this; } - /** - * {@inheritDoc} - */ @Override public boolean isWrapperFor(Class iface) throws SQLException { checkClosed(); return false; } - /** - * {@inheritDoc} - */ @Override public ResultSet executeQuery(String sql) throws SQLException { checkClosed(); return new StubResultSet(); } - /** - * {@inheritDoc} - */ @Override public int executeUpdate(String sql) throws SQLException { checkClosed(); return 0; } - /** - * {@inheritDoc} - */ @Override public void close() throws SQLException { closed = true; } - /** - * {@inheritDoc} - */ @Override public int getMaxFieldSize() throws SQLException { checkClosed(); return 0; } - /** - * {@inheritDoc} - */ @Override public void setMaxFieldSize(int max) throws SQLException { checkClosed(); } - /** - * {@inheritDoc} - */ @Override public int getMaxRows() throws SQLException { checkClosed(); return 0; } - /** - * {@inheritDoc} - */ @Override public void setMaxRows(int max) throws SQLException { checkClosed(); } - /** - * {@inheritDoc} - */ @Override public void setEscapeProcessing(boolean enable) throws SQLException { checkClosed(); } - /** - * {@inheritDoc} - */ @Override public int getQueryTimeout() throws SQLException { checkClosed(); return 0; } - /** - * {@inheritDoc} - */ @Override public void setQueryTimeout(int seconds) throws SQLException { if (oldDriver) { @@ -131,42 +95,27 @@ public class StubStatement implements Statement { checkClosed(); } - /** - * {@inheritDoc} - */ @Override public void cancel() throws SQLException { checkClosed(); } - /** - * {@inheritDoc} - */ @Override public SQLWarning getWarnings() throws SQLException { checkClosed(); return null; } - /** - * {@inheritDoc} - */ @Override public void clearWarnings() throws SQLException { checkClosed(); } - /** - * {@inheritDoc} - */ @Override public void setCursorName(String name) throws SQLException { checkClosed(); } - /** - * {@inheritDoc} - */ @Override public boolean execute(String sql) throws SQLException { checkClosed(); @@ -176,235 +125,155 @@ public class StubStatement implements Statement { return false; } - /** - * {@inheritDoc} - */ @Override public ResultSet getResultSet() throws SQLException { checkClosed(); return new StubResultSet(); } - /** - * {@inheritDoc} - */ @Override public int getUpdateCount() throws SQLException { checkClosed(); return 0; } - /** - * {@inheritDoc} - */ @Override public boolean getMoreResults() throws SQLException { checkClosed(); return false; } - /** - * {@inheritDoc} - */ @Override public void setFetchDirection(int direction) throws SQLException { checkClosed(); } - /** - * {@inheritDoc} - */ @Override public int getFetchDirection() throws SQLException { checkClosed(); return 0; } - /** - * {@inheritDoc} - */ @Override public void setFetchSize(int rows) throws SQLException { checkClosed(); } - /** - * {@inheritDoc} - */ @Override public int getFetchSize() throws SQLException { checkClosed(); return 0; } - /** - * {@inheritDoc} - */ @Override public int getResultSetConcurrency() throws SQLException { checkClosed(); return 0; } - /** - * {@inheritDoc} - */ @Override public int getResultSetType() throws SQLException { checkClosed(); return 0; } - /** - * {@inheritDoc} - */ @Override public void addBatch(String sql) throws SQLException { checkClosed(); } - /** - * {@inheritDoc} - */ @Override public void clearBatch() throws SQLException { checkClosed(); } - /** - * {@inheritDoc} - */ @Override public int[] executeBatch() throws SQLException { checkClosed(); return null; } - /** - * {@inheritDoc} - */ @Override public Connection getConnection() throws SQLException { checkClosed(); return connection; } - /** - * {@inheritDoc} - */ @Override public boolean getMoreResults(int current) throws SQLException { checkClosed(); return false; } - /** - * {@inheritDoc} - */ @Override public ResultSet getGeneratedKeys() throws SQLException { checkClosed(); return new StubResultSet(); } - /** - * {@inheritDoc} - */ @Override public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { checkClosed(); return 0; } - /** - * {@inheritDoc} - */ @Override public int executeUpdate(String sql, int[] columnIndexes) throws SQLException { checkClosed(); return 0; } - /** - * {@inheritDoc} - */ @Override public int executeUpdate(String sql, String[] columnNames) throws SQLException { checkClosed(); return 0; } - /** - * {@inheritDoc} - */ @Override public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { checkClosed(); return false; } - /** - * {@inheritDoc} - */ @Override public boolean execute(String sql, int[] columnIndexes) throws SQLException { checkClosed(); return false; } - /** - * {@inheritDoc} - */ @Override public boolean execute(String sql, String[] columnNames) throws SQLException { checkClosed(); return false; } - /** - * {@inheritDoc} - */ @Override public int getResultSetHoldability() throws SQLException { checkClosed(); return 0; } - /** - * {@inheritDoc} - */ @Override public boolean isClosed() throws SQLException { return closed; } - /** - * {@inheritDoc} - */ @Override public void setPoolable(boolean poolable) throws SQLException { checkClosed(); } - /** - * {@inheritDoc} - */ @Override public boolean isPoolable() throws SQLException { checkClosed(); return false; } - /** - * {@inheritDoc} - */ public void closeOnCompletion() throws SQLException { checkClosed(); } - /** - * {@inheritDoc} - */ + @Override public boolean isCloseOnCompletion() throws SQLException { checkClosed(); return false; diff --git a/jdbc-query/src/main/java/org/xbib/jdbc/query/Schema.java b/jdbc-query/src/main/java/org/xbib/jdbc/query/Schema.java index 0b5809c..f687e49 100644 --- a/jdbc-query/src/main/java/org/xbib/jdbc/query/Schema.java +++ b/jdbc-query/src/main/java/org/xbib/jdbc/query/Schema.java @@ -29,6 +29,9 @@ public class Schema { private String userTableName = "user_principal"; + public Schema() { + } + public Sequence addSequence(String name) { Sequence sequence = new Sequence(name); sequences.add(sequence); diff --git a/jdbc-query/src/main/java/org/xbib/jdbc/query/SqlArgs.java b/jdbc-query/src/main/java/org/xbib/jdbc/query/SqlArgs.java index 4190755..f505ef6 100644 --- a/jdbc-query/src/main/java/org/xbib/jdbc/query/SqlArgs.java +++ b/jdbc-query/src/main/java/org/xbib/jdbc/query/SqlArgs.java @@ -19,8 +19,12 @@ import java.util.Set; * various arg*() calls and replay them later via the apply(sqlArgs) methods. */ public class SqlArgs implements SqlInsert.Apply, SqlUpdate.Apply, SqlSelect.Apply { + private final List invocations = new ArrayList<>(); - + + public SqlArgs() { + } + public static Builder fromMetadata(Row r) { return new Builder(r); } diff --git a/jdbc-query/src/main/java/org/xbib/jdbc/query/TransactionImpl.java b/jdbc-query/src/main/java/org/xbib/jdbc/query/TransactionImpl.java index b518cef..199ee21 100644 --- a/jdbc-query/src/main/java/org/xbib/jdbc/query/TransactionImpl.java +++ b/jdbc-query/src/main/java/org/xbib/jdbc/query/TransactionImpl.java @@ -5,9 +5,14 @@ package org.xbib.jdbc.query; * in terms of commit/rollback. */ public class TransactionImpl implements Transaction { + private boolean rollbackOnError; + private boolean rollbackOnly; + public TransactionImpl() { + } + @Override public boolean isRollbackOnError() { return rollbackOnError;