Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
6e960911
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看板
提交
6e960911
编写于
2月 17, 2014
作者:
J
jbachorik
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8034177: sun/management/jmxremote/startstop/JMXStartStopTest.java should report port in use
Reviewed-by: dfuchs, sjiang
上级
34929b0e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
25 addition
and
24 deletion
+25
-24
test/sun/management/jmxremote/startstop/JMXStartStopTest.java
.../sun/management/jmxremote/startstop/JMXStartStopTest.java
+25
-24
未找到文件。
test/sun/management/jmxremote/startstop/JMXStartStopTest.java
浏览文件 @
6e960911
...
@@ -25,6 +25,7 @@ import java.io.File;
...
@@ -25,6 +25,7 @@ import java.io.File;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
import
java.net.ConnectException
;
import
java.net.ConnectException
;
import
java.net.ServerSocket
;
import
java.rmi.NoSuchObjectException
;
import
java.rmi.NoSuchObjectException
;
import
java.rmi.registry.LocateRegistry
;
import
java.rmi.registry.LocateRegistry
;
import
java.rmi.registry.Registry
;
import
java.rmi.registry.Registry
;
...
@@ -255,26 +256,23 @@ public class JMXStartStopTest {
...
@@ -255,26 +256,23 @@ public class JMXStartStopTest {
private
static
List
<
Failure
>
failures
=
new
ArrayList
<>();
private
static
List
<
Failure
>
failures
=
new
ArrayList
<>();
public
static
void
main
(
String
args
[])
throws
Exception
{
public
static
void
main
(
String
args
[])
throws
Exception
{
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
for
(
Method
m
:
JMXStartStopTest
.
class
.
getDeclaredMethods
())
{
System
.
out
.
println
(
"=== PASS "
+
i
+
" ==="
);
if
(
m
.
getName
().
startsWith
(
"test_"
))
{
for
(
Method
m
:
JMXStartStopTest
.
class
.
getDeclaredMethods
())
{
try
{
if
(
m
.
getName
().
startsWith
(
"test_"
))
{
m
.
invoke
(
null
);
try
{
System
.
out
.
println
(
"=== PASSED\n"
);
m
.
invoke
(
null
);
}
catch
(
Throwable
e
)
{
System
.
out
.
println
(
"=== PASSED\n"
);
failures
.
add
(
new
Failure
(
e
,
m
.
getName
()
+
" failed"
));
}
catch
(
Throwable
e
)
{
failures
.
add
(
new
Failure
(
e
,
m
.
getName
()
+
" failed"
));
}
}
}
}
}
}
if
(!
failures
.
isEmpty
())
{
if
(!
failures
.
isEmpty
())
{
for
(
Failure
f
:
failures
)
{
for
(
Failure
f
:
failures
)
{
System
.
err
.
println
(
f
.
getMsg
());
System
.
err
.
println
(
f
.
getMsg
());
f
.
getCause
().
printStackTrace
(
System
.
err
);
f
.
getCause
().
printStackTrace
(
System
.
err
);
}
throw
new
Error
();
}
}
throw
new
Error
();
}
}
}
}
...
@@ -371,6 +369,7 @@ public class JMXStartStopTest {
...
@@ -371,6 +369,7 @@ public class JMXStartStopTest {
));
));
pbArgs
.
addAll
(
Arrays
.
asList
(
args
));
pbArgs
.
addAll
(
Arrays
.
asList
(
args
));
pbArgs
.
add
(
"JMXStartStopDoSomething"
);
pbArgs
.
add
(
"JMXStartStopDoSomething"
);
ProcessBuilder
pb
=
ProcessTools
.
createJavaProcessBuilder
(
ProcessBuilder
pb
=
ProcessTools
.
createJavaProcessBuilder
(
pbArgs
.
toArray
(
new
String
[
pbArgs
.
size
()])
pbArgs
.
toArray
(
new
String
[
pbArgs
.
size
()])
);
);
...
@@ -596,14 +595,16 @@ public class JMXStartStopTest {
...
@@ -596,14 +595,16 @@ public class JMXStartStopTest {
jcmd
(
CMD_STOP
);
jcmd
(
CMD_STOP
);
jcmd
(
CMD_STOP
);
jcmd
(
CMD_STOP
);
ServerSocket
ss
=
new
ServerSocket
(
0
);
jcmd
(
jcmd
(
line
->
{
line
->
{
if
(
line
.
contains
(
"Port already in use:
22"
))
{
if
(
line
.
contains
(
"Port already in use:
"
+
ss
.
getLocalPort
()
))
{
checks
[
2
]
=
true
;
checks
[
2
]
=
true
;
}
}
},
},
CMD_START
,
CMD_START
,
"jmxremote.port=
22"
,
"jmxremote.port=
"
+
ss
.
getLocalPort
()
,
"jmxremote.rmi.port="
+
port2
,
"jmxremote.rmi.port="
+
port2
,
"jmxremote.authenticate=false"
,
"jmxremote.authenticate=false"
,
"jmxremote.ssl=false"
);
"jmxremote.ssl=false"
);
...
@@ -616,7 +617,7 @@ public class JMXStartStopTest {
...
@@ -616,7 +617,7 @@ public class JMXStartStopTest {
"report an invalid agent state"
);
"report an invalid agent state"
);
}
}
if
(!
checks
[
2
])
{
if
(!
checks
[
2
])
{
throw
new
Exception
(
"Starting agent on port
22
should "
+
throw
new
Exception
(
"Starting agent on port
"
+
ss
.
getLocalPort
()
+
"
should "
+
"report port in use"
);
"report port in use"
);
}
}
}
finally
{
}
finally
{
...
@@ -627,7 +628,7 @@ public class JMXStartStopTest {
...
@@ -627,7 +628,7 @@ public class JMXStartStopTest {
private
static
void
test_07
()
throws
Exception
{
private
static
void
test_07
()
throws
Exception
{
// Run an app without JMX enabled, but with some properties set
// Run an app without JMX enabled, but with some properties set
// in command line.
// in command line.
// make sure these properties overriden corectly
// make sure these properties overrid
d
en corectly
System
.
out
.
println
(
"**** Test seven ****"
);
System
.
out
.
println
(
"**** Test seven ****"
);
...
@@ -654,7 +655,7 @@ public class JMXStartStopTest {
...
@@ -654,7 +655,7 @@ public class JMXStartStopTest {
// Run an app with JMX enabled and with some properties set
// Run an app with JMX enabled and with some properties set
// in command line.
// in command line.
// stop JMX agent and then start it again with different property values
// stop JMX agent and then start it again with different property values
// make sure these properties overriden corectly
// make sure these properties overrid
d
en corectly
System
.
out
.
println
(
"**** Test eight ****"
);
System
.
out
.
println
(
"**** Test eight ****"
);
...
@@ -690,7 +691,7 @@ public class JMXStartStopTest {
...
@@ -690,7 +691,7 @@ public class JMXStartStopTest {
// stop JMX agent and then start it again with different property values
// stop JMX agent and then start it again with different property values
// specifing some property in management config file and some of them
// specifing some property in management config file and some of them
// in command line
// in command line
// make sure these properties overriden corectly
// make sure these properties overrid
d
en corectly
System
.
out
.
println
(
"**** Test nine ****"
);
System
.
out
.
println
(
"**** Test nine ****"
);
...
@@ -725,7 +726,7 @@ public class JMXStartStopTest {
...
@@ -725,7 +726,7 @@ public class JMXStartStopTest {
// in command line.
// in command line.
// stop JMX agent and then start it again with different property values
// stop JMX agent and then start it again with different property values
// stop JMX agent again and then start it without property value
// stop JMX agent again and then start it without property value
// make sure these properties overriden corectly
// make sure these properties overrid
d
en corectly
System
.
out
.
println
(
"**** Test ten ****"
);
System
.
out
.
println
(
"**** Test ten ****"
);
...
@@ -800,7 +801,7 @@ public class JMXStartStopTest {
...
@@ -800,7 +801,7 @@ public class JMXStartStopTest {
// Run an app with -javaagent make sure it works as expected -
// Run an app with -javaagent make sure it works as expected -
// system properties are ignored
// system properties are ignored
System
.
out
.
println
(
"**** Test
fou
rteen ****"
);
System
.
out
.
println
(
"**** Test
thi
rteen ****"
);
String
agent
=
TEST_JDK
+
"/jre/lib/management-agent.jar"
;
String
agent
=
TEST_JDK
+
"/jre/lib/management-agent.jar"
;
if
(!
new
File
(
agent
).
exists
())
{
if
(!
new
File
(
agent
).
exists
())
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录