use of com.alibaba.druid.filter.FilterAdapter in project druid by alibaba.
the class DruidDataSourceTest_createError 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 {
throw new SQLException();
}
});
}
use of com.alibaba.druid.filter.FilterAdapter 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.FilterAdapter 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.FilterAdapter 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;
}
});
}
use of com.alibaba.druid.filter.FilterAdapter in project druid by alibaba.
the class HoldableUnsupportTest method setUp.
protected void setUp() throws Exception {
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
Filter filter = new FilterAdapter() {
@Override
public int connection_getHoldability(FilterChain chain, ConnectionProxy connection) throws SQLException {
throw new UnsupportedOperationException();
}
};
dataSource.getProxyFilters().add(filter);
}
Aggregations