Skip to content
Permalink
Browse files
[JENKINS-23713] Compatibility with SimpleBuildStep.
  • Loading branch information
jglick committed Aug 11, 2014
1 parent 85b64ee commit 4ba5a491583157a90bfd472db5f657a60bb0c38e
Showing with 348 additions and 177 deletions.
  1. +1 −1 pom.xml
  2. +8 −9 src/main/java/hudson/tasks/junit/CaseResult.java
  3. +3 −3 src/main/java/hudson/tasks/junit/ClassResult.java
  4. +12 −10 src/main/java/hudson/tasks/junit/History.java
  5. +3 −7 src/main/java/hudson/tasks/junit/JUnitParser.java
  6. +46 −42 src/main/java/hudson/tasks/junit/JUnitResultArchiver.java
  7. +3 −3 src/main/java/hudson/tasks/junit/PackageResult.java
  8. +27 −2 src/main/java/hudson/tasks/junit/TestDataPublisher.java
  9. +38 −3 src/main/java/hudson/tasks/junit/TestObject.java
  10. +2 −3 src/main/java/hudson/tasks/junit/TestResult.java
  11. +26 −5 src/main/java/hudson/tasks/junit/TestResultAction.java
  12. +39 −17 src/main/java/hudson/tasks/test/AbstractTestResultAction.java
  13. +38 −6 src/main/java/hudson/tasks/test/AggregatedTestResultAction.java
  14. +3 −3 src/main/java/hudson/tasks/test/DefaultTestResultParserImpl.java
  15. +4 −4 src/main/java/hudson/tasks/test/SimpleCaseResult.java
  16. +14 −9 src/main/java/hudson/tasks/test/TestObject.java
  17. +3 −4 src/main/java/hudson/tasks/test/TestResult.java
  18. +33 −5 src/main/java/hudson/tasks/test/TestResultParser.java
  19. +18 −4 src/main/java/hudson/tasks/test/TestResultProjectAction.java
  20. +3 −3 src/main/resources/hudson/tasks/junit/CaseResult/index.jelly
  21. +2 −2 src/main/resources/hudson/tasks/junit/CaseResult/list.jelly
  22. +2 −2 src/main/resources/hudson/tasks/junit/ClassResult/list.jelly
  23. +3 −3 src/main/resources/hudson/tasks/junit/History/index.jelly
  24. +0 −2 src/main/resources/hudson/tasks/junit/Messages.properties
  25. +0 −1 src/main/resources/hudson/tasks/junit/Messages_da.properties
  26. +0 −1 src/main/resources/hudson/tasks/junit/Messages_de.properties
  27. +0 −1 src/main/resources/hudson/tasks/junit/Messages_es.properties
  28. +1 −3 src/main/resources/hudson/tasks/junit/Messages_ja.properties
  29. +0 −1 src/main/resources/hudson/tasks/junit/Messages_pt_BR.properties
  30. +0 −2 src/main/resources/hudson/tasks/junit/Messages_zh_TW.properties
  31. +1 −1 src/main/resources/hudson/tasks/test/AbstractTestResultAction/summary.jelly
  32. +2 −2 src/main/resources/hudson/tasks/test/MetaTabulatedResult/list.jelly
  33. +4 −4 src/main/resources/hudson/tasks/test/TestObject/sidepanel.jelly
  34. +2 −2 src/main/resources/hudson/tasks/test/TestResult/index.jelly
  35. +2 −2 src/main/resources/hudson/tasks/test/TestResultProjectAction/index.jelly
  36. +1 −1 src/main/resources/hudson/tasks/test/TestResultProjectAction/jobMain.jelly
  37. +1 −1 src/test/java/hudson/tasks/junit/JUnitParserTest.java
  38. +3 −3 src/test/java/hudson/tasks/test/TestResultExtensionTest.java
@@ -3,7 +3,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.575</version>
<version>1.577-SNAPSHOT</version>
</parent>
<artifactId>junit</artifactId>
<version>1.1-SNAPSHOT</version>
@@ -27,7 +27,6 @@
import org.apache.commons.io.FileUtils;
import org.jvnet.localizer.Localizable;

import hudson.model.AbstractBuild;
import hudson.model.Run;
import hudson.tasks.test.TestResult;

@@ -374,8 +373,8 @@ public int getFailedSince() {
CaseResult prev = getPreviousResult();
if(prev!=null && !prev.isPassed())
this.failedSince = prev.getFailedSince();
else if (getOwner() != null) {
this.failedSince = getOwner().getNumber();
else if (getRun() != null) {
this.failedSince = getRun().getNumber();
} else {
LOGGER.warning("trouble calculating getFailedSince. We've got prev, but no owner.");
// failedSince will be 0, which isn't correct.
@@ -385,7 +384,7 @@ else if (getOwner() != null) {
}

public Run<?,?> getFailedSinceRun() {
return getOwner().getParent().getBuildByNumber(getFailedSince());
return getRun().getParent().getBuildByNumber(getFailedSince());
}

/**
@@ -396,8 +395,8 @@ else if (getOwner() != null) {
public int getAge() {
if(isPassed())
return 0;
else if (getOwner() != null) {
return getOwner().getNumber()-getFailedSince()+1;
else if (getRun() != null) {
return getRun().getNumber()-getFailedSince()+1;
} else {
LOGGER.fine("Trying to get age of a CaseResult without an owner");
return 0;
@@ -553,14 +552,14 @@ public SuiteResult getSuiteResult() {
}

@Override
public AbstractBuild<?,?> getOwner() {
public Run<?,?> getRun() {
SuiteResult sr = getSuiteResult();
if (sr==null) {
LOGGER.warning("In getOwner(), getSuiteResult is null"); return null; }
hudson.tasks.junit.TestResult tr = sr.getParent();
if (tr==null) {
LOGGER.warning("In getOwner(), suiteResult.getParent() is null."); return null; }
return tr.getOwner();
return tr.getRun();
}

public void setParentSuiteResult(SuiteResult parent) {
@@ -575,7 +574,7 @@ public void freeze(SuiteResult parent) {
if(prev!=null && !prev.isPassed())
this.failedSince = prev.failedSince;
else
this.failedSince = getOwner().getNumber();
this.failedSince = getRun().getNumber();
}
}

@@ -23,7 +23,7 @@
*/
package hudson.tasks.junit;

import hudson.model.AbstractBuild;
import hudson.model.Run;
import hudson.tasks.test.TabulatedResult;
import hudson.tasks.test.TestResult;
import hudson.tasks.test.TestObject;
@@ -58,8 +58,8 @@
}

@Override
public AbstractBuild<?, ?> getOwner() {
return (parent==null ? null: parent.getOwner());
public Run<?, ?> getRun() {
return (parent==null ? null: parent.getRun());
}

public PackageResult getParent() {
@@ -24,6 +24,7 @@
package hudson.tasks.junit;

import hudson.model.AbstractBuild;
import hudson.model.Run;
import jenkins.model.Jenkins;
import hudson.tasks.test.TestObject;
import hudson.tasks.test.TestResult;
@@ -68,18 +69,18 @@ public TestObject getTestObject() {
}

public boolean historyAvailable() {
if (testObject.getOwner().getParent().getBuilds().size() > 1)
if (testObject.getRun().getParent().getBuilds().size() > 1)
return true;
else
return false;
}

public List<TestResult> getList(int start, int end) {
List<TestResult> list = new ArrayList<TestResult>();
end = Math.min(end, testObject.getOwner().getParent().getBuilds().size());
for (AbstractBuild<?,?> b: testObject.getOwner().getParent().getBuilds().subList(start, end)) {
end = Math.min(end, testObject.getRun().getParent().getBuilds().size());
for (Run<?,?> b: testObject.getRun().getParent().getBuilds().subList(start, end)) {
if (b.isBuilding()) continue;
TestResult o = testObject.getResultInBuild(b);
TestResult o = testObject.getResultInRun(b);
if (o != null) {
list.add(o);
}
@@ -88,7 +89,7 @@ public boolean historyAvailable() {
}

public List<TestResult> getList() {
return getList(0, testObject.getOwner().getParent().getBuilds().size());
return getList(0, testObject.getRun().getParent().getBuilds().size());
}

/**
@@ -223,7 +224,7 @@ public String generateURL(CategoryDataset dataset, int row,
public String generateToolTip(CategoryDataset dataset, int row,
int column) {
ChartLabel label = (ChartLabel) dataset.getColumnKey(column);
return label.o.getOwner().getDisplayName() + " : "
return label.o.getRun().getDisplayName() + " : "
+ label.o.getDurationString();
}
};
@@ -253,14 +254,14 @@ public String getUrl() {
}

private void generateUrl() {
AbstractBuild<?,?> build = o.getOwner();
Run<?,?> build = o.getRun();
String buildLink = build.getUrl();
String actionUrl = o.getTestResultAction().getUrlName();
this.url = Jenkins.getInstance().getRootUrl() + buildLink + actionUrl + o.getUrl();
}

public int compareTo(ChartLabel that) {
return this.o.getOwner().number - that.o.getOwner().number;
return this.o.getRun().number - that.o.getRun().number;
}

@Override
@@ -283,8 +284,9 @@ public int hashCode() {

@Override
public String toString() {
String l = o.getOwner().getDisplayName();
String s = o.getOwner().getBuiltOnStr();
Run<?, ?> run = o.getRun();
String l = run.getDisplayName();
String s = run instanceof AbstractBuild ? ((AbstractBuild) run).getBuiltOnStr() : null;
if (s != null)
l += ' ' + s;
return l;
@@ -25,8 +25,8 @@

import hudson.model.TaskListener;
import hudson.tasks.test.TestResultParser;
import hudson.model.AbstractBuild;
import hudson.*;
import hudson.model.Run;
import hudson.remoting.VirtualChannel;

import java.io.IOException;
@@ -69,8 +69,8 @@ public String getTestResultLocationMessage() {
}

@Override
public TestResult parse(String testResultLocations,
AbstractBuild build, Launcher launcher,
public TestResult parseResult(String testResultLocations,

This comment has been minimized.

Copy link
@daniel-beck

daniel-beck Oct 30, 2014

Member

Backwards incompatible change as it appears to have caused JENKINS-25375.

Run<?,?> build, FilePath workspace, Launcher launcher,
TaskListener listener)
throws InterruptedException, IOException
{
@@ -80,10 +80,6 @@ public TestResult parse(String testResultLocations,
// [BUG 3123310] TODO - Test Result Refactor: review and fix TestDataPublisher/TestAction subsystem]
// also get code that deals with testDataPublishers from JUnitResultArchiver.perform

FilePath workspace = build.getWorkspace();
if (workspace == null) {
throw new AbortException(Messages.JUnitParser_no_workspace_found(build));
}
return workspace.act(new ParseResultCallable(testResultLocations, buildTime, timeOnMaster, keepLongStdio));
}

0 comments on commit 4ba5a49

Please sign in to comment.