use of com.alibaba.druid.filter.FilterChain 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.FilterChain 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.FilterChain in project druid by alibaba.
the class DruidDataSourceTest_autocommit method setUp.
protected void setUp() throws Exception {
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setTestOnBorrow(false);
dataSource.setDefaultAutoCommit(true);
dataSource.setInitialSize(1);
dataSource.getProxyFilters().add(new FilterAdapter() {
public ConnectionProxy connection_connect(FilterChain chain, Properties info) throws SQLException {
ConnectionProxy conn = chain.connection_connect(info);
conn.setAutoCommit(false);
return conn;
}
});
}
use of com.alibaba.druid.filter.FilterChain in project druid by alibaba.
the class DruidDataSourceTest_autocommit2 method setUp.
protected void setUp() throws Exception {
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setTestOnBorrow(false);
dataSource.setDefaultAutoCommit(false);
dataSource.setInitialSize(1);
dataSource.getProxyFilters().add(new FilterAdapter() {
public ConnectionProxy connection_connect(FilterChain chain, Properties info) throws SQLException {
ConnectionProxy conn = chain.connection_connect(info);
conn.setAutoCommit(true);
return conn;
}
});
}
use of com.alibaba.druid.filter.FilterChain in project druid by alibaba.
the class DruidDataSourceTest_autocommit4 method setUp.
protected void setUp() throws Exception {
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setTestOnBorrow(false);
dataSource.setDefaultAutoCommit(true);
dataSource.setInitialSize(1);
dataSource.getProxyFilters().add(new FilterAdapter() {
public ConnectionProxy connection_connect(FilterChain chain, Properties info) throws SQLException {
ConnectionProxy conn = chain.connection_connect(info);
conn.setAutoCommit(true);
return conn;
}
});
}
Aggregations