mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improve testcase
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user