Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FIY695
jenkins
提交
93b82be1
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,发现更多精彩内容 >>
提交
93b82be1
编写于
5月 29, 2013
作者:
J
Jesse Glick
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
JUnit 4.
上级
972d8bad
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
58 addition
and
52 deletion
+58
-52
test/src/test/java/hudson/maven/MavenMultiModuleTest.java
test/src/test/java/hudson/maven/MavenMultiModuleTest.java
+58
-52
未找到文件。
test/src/test/java/hudson/maven/MavenMultiModuleTest.java
浏览文件 @
93b82be1
package
hudson.maven
;
import
org.junit.Assert
;
import
org.junit.Ignore
;
import
org.jvnet.hudson.test.HudsonTestCase
;
import
org.jvnet.hudson.test.Bug
;
import
org.jvnet.hudson.test.ExtractResourceSCM
;
import
org.jvnet.hudson.test.ExtractResourceWithChangesSCM
;
...
...
@@ -18,37 +16,45 @@ import hudson.tasks.Fingerprinter.FingerprintAction;
import
hudson.tasks.Maven.MavenInstallation
;
import
java.io.IOException
;
import
static
org
.
junit
.
Assert
.*;
import
org.junit.Ignore
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.jvnet.hudson.test.JenkinsRule
;
/**
* @author Andrew Bayer
*/
public
class
MavenMultiModuleTest
extends
HudsonTestCase
{
public
class
MavenMultiModuleTest
{
@Rule
public
JenkinsRule
j
=
new
JenkinsRule
();
/**
* NPE in {@code build.getProject().getWorkspace()} for {@link MavenBuild}.
*/
@Bug
(
4192
)
public
void
testM
ultiModMavenWsExists
()
throws
Exception
{
configureDefaultMaven
(
"apache-maven-2.2.1"
,
MavenInstallation
.
MAVEN_21
);
MavenModuleSet
m
=
createMavenProject
();
@Test
public
void
m
ultiModMavenWsExists
()
throws
Exception
{
j
.
configureDefaultMaven
(
"apache-maven-2.2.1"
,
MavenInstallation
.
MAVEN_21
);
MavenModuleSet
m
=
j
.
createMavenProject
();
m
.
getReporters
().
add
(
new
TestReporter
());
m
.
setScm
(
new
ExtractResourceSCM
(
getClass
().
getResource
(
"maven-multimod.zip"
)));
assertFalse
(
"MavenModuleSet.isNonRecursive() should be false"
,
m
.
isNonRecursive
());
buildAndAssertSuccess
(
m
);
j
.
buildAndAssertSuccess
(
m
);
}
public
void
testI
ncrementalMultiModMaven
()
throws
Exception
{
configureDefaultMaven
(
"apache-maven-2.2.1"
,
MavenInstallation
.
MAVEN_21
);
MavenModuleSet
m
=
createMavenProject
();
@Test
public
void
i
ncrementalMultiModMaven
()
throws
Exception
{
j
.
configureDefaultMaven
(
"apache-maven-2.2.1"
,
MavenInstallation
.
MAVEN_21
);
MavenModuleSet
m
=
j
.
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"
)));
buildAndAssertSuccess
(
m
);
j
.
buildAndAssertSuccess
(
m
);
// Now run a second build with the changes.
m
.
setIncrementalBuild
(
true
);
buildAndAssertSuccess
(
m
);
j
.
buildAndAssertSuccess
(
m
);
MavenModuleSetBuild
pBuild
=
m
.
getLastBuild
();
ExtractChangeLogSet
changeSet
=
(
ExtractChangeLogSet
)
pBuild
.
getChangeSet
();
...
...
@@ -111,19 +117,19 @@ public class MavenMultiModuleTest extends HudsonTestCase {
}
@Bug
(
5357
)
public
void
testI
ncrRelMultiModMaven
()
throws
Exception
{
configureDefaultMaven
(
"apache-maven-2.2.1"
,
MavenInstallation
.
MAVEN_21
);
MavenModuleSet
m
=
createMavenProject
();
@Test
public
void
i
ncrRelMultiModMaven
()
throws
Exception
{
j
.
configureDefaultMaven
(
"apache-maven-2.2.1"
,
MavenInstallation
.
MAVEN_21
);
MavenModuleSet
m
=
j
.
createMavenProject
();
m
.
setRootPOM
(
"parent/pom.xml"
);
m
.
getReporters
().
add
(
new
TestReporter
());
m
.
setScm
(
new
ExtractResourceWithChangesSCM
(
getClass
().
getResource
(
"maven-multimod-rel-base.zip"
),
getClass
().
getResource
(
"maven-multimod-changes.zip"
)));
buildAndAssertSuccess
(
m
);
j
.
buildAndAssertSuccess
(
m
);
// Now run a second build with the changes.
m
.
setIncrementalBuild
(
true
);
buildAndAssertSuccess
(
m
);
j
.
buildAndAssertSuccess
(
m
);
MavenModuleSetBuild
pBuild
=
m
.
getLastBuild
();
ExtractChangeLogSet
changeSet
=
(
ExtractChangeLogSet
)
pBuild
.
getChangeSet
();
...
...
@@ -153,21 +159,21 @@ public class MavenMultiModuleTest extends HudsonTestCase {
@Bug
(
6544
)
// kutzi 10/10/11 ignore test until I can figure out why it fails sometimes
public
void
ignore_testE
stimatedDurationForIncrementalMultiModMaven
()
@Ignore
(
"kutzi 10/10/11 ignore test until I can figure out why it fails sometimes"
)
@Test
public
void
e
stimatedDurationForIncrementalMultiModMaven
()
throws
Exception
{
configureDefaultMaven
(
"apache-maven-2.2.1"
,
MavenInstallation
.
MAVEN_21
);
MavenModuleSet
m
=
createMavenProject
();
j
.
configureDefaultMaven
(
"apache-maven-2.2.1"
,
MavenInstallation
.
MAVEN_21
);
MavenModuleSet
m
=
j
.
createMavenProject
();
m
.
getReporters
().
add
(
new
TestReporter
());
m
.
setScm
(
new
ExtractResourceWithChangesSCM
(
getClass
().
getResource
(
"maven-multimod.zip"
),
getClass
().
getResource
(
"maven-multimod-changes.zip"
)));
buildAndAssertSuccess
(
m
);
j
.
buildAndAssertSuccess
(
m
);
// Now run a second, incremental build with the changes.
m
.
setIncrementalBuild
(
true
);
buildAndAssertSuccess
(
m
);
j
.
buildAndAssertSuccess
(
m
);
MavenModuleSetBuild
lastBuild
=
m
.
getLastBuild
();
MavenModuleSetBuild
previousBuild
=
lastBuild
.
getPreviousBuild
();
...
...
@@ -188,29 +194,29 @@ public class MavenMultiModuleTest extends HudsonTestCase {
* NPE in {@code getChangeSetFor(m)} in {@link MavenModuleSetBuild} when incremental build is
* enabled and a new module is added.
*/
public
void
testN
ewModMultiModMaven
()
throws
Exception
{
configureDefaultMaven
(
"apache-maven-2.2.1"
,
MavenInstallation
.
MAVEN_21
);
MavenModuleSet
m
=
createMavenProject
();
@Test
public
void
n
ewModMultiModMaven
()
throws
Exception
{
j
.
configureDefaultMaven
(
"apache-maven-2.2.1"
,
MavenInstallation
.
MAVEN_21
);
MavenModuleSet
m
=
j
.
createMavenProject
();
m
.
getReporters
().
add
(
new
TestReporter
());
m
.
setScm
(
new
ExtractResourceWithChangesSCM
(
getClass
().
getResource
(
"maven-multimod.zip"
),
getClass
().
getResource
(
"maven-multimod-changes.zip"
)));
m
.
setIncrementalBuild
(
true
);
buildAndAssertSuccess
(
m
);
j
.
buildAndAssertSuccess
(
m
);
}
/**
* When "-N' or "--non-recursive" show up in the goals, any child modules should be ignored.
*/
@Bug
(
4491
)
public
void
testM
ultiModMavenNonRecursiveParsing
()
throws
Exception
{
configureDefaultMaven
(
"apache-maven-2.2.1"
,
MavenInstallation
.
MAVEN_21
);
MavenModuleSet
m
=
createMavenProject
();
@Test
public
void
m
ultiModMavenNonRecursiveParsing
()
throws
Exception
{
j
.
configureDefaultMaven
(
"apache-maven-2.2.1"
,
MavenInstallation
.
MAVEN_21
);
MavenModuleSet
m
=
j
.
createMavenProject
();
m
.
setGoals
(
"clean install -N"
);
m
.
getReporters
().
add
(
new
TestReporter
());
m
.
setScm
(
new
ExtractResourceSCM
(
getClass
().
getResource
(
"maven-multimod.zip"
)));
buildAndAssertSuccess
(
m
);
j
.
buildAndAssertSuccess
(
m
);
MavenModuleSetBuild
pBuild
=
m
.
getLastBuild
();
...
...
@@ -238,15 +244,15 @@ public class MavenMultiModuleTest extends HudsonTestCase {
* incremental build is enabled and nothing changed in those modules.
*/
@Bug
(
4152
)
public
void
testI
ncrementalMultiModWithErrorsMaven
()
throws
Exception
{
configureDefaultMaven
(
"apache-maven-2.2.1"
,
MavenInstallation
.
MAVEN_21
);
MavenModuleSet
m
=
createMavenProject
();
@Test
public
void
i
ncrementalMultiModWithErrorsMaven
()
throws
Exception
{
j
.
configureDefaultMaven
(
"apache-maven-2.2.1"
,
MavenInstallation
.
MAVEN_21
);
MavenModuleSet
m
=
j
.
createMavenProject
();
m
.
setIncrementalBuild
(
true
);
m
.
getReporters
().
add
(
new
TestReporter
());
m
.
setScm
(
new
ExtractResourceWithChangesSCM
(
getClass
().
getResource
(
"maven-multimod-incr.zip"
),
getClass
().
getResource
(
"maven-multimod-changes.zip"
)));
assertBuildStatus
(
Result
.
UNSTABLE
,
m
.
scheduleBuild2
(
0
).
get
());
j
.
assertBuildStatus
(
Result
.
UNSTABLE
,
m
.
scheduleBuild2
(
0
).
get
());
MavenModuleSetBuild
pBuild
=
m
.
getLastBuild
();
for
(
MavenBuild
modBuild
:
pBuild
.
getModuleLastBuilds
().
values
())
{
...
...
@@ -266,7 +272,7 @@ public class MavenMultiModuleTest extends HudsonTestCase {
}
// Now run a second build with the changes.
assertBuildStatus
(
Result
.
UNSTABLE
,
m
.
scheduleBuild2
(
0
).
get
());
j
.
assertBuildStatus
(
Result
.
UNSTABLE
,
m
.
scheduleBuild2
(
0
).
get
());
pBuild
=
m
.
getLastBuild
();
ExtractChangeLogSet
changeSet
=
(
ExtractChangeLogSet
)
pBuild
.
getChangeSet
();
...
...
@@ -301,16 +307,16 @@ public class MavenMultiModuleTest extends HudsonTestCase {
* then all modules build this time, have to be build next time, again.
*/
@Bug
(
5121
)
public
void
testI
ncrementalRedeployAfterAggregatorError
()
throws
Exception
{
configureDefaultMaven
(
"apache-maven-2.2.1"
,
MavenInstallation
.
MAVEN_21
);
MavenModuleSet
m
=
createMavenProject
();
@Test
public
void
i
ncrementalRedeployAfterAggregatorError
()
throws
Exception
{
j
.
configureDefaultMaven
(
"apache-maven-2.2.1"
,
MavenInstallation
.
MAVEN_21
);
MavenModuleSet
m
=
j
.
createMavenProject
();
m
.
setIncrementalBuild
(
true
);
m
.
getReporters
().
add
(
new
TestReporter
());
m
.
getPublishers
().
add
(
new
DummyRedeployPublisher
());
m
.
setScm
(
new
ExtractResourceWithChangesSCM
(
getClass
().
getResource
(
"maven-multimod-incr.zip"
),
getClass
().
getResource
(
"maven-multimod-changes.zip"
)));
assertBuildStatus
(
Result
.
UNSTABLE
,
m
.
scheduleBuild2
(
0
).
get
());
j
.
assertBuildStatus
(
Result
.
UNSTABLE
,
m
.
scheduleBuild2
(
0
).
get
());
MavenModuleSetBuild
pBuild
=
m
.
getLastBuild
();
for
(
MavenBuild
modBuild
:
pBuild
.
getModuleLastBuilds
().
values
())
{
...
...
@@ -330,7 +336,7 @@ public class MavenMultiModuleTest extends HudsonTestCase {
}
// Now run a second build.
assertBuildStatus
(
Result
.
UNSTABLE
,
m
.
scheduleBuild2
(
0
).
get
());
j
.
assertBuildStatus
(
Result
.
UNSTABLE
,
m
.
scheduleBuild2
(
0
).
get
());
pBuild
=
m
.
getLastBuild
();
ExtractChangeLogSet
changeSet
=
(
ExtractChangeLogSet
)
pBuild
.
getChangeSet
();
...
...
@@ -364,13 +370,13 @@ public class MavenMultiModuleTest extends HudsonTestCase {
* Test failures in a child module should lead to the parent being marked as unstable.
*/
@Bug
(
4378
)
public
void
testM
ultiModWithTestFailuresMaven
()
throws
Exception
{
configureDefaultMaven
(
"apache-maven-2.2.1"
,
MavenInstallation
.
MAVEN_21
);
MavenModuleSet
m
=
createMavenProject
();
@Test
public
void
m
ultiModWithTestFailuresMaven
()
throws
Exception
{
j
.
configureDefaultMaven
(
"apache-maven-2.2.1"
,
MavenInstallation
.
MAVEN_21
);
MavenModuleSet
m
=
j
.
createMavenProject
();
m
.
getReporters
().
add
(
new
TestReporter
());
m
.
setScm
(
new
ExtractResourceSCM
(
getClass
().
getResource
(
"maven-multimod-incr.zip"
)));
assertBuildStatus
(
Result
.
UNSTABLE
,
m
.
scheduleBuild2
(
0
).
get
());
j
.
assertBuildStatus
(
Result
.
UNSTABLE
,
m
.
scheduleBuild2
(
0
).
get
());
MavenModuleSetBuild
pBuild
=
m
.
getLastBuild
();
...
...
@@ -394,19 +400,19 @@ public class MavenMultiModuleTest extends HudsonTestCase {
}
@Bug
(
8484
)
public
void
testM
ultiModMavenNonRecursive
()
throws
Exception
{
configureDefaultMaven
(
"apache-maven-2.2.1"
,
MavenInstallation
.
MAVEN_21
);
MavenModuleSet
m
=
createMavenProject
();
@Test
public
void
m
ultiModMavenNonRecursive
()
throws
Exception
{
j
.
configureDefaultMaven
(
"apache-maven-2.2.1"
,
MavenInstallation
.
MAVEN_21
);
MavenModuleSet
m
=
j
.
createMavenProject
();
m
.
getReporters
().
add
(
new
TestReporter
());
m
.
setScm
(
new
ExtractResourceSCM
(
getClass
().
getResource
(
"maven-multimod.zip"
)));
m
.
setGoals
(
"-N validate"
);
assertTrue
(
"MavenModuleSet.isNonRecursive() should be true"
,
m
.
isNonRecursive
());
buildAndAssertSuccess
(
m
);
j
.
buildAndAssertSuccess
(
m
);
assertEquals
(
"not only one module"
,
1
,
m
.
getModules
().
size
());
}
/*
public void testP
arallelMultiModMavenWsExists() throws Exception {
@Test public void p
arallelMultiModMavenWsExists() throws Exception {
configureDefaultMaven();
MavenModuleSet m = createMavenProject();
m.setAggregatorStyleBuild(false);
...
...
@@ -430,7 +436,7 @@ public class MavenMultiModuleTest extends HudsonTestCase {
}
public void testP
rivateRepoParallelMultiModMavenWsExists() throws Exception {
@Test public void p
rivateRepoParallelMultiModMavenWsExists() throws Exception {
configureDefaultMaven();
MavenModuleSet m = createMavenProject();
m.setAggregatorStyleBuild(false);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录