Skip to content

Commit

Permalink
Merge pull request #810 from kutzi/claim-plugin-fix
Browse files Browse the repository at this point in the history
[JENKINS-14585] core side fix for: claim-plugin cannot claim broken tests in maven jobs
  • Loading branch information
kutzi committed Jul 6, 2013
2 parents 3fdba72 + ee8753a commit 84ee0de
Showing 1 changed file with 27 additions and 16 deletions.
43 changes: 27 additions & 16 deletions maven-plugin/src/main/java/hudson/maven/MavenTestDataPublisher.java
Expand Up @@ -42,6 +42,7 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import net.sf.json.JSONObject;

Expand All @@ -68,22 +69,32 @@ public BuildStepMonitor getRequiredMonitorService() {
public boolean perform(AbstractBuild<?,?> build, Launcher launcher,
BuildListener listener) throws InterruptedException, IOException {

SurefireReport report = build.getAction(SurefireReport.class);
if (report == null) {
return true;
}

List<Data> data = new ArrayList<Data>();
if (testDataPublishers != null) {
for (TestDataPublisher tdp : testDataPublishers) {
Data d = tdp.getTestData(build, launcher, listener, report.getResult());
if (d != null) {
data.add(d);
}
}
}

report.setData(data);
MavenModuleSetBuild msb = (MavenModuleSetBuild) build;

Map<MavenModule, MavenBuild> moduleLastBuilds = msb.getModuleLastBuilds();

for (MavenBuild moduleBuild : moduleLastBuilds.values()) {

SurefireReport report = moduleBuild.getAction(SurefireReport.class);
if (report == null) {
continue;
}

List<Data> data = new ArrayList<Data>();
if (getTestDataPublishers() != null) {
for (TestDataPublisher tdp : getTestDataPublishers()) {
Data d = tdp.getTestData(build, launcher, listener, report.getResult());
if (d != null) {
data.add(d);
}
}
}

if (!data.isEmpty()) {
report.setData(data);
moduleBuild.save();
}
}

return true;
}
Expand Down

0 comments on commit 84ee0de

Please sign in to comment.