mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
修正测试
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@419 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -128,7 +128,7 @@ public class Case1 extends TestCase {
|
||||
private void p0(final DataSource dataSource, String name, int threadCount) throws Exception {
|
||||
|
||||
final CountDownLatch startLatch = new CountDownLatch(1);
|
||||
final CountDownLatch endLatch = new CountDownLatch(1);
|
||||
final CountDownLatch endLatch = new CountDownLatch(threadCount);
|
||||
for (int i = 0; i < threadCount; ++i) {
|
||||
Thread thread = new Thread() {
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ public class Case2 extends TestCase {
|
||||
private void p0(final DataSource dataSource, String name, int threadCount) throws Exception {
|
||||
|
||||
final CountDownLatch startLatch = new CountDownLatch(1);
|
||||
final CountDownLatch endLatch = new CountDownLatch(1);
|
||||
final CountDownLatch endLatch = new CountDownLatch(threadCount);
|
||||
for (int i = 0; i < threadCount; ++i) {
|
||||
Thread thread = new Thread() {
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.commons.dbcp.BasicDataSource;
|
||||
@@ -40,15 +41,16 @@ public class Case3 extends TestCase {
|
||||
private long minEvictableIdleTimeMillis = 60000;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
// jdbcUrl = "jdbc:fake:dragoon_v25masterdb";
|
||||
// user = "dragoon25";
|
||||
// password = "dragoon25";
|
||||
// driverClass = "com.alibaba.druid.mock.MockDriver";
|
||||
// connectionProperties = "connectSleep=3;executeSleep=0";
|
||||
// jdbcUrl = "jdbc:fake:dragoon_v25masterdb";
|
||||
// user = "dragoon25";
|
||||
// password = "dragoon25";
|
||||
// driverClass = "com.alibaba.druid.mock.MockDriver";
|
||||
// connectionProperties = "connectSleep=3;executeSleep=0";
|
||||
|
||||
jdbcUrl = "jdbc:mysql://10.20.153.104:3306/druid2";
|
||||
user = "root";
|
||||
password = "root";
|
||||
driverClass = "com.mysql.jdbc.Driver";
|
||||
}
|
||||
|
||||
public void test_perf() throws Exception {
|
||||
@@ -145,7 +147,7 @@ public class Case3 extends TestCase {
|
||||
final AtomicInteger errorCount = new AtomicInteger();
|
||||
|
||||
final CountDownLatch startLatch = new CountDownLatch(1);
|
||||
final CountDownLatch endLatch = new CountDownLatch(1);
|
||||
final CountDownLatch endLatch = new CountDownLatch(threadCount);
|
||||
for (int i = 0; i < threadCount; ++i) {
|
||||
Thread thread = new Thread() {
|
||||
|
||||
@@ -188,8 +190,9 @@ public class Case3 extends TestCase {
|
||||
long ygc = TestUtil.getYoungGC() - startYGC;
|
||||
long fullGC = TestUtil.getFullGC() - startFullGC;
|
||||
|
||||
Assert.assertEquals(LOOP_COUNT * threadCount, count.get());
|
||||
Thread.sleep(1);
|
||||
|
||||
System.out.println("thread " + threadCount + " " + name + " millis : " + NumberFormat.getInstance().format(millis) + ", YGC " + ygc + " FGC " + fullGC + ", TX " + count.get() + ", error " + errorCount.get());
|
||||
System.out.println("thread " + threadCount + " " + name + " millis : " + NumberFormat.getInstance().format(millis) + ", YGC " + ygc + " FGC " + fullGC);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ public class CaseKylin extends TestCase {
|
||||
private void p0(final DataSource dataSource, String name, int threadCount) throws Exception {
|
||||
|
||||
final CountDownLatch startLatch = new CountDownLatch(1);
|
||||
final CountDownLatch endLatch = new CountDownLatch(1);
|
||||
final CountDownLatch endLatch = new CountDownLatch(threadCount);
|
||||
for (int i = 0; i < threadCount; ++i) {
|
||||
Thread thread = new Thread() {
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ public class Oracle_Case3 extends TestCase {
|
||||
private void p0(final DataSource dataSource, String name, int threadCount) throws Exception {
|
||||
|
||||
final CountDownLatch startLatch = new CountDownLatch(1);
|
||||
final CountDownLatch endLatch = new CountDownLatch(1);
|
||||
final CountDownLatch endLatch = new CountDownLatch(threadCount);
|
||||
for (int i = 0; i < threadCount; ++i) {
|
||||
Thread thread = new Thread() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user