protected void setUp() throws Exception { originalDataSourceCount = DruidDataSourceStatManager.getInstance().getDataSourceList().size(); driver = new MockDriver(); dataSource = new DruidDataSource(); dataSource.setDriver(driver); dataSource.setUrl("jdbc:mock:xxx"); dataSource.setFilters("stat,trace,log4j,encoding"); dataSource.setDefaultAutoCommit(false); }
protected void setUp() throws Exception { DruidDataSourceStatManager.cear(); dataSource = new DruidDataSource(); dataSource.setRemoveAbandoned(true); dataSource.setRemoveAbandonedTimeoutMillis(100); dataSource.setLogAbandoned(true); dataSource.setTimeBetweenEvictionRunsMillis(10); dataSource.setMinEvictableIdleTimeMillis(300 * 1000); dataSource.setUrl("jdbc:mock:xxx"); }
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); dataSource.setMinEvictableIdleTimeMillis(300 * 1000); // 300 / 10 dataSource.setTimeBetweenEvictionRunsMillis(10); // 180 / 10 dataSource.setTestWhileIdle(true); dataSource.setTestOnBorrow(false); dataSource.setValidationQuery("SELECT 1"); dataSource.setFilters("stat"); dataSource.setPoolPreparedStatements(false); dataSource.setMaxPoolPreparedStatementPerConnectionSize(20); // ((StatFilter) dataSource.getProxyFilters().get(0)).setMaxSqlStatCount(100); }
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); dataSource.setMinEvictableIdleTimeMillis(300 * 1000); // 300 / 10 dataSource.setTimeBetweenEvictionRunsMillis(180 * 1000); // 180 / 10 dataSource.setTestWhileIdle(true); dataSource.setTestOnBorrow(false); dataSource.setValidationQuery("SELECT 1"); dataSource.setFilters("stat,trace"); JdbcStatContext context = new JdbcStatContext(); context.setTraceEnable(true); JdbcStatManager.getInstance().setStatContext(context); }
protected void tearDown() throws Exception { dataSource.close(); Assert.assertEquals(0, DruidDataSourceStatManager.getInstance().getDataSourceList().size()); }
protected void setUp() throws Exception { DruidDataSourceStatManager.clear(); }