Skip to content

Commit

Permalink
[JENKINS-14585] MavenTestDataPublisher didn't do anything
Browse files Browse the repository at this point in the history
Originally-Committed-As: 8d246cbf9de8ed1ad1ec4256f814e7b40fe0e419
  • Loading branch information
kutzi committed Jun 14, 2013
1 parent 90bb490 commit 5f3364e
Showing 1 changed file with 27 additions and 16 deletions.
43 changes: 27 additions & 16 deletions 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) {
return true;
}

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 5f3364e

Please sign in to comment.