mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed sql runningCount & add statLog support
This commit is contained in:
@@ -5,9 +5,10 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.alibaba.druid.stat.DruidDataSourceStatManager;
|
||||
import com.alibaba.druid.stat.JdbcSqlStat;
|
||||
@@ -24,6 +25,7 @@ public class TestOnBorrowFileAndNameTest extends TestCase {
|
||||
dataSource.setName("com.alibaba.dragoon.monitor");
|
||||
dataSource.setMinIdle(0);
|
||||
dataSource.setPoolPreparedStatements(false);
|
||||
dataSource.setTestOnBorrow(true);
|
||||
dataSource.setValidationQuery("SELECT 1");
|
||||
dataSource.setFilters("stat");
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.alibaba.druid.bvt.pool;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.alibaba.druid.util.JdbcUtils;
|
||||
|
||||
public class TimeBetweenLogStatsMillisTest extends TestCase {
|
||||
|
||||
private DruidDataSource dataSource;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
dataSource = new DruidDataSource();
|
||||
|
||||
dataSource.setUrl("jdbc:mock:xxx");
|
||||
dataSource.setTimeBetweenLogStatsMillis(1000);
|
||||
// dataSource.setFilters("log4j");
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
JdbcUtils.close(dataSource);
|
||||
}
|
||||
|
||||
public void test_0() throws Exception {
|
||||
dataSource.init();
|
||||
Assert.assertEquals(1000, dataSource.getTimeBetweenLogStatsMillis());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user