use of com.alibaba.druid.filter.FilterChain in project druid by alibaba.
the class DruidDataSourceTest3 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() {
public ConnectionProxy connection_connect(FilterChain chain, Properties info) throws SQLException {
try {
Thread.sleep(Long.MAX_VALUE);
} catch (InterruptedException e) {
// skip
}
return null;
}
});
}
use of com.alibaba.druid.filter.FilterChain in project druid by alibaba.
the class DruidConnectionHolderTest method setUp.
protected void setUp() throws Exception {
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.FilterChain in project druid by alibaba.
the class DruidConnectionHolderTest3 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() {
public int connection_getTransactionIsolation(FilterChain chain, ConnectionProxy connection) throws SQLException {
throw new MySQLException();
}
});
}
use of com.alibaba.druid.filter.FilterChain in project druid by alibaba.
the class DruidDataSourceTest_autocommit3 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(false);
return conn;
}
});
}
use of com.alibaba.druid.filter.FilterChain in project druid by alibaba.
the class DruidDataSourceTest_closeError 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() {
public void connection_close(FilterChain chain, ConnectionProxy connection) throws SQLException {
throw new SQLException();
}
});
dataSource.init();
}
Aggregations