bug fixed sql runningCount & add statLog support

This commit is contained in:
wenshao
2013-05-18 22:01:29 +08:00
parent c9b2753985
commit 5f8b154bb2
12 changed files with 620 additions and 15 deletions
@@ -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());
}
}