Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
e4499e4f
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看板
提交
e4499e4f
编写于
8月 13, 2013
作者:
D
dfuchs
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8019948: java/util/logging/bundlesearch/ResourceBundleSearchTest.java is failing intermittently
Reviewed-by: mchung, dholmes
上级
959d7d57
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
38 addition
and
7 deletion
+38
-7
test/java/util/logging/bundlesearch/ResourceBundleSearchTest.java
...a/util/logging/bundlesearch/ResourceBundleSearchTest.java
+38
-7
未找到文件。
test/java/util/logging/bundlesearch/ResourceBundleSearchTest.java
浏览文件 @
e4499e4f
...
...
@@ -57,9 +57,32 @@ public class ResourceBundleSearchTest {
private
static
int
numFail
=
0
;
private
static
List
<
String
>
msgs
=
new
ArrayList
<>();
// This test has been falling in timeout - so we're adding some
// time stamp here and there to help diagnose whether it's a
// simple system slowness or whether there's a deeper issue,
// like a deadlock. The timeout issue should be fixed now,
// but we leave the time stamps in case it reappears.
//
static
final
long
stamp
=
System
.
currentTimeMillis
();
private
static
String
getTimeStamp
()
{
long
time
=
System
.
currentTimeMillis
();
long
delta
=
time
-
stamp
;
long
min
=
delta
/
60000
;
long
sec
=
(
delta
-
min
*
60000
)
/
10000
;
long
msec
=
delta
-
min
*
60000
-
sec
*
1000
;
return
(
min
==
0
?
""
:
(
min
+
" min. "
))
+
(
sec
==
0
?
""
:
(
sec
+
" sec. "
))
+
(
msec
==
0
?
""
:
(
msec
+
"ms."
));
}
public
static
void
main
(
String
[]
args
)
throws
Throwable
{
System
.
out
.
println
(
"ResourceBundleSearchTest starting: "
+
getTimeStamp
());
ResourceBundleSearchTest
test
=
new
ResourceBundleSearchTest
();
test
.
runTests
();
try
{
test
.
runTests
();
}
finally
{
System
.
out
.
println
(
"ResourceBundleSearchTest terminated: "
+
getTimeStamp
());
}
}
private
void
runTests
()
throws
Throwable
{
...
...
@@ -77,15 +100,19 @@ public class ResourceBundleSearchTest {
urls
[
0
]
=
Paths
.
get
(
testDir
,
"resources"
).
toUri
().
toURL
();
URLClassLoader
rbClassLoader
=
new
URLClassLoader
(
urls
);
int
testnb
=
1
;
System
.
out
.
println
(
"ResourceBundleSearchTest starting test #"
+(
testnb
++)+
": "
+
getTimeStamp
());
// Test 1 - can we find a Logger bundle from doing a stack search?
// We shouldn't be able to
assertFalse
(
testGetBundleFromStackSearch
(),
"1-testGetBundleFromStackSearch"
);
System
.
out
.
println
(
"ResourceBundleSearchTest starting test #"
+(
testnb
++)+
": "
+
getTimeStamp
());
// Test 2 - can we find a Logger bundle off of the Thread context class
// loader? We should be able to.
assertTrue
(
testGetBundleFromTCCL
(
TCCL_TEST_BUNDLE
,
rbClassLoader
),
"2-testGetBundleFromTCCL"
);
System
.
out
.
println
(
"ResourceBundleSearchTest starting test #"
+(
testnb
++)+
": "
+
getTimeStamp
());
// Test 3 - Can we find a Logger bundle from the classpath? We should be
// able to. We'll first check to make sure the setup is correct and
// it actually is on the classpath before checking whether logging
...
...
@@ -99,21 +126,25 @@ public class ResourceBundleSearchTest {
+
" on the classpath"
);
}
System
.
out
.
println
(
"ResourceBundleSearchTest starting test #"
+(
testnb
++)+
": "
+
getTimeStamp
());
// Test 4 - we should be able to find a bundle from the caller's
// classloader, but only one level up.
assertTrue
(
testGetBundleFromCallersClassLoader
(),
"4-testGetBundleFromCallersClassLoader"
);
System
.
out
.
println
(
"ResourceBundleSearchTest starting test #"
+(
testnb
++)+
": "
+
getTimeStamp
());
// Test 5 - this ensures that getAnonymousLogger(String rbName)
// can find the bundle from the caller's classloader
assertTrue
(
testGetAnonymousLogger
(),
"5-testGetAnonymousLogger"
);
System
.
out
.
println
(
"ResourceBundleSearchTest starting test #"
+(
testnb
++)+
": "
+
getTimeStamp
());
// Test 6 - first call getLogger("myLogger").
// Then call getLogger("myLogger","bundleName") from a different ClassLoader
// Make sure we find the bundle
assertTrue
(
testGetBundleFromSecondCallersClassLoader
(),
"6-testGetBundleFromSecondCallersClassLoader"
);
System
.
out
.
println
(
"ResourceBundleSearchTest generating report: "
+
getTimeStamp
());
report
();
}
...
...
@@ -132,6 +163,7 @@ public class ResourceBundleSearchTest {
public
void
assertTrue
(
boolean
testResult
,
String
testName
)
{
if
(
testResult
)
{
numPass
++;
System
.
out
.
println
(
"PASSED: "
+
testName
);
}
else
{
numFail
++;
System
.
out
.
println
(
"FAILED: "
+
testName
...
...
@@ -142,6 +174,7 @@ public class ResourceBundleSearchTest {
public
void
assertFalse
(
boolean
testResult
,
String
testName
)
{
if
(!
testResult
)
{
numPass
++;
System
.
out
.
println
(
"PASSED: "
+
testName
);
}
else
{
numFail
++;
System
.
out
.
println
(
"FAILED: "
+
testName
...
...
@@ -170,12 +203,10 @@ public class ResourceBundleSearchTest {
debug
(
"Looking for "
+
bundleName
+
" using TCCL"
);
LoggingThread
lr
=
new
LoggingThread
(
bundleName
,
setOnTCCL
);
lr
.
start
();
synchronized
(
lr
)
{
try
{
lr
.
wait
();
}
catch
(
InterruptedException
ex
)
{
throw
ex
;
}
try
{
lr
.
join
();
}
catch
(
InterruptedException
ex
)
{
throw
ex
;
}
msgs
.
add
(
lr
.
msg
);
return
lr
.
foundBundle
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录