Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
2a4cebb4
J
jenkins
项目概览
xxadev
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2a4cebb4
编写于
10月 02, 2019
作者:
S
Stefan Spieker
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
minor improvements to unit tests
上级
58ac3a0f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
15 addition
and
27 deletion
+15
-27
core/src/test/java/hudson/PluginManagerTest.java
core/src/test/java/hudson/PluginManagerTest.java
+2
-1
core/src/test/java/hudson/util/ConsistentHashTest.java
core/src/test/java/hudson/util/ConsistentHashTest.java
+1
-1
core/src/test/java/jenkins/model/lazy/AbstractLazyLoadRunMapTest.java
...t/java/jenkins/model/lazy/AbstractLazyLoadRunMapTest.java
+7
-19
core/src/test/java/jenkins/plugins/DetachedPluginsUtilTest.java
...rc/test/java/jenkins/plugins/DetachedPluginsUtilTest.java
+5
-6
未找到文件。
core/src/test/java/hudson/PluginManagerTest.java
浏览文件 @
2a4cebb4
...
...
@@ -25,6 +25,7 @@
package
hudson
;
import
java.io.File
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.file.Files
;
import
org.apache.tools.ant.filters.StringInputStream
;
import
org.junit.Test
;
...
...
@@ -145,7 +146,7 @@ public class PluginManagerTest {
File
newFolder
=
tmp
.
newFolder
(
"myJar"
);
String
manifestPath
=
"META-INF/MANIFEST.MF"
;
new
File
(
"META-INF"
).
mkdir
();
FileUtils
.
write
(
new
File
(
newFolder
,
manifestPath
),
SAMPLE_MANIFEST_FILE
);
FileUtils
.
write
(
new
File
(
newFolder
,
manifestPath
),
SAMPLE_MANIFEST_FILE
,
StandardCharsets
.
UTF_8
);
final
File
f
=
new
File
(
tmp
.
getRoot
(),
"my.hpi"
);
try
(
ZipOutputStream
out
=
new
ZipOutputStream
(
Files
.
newOutputStream
(
f
.
toPath
())))
{
...
...
core/src/test/java/hudson/util/ConsistentHashTest.java
浏览文件 @
2a4cebb4
...
...
@@ -66,7 +66,7 @@ public class ConsistentHashTest {
assertEquals
(
z
,
x
);
all
.
add
(
itr
.
next
());
all
.
add
(
itr
.
next
());
assert
True
(!
itr
.
hasNext
());
assert
False
(
itr
.
hasNext
());
assertEquals
(
3
,
all
.
size
());
}
...
...
core/src/test/java/jenkins/model/lazy/AbstractLazyLoadRunMapTest.java
浏览文件 @
2a4cebb4
...
...
@@ -39,7 +39,6 @@ import java.util.Map.Entry;
import
java.util.NoSuchElementException
;
import
java.util.Set
;
import
java.util.SortedMap
;
import
java.util.concurrent.Callable
;
import
java.util.concurrent.Future
;
import
java.util.concurrent.Semaphore
;
import
java.util.concurrent.atomic.AtomicInteger
;
...
...
@@ -201,7 +200,7 @@ public class AbstractLazyLoadRunMapTest {
final
FakeMap
m
=
localExpiredBuilder
.
add
(
1
).
add
(
2
).
make
();
// force index creation
m
.
entrySet
(
);
assertEquals
(
2
,
m
.
entrySet
().
size
()
);
m
.
search
(
1
,
Direction
.
EXACT
).
asserts
(
1
);
assertNull
(
m
.
search
(
3
,
Direction
.
EXACT
));
...
...
@@ -259,10 +258,9 @@ public class AbstractLazyLoadRunMapTest {
@Test
public
void
identity
()
{
assertTrue
(
a
.
equals
(
a
));
assertTrue
(!
a
.
equals
(
b
));
a
.
hashCode
();
b
.
hashCode
();
assertEquals
(
a
,
a
);
assertNotEquals
(
a
,
b
);
assertNotEquals
(
a
.
hashCode
(),
b
.
hashCode
());
}
@Issue
(
"JENKINS-15439"
)
...
...
@@ -285,7 +283,7 @@ public class AbstractLazyLoadRunMapTest {
}
@Issue
(
"JENKINS-18065"
)
@Test
public
void
all
()
throws
Exception
{
@Test
public
void
all
()
{
assertEquals
(
"[]"
,
a
.
getLoadedBuilds
().
keySet
().
toString
());
Set
<
Map
.
Entry
<
Integer
,
Build
>>
entries
=
a
.
entrySet
();
assertEquals
(
"[]"
,
a
.
getLoadedBuilds
().
keySet
().
toString
());
...
...
@@ -399,18 +397,8 @@ public class AbstractLazyLoadRunMapTest {
slowBuilderLoadCount
.
put
(
i
,
new
AtomicInteger
());
}
final
FakeMap
m
=
slowBuilder
.
make
();
Future
<
Build
>
firstLoad
=
Timer
.
get
().
submit
(
new
Callable
<
Build
>()
{
@Override
public
Build
call
()
throws
Exception
{
return
m
.
getByNumber
(
2
);
}
});
Future
<
Build
>
secondLoad
=
Timer
.
get
().
submit
(
new
Callable
<
Build
>()
{
@Override
public
Build
call
()
throws
Exception
{
return
m
.
getByNumber
(
2
);
}
});
Future
<
Build
>
firstLoad
=
Timer
.
get
().
submit
(()
->
m
.
getByNumber
(
2
));
Future
<
Build
>
secondLoad
=
Timer
.
get
().
submit
(()
->
m
.
getByNumber
(
2
));
slowBuilderStartSemaphores
.
get
(
2
).
acquire
(
1
);
// now one of them is inside retrieve(…); the other is waiting for the lock
slowBuilderEndSemaphores
.
get
(
2
).
release
(
2
);
// allow both to proceed
...
...
core/src/test/java/jenkins/plugins/DetachedPluginsUtilTest.java
浏览文件 @
2a4cebb4
...
...
@@ -6,6 +6,7 @@ import org.apache.commons.io.IOUtils;
import
org.junit.Test
;
import
java.io.IOException
;
import
java.nio.charset.StandardCharsets
;
import
java.util.List
;
import
java.util.stream.Collectors
;
...
...
@@ -29,12 +30,10 @@ public class DetachedPluginsUtilTest {
final
List
<
DetachedPluginsUtil
.
DetachedPlugin
>
detachedPlugins
=
DetachedPluginsUtil
.
getDetachedPlugins
();
if
(
JavaUtils
.
isRunningWithJava8OrBelow
())
{
assertEquals
(
0
,
detachedPlugins
.
stream
()
.
filter
(
plugin
->
plugin
.
getShortName
().
equals
(
"jaxb"
))
.
collect
(
Collectors
.
toList
()).
size
());
.
filter
(
plugin
->
plugin
.
getShortName
().
equals
(
"jaxb"
)).
count
());
}
else
if
(
JavaUtils
.
getCurrentJavaRuntimeVersionNumber
().
isNewerThanOrEqualTo
(
new
VersionNumber
(
"11.0.2"
)))
{
assertEquals
(
1
,
detachedPlugins
.
stream
()
.
filter
(
plugin
->
plugin
.
getShortName
().
equals
(
"jaxb"
))
.
collect
(
Collectors
.
toList
()).
size
());
.
filter
(
plugin
->
plugin
.
getShortName
().
equals
(
"jaxb"
)).
count
());
final
List
<
DetachedPluginsUtil
.
DetachedPlugin
>
detachedPluginsSince2_161
=
DetachedPluginsUtil
.
getDetachedPlugins
(
new
VersionNumber
(
"2.161"
));
...
...
@@ -49,8 +48,8 @@ public class DetachedPluginsUtilTest {
*/
@Test
public
void
checkSplitPluginsFileFormat
()
throws
IOException
{
final
List
<
String
>
splitPluginsLines
=
IOUtils
.
readLines
(
getClass
().
getResourceAsStream
(
"/jenkins/split-plugins.txt"
));
assert
True
(!
splitPluginsLines
.
isEmpty
());
final
List
<
String
>
splitPluginsLines
=
IOUtils
.
readLines
(
getClass
().
getResourceAsStream
(
"/jenkins/split-plugins.txt"
)
,
StandardCharsets
.
UTF_8
);
assert
False
(
splitPluginsLines
.
isEmpty
());
// File is not only comments
final
List
<
String
>
linesWithoutComments
=
splitPluginsLines
.
stream
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录