Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
e4914db5
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,发现更多精彩内容 >>
提交
e4914db5
编写于
4月 18, 2011
作者:
O
Olivier Lamy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[FIXED JENKINS-9326] Jenkins Maven build does not recognize Tycho surfire reports
上级
988b1a20
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
53 addition
and
2 deletion
+53
-2
maven-plugin/src/main/java/hudson/maven/reporters/SurefireArchiver.java
...rc/main/java/hudson/maven/reporters/SurefireArchiver.java
+8
-2
test/src/main/java/org/jvnet/hudson/test/ExtractResourceSCM.java
...c/main/java/org/jvnet/hudson/test/ExtractResourceSCM.java
+17
-0
test/src/test/java/hudson/maven/Maven3BuildTest.java
test/src/test/java/hudson/maven/Maven3BuildTest.java
+28
-0
未找到文件。
maven-plugin/src/main/java/hudson/maven/reporters/SurefireArchiver.java
浏览文件 @
e4914db5
...
@@ -88,7 +88,7 @@ public class SurefireArchiver extends MavenReporter {
...
@@ -88,7 +88,7 @@ public class SurefireArchiver extends MavenReporter {
// so that we can record this as yellow.
// so that we can record this as yellow.
// note that because of the way Maven works, just updating system property at this point is too late
// note that because of the way Maven works, just updating system property at this point is too late
XmlPlexusConfiguration
c
=
(
XmlPlexusConfiguration
)
mojo
.
configuration
.
getChild
(
"testFailureIgnore"
);
XmlPlexusConfiguration
c
=
(
XmlPlexusConfiguration
)
mojo
.
configuration
.
getChild
(
"testFailureIgnore"
);
if
(
c
!=
null
&&
c
.
getValue
().
equals
(
"${maven.test.failure.ignore}"
)
&&
System
.
getProperty
(
"maven.test.failure.ignore"
)==
null
)
{
if
(
c
!=
null
&&
c
.
getValue
()
!=
null
&&
c
.
getValue
()
.
equals
(
"${maven.test.failure.ignore}"
)
&&
System
.
getProperty
(
"maven.test.failure.ignore"
)==
null
)
{
if
(
maven3orLater
(
build
.
getMavenBuildInformation
().
getMavenVersion
()
))
{
if
(
maven3orLater
(
build
.
getMavenBuildInformation
().
getMavenVersion
()
))
{
String
fieldName
=
"testFailureIgnore"
;
String
fieldName
=
"testFailureIgnore"
;
if
(
mojo
.
mojoExecution
.
getConfiguration
().
getChild
(
fieldName
)
!=
null
)
{
if
(
mojo
.
mojoExecution
.
getConfiguration
().
getChild
(
fieldName
)
!=
null
)
{
...
@@ -245,6 +245,7 @@ public class SurefireArchiver extends MavenReporter {
...
@@ -245,6 +245,7 @@ public class SurefireArchiver extends MavenReporter {
private
boolean
isSurefireTest
(
MojoInfo
mojo
)
{
private
boolean
isSurefireTest
(
MojoInfo
mojo
)
{
if
((!
mojo
.
is
(
"com.sun.maven"
,
"maven-junit-plugin"
,
"test"
))
if
((!
mojo
.
is
(
"com.sun.maven"
,
"maven-junit-plugin"
,
"test"
))
&&
(!
mojo
.
is
(
"org.sonatype.flexmojos"
,
"flexmojos-maven-plugin"
,
"test-run"
))
&&
(!
mojo
.
is
(
"org.sonatype.flexmojos"
,
"flexmojos-maven-plugin"
,
"test-run"
))
&&
(!
mojo
.
is
(
"org.sonatype.tycho"
,
"maven-osgi-test-plugin"
,
"test"
))
&&
(!
mojo
.
is
(
"org.apache.maven.plugins"
,
"maven-surefire-plugin"
,
"test"
))
&&
(!
mojo
.
is
(
"org.apache.maven.plugins"
,
"maven-surefire-plugin"
,
"test"
))
&&
(!
mojo
.
is
(
"org.apache.maven.plugins"
,
"maven-failsafe-plugin"
,
"integration-test"
)))
&&
(!
mojo
.
is
(
"org.apache.maven.plugins"
,
"maven-failsafe-plugin"
,
"integration-test"
)))
return
false
;
return
false
;
...
@@ -284,7 +285,12 @@ public class SurefireArchiver extends MavenReporter {
...
@@ -284,7 +285,12 @@ public class SurefireArchiver extends MavenReporter {
if
(((
skipTests
!=
null
)
&&
(
skipTests
)))
{
if
(((
skipTests
!=
null
)
&&
(
skipTests
)))
{
return
false
;
return
false
;
}
}
}
}
else
if
(
mojo
.
is
(
"org.sonatype.tycho"
,
"maven-osgi-test-plugin"
,
"test"
))
{
Boolean
skipTests
=
mojo
.
getConfigurationValue
(
"skipTest"
,
Boolean
.
class
);
if
(((
skipTests
!=
null
)
&&
(
skipTests
)))
{
return
false
;
}
}
}
catch
(
ComponentConfigurationException
e
)
{
}
catch
(
ComponentConfigurationException
e
)
{
return
false
;
return
false
;
...
...
test/src/main/java/org/jvnet/hudson/test/ExtractResourceSCM.java
浏览文件 @
e4914db5
...
@@ -29,6 +29,8 @@ import hudson.model.AbstractBuild;
...
@@ -29,6 +29,8 @@ import hudson.model.AbstractBuild;
import
hudson.model.BuildListener
;
import
hudson.model.BuildListener
;
import
hudson.scm.NullSCM
;
import
hudson.scm.NullSCM
;
import
hudson.scm.SCM
;
import
hudson.scm.SCM
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.io.IOUtils
;
import
java.io.File
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.IOException
;
...
@@ -42,12 +44,21 @@ import java.net.URL;
...
@@ -42,12 +44,21 @@ import java.net.URL;
public
class
ExtractResourceSCM
extends
NullSCM
{
public
class
ExtractResourceSCM
extends
NullSCM
{
private
final
URL
zip
;
private
final
URL
zip
;
private
String
parentFolder
;
public
ExtractResourceSCM
(
URL
zip
)
{
public
ExtractResourceSCM
(
URL
zip
)
{
if
(
zip
==
null
)
if
(
zip
==
null
)
throw
new
IllegalArgumentException
();
throw
new
IllegalArgumentException
();
this
.
zip
=
zip
;
this
.
zip
=
zip
;
}
}
public
ExtractResourceSCM
(
URL
zip
,
String
parentFolder
)
{
if
(
zip
==
null
)
throw
new
IllegalArgumentException
();
this
.
zip
=
zip
;
this
.
parentFolder
=
parentFolder
;
}
@Override
@Override
public
boolean
checkout
(
AbstractBuild
build
,
Launcher
launcher
,
FilePath
workspace
,
BuildListener
listener
,
File
changeLogFile
)
throws
IOException
,
InterruptedException
{
public
boolean
checkout
(
AbstractBuild
build
,
Launcher
launcher
,
FilePath
workspace
,
BuildListener
listener
,
File
changeLogFile
)
throws
IOException
,
InterruptedException
{
if
(
workspace
.
exists
())
{
if
(
workspace
.
exists
())
{
...
@@ -56,6 +67,12 @@ public class ExtractResourceSCM extends NullSCM {
...
@@ -56,6 +67,12 @@ public class ExtractResourceSCM extends NullSCM {
}
}
listener
.
getLogger
().
println
(
"Staging "
+
zip
);
listener
.
getLogger
().
println
(
"Staging "
+
zip
);
workspace
.
unzipFrom
(
zip
.
openStream
());
workspace
.
unzipFrom
(
zip
.
openStream
());
if
(
parentFolder
!=
null
)
{
System
.
out
.
println
(
"workspace "
+
workspace
.
getRemote
());
//Thread.sleep( 100000 );
FileUtils
.
copyDirectory
(
new
File
(
workspace
.
getRemote
()
+
"/"
+
parentFolder
),
new
File
(
workspace
.
getRemote
()));
//FileUtils.moveDirectory( new File(workspace.getRemote() + "/" + parentFolder), new File( workspace.getRemote()));
}
return
true
;
return
true
;
}
}
}
}
test/src/test/java/hudson/maven/Maven3BuildTest.java
浏览文件 @
e4914db5
package
hudson.maven
;
package
hudson.maven
;
/*
/*
* Olivier Lamy
* Licensed to the Apache Software Foundation (ASF) under one
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* distributed with this work for additional information
...
@@ -28,6 +29,7 @@ import java.io.File;
...
@@ -28,6 +29,7 @@ import java.io.File;
import
java.io.FilenameFilter
;
import
java.io.FilenameFilter
;
import
java.io.IOException
;
import
java.io.IOException
;
import
hudson.tasks.test.AbstractTestResultAction
;
import
hudson.tasks.test.TestResult
;
import
hudson.tasks.test.TestResult
;
import
hudson.tasks.test.TestResultProjectAction
;
import
hudson.tasks.test.TestResultProjectAction
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.io.FileUtils
;
...
@@ -193,6 +195,32 @@ public class Maven3BuildTest extends HudsonTestCase {
...
@@ -193,6 +195,32 @@ public class Maven3BuildTest extends HudsonTestCase {
.
getAction
(
TestResultProjectAction
.
class
).
getLastTestResultAction
().
getTotalCount
();
.
getAction
(
TestResultProjectAction
.
class
).
getLastTestResultAction
().
getTotalCount
();
assertEquals
(
4
,
totalCount
);
assertEquals
(
4
,
totalCount
);
}
}
@Bug
(
9326
)
public
void
testTychoTestResults
()
throws
Exception
{
MavenInstallation
mavenInstallation
=
configureMaven3
();
MavenModuleSet
m
=
createMavenProject
();
m
.
setRootPOM
(
"org.foobar.build/pom.xml"
);
m
.
setMaven
(
mavenInstallation
.
getName
()
);
m
.
getReporters
().
add
(
new
TestReporter
());
m
.
setScm
(
new
ExtractResourceSCM
(
getClass
().
getResource
(
"JENKINS-9326.zip"
),
"foobar"
));
m
.
setGoals
(
"verify"
);
buildAndAssertSuccess
(
m
);
System
.
out
.
println
(
"modules size "
+
m
.
getModules
());
MavenModule
testModule
=
null
;
for
(
MavenModule
mavenModule
:
m
.
getModules
())
{
System
.
out
.
println
(
"module "
+
mavenModule
.
getName
()
+
"/"
+
mavenModule
.
getDisplayName
());
if
(
"org.foobar:org.foobar.test"
.
equals
(
mavenModule
.
getName
()
))
testModule
=
mavenModule
;
}
AbstractTestResultAction
trpa
=
testModule
.
getLastBuild
().
getTestResultAction
();
int
totalCount
=
trpa
.
getTotalCount
();
assertEquals
(
1
,
totalCount
);
}
private
static
class
TestReporter
extends
MavenReporter
{
private
static
class
TestReporter
extends
MavenReporter
{
@Override
@Override
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录