Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dream21st
jenkins
提交
dcc10a42
J
jenkins
项目概览
dream21st
/
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,发现更多精彩内容 >>
提交
dcc10a42
编写于
7月 02, 2011
作者:
C
Christoph Kutzinski
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added test for Maven fingerprinter
上级
98b7c4e3
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
41 addition
and
3 deletion
+41
-3
test/src/test/java/hudson/maven/MavenMultiModuleTest.java
test/src/test/java/hudson/maven/MavenMultiModuleTest.java
+41
-3
未找到文件。
test/src/test/java/hudson/maven/MavenMultiModuleTest.java
浏览文件 @
dcc10a42
package
hudson.maven
;
import
org.junit.Assert
;
import
org.jvnet.hudson.test.HudsonTestCase
;
import
org.jvnet.hudson.test.Bug
;
import
org.jvnet.hudson.test.ExtractResourceSCM
;
...
...
@@ -7,12 +8,14 @@ import org.jvnet.hudson.test.ExtractResourceWithChangesSCM;
import
org.jvnet.hudson.test.ExtractChangeLogSet
;
import
hudson.Launcher
;
import
hudson.maven.reporters.MavenArtifact
;
import
hudson.maven.reporters.MavenArtifactRecord
;
import
hudson.maven.reporters.MavenFingerprinter
;
import
hudson.model.AbstractBuild
;
import
hudson.model.BuildListener
;
import
hudson.model.Result
;
import
hudson.scm.ChangeLogSet
;
import
hudson.scm.ChangeLogSet.Entry
;
import
hudson.scm.NullSCM
;
import
hudson.model.Run.Artifact
;
import
hudson.tasks.Fingerprinter.FingerprintAction
;
import
hudson.tasks.Maven.MavenInstallation
;
import
java.io.IOException
;
...
...
@@ -38,6 +41,7 @@ public class MavenMultiModuleTest extends HudsonTestCase {
configureDefaultMaven
(
"apache-maven-2.2.1"
,
MavenInstallation
.
MAVEN_21
);
MavenModuleSet
m
=
createMavenProject
();
m
.
getReporters
().
add
(
new
TestReporter
());
m
.
getReporters
().
add
(
new
MavenFingerprinter
());
m
.
setScm
(
new
ExtractResourceWithChangesSCM
(
getClass
().
getResource
(
"maven-multimod.zip"
),
getClass
().
getResource
(
"maven-multimod-changes.zip"
)));
...
...
@@ -71,6 +75,40 @@ public class MavenMultiModuleTest extends HudsonTestCase {
}
assertTrue
(
"duration of moduleset build should be greater-equal than sum of the module builds"
,
pBuild
.
getDuration
()
>=
summedModuleDuration
);
assertFingerprintWereRecorded
(
pBuild
);
}
private
void
assertFingerprintWereRecorded
(
MavenModuleSetBuild
modulesetBuild
)
{
boolean
mustHaveFingerprints
=
false
;
for
(
MavenBuild
moduleBuild
:
modulesetBuild
.
getModuleLastBuilds
().
values
())
{
if
(
moduleBuild
.
getResult
()
!=
Result
.
NOT_BUILT
&&
moduleBuild
.
getResult
()
!=
Result
.
ABORTED
)
{
assertFingerprintWereRecorded
(
moduleBuild
);
mustHaveFingerprints
=
true
;
}
}
if
(
mustHaveFingerprints
)
{
FingerprintAction
action
=
modulesetBuild
.
getAction
(
FingerprintAction
.
class
);
Assert
.
assertNotNull
(
action
);
Assert
.
assertFalse
(
action
.
getFingerprints
().
isEmpty
());
}
}
private
void
assertFingerprintWereRecorded
(
MavenBuild
moduleBuild
)
{
FingerprintAction
action
=
moduleBuild
.
getAction
(
FingerprintAction
.
class
);
Assert
.
assertNotNull
(
action
);
Assert
.
assertFalse
(
action
.
getFingerprints
().
isEmpty
());
MavenArtifactRecord
artifactRecord
=
moduleBuild
.
getAction
(
MavenArtifactRecord
.
class
);
Assert
.
assertNotNull
(
artifactRecord
);
String
fingerprintName
=
artifactRecord
.
mainArtifact
.
groupId
+
":"
+
artifactRecord
.
mainArtifact
.
fileName
;
Assert
.
assertTrue
(
"Expected fingerprint "
+
fingerprintName
+
" in module build "
+
moduleBuild
,
action
.
getFingerprints
().
containsKey
(
fingerprintName
));
// we should assert more - i.e. that all dependencies are fingerprinted, too,
// but it's complicated to find out the dependencies of the build
}
@Bug
(
5357
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录