Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FIY695
jenkins
提交
291c39ad
J
jenkins
项目概览
FIY695
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
291c39ad
编写于
6月 05, 2013
作者:
J
Jesse Glick
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
JUnit 4.
上级
d964d072
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
39 addition
and
34 deletion
+39
-34
test/src/test/java/hudson/tasks/FingerprinterTest.java
test/src/test/java/hudson/tasks/FingerprinterTest.java
+39
-34
未找到文件。
test/src/test/java/hudson/tasks/FingerprinterTest.java
浏览文件 @
291c39ad
...
...
@@ -38,15 +38,19 @@ import hudson.util.RunList;
import
java.io.IOException
;
import
java.util.Collection
;
import
java.util.List
;
import
static
org
.
junit
.
Assert
.*;
import
org.junit.BeforeClass
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.jvnet.hudson.test.
HudsonTestCas
e
;
import
org.jvnet.hudson.test.
JenkinsRul
e
;
/**
*
* @author dty
*/
@SuppressWarnings
(
"rawtypes"
)
public
class
FingerprinterTest
extends
HudsonTestCase
{
public
class
FingerprinterTest
{
private
static
final
String
[]
singleContents
=
{
"abcdef"
};
...
...
@@ -71,18 +75,19 @@ public class FingerprinterTest extends HudsonTestCase {
private
static
final
String
renamedProject1
=
"renamed project 1"
;
private
static
final
String
renamedProject2
=
"renamed project 2"
;
@Override
public
void
setUp
()
throws
Exception
{
super
.
setUp
();
@Rule
public
JenkinsRule
j
=
new
JenkinsRule
();
@BeforeClass
public
static
void
setUp
()
throws
Exception
{
Fingerprinter
.
enableFingerprintsInDependencyGraph
=
true
;
}
public
void
testF
ingerprintDependencies
()
throws
Exception
{
@Test
public
void
f
ingerprintDependencies
()
throws
Exception
{
FreeStyleProject
upstream
=
createFreeStyleProjectWithFingerprints
(
singleContents
,
singleFiles
);
FreeStyleProject
downstream
=
createFreeStyleProjectWithFingerprints
(
singleContents
,
singleFiles
);
assertBuildStatusSuccess
(
upstream
.
scheduleBuild2
(
0
).
get
());
assertBuildStatusSuccess
(
downstream
.
scheduleBuild2
(
0
).
get
());
j
.
assertBuildStatusSuccess
(
upstream
.
scheduleBuild2
(
0
).
get
());
j
.
assertBuildStatusSuccess
(
downstream
.
scheduleBuild2
(
0
).
get
());
List
<
AbstractProject
>
downstreamProjects
=
upstream
.
getDownstreamProjects
();
List
<
AbstractProject
>
upstreamProjects
=
downstream
.
getUpstreamProjects
();
...
...
@@ -93,14 +98,14 @@ public class FingerprinterTest extends HudsonTestCase {
assertTrue
(
downstreamProjects
.
contains
(
downstream
));
}
public
void
testM
ultipleUpstreamDependencies
()
throws
Exception
{
@Test
public
void
m
ultipleUpstreamDependencies
()
throws
Exception
{
FreeStyleProject
upstream
=
createFreeStyleProjectWithFingerprints
(
singleContents
,
singleFiles
);
FreeStyleProject
upstream2
=
createFreeStyleProjectWithFingerprints
(
singleContents2
,
singleFiles2
);
FreeStyleProject
downstream
=
createFreeStyleProjectWithFingerprints
(
doubleContents
,
doubleFiles
);
assertBuildStatusSuccess
(
upstream
.
scheduleBuild2
(
0
).
get
());
assertBuildStatusSuccess
(
upstream2
.
scheduleBuild2
(
0
).
get
());
assertBuildStatusSuccess
(
downstream
.
scheduleBuild2
(
0
).
get
());
j
.
assertBuildStatusSuccess
(
upstream
.
scheduleBuild2
(
0
).
get
());
j
.
assertBuildStatusSuccess
(
upstream2
.
scheduleBuild2
(
0
).
get
());
j
.
assertBuildStatusSuccess
(
downstream
.
scheduleBuild2
(
0
).
get
());
List
<
AbstractProject
>
downstreamProjects
=
upstream
.
getDownstreamProjects
();
List
<
AbstractProject
>
downstreamProjects2
=
upstream2
.
getDownstreamProjects
();
...
...
@@ -114,14 +119,14 @@ public class FingerprinterTest extends HudsonTestCase {
assertTrue
(
downstreamProjects
.
contains
(
downstream
));
}
public
void
testM
ultipleDownstreamDependencies
()
throws
Exception
{
@Test
public
void
m
ultipleDownstreamDependencies
()
throws
Exception
{
FreeStyleProject
upstream
=
createFreeStyleProjectWithFingerprints
(
doubleContents
,
doubleFiles
);
FreeStyleProject
downstream
=
createFreeStyleProjectWithFingerprints
(
singleContents
,
singleFiles
);
FreeStyleProject
downstream2
=
createFreeStyleProjectWithFingerprints
(
singleContents2
,
singleFiles2
);
assertBuildStatusSuccess
(
upstream
.
scheduleBuild2
(
0
).
get
());
assertBuildStatusSuccess
(
downstream
.
scheduleBuild2
(
0
).
get
());
assertBuildStatusSuccess
(
downstream2
.
scheduleBuild2
(
0
).
get
());
j
.
assertBuildStatusSuccess
(
upstream
.
scheduleBuild2
(
0
).
get
());
j
.
assertBuildStatusSuccess
(
downstream
.
scheduleBuild2
(
0
).
get
());
j
.
assertBuildStatusSuccess
(
downstream2
.
scheduleBuild2
(
0
).
get
());
List
<
AbstractProject
>
downstreamProjects
=
upstream
.
getDownstreamProjects
();
List
<
AbstractProject
>
upstreamProjects
=
downstream
.
getUpstreamProjects
();
...
...
@@ -136,12 +141,12 @@ public class FingerprinterTest extends HudsonTestCase {
assertTrue
(
downstreamProjects
.
contains
(
downstream2
));
}
public
void
testD
ependencyExclusion
()
throws
Exception
{
@Test
public
void
d
ependencyExclusion
()
throws
Exception
{
FreeStyleProject
upstream
=
createFreeStyleProjectWithFingerprints
(
singleContents
,
singleFiles
);
FreeStyleProject
downstream
=
createFreeStyleProjectWithFingerprints
(
singleContents
,
singleFiles
);
FreeStyleBuild
upstreamBuild
=
assertBuildStatusSuccess
(
upstream
.
scheduleBuild2
(
0
).
get
());
assertBuildStatusSuccess
(
downstream
.
scheduleBuild2
(
0
).
get
());
FreeStyleBuild
upstreamBuild
=
j
.
assertBuildStatusSuccess
(
upstream
.
scheduleBuild2
(
0
).
get
());
j
.
assertBuildStatusSuccess
(
downstream
.
scheduleBuild2
(
0
).
get
());
upstreamBuild
.
delete
();
...
...
@@ -154,11 +159,11 @@ public class FingerprinterTest extends HudsonTestCase {
assertEquals
(
0
,
downstreamProjects
.
size
());
}
public
void
testC
ircularDependency
()
throws
Exception
{
@Test
public
void
c
ircularDependency
()
throws
Exception
{
FreeStyleProject
p
=
createFreeStyleProjectWithFingerprints
(
singleContents
,
singleFiles
);
assertBuildStatusSuccess
(
p
.
scheduleBuild2
(
0
).
get
());
assertBuildStatusSuccess
(
p
.
scheduleBuild2
(
0
).
get
());
j
.
assertBuildStatusSuccess
(
p
.
scheduleBuild2
(
0
).
get
());
j
.
assertBuildStatusSuccess
(
p
.
scheduleBuild2
(
0
).
get
());
List
<
AbstractProject
>
upstreamProjects
=
p
.
getUpstreamProjects
();
List
<
AbstractProject
>
downstreamProjects
=
p
.
getDownstreamProjects
();
...
...
@@ -167,34 +172,34 @@ public class FingerprinterTest extends HudsonTestCase {
assertEquals
(
0
,
downstreamProjects
.
size
());
}
public
void
test
MatrixDependency
()
throws
Exception
{
MatrixProject
matrixProject
=
createMatrixProject
();
@Test
public
void
MatrixDependency
()
throws
Exception
{
MatrixProject
matrixProject
=
j
.
createMatrixProject
();
matrixProject
.
setAxes
(
new
AxisList
(
new
Axis
(
"foo"
,
"a"
,
"b"
)));
FreeStyleProject
freestyleProject
=
createFreeStyleProjectWithFingerprints
(
singleContents
,
singleFiles
);
addFingerprinterToProject
(
matrixProject
,
singleContents
,
singleFiles
);
jenkins
.
rebuildDependencyGraph
();
j
.
j
enkins
.
rebuildDependencyGraph
();
buildAndAssertSuccess
(
matrixProject
);
buildAndAssertSuccess
(
freestyleProject
);
waitUntilNoActivity
();
j
.
buildAndAssertSuccess
(
matrixProject
);
j
.
buildAndAssertSuccess
(
freestyleProject
);
j
.
waitUntilNoActivity
();
RunList
<
FreeStyleBuild
>
builds
=
freestyleProject
.
getBuilds
();
assertEquals
(
"There should only be one FreestyleBuild"
,
1
,
builds
.
size
());
FreeStyleBuild
build
=
builds
.
iterator
().
next
();
assertEquals
(
Result
.
SUCCESS
,
build
.
getResult
());
List
<
AbstractProject
>
downstream
=
jenkins
.
getDependencyGraph
().
getDownstream
(
matrixProject
);
List
<
AbstractProject
>
downstream
=
j
.
j
enkins
.
getDependencyGraph
().
getDownstream
(
matrixProject
);
assertTrue
(
downstream
.
contains
(
freestyleProject
));
List
<
AbstractProject
>
upstream
=
jenkins
.
getDependencyGraph
().
getUpstream
(
freestyleProject
);
List
<
AbstractProject
>
upstream
=
j
.
j
enkins
.
getDependencyGraph
().
getUpstream
(
freestyleProject
);
assertTrue
(
upstream
.
contains
(
matrixProject
));
}
public
void
testP
rojectRename
()
throws
Exception
{
@Test
public
void
p
rojectRename
()
throws
Exception
{
FreeStyleProject
upstream
=
createFreeStyleProjectWithFingerprints
(
singleContents
,
singleFiles
);
FreeStyleProject
downstream
=
createFreeStyleProjectWithFingerprints
(
singleContents
,
singleFiles
);
FreeStyleBuild
upstreamBuild
=
assertBuildStatusSuccess
(
upstream
.
scheduleBuild2
(
0
).
get
());
FreeStyleBuild
downstreamBuild
=
assertBuildStatusSuccess
(
downstream
.
scheduleBuild2
(
0
).
get
());
FreeStyleBuild
upstreamBuild
=
j
.
assertBuildStatusSuccess
(
upstream
.
scheduleBuild2
(
0
).
get
());
FreeStyleBuild
downstreamBuild
=
j
.
assertBuildStatusSuccess
(
downstream
.
scheduleBuild2
(
0
).
get
());
String
oldUpstreamName
=
upstream
.
getName
();
String
oldDownstreamName
=
downstream
.
getName
();
...
...
@@ -246,7 +251,7 @@ public class FingerprinterTest extends HudsonTestCase {
}
private
FreeStyleProject
createFreeStyleProjectWithFingerprints
(
String
[]
contents
,
String
[]
files
)
throws
IOException
,
Exception
{
FreeStyleProject
project
=
createFreeStyleProject
();
FreeStyleProject
project
=
j
.
createFreeStyleProject
();
addFingerprinterToProject
(
project
,
contents
,
files
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录