Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
ffac7c43
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ffac7c43
编写于
7月 24, 2013
作者:
S
sjiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8016221: A unit test should not use a fix port to run a jmx connector
Reviewed-by: jbachorik, dfuchs
上级
2890559e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
88 addition
and
100 deletion
+88
-100
test/com/sun/management/DiagnosticCommandMBean/DcmdMBeanDoubleInvocationTest.java
...DiagnosticCommandMBean/DcmdMBeanDoubleInvocationTest.java
+32
-39
test/com/sun/management/DiagnosticCommandMBean/DcmdMBeanInvocationTest.java
...ement/DiagnosticCommandMBean/DcmdMBeanInvocationTest.java
+28
-33
test/com/sun/management/DiagnosticCommandMBean/DcmdMBeanTest.java
.../sun/management/DiagnosticCommandMBean/DcmdMBeanTest.java
+28
-28
未找到文件。
test/com/sun/management/DiagnosticCommandMBean/DcmdMBeanDoubleInvocationTest.java
浏览文件 @
ffac7c43
...
...
@@ -25,25 +25,15 @@
* @test
* @bug 7150256
* @summary Basic Test for the DiagnosticCommandMBean
* @author Frederic Parain
* @author Frederic Parain
, Shanliang JIANG
*
* @run main/othervm
-Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=8125
DcmdMBeanDoubleInvocationTest
* @run main/othervm DcmdMBeanDoubleInvocationTest
*/
import
java.io.IOException
;
import
java.lang.management.ManagementFactory
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.management.Descriptor
;
import
javax.management.InstanceNotFoundException
;
import
javax.management.IntrospectionException
;
import
javax.management.MBeanInfo
;
import
javax.management.MBeanOperationInfo
;
import
javax.management.MBeanServer
;
import
javax.management.MalformedObjectNameException
;
import
javax.management.ObjectName
;
import
javax.management.ReflectionException
;
import
javax.management.*
;
import
javax.management.remote.*
;
...
...
@@ -52,39 +42,42 @@ public class DcmdMBeanDoubleInvocationTest {
private
static
String
HOTSPOT_DIAGNOSTIC_MXBEAN_NAME
=
"com.sun.management:type=DiagnosticCommand"
;
public
static
void
main
(
String
[]
args
)
{
MBeanServerConnection
mbs
=
null
;
try
{
JMXServiceURL
url
=
new
JMXServiceURL
(
"service:jmx:rmi:///jndi/rmi://localhost:8125/jmxrmi"
);
JMXConnector
connector
=
JMXConnectorFactory
.
connect
(
url
);
mbs
=
connector
.
getMBeanServerConnection
();
}
catch
(
Throwable
t
)
{
t
.
printStackTrace
();
}
ObjectName
name
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
System
.
out
.
println
(
"--->JRCMD MBean Test: invocation on \"help VM.version\" ..."
);
ObjectName
name
=
new
ObjectName
(
HOTSPOT_DIAGNOSTIC_MXBEAN_NAME
);
String
[]
helpArgs
=
{
"-all"
,
"\n"
,
"VM.version"
};
Object
[]
dcmdArgs
=
{
helpArgs
};
String
[]
signature
=
{
String
[].
class
.
getName
()};
MBeanServer
mbs
=
ManagementFactory
.
getPlatformMBeanServer
();
JMXServiceURL
url
=
new
JMXServiceURL
(
"rmi"
,
null
,
0
);
JMXConnectorServer
cs
=
null
;
JMXConnector
cc
=
null
;
try
{
name
=
new
ObjectName
(
HOTSPOT_DIAGNOSTIC_MXBEAN_NAME
);
MBeanInfo
info
=
mbs
.
getMBeanInfo
(
name
);
String
[]
helpArgs
=
{
"-all"
,
"\n"
,
"VM.version"
};
Object
[]
dcmdArgs
=
{
helpArgs
};
String
[]
signature
=
{
String
[].
class
.
getName
()};
String
result
=
(
String
)
mbs
.
invoke
(
name
,
"help"
,
dcmdArgs
,
signature
);
cs
=
JMXConnectorServerFactory
.
newJMXConnectorServer
(
url
,
null
,
mbs
);
cs
.
start
();
JMXServiceURL
addr
=
cs
.
getAddress
();
cc
=
JMXConnectorFactory
.
connect
(
addr
);
MBeanServerConnection
mbsc
=
cc
.
getMBeanServerConnection
();
String
result
=
(
String
)
mbsc
.
invoke
(
name
,
"help"
,
dcmdArgs
,
signature
);
System
.
out
.
println
(
result
);
}
catch
(
RuntimeMBeanException
ex
)
{
throw
new
Error
(
"Test failed: Double commands have not been detected"
);
}
catch
(
RuntimeMBeanException
ex
)
{
if
(
ex
.
getCause
()
instanceof
IllegalArgumentException
)
{
System
.
out
.
println
(
"Test passed"
);
return
;
System
.
out
.
println
(
"JTest passed: Double commands have been detected"
);
}
else
{
ex
.
printStackTrace
();
throw
new
RuntimeException
(
"TEST FAILED"
);
throw
new
Error
(
"TEST FAILED: got unknown exception "
+
ex
);
}
}
finally
{
try
{
cc
.
close
();
cs
.
stop
();
}
catch
(
Exception
e
)
{
}
}
catch
(
InstanceNotFoundException
|
IntrospectionException
|
ReflectionException
|
MalformedObjectNameException
|
MBeanException
|
IOException
ex
)
{
ex
.
printStackTrace
();
throw
new
RuntimeException
(
"TEST FAILED"
);
}
System
.
out
.
println
(
"Double commands have not been detected"
);
throw
new
RuntimeException
(
"TEST FAILED"
);
}
}
test/com/sun/management/DiagnosticCommandMBean/DcmdMBeanInvocationTest.java
浏览文件 @
ffac7c43
...
...
@@ -25,25 +25,15 @@
* @test
* @bug 7150256
* @summary Basic Test for the DiagnosticCommandMBean
* @author Frederic Parain
* @author Frederic Parain
, Shanliang JIANG
*
* @run main/othervm
-Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=8129
DcmdMBeanInvocationTest
* @run main/othervm DcmdMBeanInvocationTest
*/
import
java.io.IOException
;
import
java.lang.management.ManagementFactory
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.management.Descriptor
;
import
javax.management.InstanceNotFoundException
;
import
javax.management.IntrospectionException
;
import
javax.management.MBeanInfo
;
import
javax.management.MBeanOperationInfo
;
import
javax.management.MBeanServer
;
import
javax.management.MalformedObjectNameException
;
import
javax.management.ObjectName
;
import
javax.management.ReflectionException
;
import
javax.management.*
;
import
javax.management.remote.*
;
...
...
@@ -52,30 +42,35 @@ public class DcmdMBeanInvocationTest {
private
static
String
HOTSPOT_DIAGNOSTIC_MXBEAN_NAME
=
"com.sun.management:type=DiagnosticCommand"
;
public
static
void
main
(
String
[]
args
)
{
MBeanServerConnection
mbs
=
null
;
try
{
JMXServiceURL
url
=
new
JMXServiceURL
(
"service:jmx:rmi:///jndi/rmi://localhost:8129/jmxrmi"
);
JMXConnector
connector
=
JMXConnectorFactory
.
connect
(
url
);
mbs
=
connector
.
getMBeanServerConnection
();
}
catch
(
Throwable
t
)
{
t
.
printStackTrace
();
}
ObjectName
name
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
System
.
out
.
println
(
"--->JRCMD MBean Test: invocation on \"help -all\" ..."
);
ObjectName
name
=
new
ObjectName
(
HOTSPOT_DIAGNOSTIC_MXBEAN_NAME
);
String
[]
helpArgs
=
{
"-all"
};
Object
[]
dcmdArgs
=
{
helpArgs
};
String
[]
signature
=
{
String
[].
class
.
getName
()};
MBeanServer
mbs
=
ManagementFactory
.
getPlatformMBeanServer
();
JMXServiceURL
url
=
new
JMXServiceURL
(
"rmi"
,
null
,
0
);
JMXConnectorServer
cs
=
null
;
JMXConnector
cc
=
null
;
try
{
name
=
new
ObjectName
(
HOTSPOT_DIAGNOSTIC_MXBEAN_NAME
);
MBeanInfo
info
=
mbs
.
getMBeanInfo
(
name
);
String
[]
helpArgs
=
{
"-all"
};
Object
[]
dcmdArgs
=
{
helpArgs
};
String
[]
signature
=
{
String
[].
class
.
getName
()};
String
result
=
(
String
)
mbs
.
invoke
(
name
,
"help"
,
dcmdArgs
,
signature
);
cs
=
JMXConnectorServerFactory
.
newJMXConnectorServer
(
url
,
null
,
mbs
);
cs
.
start
();
JMXServiceURL
addr
=
cs
.
getAddress
();
cc
=
JMXConnectorFactory
.
connect
(
addr
);
MBeanServerConnection
mbsc
=
cc
.
getMBeanServerConnection
();
String
result
=
(
String
)
mbsc
.
invoke
(
name
,
"help"
,
dcmdArgs
,
signature
);
System
.
out
.
println
(
result
);
}
catch
(
InstanceNotFoundException
|
IntrospectionException
|
ReflectionException
|
MalformedObjectNameException
|
MBeanException
|
IOException
ex
)
{
ex
.
printStackTrace
();
throw
new
RuntimeException
(
"TEST FAILED"
);
}
finally
{
try
{
cc
.
close
();
cs
.
stop
();
}
catch
(
Exception
e
)
{
}
}
System
.
out
.
println
(
"Test passed"
);
}
}
test/com/sun/management/DiagnosticCommandMBean/DcmdMBeanTest.java
浏览文件 @
ffac7c43
...
...
@@ -25,25 +25,18 @@
* @test
* @bug 7150256
* @summary Basic Test for the DiagnosticCommandMBean
* @author Frederic Parain
* @author Frederic Parain
, Shanliang JIANG
*
* @run main/othervm
-Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=8127
DcmdMBeanTest
* @run main/othervm DcmdMBeanTest
*/
import
java.io.IOException
;
import
java.lang.management.ManagementFactory
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.management.Descriptor
;
import
javax.management.InstanceNotFoundException
;
import
javax.management.IntrospectionException
;
import
javax.management.MBeanInfo
;
import
javax.management.MBeanOperationInfo
;
import
javax.management.MBeanServer
;
import
javax.management.MalformedObjectNameException
;
import
javax.management.ObjectName
;
import
javax.management.ReflectionException
;
import
javax.management.*
;
import
javax.management.remote.*
;
...
...
@@ -52,34 +45,42 @@ public class DcmdMBeanTest {
private
static
String
HOTSPOT_DIAGNOSTIC_MXBEAN_NAME
=
"com.sun.management:type=DiagnosticCommand"
;
public
static
void
main
(
String
[]
args
)
{
MBeanServerConnection
mbs
=
null
;
try
{
JMXServiceURL
url
=
new
JMXServiceURL
(
"service:jmx:rmi:///jndi/rmi://localhost:8127/jmxrmi"
);
JMXConnector
connector
=
JMXConnectorFactory
.
connect
(
url
);
mbs
=
connector
.
getMBeanServerConnection
();
}
catch
(
Throwable
t
)
{
t
.
printStackTrace
();
}
ObjectName
name
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
System
.
out
.
println
(
"--->JRCMD MBean Test: invocation on \"operation info\"..."
);
MBeanServer
mbs
=
ManagementFactory
.
getPlatformMBeanServer
();
JMXServiceURL
url
=
new
JMXServiceURL
(
"rmi"
,
null
,
0
);
JMXConnectorServer
cs
=
null
;
JMXConnector
cc
=
null
;
try
{
name
=
new
ObjectName
(
HOTSPOT_DIAGNOSTIC_MXBEAN_NAME
);
MBeanInfo
info
=
mbs
.
getMBeanInfo
(
name
);
cs
=
JMXConnectorServerFactory
.
newJMXConnectorServer
(
url
,
null
,
mbs
);
cs
.
start
();
JMXServiceURL
addr
=
cs
.
getAddress
();
cc
=
JMXConnectorFactory
.
connect
(
addr
);
MBeanServerConnection
mbsc
=
cc
.
getMBeanServerConnection
();
ObjectName
name
=
new
ObjectName
(
HOTSPOT_DIAGNOSTIC_MXBEAN_NAME
);
MBeanInfo
info
=
mbsc
.
getMBeanInfo
(
name
);
// the test should check that the MBean doesn't have any
// Attribute, notification or constructor. Current version only
// check operations
System
.
out
.
println
(
"Class Name:"
+
info
.
getClassName
());
System
.
out
.
println
(
"Description:"
+
info
.
getDescription
());
System
.
out
.
println
(
"Class Name:"
+
info
.
getClassName
());
System
.
out
.
println
(
"Description:"
+
info
.
getDescription
());
MBeanOperationInfo
[]
opInfo
=
info
.
getOperations
();
System
.
out
.
println
(
"Operations:"
);
for
(
int
i
=
0
;
i
<
opInfo
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
opInfo
.
length
;
i
++)
{
printOperation
(
opInfo
[
i
]);
System
.
out
.
println
(
"\n@@@@@@\n"
);
}
}
catch
(
InstanceNotFoundException
|
IntrospectionException
|
ReflectionException
|
MalformedObjectNameException
|
IOException
ex
)
{
Logger
.
getLogger
(
DcmdMBeanTest
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
}
finally
{
try
{
cc
.
close
();
cs
.
stop
();
}
catch
(
Exception
e
)
{
}
}
System
.
out
.
println
(
"Test passed"
);
}
static
void
printOperation
(
MBeanOperationInfo
info
)
{
...
...
@@ -110,4 +111,3 @@ public class DcmdMBeanTest {
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录