use of com.alibaba.druid.pool.vendor.NullExceptionSorter in project druid by alibaba.
the class PoolableStatementTest2 method setUp.
protected void setUp() throws Exception {
DruidDataSourceStatManager.clear();
driver = new MockDriver();
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setDriver(driver);
dataSource.setInitialSize(1);
dataSource.setMaxActive(2);
dataSource.setMaxIdle(2);
dataSource.setMinIdle(1);
// 300 / 10
dataSource.setMinEvictableIdleTimeMillis(300 * 1000);
// 180 / 10
dataSource.setTimeBetweenEvictionRunsMillis(180 * 1000);
dataSource.setTestWhileIdle(true);
dataSource.setTestOnBorrow(false);
dataSource.setValidationQuery("SELECT 1");
dataSource.setFilters("stat,trace");
dataSource.setRemoveAbandoned(true);
dataSource.setExceptionSorterClassName(null);
Assert.assertTrue(dataSource.getExceptionSorter() instanceof NullExceptionSorter);
dataSource.setExceptionSorterClassName("");
Assert.assertTrue(dataSource.getExceptionSorter() instanceof NullExceptionSorter);
JdbcStatContext context = new JdbcStatContext();
context.setTraceEnable(true);
JdbcStatManager.getInstance().setStatContext(context);
}
use of com.alibaba.druid.pool.vendor.NullExceptionSorter in project druid by alibaba.
the class TestDataSourceBasic method setUp.
protected void setUp() throws Exception {
super.setUp();
driver = new MockDriver();
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setDriver(driver);
dataSource.setInitialSize(1);
dataSource.setMaxActive(2);
dataSource.setMaxIdle(2);
dataSource.setMinIdle(1);
// 300 / 10
dataSource.setMinEvictableIdleTimeMillis(300 * 1000);
// 180 / 10
dataSource.setTimeBetweenEvictionRunsMillis(180 * 1000);
dataSource.setTestWhileIdle(true);
dataSource.setTestOnBorrow(false);
dataSource.setValidationQuery("SELECT 1");
dataSource.setFilters("stat,trace");
dataSource.setRemoveAbandoned(true);
dataSource.setExceptionSorterClassName(null);
Assert.assertTrue(dataSource.getExceptionSorter() instanceof NullExceptionSorter);
dataSource.setExceptionSorterClassName("");
Assert.assertTrue(dataSource.getExceptionSorter() instanceof NullExceptionSorter);
}
Aggregations