mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-17 05:52:26 +00:00
surefire plugin is hooked upto project action.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@2062 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
452a02ece3
commit
daa5530f1d
3 files changed
+20
-8
No files matched your search
@@ -90,6 +90,12 @@ public class MavenBuild extends AbstractBuild<MavenModule,MavenBuild> {
|
||||
return getAction(AbstractTestResultAction.class);
|
||||
}
|
||||
|
||||
public void registerAsProjectAction(MavenReporter reporter) {
|
||||
if(projectActionReporters==null)
|
||||
projectActionReporters = new ArrayList<MavenReporter>();
|
||||
projectActionReporters.add(reporter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
run(new RunnerImpl());
|
||||
@@ -199,9 +205,7 @@ public class MavenBuild extends AbstractBuild<MavenModule,MavenBuild> {
|
||||
}
|
||||
|
||||
public void registerAsProjectAction(MavenReporter reporter) {
|
||||
if(projectActionReporters==null)
|
||||
projectActionReporters = new ArrayList<MavenReporter>();
|
||||
projectActionReporters.add(reporter);
|
||||
MavenBuild.this.registerAsProjectAction(reporter);
|
||||
}
|
||||
|
||||
private Object writeReplace() {
|
||||
|
||||
@@ -7,10 +7,12 @@ import hudson.maven.MavenModule;
|
||||
import hudson.maven.MavenReporter;
|
||||
import hudson.maven.MavenReporterDescriptor;
|
||||
import hudson.maven.MojoInfo;
|
||||
import hudson.model.Action;
|
||||
import hudson.model.BuildListener;
|
||||
import hudson.model.Result;
|
||||
import hudson.tasks.junit.TestResult;
|
||||
import hudson.tasks.junit.TestResultAction;
|
||||
import hudson.tasks.test.TestResultProjectAction;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.tools.ant.DirectoryScanner;
|
||||
import org.apache.tools.ant.Project;
|
||||
@@ -68,6 +70,7 @@ public class SurefireArchiver extends MavenReporter {
|
||||
build.getActions().add(action);
|
||||
if(tr.getFailCount()>0)
|
||||
build.setResult(Result.UNSTABLE);
|
||||
build.registerAsProjectAction(SurefireArchiver.this);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
@@ -76,6 +79,11 @@ public class SurefireArchiver extends MavenReporter {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public Action getProjectAction(MavenModule module) {
|
||||
return new TestResultProjectAction(module);
|
||||
}
|
||||
|
||||
private boolean isSurefireTest(MojoInfo mojo) {
|
||||
return mojo.pluginName.matches("org.apache.maven.plugins", "maven-surefire-plugin") && mojo.getGoal().equals("test");
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package hudson.tasks.test;
|
||||
|
||||
import hudson.model.AbstractBuild;
|
||||
import hudson.model.AbstractProject;
|
||||
import hudson.model.Action;
|
||||
import hudson.model.Build;
|
||||
import hudson.model.Project;
|
||||
import hudson.tasks.junit.JUnitResultArchiver;
|
||||
import org.kohsuke.stapler.Ancestor;
|
||||
import org.kohsuke.stapler.StaplerRequest;
|
||||
@@ -27,9 +27,9 @@ public class TestResultProjectAction implements Action {
|
||||
/**
|
||||
* Project that owns this action.
|
||||
*/
|
||||
public final Project project;
|
||||
public final AbstractProject<?,?> project;
|
||||
|
||||
public TestResultProjectAction(Project project) {
|
||||
public TestResultProjectAction(AbstractProject<?,?> project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class TestResultProjectAction implements Action {
|
||||
}
|
||||
|
||||
protected AbstractTestResultAction getLastTestResultAction() {
|
||||
Build b = project.getLastSuccessfulBuild();
|
||||
AbstractBuild<?,?> b = project.getLastSuccessfulBuild();
|
||||
if(b!=null) {
|
||||
AbstractTestResultAction a = b.getTestResultAction();
|
||||
if(a!=null) return a;
|
||||
|
||||
Reference in new issue
Block a user