use of com.alibaba.druid.filter.FilterAdapter in project druid by alibaba.
the class FilterChainImplTest3 method setUp.
protected void setUp() throws Exception {
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setFilters("stat,log4j,wall,encoding");
dataSource.getProxyFilters().add(new FilterAdapter() {
});
dataSource.setDbType("mysql");
dataSource.setDriver(new MockDriver() {
public ResultSet executeQuery(MockStatementBase stmt, String sql) throws SQLException {
return null;
}
public MockStatement createMockStatement(MockConnection conn) {
return new MockStatement(conn) {
public ResultSet getResultSet() throws SQLException {
return null;
}
};
}
});
dataSource.init();
}
use of com.alibaba.druid.filter.FilterAdapter in project druid by alibaba.
the class StatFilterReadStringLengthTest 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 String resultSet_getString(FilterChain chain, ResultSetProxy result, int columnIndex) throws SQLException {
return "123456";
}
@Override
public String resultSet_getString(FilterChain chain, ResultSetProxy result, String columnIndex) throws SQLException {
return "1234567";
}
});
dataSource.init();
}
use of com.alibaba.druid.filter.FilterAdapter in project druid by alibaba.
the class FilterChainImplTest2 method setUp.
protected void setUp() throws Exception {
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setFilters("stat,log4j,wall,encoding");
dataSource.getProxyFilters().add(new FilterAdapter() {
});
dataSource.setDbType("mysql");
dataSource.init();
}
use of com.alibaba.druid.filter.FilterAdapter in project druid by alibaba.
the class DruidDataSourceTest8 method setUp.
protected void setUp() throws Exception {
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setInitialSize(1);
dataSource.getProxyFilters().add(new FilterAdapter() {
@Override
public ConnectionProxy connection_connect(FilterChain chain, Properties info) throws SQLException {
throw new Error();
}
});
}
use of com.alibaba.druid.filter.FilterAdapter in project druid by alibaba.
the class DruidConnectionHolderTest2 method setUp.
protected void setUp() throws Exception {
super.setUp();
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setTestOnBorrow(false);
dataSource.setPoolPreparedStatements(true);
dataSource.getProxyFilters().add(new FilterAdapter() {
public int connection_getTransactionIsolation(FilterChain chain, ConnectionProxy connection) throws SQLException {
throw new SQLException();
}
});
}
Aggregations