Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
c0b81ca8
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看板
提交
c0b81ca8
编写于
5月 30, 2014
作者:
A
amurillo
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
9de8a648
577875db
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
11 addition
and
2 deletion
+11
-2
test/sun/tools/jstatd/JstatdTest.java
test/sun/tools/jstatd/JstatdTest.java
+11
-2
未找到文件。
test/sun/tools/jstatd/JstatdTest.java
浏览文件 @
c0b81ca8
...
@@ -27,6 +27,7 @@ import java.rmi.RemoteException;
...
@@ -27,6 +27,7 @@ import java.rmi.RemoteException;
import
java.rmi.registry.LocateRegistry
;
import
java.rmi.registry.LocateRegistry
;
import
java.rmi.registry.Registry
;
import
java.rmi.registry.Registry
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.regex.Pattern
;
import
static
jdk
.
testlibrary
.
Asserts
.*;
import
static
jdk
.
testlibrary
.
Asserts
.*;
import
jdk.testlibrary.JDKToolLauncher
;
import
jdk.testlibrary.JDKToolLauncher
;
...
@@ -34,6 +35,7 @@ import jdk.testlibrary.OutputAnalyzer;
...
@@ -34,6 +35,7 @@ import jdk.testlibrary.OutputAnalyzer;
import
jdk.testlibrary.ProcessThread
;
import
jdk.testlibrary.ProcessThread
;
import
jdk.testlibrary.TestThread
;
import
jdk.testlibrary.TestThread
;
import
jdk.testlibrary.Utils
;
import
jdk.testlibrary.Utils
;
import
jdk.testlibrary.ProcessTools
;
/**
/**
* The base class for tests of jstatd.
* The base class for tests of jstatd.
...
@@ -93,8 +95,11 @@ public final class JstatdTest {
...
@@ -93,8 +95,11 @@ public final class JstatdTest {
if
(
tool
==
"rmiregistry"
)
{
if
(
tool
==
"rmiregistry"
)
{
processName
=
"registryimpl"
;
processName
=
"registryimpl"
;
}
}
Pattern
toolInJpsPattern
=
Pattern
.
compile
(
"^\\d+\\s{1}"
+
processName
+
"\\s{1}.*-dparent\\.pid\\."
+
ProcessTools
.
getProcessId
()
+
".*"
);
for
(
String
line
:
lines
)
{
for
(
String
line
:
lines
)
{
if
(
line
.
toLowerCase
().
matches
(
"^\\d+\\s{1}"
+
processName
+
"$"
))
{
if
(
toolInJpsPattern
.
matcher
(
line
.
toLowerCase
()).
matches
(
))
{
pid
=
line
.
split
(
" "
)[
0
];
pid
=
line
.
split
(
" "
)[
0
];
count
++;
count
++;
}
}
...
@@ -167,6 +172,8 @@ public final class JstatdTest {
...
@@ -167,6 +172,8 @@ public final class JstatdTest {
private
OutputAnalyzer
runJps
()
throws
Exception
{
private
OutputAnalyzer
runJps
()
throws
Exception
{
JDKToolLauncher
launcher
=
JDKToolLauncher
.
createUsingTestJDK
(
"jps"
);
JDKToolLauncher
launcher
=
JDKToolLauncher
.
createUsingTestJDK
(
"jps"
);
launcher
.
addVMArg
(
"-XX:+UsePerfData"
);
launcher
.
addVMArg
(
"-XX:+UsePerfData"
);
// Run jps with -v flag to obtain -Dparent.pid.<pid>
launcher
.
addToolArg
(
"-v"
);
launcher
.
addToolArg
(
getDestination
());
launcher
.
addToolArg
(
getDestination
());
String
[]
cmd
=
launcher
.
getCommand
();
String
[]
cmd
=
launcher
.
getCommand
();
...
@@ -286,7 +293,7 @@ public final class JstatdTest {
...
@@ -286,7 +293,7 @@ public final class JstatdTest {
* jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy -n serverName
* jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy -n serverName
* jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy -p port -n serverName
* jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy -p port -n serverName
*/
*/
private
String
[]
getJstatdCmd
()
throws
UnknownHost
Exception
{
private
String
[]
getJstatdCmd
()
throws
Exception
{
JDKToolLauncher
launcher
=
JDKToolLauncher
.
createUsingTestJDK
(
"jstatd"
);
JDKToolLauncher
launcher
=
JDKToolLauncher
.
createUsingTestJDK
(
"jstatd"
);
launcher
.
addVMArg
(
"-XX:+UsePerfData"
);
launcher
.
addVMArg
(
"-XX:+UsePerfData"
);
String
testSrc
=
System
.
getProperty
(
"test.src"
);
String
testSrc
=
System
.
getProperty
(
"test.src"
);
...
@@ -294,6 +301,8 @@ public final class JstatdTest {
...
@@ -294,6 +301,8 @@ public final class JstatdTest {
assertTrue
(
policy
.
exists
()
&&
policy
.
isFile
(),
assertTrue
(
policy
.
exists
()
&&
policy
.
isFile
(),
"Security policy "
+
policy
.
getAbsolutePath
()
+
" does not exist or not a file"
);
"Security policy "
+
policy
.
getAbsolutePath
()
+
" does not exist or not a file"
);
launcher
.
addVMArg
(
"-Djava.security.policy="
+
policy
.
getAbsolutePath
());
launcher
.
addVMArg
(
"-Djava.security.policy="
+
policy
.
getAbsolutePath
());
// -Dparent.pid.<pid> will help to identify jstad process started by this test
launcher
.
addVMArg
(
"-Dparent.pid."
+
ProcessTools
.
getProcessId
());
if
(
port
!=
null
)
{
if
(
port
!=
null
)
{
launcher
.
addToolArg
(
"-p"
);
launcher
.
addToolArg
(
"-p"
);
launcher
.
addToolArg
(
port
);
launcher
.
addToolArg
(
port
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录