mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
fixed testcase
This commit is contained in:
@@ -21,9 +21,6 @@ import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.MysqlTest;
|
||||
import com.alibaba.druid.sql.ast.SQLStatement;
|
||||
import com.alibaba.druid.sql.ast.statement.SQLSelect;
|
||||
import com.alibaba.druid.sql.ast.statement.SQLSelectStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSelectQueryBlock;
|
||||
import com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser;
|
||||
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlSchemaStatVisitor;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ package com.alibaba.druid.bvt.sql.mysql;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.MysqlTest;
|
||||
import com.alibaba.druid.sql.ast.SQLStatement;
|
||||
|
||||
@@ -17,14 +17,13 @@ package com.alibaba.druid.bvt.sql.mysql;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.MysqlTest;
|
||||
import com.alibaba.druid.sql.ast.SQLStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser;
|
||||
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlSchemaStatVisitor;
|
||||
import com.alibaba.druid.stat.TableStat;
|
||||
import com.alibaba.druid.stat.TableStat.Column;
|
||||
|
||||
public class MySqlUpdateTest_1 extends MysqlTest {
|
||||
|
||||
|
||||
@@ -17,9 +17,10 @@ package com.alibaba.druid.bvt.sql.mysql;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.ast.SQLStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser;
|
||||
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlOutputVisitor;
|
||||
|
||||
@@ -13,7 +13,7 @@ public class JdbcSqlStatTest extends TestCase {
|
||||
gc();
|
||||
long memoryStart = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed();
|
||||
|
||||
final int COUNT = 1024 * 1024;
|
||||
final int COUNT = 1000 * 5;
|
||||
JdbcSqlStat[] items = new JdbcSqlStat[COUNT];
|
||||
for (int i = 0; i < COUNT; ++i) {
|
||||
items[i] = new JdbcSqlStat("");
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.alibaba.druid.stat;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.text.NumberFormat;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class JdbcSqlStatTest1 extends TestCase {
|
||||
|
||||
private JdbcDataSourceStat dataSourceStat = new JdbcDataSourceStat("", "");
|
||||
|
||||
public void test_0() throws Exception {
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
gc();
|
||||
long memoryStart = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed();
|
||||
|
||||
final int COUNT = 1024 * 1024;
|
||||
for (int j = 0; j < COUNT; ++j) {
|
||||
dataSourceStat.createSqlStat(Integer.toString(j));
|
||||
// items[i] = Histogram.makeHistogram(20);
|
||||
}
|
||||
gc();
|
||||
|
||||
long memoryEnd = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed();
|
||||
|
||||
System.out.println("memory used : " + NumberFormat.getInstance().format(memoryStart));
|
||||
System.out.println("memory used : " + NumberFormat.getInstance().format(memoryEnd));
|
||||
System.out.println("memory used : " + NumberFormat.getInstance().format(memoryEnd - memoryStart));
|
||||
}
|
||||
}
|
||||
|
||||
private void gc() {
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
System.gc();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user