mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
添加jconsole plugin
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@222 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -14,6 +14,8 @@ import javax.management.MBeanInfo;
|
||||
import javax.management.MBeanServerConnection;
|
||||
import javax.management.ObjectInstance;
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.openmbean.CompositeData;
|
||||
import javax.management.openmbean.TabularData;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
@@ -61,7 +63,7 @@ public class DruidPanel extends JPanel {
|
||||
|
||||
this.setBackground(Color.BLUE);
|
||||
|
||||
init();
|
||||
// init();
|
||||
}
|
||||
|
||||
public void init() {
|
||||
@@ -112,9 +114,33 @@ public class DruidPanel extends JPanel {
|
||||
|
||||
}
|
||||
|
||||
for (ObjectInstance statInstance : stats) {
|
||||
TabularData tabularValue = (TabularData) conn.getAttribute(statInstance.getObjectName(), "DataSourceList");
|
||||
for (Object item : tabularValue.values()) {
|
||||
CompositeData rowData = (CompositeData) item;
|
||||
|
||||
String name = (String) rowData.get("Name");
|
||||
|
||||
DefaultMutableTreeNode dataSourceNode = new DefaultMutableTreeNode(name, true);
|
||||
|
||||
DefaultMutableTreeNode connections = new DefaultMutableTreeNode("Connections", true);
|
||||
{
|
||||
}
|
||||
dataSourceNode.add(connections);
|
||||
|
||||
DefaultMutableTreeNode sqlListNode = new DefaultMutableTreeNode("SQL", true);
|
||||
{
|
||||
|
||||
}
|
||||
dataSourceNode.add(sqlListNode);
|
||||
|
||||
dataSourcesNode.add(dataSourceNode);
|
||||
}
|
||||
}
|
||||
|
||||
for (ObjectInstance dataSourceInstance : dataSourceInstances) {
|
||||
String name = (String) conn.getAttribute(dataSourceInstance.getObjectName(), "Name");
|
||||
|
||||
|
||||
DefaultMutableTreeNode dataSource = new DefaultMutableTreeNode(name, true);
|
||||
|
||||
DefaultMutableTreeNode connections = new DefaultMutableTreeNode("Connections", true);
|
||||
|
||||
-2
@@ -4,13 +4,11 @@ import com.alibaba.druid.sql.ast.SQLExpr;
|
||||
import com.alibaba.druid.sql.ast.expr.SQLBinaryOpExpr;
|
||||
import com.alibaba.druid.sql.ast.expr.SQLBinaryOperator;
|
||||
import com.alibaba.druid.sql.ast.expr.SQLCharExpr;
|
||||
import com.alibaba.druid.sql.ast.expr.SQLIdentifierExpr;
|
||||
import com.alibaba.druid.sql.ast.expr.SQLInListExpr;
|
||||
import com.alibaba.druid.sql.ast.expr.SQLIntegerExpr;
|
||||
import com.alibaba.druid.sql.ast.expr.SQLLiteralExpr;
|
||||
import com.alibaba.druid.sql.ast.expr.SQLNCharExpr;
|
||||
import com.alibaba.druid.sql.ast.expr.SQLNumberExpr;
|
||||
import com.alibaba.druid.sql.ast.expr.SQLPropertyExpr;
|
||||
import com.alibaba.druid.sql.ast.expr.SQLVariantRefExpr;
|
||||
|
||||
public class OracleParameterizedOutputVisitor extends OracleOutputVisitor {
|
||||
|
||||
@@ -27,7 +27,7 @@ public class MySqlParserResourceTest extends TestCase {
|
||||
exec_test("bvt/parser/mysql-7.txt");
|
||||
exec_test("bvt/parser/mysql-8.txt");
|
||||
exec_test("bvt/parser/mysql-9.txt");
|
||||
// exec_test("bvt/parser/mysql-10.txt");
|
||||
exec_test("bvt/parser/mysql-10.txt");
|
||||
}
|
||||
|
||||
public void exec_test(String resource) throws Exception {
|
||||
@@ -72,7 +72,7 @@ public class MySqlParserResourceTest extends TestCase {
|
||||
StringBuilder out = new StringBuilder();
|
||||
MySqlParameterizedOutputVisitor visitor = new MySqlParameterizedOutputVisitor(out);
|
||||
statemen.accept(visitor);
|
||||
|
||||
|
||||
System.out.println(out.toString());
|
||||
|
||||
Assert.assertEquals(expect, out.toString());
|
||||
|
||||
Reference in New Issue
Block a user