use of com.alibaba.druid.filter.FilterAdapter in project druid by alibaba.
the class DruidConnectionHolderTest method setUp.
protected void setUp() throws Exception {
super.setUp();
driver = new Driver();
if (driver.getMajorVersion() == 5) {
exceptionClass = Class.forName("com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException");
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setTestOnBorrow(false);
dataSource.setInitialSize(1);
dataSource.getProxyFilters().add(new FilterAdapter() {
public int connection_getTransactionIsolation(FilterChain chain, ConnectionProxy connection) throws SQLException {
throw createSyntaxException();
}
});
}
}
use of com.alibaba.druid.filter.FilterAdapter in project druid by alibaba.
the class DruidConnectionHolderTest3 method setUp.
protected void setUp() throws Exception {
super.setUp();
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setTestOnBorrow(false);
dataSource.setInitialSize(1);
dataSource.getProxyFilters().add(new FilterAdapter() {
public int connection_getTransactionIsolation(FilterChain chain, ConnectionProxy connection) throws SQLException {
throw new MySQLException();
}
});
}
use of com.alibaba.druid.filter.FilterAdapter in project druid by alibaba.
the class DruidPooledConnectionTest_prepareError method setUp.
protected void setUp() throws Exception {
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setTestOnBorrow(false);
dataSource.setFilters("stat");
dataSource.setPoolPreparedStatements(true);
dataSource.getProxyFilters().add(new FilterAdapter() {
@Override
public PreparedStatementProxy connection_prepareStatement(FilterChain chain, ConnectionProxy connection, String sql) throws SQLException {
throw new SQLException();
}
@Override
public PreparedStatementProxy connection_prepareStatement(FilterChain chain, ConnectionProxy connection, String sql, int autoGeneratedKeys) throws SQLException {
throw new SQLException();
}
@Override
public PreparedStatementProxy connection_prepareStatement(FilterChain chain, ConnectionProxy connection, String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
throw new SQLException();
}
@Override
public PreparedStatementProxy connection_prepareStatement(FilterChain chain, ConnectionProxy connection, String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
throw new SQLException();
}
@Override
public PreparedStatementProxy connection_prepareStatement(FilterChain chain, ConnectionProxy connection, String sql, int[] columnIndexes) throws SQLException {
throw new SQLException();
}
@Override
public PreparedStatementProxy connection_prepareStatement(FilterChain chain, ConnectionProxy connection, String sql, String[] columnNames) throws SQLException {
throw new SQLException();
}
@Override
public CallableStatementProxy connection_prepareCall(FilterChain chain, ConnectionProxy connection, String sql) throws SQLException {
throw new SQLException();
}
@Override
public CallableStatementProxy connection_prepareCall(FilterChain chain, ConnectionProxy connection, String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
throw new SQLException();
}
@Override
public CallableStatementProxy connection_prepareCall(FilterChain chain, ConnectionProxy connection, String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
throw new SQLException();
}
});
}
use of com.alibaba.druid.filter.FilterAdapter in project druid by alibaba.
the class DruidPooledPreparedStatementTest1 method setUp.
protected void setUp() throws Exception {
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setTestOnBorrow(false);
dataSource.setInitialSize(1);
dataSource.getProxyFilters().add(new FilterAdapter() {
@Override
public boolean preparedStatement_execute(FilterChain chain, PreparedStatementProxy statement) throws SQLException {
throw new SQLException();
}
@Override
public int preparedStatement_executeUpdate(FilterChain chain, PreparedStatementProxy statement) throws SQLException {
throw new SQLException();
}
public ResultSetProxy preparedStatement_executeQuery(FilterChain chain, PreparedStatementProxy statement) throws SQLException {
throw new SQLException();
}
public void preparedStatement_clearParameters(FilterChain chain, PreparedStatementProxy statement) throws SQLException {
throw new SQLException();
}
@Override
public int[] statement_executeBatch(FilterChain chain, StatementProxy statement) throws SQLException {
throw new SQLException();
}
@Override
public ParameterMetaData preparedStatement_getParameterMetaData(FilterChain chain, PreparedStatementProxy statement) throws SQLException {
throw new SQLException();
}
});
}
use of com.alibaba.druid.filter.FilterAdapter in project druid by alibaba.
the class StatFilterExecErrorTest method setUp.
protected void setUp() throws Exception {
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setFilters("stat");
dataSource.setTestOnBorrow(false);
dataSource.getProxyFilters().add(new FilterAdapter() {
@Override
public ResultSetProxy statement_executeQuery(FilterChain chain, StatementProxy statement, String sql) throws SQLException {
throw new SQLException();
}
@Override
public ResultSetProxy preparedStatement_executeQuery(FilterChain chain, PreparedStatementProxy statement) throws SQLException {
throw new SQLException();
}
});
dataSource.init();
}
Aggregations