@Override
 protected void starting(Description description) {
   try {
     if (delegate == null || delegate.isClosed()) delegate = getNewConnection();
     if (!autoCommit) delegate.setAutoCommit(false);
   } catch (Exception e) {
     throw new RuntimeException(e);
   }
 }
 @Override
 protected void finished(Description description) {
   if (!autoCommit && delegate != null) {
     try {
       if (!delegate.isClosed()) {
         delegate.rollback();
         delegate.reset();
       }
     } catch (SQLException se) {
       throw new RuntimeException(se);
     }
   }
 }
 @Override
 public PreparedStatement prepareStatement(
     String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
     throws SQLException {
   return delegate.prepareStatement(
       sql, resultSetType, resultSetConcurrency, resultSetHoldability);
 }
 @Override
 public Savepoint setSavepoint(String name) throws SQLException {
   return delegate.setSavepoint(name);
 }
 @Override
 public PreparedStatement prepareStatement(String sql) throws SQLException {
   return delegate.prepareStatement(sql);
 }
 private TestConnection getNewConnection() throws Exception {
   TestConnection conn = connPool.getConnection(userName, password);
   if (schema != null) conn.setSchema(schema);
   return conn;
 }
 @Override
 public <T> T unwrap(Class<T> iface) throws SQLException {
   return delegate.unwrap(iface);
 }
 @Override
 public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException {
   delegate.setNetworkTimeout(executor, milliseconds);
 }
 @Override
 public String getSchema() throws SQLException {
   return delegate.getSchema();
 }
Exemplo n.º 10
0
 @Override
 public NClob createNClob() throws SQLException {
   return delegate.createNClob();
 }
Exemplo n.º 11
0
 @Override
 public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
   return delegate.prepareStatement(sql, columnNames);
 }
Exemplo n.º 12
0
 @Override
 public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
   return delegate.prepareStatement(sql, autoGeneratedKeys);
 }
Exemplo n.º 13
0
 @Override
 public Statement createStatement(
     int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
   return delegate.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability);
 }
Exemplo n.º 14
0
 @Override
 public void releaseSavepoint(Savepoint savepoint) throws SQLException {
   delegate.releaseSavepoint(savepoint);
 }
Exemplo n.º 15
0
 @Override
 public void rollback(Savepoint savepoint) throws SQLException {
   delegate.rollback(savepoint);
 }
Exemplo n.º 16
0
 @Override
 public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
   return delegate.createStruct(typeName, attributes);
 }
Exemplo n.º 17
0
 @Override
 public void setSchema(String schema) throws SQLException {
   delegate.setSchema(schema);
 }
Exemplo n.º 18
0
 @Override
 public SQLXML createSQLXML() throws SQLException {
   return delegate.createSQLXML();
 }
Exemplo n.º 19
0
 @Override
 public void abort(Executor executor) throws SQLException {
   delegate.abort(executor);
 }
Exemplo n.º 20
0
 @Override
 public boolean isValid(int timeout) throws SQLException {
   return delegate.isValid(timeout);
 }
Exemplo n.º 21
0
 @Override
 public int getNetworkTimeout() throws SQLException {
   return delegate.getNetworkTimeout();
 }
Exemplo n.º 22
0
 @Override
 public void setClientInfo(String name, String value) throws SQLClientInfoException {
   delegate.setClientInfo(name, value);
 }
Exemplo n.º 23
0
 @Override
 public boolean isWrapperFor(Class<?> iface) throws SQLException {
   return delegate.isWrapperFor(iface);
 }
Exemplo n.º 24
0
 @Override
 public void setClientInfo(Properties properties) throws SQLClientInfoException {
   delegate.setClientInfo(properties);
 }
Exemplo n.º 25
0
 @Override
 public String getClientInfo(String name) throws SQLException {
   return delegate.getClientInfo(name);
 }
Exemplo n.º 26
0
 @Override
 public Properties getClientInfo() throws SQLException {
   return delegate.getClientInfo();
 }
Exemplo n.º 27
0
 @Override
 public Statement createStatement() throws SQLException {
   return delegate.createStatement();
 }
Exemplo n.º 28
0
 @Override
 public Array createArrayOf(String typeName, Object[] elements) throws SQLException {
   return delegate.createArrayOf(typeName, elements);
 }
Exemplo n.º 29
0
 @Override
 public CallableStatement prepareCall(String sql) throws SQLException {
   return delegate.prepareCall(sql);
 }
Exemplo n.º 30
0
 @Override
 public Savepoint setSavepoint() throws SQLException {
   return delegate.setSavepoint();
 }