use of com.alibaba.druid.mock.MockDriver in project druid by alibaba.
the class TestConcurrent method setUp.
protected void setUp() throws Exception {
DruidDataSourceStatManager.clear();
driver = new MockDriver();
driver.setLogExecuteQueryEnable(false);
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setDriver(driver);
dataSource.setInitialSize(1);
dataSource.setMaxActive(100);
dataSource.setMaxIdle(100);
dataSource.setMinIdle(1);
dataSource.setMinEvictableIdleTimeMillis(10 * 1000);
dataSource.setTimeBetweenEvictionRunsMillis(1 * 10);
dataSource.setTestWhileIdle(true);
dataSource.setTestOnBorrow(false);
dataSource.setValidationQuery("SELECT 1");
dataSource.setFilters("stat");
Assert.assertEquals(0, dataSource.getActiveCount());
Assert.assertEquals(0, dataSource.getPoolingCount());
Assert.assertEquals(true, dataSource.isEnable());
}
use of com.alibaba.druid.mock.MockDriver in project druid by alibaba.
the class TestIdle3_Concurrent_MaxActive 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(14);
dataSource.setMaxIdle(14);
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");
}
use of com.alibaba.druid.mock.MockDriver in project druid by alibaba.
the class TestIdle3_Concurrent_Starvation 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(100);
dataSource.setMaxIdle(100);
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");
}
use of com.alibaba.druid.mock.MockDriver in project druid by alibaba.
the class StatFilterExecuteFirstResultSetTest method setUp.
protected void setUp() throws Exception {
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setFilters("stat");
dataSource.setTestOnBorrow(false);
MockDriver driver = new MockDriver() {
public MockPreparedStatement createMockPreparedStatement(MockConnection conn, String sql) {
return new MyMockPreparedStatement(conn, sql);
}
};
dataSource.setDriver(driver);
dataSource.init();
}
use of com.alibaba.druid.mock.MockDriver in project druid by alibaba.
the class DruidDataSourceTest_oracle method setUp.
protected void setUp() throws Exception {
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setTestOnBorrow(false);
dataSource.setFilters("stat");
dataSource.setDbType("oracle");
dataSource.setDriver(new MockDriver() {
@Override
public int getMajorVersion() {
return 11;
}
});
}
Aggregations