This commit is contained in:
温少
2012-03-20 06:23:08 +08:00
parent aaa2e474a5
commit b7be5a659d
4 changed files with 20 additions and 10 deletions
@@ -1,6 +1,7 @@
package com.alibaba.druid.pool;
import java.sql.Connection;
import java.sql.Statement;
import junit.framework.TestCase;
@@ -14,6 +15,8 @@ public class TestMockPerf extends TestCase {
dataSource.setInitialSize(3);
dataSource.setMinIdle(3);
dataSource.setMaxActive(20);
dataSource.setDbType("mysql");
dataSource.setFilters("stat,wall");
dataSource.init();
}
@@ -29,6 +32,9 @@ public class TestMockPerf extends TestCase {
public void perf() throws Exception {
for (int i = 0; i < 1000 * 1000; ++i) {
Connection conn = dataSource.getConnection();
Statement stmt = conn.createStatement();
stmt.execute("SELECT 1");
stmt.close();
conn.close();
}
}