improve testcase

This commit is contained in:
wenshao
2011-11-18 09:30:43 +08:00
parent f2efb27d86
commit c693ec4373
3 changed files with 14 additions and 1 deletions
@@ -6,6 +6,7 @@ import java.sql.PreparedStatement;
import junit.framework.Assert;
import junit.framework.TestCase;
import com.alibaba.druid.filter.stat.StatFilter;
import com.alibaba.druid.mock.MockDriver;
import com.alibaba.druid.mock.MockPreparedStatement;
import com.alibaba.druid.pool.DruidDataSource;
@@ -35,6 +36,7 @@ public class TestPoolPreparedStatement extends TestCase {
dataSource.setValidationQuery("SELECT 1");
dataSource.setFilters("stat");
dataSource.setPoolPreparedStatements(true);
((StatFilter) dataSource.getProxyFilters().get(0)).setMaxSqlStatCount(100);
}
protected void tearDown() throws Exception {
@@ -6,6 +6,7 @@ import java.sql.PreparedStatement;
import junit.framework.Assert;
import junit.framework.TestCase;
import com.alibaba.druid.filter.stat.StatFilter;
import com.alibaba.druid.mock.MockDriver;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.PoolableConnection;
@@ -36,6 +37,8 @@ public class TestPoolPreparedStatement2 extends TestCase {
dataSource.setFilters("stat");
dataSource.setPoolPreparedStatements(false);
dataSource.setMaxPoolPreparedStatementPerConnectionSize(20);
((StatFilter) dataSource.getProxyFilters().get(0)).setMaxSqlStatCount(100);
}
protected void tearDown() throws Exception {
@@ -68,7 +71,7 @@ public class TestPoolPreparedStatement2 extends TestCase {
}
}
for (int i = 0; i < 1000 * 100 * 1; ++i) {
for (int i = 0; i < 1000 * 1; ++i) {
Connection conn = dataSource.getConnection();
PreparedStatement stmt = conn.prepareStatement("SELECT " + i);
stmt.execute();