mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
test
This commit is contained in:
@@ -18,8 +18,6 @@ package com.alibaba.druid.benckmark.proxy;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import com.alibaba.druid.benckmark.proxy.sqlcase.SelectNow;
|
||||
import com.alibaba.druid.benckmark.sqlcase.*;
|
||||
import com.alibaba.druid.benckmark.sqlcase.dragoon.*;
|
||||
|
||||
public class DruidBenchmarkTest extends TestCase {
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.alibaba.druid.pool;
|
||||
|
||||
import java.sql.Connection;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class TestMockPerf extends TestCase {
|
||||
|
||||
private DruidDataSource dataSource;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
dataSource = new DruidDataSource();
|
||||
dataSource.setUrl("jdbc:mock:xx");
|
||||
dataSource.setInitialSize(3);
|
||||
dataSource.setMinIdle(3);
|
||||
dataSource.setMaxActive(20);
|
||||
dataSource.init();
|
||||
}
|
||||
|
||||
public void test_perf() throws Exception {
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
long startMillis = System.currentTimeMillis();
|
||||
perf();
|
||||
long millis = System.currentTimeMillis() - startMillis;
|
||||
System.out.println("millis : " + millis);
|
||||
}
|
||||
}
|
||||
|
||||
public void perf() throws Exception {
|
||||
for (int i = 0; i < 1000 * 1000; ++i) {
|
||||
Connection conn = dataSource.getConnection();
|
||||
conn.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user