提交 7a43fdfa 编写于 作者: J Jesse Glick

Reverting portions of patch that were moved to junit-plugin.

上级 6e6ca263
...@@ -27,6 +27,7 @@ import hudson.util.TextFile; ...@@ -27,6 +27,7 @@ import hudson.util.TextFile;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.jvnet.localizer.Localizable; import org.jvnet.localizer.Localizable;
import hudson.model.AbstractBuild;
import hudson.model.Run; import hudson.model.Run;
import hudson.tasks.test.TestResult; import hudson.tasks.test.TestResult;
...@@ -373,8 +374,8 @@ public class CaseResult extends TestResult implements Comparable<CaseResult> { ...@@ -373,8 +374,8 @@ public class CaseResult extends TestResult implements Comparable<CaseResult> {
CaseResult prev = getPreviousResult(); CaseResult prev = getPreviousResult();
if(prev!=null && !prev.isPassed()) if(prev!=null && !prev.isPassed())
this.failedSince = prev.getFailedSince(); this.failedSince = prev.getFailedSince();
else if (getRun() != null) { else if (getOwner() != null) {
this.failedSince = getRun().getNumber(); this.failedSince = getOwner().getNumber();
} else { } else {
LOGGER.warning("trouble calculating getFailedSince. We've got prev, but no owner."); LOGGER.warning("trouble calculating getFailedSince. We've got prev, but no owner.");
// failedSince will be 0, which isn't correct. // failedSince will be 0, which isn't correct.
...@@ -384,7 +385,7 @@ public class CaseResult extends TestResult implements Comparable<CaseResult> { ...@@ -384,7 +385,7 @@ public class CaseResult extends TestResult implements Comparable<CaseResult> {
} }
public Run<?,?> getFailedSinceRun() { public Run<?,?> getFailedSinceRun() {
return getRun().getParent().getBuildByNumber(getFailedSince()); return getOwner().getParent().getBuildByNumber(getFailedSince());
} }
/** /**
...@@ -395,8 +396,8 @@ public class CaseResult extends TestResult implements Comparable<CaseResult> { ...@@ -395,8 +396,8 @@ public class CaseResult extends TestResult implements Comparable<CaseResult> {
public int getAge() { public int getAge() {
if(isPassed()) if(isPassed())
return 0; return 0;
else if (getRun() != null) { else if (getOwner() != null) {
return getRun().getNumber()-getFailedSince()+1; return getOwner().getNumber()-getFailedSince()+1;
} else { } else {
LOGGER.fine("Trying to get age of a CaseResult without an owner"); LOGGER.fine("Trying to get age of a CaseResult without an owner");
return 0; return 0;
...@@ -552,14 +553,14 @@ public class CaseResult extends TestResult implements Comparable<CaseResult> { ...@@ -552,14 +553,14 @@ public class CaseResult extends TestResult implements Comparable<CaseResult> {
} }
@Override @Override
public Run<?,?> getRun() { public AbstractBuild<?,?> getOwner() {
SuiteResult sr = getSuiteResult(); SuiteResult sr = getSuiteResult();
if (sr==null) { if (sr==null) {
LOGGER.warning("In getOwner(), getSuiteResult is null"); return null; } LOGGER.warning("In getOwner(), getSuiteResult is null"); return null; }
hudson.tasks.junit.TestResult tr = sr.getParent(); hudson.tasks.junit.TestResult tr = sr.getParent();
if (tr==null) { if (tr==null) {
LOGGER.warning("In getOwner(), suiteResult.getParent() is null."); return null; } LOGGER.warning("In getOwner(), suiteResult.getParent() is null."); return null; }
return tr.getRun(); return tr.getOwner();
} }
public void setParentSuiteResult(SuiteResult parent) { public void setParentSuiteResult(SuiteResult parent) {
...@@ -574,7 +575,7 @@ public class CaseResult extends TestResult implements Comparable<CaseResult> { ...@@ -574,7 +575,7 @@ public class CaseResult extends TestResult implements Comparable<CaseResult> {
if(prev!=null && !prev.isPassed()) if(prev!=null && !prev.isPassed())
this.failedSince = prev.failedSince; this.failedSince = prev.failedSince;
else else
this.failedSince = getRun().getNumber(); this.failedSince = getOwner().getNumber();
} }
} }
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
*/ */
package hudson.tasks.junit; package hudson.tasks.junit;
import hudson.model.Run; import hudson.model.AbstractBuild;
import hudson.tasks.test.TabulatedResult; import hudson.tasks.test.TabulatedResult;
import hudson.tasks.test.TestResult; import hudson.tasks.test.TestResult;
import hudson.tasks.test.TestObject; import hudson.tasks.test.TestObject;
...@@ -58,8 +58,8 @@ public final class ClassResult extends TabulatedResult implements Comparable<Cla ...@@ -58,8 +58,8 @@ public final class ClassResult extends TabulatedResult implements Comparable<Cla
} }
@Override @Override
public Run<?, ?> getRun() { public AbstractBuild<?, ?> getOwner() {
return (parent==null ? null: parent.getRun()); return (parent==null ? null: parent.getOwner());
} }
public PackageResult getParent() { public PackageResult getParent() {
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
package hudson.tasks.junit; package hudson.tasks.junit;
import hudson.model.AbstractBuild; import hudson.model.AbstractBuild;
import hudson.model.Run;
import jenkins.model.Jenkins; import jenkins.model.Jenkins;
import hudson.tasks.test.TestObject; import hudson.tasks.test.TestObject;
import hudson.tasks.test.TestResult; import hudson.tasks.test.TestResult;
...@@ -69,7 +68,7 @@ public class History { ...@@ -69,7 +68,7 @@ public class History {
} }
public boolean historyAvailable() { public boolean historyAvailable() {
if (testObject.getRun().getParent().getBuilds().size() > 1) if (testObject.getOwner().getParent().getBuilds().size() > 1)
return true; return true;
else else
return false; return false;
...@@ -77,10 +76,10 @@ public class History { ...@@ -77,10 +76,10 @@ public class History {
public List<TestResult> getList(int start, int end) { public List<TestResult> getList(int start, int end) {
List<TestResult> list = new ArrayList<TestResult>(); List<TestResult> list = new ArrayList<TestResult>();
end = Math.min(end, testObject.getRun().getParent().getBuilds().size()); end = Math.min(end, testObject.getOwner().getParent().getBuilds().size());
for (Run<?,?> b: testObject.getRun().getParent().getBuilds().subList(start, end)) { for (AbstractBuild<?,?> b: testObject.getOwner().getParent().getBuilds().subList(start, end)) {
if (b.isBuilding()) continue; if (b.isBuilding()) continue;
TestResult o = testObject.getResultInRun(b); TestResult o = testObject.getResultInBuild(b);
if (o != null) { if (o != null) {
list.add(o); list.add(o);
} }
...@@ -89,7 +88,7 @@ public class History { ...@@ -89,7 +88,7 @@ public class History {
} }
public List<TestResult> getList() { public List<TestResult> getList() {
return getList(0, testObject.getRun().getParent().getBuilds().size()); return getList(0, testObject.getOwner().getParent().getBuilds().size());
} }
/** /**
...@@ -224,7 +223,7 @@ public class History { ...@@ -224,7 +223,7 @@ public class History {
public String generateToolTip(CategoryDataset dataset, int row, public String generateToolTip(CategoryDataset dataset, int row,
int column) { int column) {
ChartLabel label = (ChartLabel) dataset.getColumnKey(column); ChartLabel label = (ChartLabel) dataset.getColumnKey(column);
return label.o.getRun().getDisplayName() + " : " return label.o.getOwner().getDisplayName() + " : "
+ label.o.getDurationString(); + label.o.getDurationString();
} }
}; };
...@@ -254,14 +253,14 @@ public class History { ...@@ -254,14 +253,14 @@ public class History {
} }
private void generateUrl() { private void generateUrl() {
Run<?,?> build = o.getRun(); AbstractBuild<?,?> build = o.getOwner();
String buildLink = build.getUrl(); String buildLink = build.getUrl();
String actionUrl = o.getTestResultAction().getUrlName(); String actionUrl = o.getTestResultAction().getUrlName();
this.url = Jenkins.getInstance().getRootUrl() + buildLink + actionUrl + o.getUrl(); this.url = Jenkins.getInstance().getRootUrl() + buildLink + actionUrl + o.getUrl();
} }
public int compareTo(ChartLabel that) { public int compareTo(ChartLabel that) {
return this.o.getRun().number - that.o.getRun().number; return this.o.getOwner().number - that.o.getOwner().number;
} }
@Override @Override
...@@ -284,9 +283,8 @@ public class History { ...@@ -284,9 +283,8 @@ public class History {
@Override @Override
public String toString() { public String toString() {
Run<?, ?> run = o.getRun(); String l = o.getOwner().getDisplayName();
String l = run.getDisplayName(); String s = o.getOwner().getBuiltOnStr();
String s = run instanceof AbstractBuild ? ((AbstractBuild) run).getBuiltOnStr() : null;
if (s != null) if (s != null)
l += ' ' + s; l += ' ' + s;
return l; return l;
......
...@@ -25,8 +25,8 @@ package hudson.tasks.junit; ...@@ -25,8 +25,8 @@ package hudson.tasks.junit;
import hudson.model.TaskListener; import hudson.model.TaskListener;
import hudson.tasks.test.TestResultParser; import hudson.tasks.test.TestResultParser;
import hudson.model.AbstractBuild;
import hudson.*; import hudson.*;
import hudson.model.Run;
import hudson.remoting.VirtualChannel; import hudson.remoting.VirtualChannel;
import java.io.IOException; import java.io.IOException;
...@@ -69,8 +69,8 @@ public class JUnitParser extends TestResultParser { ...@@ -69,8 +69,8 @@ public class JUnitParser extends TestResultParser {
} }
@Override @Override
public TestResult parseResult(String testResultLocations, public TestResult parse(String testResultLocations,
Run<?,?> build, FilePath workspace, Launcher launcher, AbstractBuild build, Launcher launcher,
TaskListener listener) TaskListener listener)
throws InterruptedException, IOException throws InterruptedException, IOException
{ {
...@@ -80,6 +80,10 @@ public class JUnitParser extends TestResultParser { ...@@ -80,6 +80,10 @@ public class JUnitParser extends TestResultParser {
// [BUG 3123310] TODO - Test Result Refactor: review and fix TestDataPublisher/TestAction subsystem] // [BUG 3123310] TODO - Test Result Refactor: review and fix TestDataPublisher/TestAction subsystem]
// also get code that deals with testDataPublishers from JUnitResultArchiver.perform // 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)); return workspace.act(new ParseResultCallable(testResultLocations, buildTime, timeOnMaster, keepLongStdio));
} }
......
...@@ -30,17 +30,17 @@ import hudson.FilePath; ...@@ -30,17 +30,17 @@ import hudson.FilePath;
import hudson.Launcher; import hudson.Launcher;
import hudson.model.AbstractBuild; import hudson.model.AbstractBuild;
import hudson.model.AbstractProject; import hudson.model.AbstractProject;
import hudson.model.Action;
import hudson.model.BuildListener; import hudson.model.BuildListener;
import hudson.model.Descriptor; import hudson.model.Descriptor;
import hudson.model.Result; import hudson.model.Result;
import hudson.model.Run;
import hudson.model.Saveable; import hudson.model.Saveable;
import hudson.model.TaskListener;
import hudson.tasks.BuildStepDescriptor; import hudson.tasks.BuildStepDescriptor;
import hudson.tasks.BuildStepMonitor; import hudson.tasks.BuildStepMonitor;
import hudson.tasks.Publisher; import hudson.tasks.Publisher;
import hudson.tasks.Recorder; import hudson.tasks.Recorder;
import hudson.tasks.junit.TestResultAction.Data; import hudson.tasks.junit.TestResultAction.Data;
import hudson.tasks.test.TestResultProjectAction;
import hudson.util.DescribableList; import hudson.util.DescribableList;
import hudson.util.FormValidation; import hudson.util.FormValidation;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
...@@ -52,18 +52,18 @@ import org.kohsuke.stapler.QueryParameter; ...@@ -52,18 +52,18 @@ import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.StaplerRequest;
import java.io.IOException; import java.io.IOException;
import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List; import java.util.List;
import javax.annotation.Nonnull;
import jenkins.tasks.SimpleBuildStep;
import org.kohsuke.stapler.DataBoundSetter;
/** /**
* Generates HTML report from JUnit test result XML files. * Generates HTML report from JUnit test result XML files.
* *
* @author Kohsuke Kawaguchi * @author Kohsuke Kawaguchi
*/ */
public class JUnitResultArchiver extends Recorder implements SimpleBuildStep { public class JUnitResultArchiver extends Recorder {
/** /**
* {@link FileSet} "includes" string, like "foo/bar/*.xml" * {@link FileSet} "includes" string, like "foo/bar/*.xml"
...@@ -74,20 +74,24 @@ public class JUnitResultArchiver extends Recorder implements SimpleBuildStep { ...@@ -74,20 +74,24 @@ public class JUnitResultArchiver extends Recorder implements SimpleBuildStep {
* If true, retain a suite's complete stdout/stderr even if this is huge and the suite passed. * If true, retain a suite's complete stdout/stderr even if this is huge and the suite passed.
* @since 1.358 * @since 1.358
*/ */
private boolean keepLongStdio; private final boolean keepLongStdio;
/** /**
* {@link TestDataPublisher}s configured for this archiver, to process the recorded data. * {@link TestDataPublisher}s configured for this archiver, to process the recorded data.
* For compatibility reasons, can be null. * For compatibility reasons, can be null.
* @since 1.320 * @since 1.320
*/ */
private DescribableList<TestDataPublisher, Descriptor<TestDataPublisher>> testDataPublishers; private final DescribableList<TestDataPublisher, Descriptor<TestDataPublisher>> testDataPublishers;
private Double healthScaleFactor; private final Double healthScaleFactor;
@DataBoundConstructor /**
* left for backwards compatibility
* @deprecated since 2009-08-09.
*/
@Deprecated
public JUnitResultArchiver(String testResults) { public JUnitResultArchiver(String testResults) {
this.testResults = testResults; this(testResults, false, null);
} }
@Deprecated @Deprecated
...@@ -104,44 +108,44 @@ public class JUnitResultArchiver extends Recorder implements SimpleBuildStep { ...@@ -104,44 +108,44 @@ public class JUnitResultArchiver extends Recorder implements SimpleBuildStep {
this(testResults, keepLongStdio, testDataPublishers, 1.0); this(testResults, keepLongStdio, testDataPublishers, 1.0);
} }
@Deprecated @DataBoundConstructor
public JUnitResultArchiver( public JUnitResultArchiver(
String testResults, String testResults,
boolean keepLongStdio, boolean keepLongStdio,
DescribableList<TestDataPublisher, Descriptor<TestDataPublisher>> testDataPublishers, DescribableList<TestDataPublisher, Descriptor<TestDataPublisher>> testDataPublishers,
double healthScaleFactor) { double healthScaleFactor) {
this.testResults = testResults; this.testResults = testResults;
setKeepLongStdio(keepLongStdio); this.keepLongStdio = keepLongStdio;
setTestDataPublishers(testDataPublishers); this.testDataPublishers = testDataPublishers;
setHealthScaleFactor(healthScaleFactor); this.healthScaleFactor = Math.max(0.0,healthScaleFactor);
} }
private TestResult parse(String expandedTestResults, Run<?,?> run, @Nonnull FilePath workspace, Launcher launcher, TaskListener listener) /**
throws IOException, InterruptedException * In progress. Working on delegating the actual parsing to the JUnitParser.
{ */
return new JUnitParser(isKeepLongStdio()).parseResult(expandedTestResults, run, workspace, launcher, listener);
}
@Deprecated
protected TestResult parse(String expandedTestResults, AbstractBuild build, Launcher launcher, BuildListener listener) protected TestResult parse(String expandedTestResults, AbstractBuild build, Launcher launcher, BuildListener listener)
throws IOException, InterruptedException throws IOException, InterruptedException
{ {
return parse(expandedTestResults, build, build.getWorkspace(), launcher, listener); return new JUnitParser(isKeepLongStdio()).parse(expandedTestResults, build, launcher, listener);
} }
@Override @Override
public void perform(Run build, FilePath workspace, Launcher launcher, public boolean perform(AbstractBuild build, Launcher launcher,
TaskListener listener) throws InterruptedException, IOException { BuildListener listener) throws InterruptedException, IOException {
listener.getLogger().println(Messages.JUnitResultArchiver_Recording()); listener.getLogger().println(Messages.JUnitResultArchiver_Recording());
TestResultAction action; TestResultAction action;
final String testResults = build.getEnvironment(listener).expand(this.testResults); final String testResults = build.getEnvironment(listener).expand(this.testResults);
try { try {
TestResult result = parse(testResults, build, workspace, launcher, listener); TestResult result = parse(testResults, build, launcher, listener);
// TODO can the build argument be omitted now, or is it used prior to the call to addAction? try {
action = new TestResultAction(build, result, listener); // TODO can the build argument be omitted now, or is it used prior to the call to addAction?
action = new TestResultAction(build, result, listener);
} catch (NullPointerException npe) {
throw new AbortException(Messages.JUnitResultArchiver_BadXML(testResults));
}
action.setHealthScaleFactor(getHealthScaleFactor()); // TODO do we want to move this to the constructor? action.setHealthScaleFactor(getHealthScaleFactor()); // TODO do we want to move this to the constructor?
result.freeze(action); result.freeze(action);
if (result.isEmpty()) { if (result.isEmpty()) {
...@@ -153,7 +157,7 @@ public class JUnitResultArchiver extends Recorder implements SimpleBuildStep { ...@@ -153,7 +157,7 @@ public class JUnitResultArchiver extends Recorder implements SimpleBuildStep {
List<Data> data = new ArrayList<Data>(); List<Data> data = new ArrayList<Data>();
if (testDataPublishers != null) { if (testDataPublishers != null) {
for (TestDataPublisher tdp : testDataPublishers) { for (TestDataPublisher tdp : testDataPublishers) {
Data d = tdp.contributeTestData(build, workspace, launcher, listener, result); Data d = tdp.getTestData(build, launcher, listener, result);
if (d != null) { if (d != null) {
data.add(d); data.add(d);
} }
...@@ -165,21 +169,23 @@ public class JUnitResultArchiver extends Recorder implements SimpleBuildStep { ...@@ -165,21 +169,23 @@ public class JUnitResultArchiver extends Recorder implements SimpleBuildStep {
if (build.getResult() == Result.FAILURE) if (build.getResult() == Result.FAILURE)
// most likely a build failed before it gets to the test phase. // most likely a build failed before it gets to the test phase.
// don't report confusing error message. // don't report confusing error message.
return; return true;
listener.getLogger().println(e.getMessage()); listener.getLogger().println(e.getMessage());
build.setResult(Result.FAILURE); build.setResult(Result.FAILURE);
return; return true;
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(listener.error("Failed to archive test reports")); e.printStackTrace(listener.error("Failed to archive test reports"));
build.setResult(Result.FAILURE); build.setResult(Result.FAILURE);
return; return true;
} }
build.addAction(action); build.addAction(action);
if (action.getResult().getFailCount() > 0) if (action.getResult().getFailCount() > 0)
build.setResult(Result.UNSTABLE); build.setResult(Result.UNSTABLE);
return true;
} }
/** /**
...@@ -204,19 +210,14 @@ public class JUnitResultArchiver extends Recorder implements SimpleBuildStep { ...@@ -204,19 +210,14 @@ public class JUnitResultArchiver extends Recorder implements SimpleBuildStep {
return healthScaleFactor == null ? 1.0 : healthScaleFactor; return healthScaleFactor == null ? 1.0 : healthScaleFactor;
} }
/** @since TODO */
public final void setHealthScaleFactor(double healthScaleFactor) {
this.healthScaleFactor = Math.max(0.0, healthScaleFactor);
}
public DescribableList<TestDataPublisher, Descriptor<TestDataPublisher>> getTestDataPublishers() { public DescribableList<TestDataPublisher, Descriptor<TestDataPublisher>> getTestDataPublishers() {
return testDataPublishers; return testDataPublishers;
} }
/** @since TODO */ @Override
public final void setTestDataPublishers(DescribableList<TestDataPublisher,Descriptor<TestDataPublisher>> testDataPublishers) { public Collection<Action> getProjectActions(AbstractProject<?, ?> project) {
this.testDataPublishers = testDataPublishers; return Collections.<Action>singleton(new TestResultProjectAction(project));
} }
/** /**
* @return the keepLongStdio * @return the keepLongStdio
...@@ -225,11 +226,6 @@ public class JUnitResultArchiver extends Recorder implements SimpleBuildStep { ...@@ -225,11 +226,6 @@ public class JUnitResultArchiver extends Recorder implements SimpleBuildStep {
return keepLongStdio; return keepLongStdio;
} }
/** @since TODO */
@DataBoundSetter public final void setKeepLongStdio(boolean keepLongStdio) {
this.keepLongStdio = keepLongStdio;
}
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Extension @Extension
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
*/ */
package hudson.tasks.junit; package hudson.tasks.junit;
import hudson.model.Run; import hudson.model.AbstractBuild;
import hudson.tasks.test.MetaTabulatedResult; import hudson.tasks.test.MetaTabulatedResult;
import hudson.tasks.test.TestResult; import hudson.tasks.test.TestResult;
import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.StaplerRequest;
...@@ -55,8 +55,8 @@ public final class PackageResult extends MetaTabulatedResult implements Comparab ...@@ -55,8 +55,8 @@ public final class PackageResult extends MetaTabulatedResult implements Comparab
} }
@Override @Override
public Run<?,?> getRun() { public AbstractBuild<?, ?> getOwner() {
return (parent == null ? null : parent.getRun()); return (parent == null ? null : parent.getOwner());
} }
public hudson.tasks.junit.TestResult getParent() { public hudson.tasks.junit.TestResult getParent() {
......
...@@ -26,14 +26,11 @@ package hudson.tasks.junit; ...@@ -26,14 +26,11 @@ package hudson.tasks.junit;
import hudson.DescriptorExtensionList; import hudson.DescriptorExtensionList;
import hudson.Extension; import hudson.Extension;
import hudson.ExtensionPoint; import hudson.ExtensionPoint;
import hudson.FilePath;
import hudson.Launcher; import hudson.Launcher;
import hudson.Util;
import hudson.model.*; import hudson.model.*;
import jenkins.model.Jenkins; import jenkins.model.Jenkins;
import java.io.IOException; import java.io.IOException;
import javax.annotation.Nonnull;
/** /**
* Contributes {@link TestAction}s to test results. * Contributes {@link TestAction}s to test results.
...@@ -53,32 +50,10 @@ public abstract class TestDataPublisher extends AbstractDescribableImpl<TestData ...@@ -53,32 +50,10 @@ public abstract class TestDataPublisher extends AbstractDescribableImpl<TestData
* *
* @return * @return
* can be null to indicate that there's nothing to contribute for this test result. * can be null to indicate that there's nothing to contribute for this test result.
* @since TODO
*/ */
public TestResultAction.Data contributeTestData( public abstract TestResultAction.Data getTestData(
Run<?,?> run, @Nonnull FilePath workspace, Launcher launcher,
TaskListener listener, TestResult testResult) throws IOException, InterruptedException {
if (run instanceof AbstractBuild && listener instanceof BuildListener) {
return getTestData((AbstractBuild) run, launcher, (BuildListener) listener, testResult);
} else {
throw new AbstractMethodError("you must override contributeTestData");
}
}
@Deprecated
public TestResultAction.Data getTestData(
AbstractBuild<?, ?> build, Launcher launcher, AbstractBuild<?, ?> build, Launcher launcher,
BuildListener listener, TestResult testResult) throws IOException, InterruptedException { BuildListener listener, TestResult testResult) throws IOException, InterruptedException;
if (Util.isOverridden(TestDataPublisher.class, getClass(), "contributeTestData", Run.class, FilePath.class, Launcher.class, TaskListener.class, TestResult.class)) {
FilePath workspace = build.getWorkspace();
if (workspace == null) {
throw new IOException("no workspace in " + build);
}
return contributeTestData(build, workspace, launcher, listener, testResult);
} else {
throw new AbstractMethodError("you must override contributeTestData");
}
}
public static DescriptorExtensionList<TestDataPublisher, Descriptor<TestDataPublisher>> all() { public static DescriptorExtensionList<TestDataPublisher, Descriptor<TestDataPublisher>> all() {
return Jenkins.getInstance().<TestDataPublisher, Descriptor<TestDataPublisher>>getDescriptorList(TestDataPublisher.class); return Jenkins.getInstance().<TestDataPublisher, Descriptor<TestDataPublisher>>getDescriptorList(TestDataPublisher.class);
......
...@@ -23,11 +23,9 @@ ...@@ -23,11 +23,9 @@
*/ */
package hudson.tasks.junit; package hudson.tasks.junit;
import hudson.Util;
import hudson.model.AbstractBuild; import hudson.model.AbstractBuild;
import hudson.model.AbstractModelObject; import hudson.model.AbstractModelObject;
import hudson.model.Api; import hudson.model.Api;
import hudson.model.Run;
import hudson.tasks.test.AbstractTestResultAction; import hudson.tasks.test.AbstractTestResultAction;
import org.kohsuke.stapler.export.ExportedBean; import org.kohsuke.stapler.export.ExportedBean;
...@@ -46,23 +44,8 @@ import java.util.List; ...@@ -46,23 +44,8 @@ import java.util.List;
*/ */
@ExportedBean @ExportedBean
public abstract class TestObject extends AbstractModelObject implements Serializable { public abstract class TestObject extends AbstractModelObject implements Serializable {
public abstract AbstractBuild<?,?> getOwner() ;
@Deprecated
public AbstractBuild<?,?> getOwner() {
if (Util.isOverridden(TestObject.class, getClass(), "getRun")) {
Run<?,?> r = getRun();
return r instanceof AbstractBuild ? (AbstractBuild) r : null;
} else {
throw new AbstractMethodError("you must override getRun");
}
}
/**
* @since TODO
*/
public Run<?,?> getRun() {
return getOwner();
}
public abstract TestObject getParent(); public abstract TestObject getParent();
...@@ -86,26 +69,8 @@ public abstract class TestObject extends AbstractModelObject implements Serializ ...@@ -86,26 +69,8 @@ public abstract class TestObject extends AbstractModelObject implements Serializ
* @return null if no such counter part exists. * @return null if no such counter part exists.
*/ */
public abstract TestObject getPreviousResult(); public abstract TestObject getPreviousResult();
@Deprecated public abstract TestObject getResultInBuild(AbstractBuild<?,?> build);
public TestObject getResultInBuild(AbstractBuild<?,?> build) {
if (Util.isOverridden(TestObject.class, getClass(), "getResultInRun", Run.class)) {
return getResultInRun(build);
} else {
throw new AbstractMethodError("you must override getResultInRun");
}
}
/**
* @since TODO
*/
public TestObject getResultInRun(Run<?,?> run) {
if (run instanceof AbstractBuild) {
return getResultInBuild((AbstractBuild) run);
} else {
throw new AbstractMethodError("you must override getResultInRun");
}
}
/** /**
* Time took to run this test. In seconds. * Time took to run this test. In seconds.
......
...@@ -25,6 +25,7 @@ package hudson.tasks.junit; ...@@ -25,6 +25,7 @@ package hudson.tasks.junit;
import hudson.AbortException; import hudson.AbortException;
import hudson.Util; import hudson.Util;
import hudson.model.AbstractBuild;
import hudson.model.Run; import hudson.model.Run;
import hudson.tasks.test.AbstractTestResultAction; import hudson.tasks.test.AbstractTestResultAction;
import hudson.tasks.test.MetaTabulatedResult; import hudson.tasks.test.MetaTabulatedResult;
...@@ -295,8 +296,8 @@ public final class TestResult extends MetaTabulatedResult { ...@@ -295,8 +296,8 @@ public final class TestResult extends MetaTabulatedResult {
} }
@Override @Override
public Run<?,?> getRun() { public AbstractBuild<?,?> getOwner() {
return (parentAction == null? null: parentAction.run); return (parentAction == null? null: parentAction.owner);
} }
@Override @Override
......
...@@ -26,13 +26,11 @@ package hudson.tasks.junit; ...@@ -26,13 +26,11 @@ package hudson.tasks.junit;
import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.XStream;
import hudson.XmlFile; import hudson.XmlFile;
import hudson.model.AbstractBuild; import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.Action; import hudson.model.Action;
import hudson.model.BuildListener; import hudson.model.BuildListener;
import hudson.model.Run;
import hudson.model.TaskListener;
import hudson.tasks.test.AbstractTestResultAction; import hudson.tasks.test.AbstractTestResultAction;
import hudson.tasks.test.TestObject; import hudson.tasks.test.TestObject;
import hudson.tasks.test.TestResultProjectAction;
import hudson.util.HeapSpaceStringConverter; import hudson.util.HeapSpaceStringConverter;
import hudson.util.XStream2; import hudson.util.XStream2;
import org.kohsuke.stapler.StaplerProxy; import org.kohsuke.stapler.StaplerProxy;
...@@ -41,12 +39,10 @@ import java.io.File; ...@@ -41,12 +39,10 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import jenkins.tasks.SimpleBuildStep;
/** /**
* {@link Action} that displays the JUnit test result. * {@link Action} that displays the JUnit test result.
...@@ -57,7 +53,7 @@ import jenkins.tasks.SimpleBuildStep; ...@@ -57,7 +53,7 @@ import jenkins.tasks.SimpleBuildStep;
* *
* @author Kohsuke Kawaguchi * @author Kohsuke Kawaguchi
*/ */
public class TestResultAction extends AbstractTestResultAction<TestResultAction> implements StaplerProxy, SimpleBuildStep.LastBuildAction { public class TestResultAction extends AbstractTestResultAction<TestResultAction> implements StaplerProxy {
private transient WeakReference<TestResult> result; private transient WeakReference<TestResult> result;
// Hudson < 1.25 didn't set these fields, so use Integer // Hudson < 1.25 didn't set these fields, so use Integer
...@@ -70,13 +66,6 @@ public class TestResultAction extends AbstractTestResultAction<TestResultAction> ...@@ -70,13 +66,6 @@ public class TestResultAction extends AbstractTestResultAction<TestResultAction>
@Deprecated @Deprecated
public TestResultAction(AbstractBuild owner, TestResult result, BuildListener listener) { public TestResultAction(AbstractBuild owner, TestResult result, BuildListener listener) {
this((Run) owner, result, listener);
}
/**
* @since TODO
*/
public TestResultAction(Run owner, TestResult result, TaskListener listener) {
super(owner); super(owner);
setResult(result, listener); setResult(result, listener);
} }
...@@ -86,15 +75,10 @@ public class TestResultAction extends AbstractTestResultAction<TestResultAction> ...@@ -86,15 +75,10 @@ public class TestResultAction extends AbstractTestResultAction<TestResultAction>
this(null, result, listener); this(null, result, listener);
} }
@Override public Collection<? extends Action> getProjectActions() {
return Collections.<Action>singleton(new TestResultProjectAction(run.getParent()));
}
/** /**
* Overwrites the {@link TestResult} by a new data set. * Overwrites the {@link TestResult} by a new data set.
* @since TODO
*/ */
public synchronized void setResult(TestResult result, TaskListener listener) { public synchronized void setResult(TestResult result, BuildListener listener) {
result.freeze(this); result.freeze(this);
totalCount = result.getTotalCount(); totalCount = result.getTotalCount();
...@@ -111,13 +95,8 @@ public class TestResultAction extends AbstractTestResultAction<TestResultAction> ...@@ -111,13 +95,8 @@ public class TestResultAction extends AbstractTestResultAction<TestResultAction>
this.result = new WeakReference<TestResult>(result); this.result = new WeakReference<TestResult>(result);
} }
@Deprecated
public void setResult(TestResult result, BuildListener listener) {
setResult(result, (TaskListener) listener);
}
private XmlFile getDataFile() { private XmlFile getDataFile() {
return new XmlFile(XSTREAM, new File(run.getRootDir(), "junitResult.xml")); return new XmlFile(XSTREAM,new File(owner.getRootDir(), "junitResult.xml"));
} }
public synchronized TestResult getResult() { public synchronized TestResult getResult() {
...@@ -215,7 +194,7 @@ public class TestResultAction extends AbstractTestResultAction<TestResultAction> ...@@ -215,7 +194,7 @@ public class TestResultAction extends AbstractTestResultAction<TestResultAction>
* Resolves {@link TestAction}s for the given {@link TestObject}. * Resolves {@link TestAction}s for the given {@link TestObject}.
* *
* <p> * <p>
* This object itself is persisted as a part of {@link Run}, so it needs to be XStream-serializable. * This object itself is persisted as a part of {@link AbstractBuild}, so it needs to be XStream-serializable.
* *
* @see TestDataPublisher * @see TestDataPublisher
*/ */
......
...@@ -37,7 +37,6 @@ import java.util.Map; ...@@ -37,7 +37,6 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import jenkins.model.RunAction2; import jenkins.model.RunAction2;
import jenkins.model.lazy.LazyBuildMixIn;
import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart; import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.CategoryAxis; import org.jfree.chart.axis.CategoryAxis;
...@@ -65,12 +64,6 @@ import org.kohsuke.stapler.export.ExportedBean; ...@@ -65,12 +64,6 @@ import org.kohsuke.stapler.export.ExportedBean;
*/ */
@ExportedBean @ExportedBean
public abstract class AbstractTestResultAction<T extends AbstractTestResultAction> implements HealthReportingAction, RunAction2 { public abstract class AbstractTestResultAction<T extends AbstractTestResultAction> implements HealthReportingAction, RunAction2 {
/**
* @since TODO
*/
public transient Run<?,?> run;
@Deprecated
public transient AbstractBuild<?,?> owner; public transient AbstractBuild<?,?> owner;
private Map<String,String> descriptions = new ConcurrentHashMap<String, String>(); private Map<String,String> descriptions = new ConcurrentHashMap<String, String>();
...@@ -78,28 +71,18 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio ...@@ -78,28 +71,18 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio
/** @since 1.545 */ /** @since 1.545 */
protected AbstractTestResultAction() {} protected AbstractTestResultAction() {}
/** /** @deprecated Use the default constructor and just call {@link Run#addAction} to associate the build with the action. */
* @deprecated Use the default constructor and just call {@link Run#addAction} to associate the build with the action.
* @since TODO
*/
@Deprecated
protected AbstractTestResultAction(Run owner) {
onAttached(owner);
}
@Deprecated @Deprecated
protected AbstractTestResultAction(AbstractBuild owner) { protected AbstractTestResultAction(AbstractBuild owner) {
this((Run) owner); this.owner = owner;
} }
@Override public void onAttached(Run<?, ?> r) { @Override public void onAttached(Run<?, ?> r) {
this.run = r; this.owner = (AbstractBuild<?,?>) r;
this.owner = r instanceof AbstractBuild ? (AbstractBuild<?,?>) r : null;
} }
@Override public void onLoad(Run<?, ?> r) { @Override public void onLoad(Run<?, ?> r) {
this.run = r; this.owner = (AbstractBuild<?,?>) r;
this.owner = r instanceof AbstractBuild ? (AbstractBuild<?,?>) r : null;
} }
/** /**
...@@ -209,15 +192,10 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio ...@@ -209,15 +192,10 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio
} }
private <U extends AbstractTestResultAction> U getPreviousResult(Class<U> type, boolean eager) { private <U extends AbstractTestResultAction> U getPreviousResult(Class<U> type, boolean eager) {
Run<?,?> b = run; Set<Integer> loadedBuilds = eager ? null : owner.getProject()._getRuns().getLoadedBuilds().keySet();
Set<Integer> loadedBuilds; AbstractBuild<?,?> b = owner;
if (!eager && run.getParent() instanceof LazyBuildMixIn.LazyLoadingJob) {
loadedBuilds = ((LazyBuildMixIn.LazyLoadingJob<?,?>) run.getParent()).getLazyBuildMixIn()._getRuns().getLoadedBuilds().keySet();
} else {
loadedBuilds = null;
}
while(true) { while(true) {
b = loadedBuilds == null || loadedBuilds.contains(b.number - /* assuming there are no gaps */1) ? b.getPreviousBuild() : null; b = eager || loadedBuilds.contains(b.number - /* assuming there are no gaps */1) ? b.getPreviousBuild() : null;
if(b==null) if(b==null)
return null; return null;
U r = b.getAction(type); U r = b.getAction(type);
...@@ -259,7 +237,7 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio ...@@ -259,7 +237,7 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio
return; return;
} }
if(req.checkIfModified(run.getTimestamp(),rsp)) if(req.checkIfModified(owner.getTimestamp(),rsp))
return; return;
ChartUtil.generateGraph(req,rsp,createChart(req,buildDataSet(req)),calcDefaultSize()); ChartUtil.generateGraph(req,rsp,createChart(req,buildDataSet(req)),calcDefaultSize());
...@@ -269,7 +247,7 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio ...@@ -269,7 +247,7 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio
* Generates a clickable map HTML for {@link #doGraph(StaplerRequest, StaplerResponse)}. * Generates a clickable map HTML for {@link #doGraph(StaplerRequest, StaplerResponse)}.
*/ */
public void doGraphMap( StaplerRequest req, StaplerResponse rsp) throws IOException { public void doGraphMap( StaplerRequest req, StaplerResponse rsp) throws IOException {
if(req.checkIfModified(run.getTimestamp(),rsp)) if(req.checkIfModified(owner.getTimestamp(),rsp))
return; return;
ChartUtil.generateClickableMap(req,rsp,createChart(req,buildDataSet(req)),calcDefaultSize()); ChartUtil.generateClickableMap(req,rsp,createChart(req,buildDataSet(req)),calcDefaultSize());
} }
...@@ -301,10 +279,10 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio ...@@ -301,10 +279,10 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio
DataSetBuilder<String,NumberOnlyBuildLabel> dsb = new DataSetBuilder<String,NumberOnlyBuildLabel>(); DataSetBuilder<String,NumberOnlyBuildLabel> dsb = new DataSetBuilder<String,NumberOnlyBuildLabel>();
for (AbstractTestResultAction<?> a = this; a != null; a = a.getPreviousResult(AbstractTestResultAction.class, false)) { for (AbstractTestResultAction<?> a = this; a != null; a = a.getPreviousResult(AbstractTestResultAction.class, false)) {
dsb.add( a.getFailCount(), "failed", new NumberOnlyBuildLabel(a.run)); dsb.add( a.getFailCount(), "failed", new NumberOnlyBuildLabel(a.owner));
if(!failureOnly) { if(!failureOnly) {
dsb.add( a.getSkipCount(), "skipped", new NumberOnlyBuildLabel(a.run)); dsb.add( a.getSkipCount(), "skipped", new NumberOnlyBuildLabel(a.owner));
dsb.add( a.getTotalCount()-a.getFailCount()-a.getSkipCount(),"total", new NumberOnlyBuildLabel(a.run)); dsb.add( a.getTotalCount()-a.getFailCount()-a.getSkipCount(),"total", new NumberOnlyBuildLabel(a.owner));
} }
} }
return dsb.build(); return dsb.build();
...@@ -359,20 +337,20 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio ...@@ -359,20 +337,20 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio
@Override @Override
public String generateURL(CategoryDataset dataset, int row, int column) { public String generateURL(CategoryDataset dataset, int row, int column) {
NumberOnlyBuildLabel label = (NumberOnlyBuildLabel) dataset.getColumnKey(column); NumberOnlyBuildLabel label = (NumberOnlyBuildLabel) dataset.getColumnKey(column);
return relPath+label.getRun().getNumber()+"/testReport/"; return relPath+label.build.getNumber()+"/testReport/";
} }
@Override @Override
public String generateToolTip(CategoryDataset dataset, int row, int column) { public String generateToolTip(CategoryDataset dataset, int row, int column) {
NumberOnlyBuildLabel label = (NumberOnlyBuildLabel) dataset.getColumnKey(column); NumberOnlyBuildLabel label = (NumberOnlyBuildLabel) dataset.getColumnKey(column);
AbstractTestResultAction a = label.getRun().getAction(AbstractTestResultAction.class); AbstractTestResultAction a = label.build.getAction(AbstractTestResultAction.class);
switch (row) { switch (row) {
case 0: case 0:
return String.valueOf(Messages.AbstractTestResultAction_fail(label.getRun().getDisplayName(), a.getFailCount())); return String.valueOf(Messages.AbstractTestResultAction_fail(label.build.getDisplayName(), a.getFailCount()));
case 1: case 1:
return String.valueOf(Messages.AbstractTestResultAction_skip(label.getRun().getDisplayName(), a.getSkipCount())); return String.valueOf(Messages.AbstractTestResultAction_skip(label.build.getDisplayName(), a.getSkipCount()));
default: default:
return String.valueOf(Messages.AbstractTestResultAction_test(label.getRun().getDisplayName(), a.getTotalCount())); return String.valueOf(Messages.AbstractTestResultAction_test(label.build.getDisplayName(), a.getTotalCount()));
} }
} }
}; };
......
...@@ -23,9 +23,7 @@ ...@@ -23,9 +23,7 @@
*/ */
package hudson.tasks.test; package hudson.tasks.test;
import hudson.Util;
import hudson.model.AbstractBuild; import hudson.model.AbstractBuild;
import hudson.model.Run;
import org.kohsuke.stapler.export.Exported; import org.kohsuke.stapler.export.Exported;
import org.kohsuke.stapler.export.ExportedBean; import org.kohsuke.stapler.export.ExportedBean;
...@@ -35,7 +33,7 @@ import java.util.List; ...@@ -35,7 +33,7 @@ import java.util.List;
/** /**
* {@link AbstractTestResultAction} that aggregates all the test results * {@link AbstractTestResultAction} that aggregates all the test results
* from the corresponding {@link Run}s. * from the corresponding {@link AbstractBuild}s.
* *
* <p> * <p>
* (This has nothing to do with {@link AggregatedTestResultPublisher}, unfortunately) * (This has nothing to do with {@link AggregatedTestResultPublisher}, unfortunately)
...@@ -123,27 +121,13 @@ public abstract class AggregatedTestResultAction extends AbstractTestResultActio ...@@ -123,27 +121,13 @@ public abstract class AggregatedTestResultAction extends AbstractTestResultActio
*/ */
@ExportedBean(defaultVisibility=2) @ExportedBean(defaultVisibility=2)
public static final class ChildReport { public static final class ChildReport {
@Deprecated @Exported
public final AbstractBuild<?,?> child; public final AbstractBuild<?,?> child;
/**
* @since TODO
*/
@Exported(name="child")
public final Run<?,?> run;
@Exported @Exported
public final Object result; public final Object result;
@Deprecated
public ChildReport(AbstractBuild<?, ?> child, AbstractTestResultAction result) { public ChildReport(AbstractBuild<?, ?> child, AbstractTestResultAction result) {
this((Run) child, result); this.child = child;
}
/**
* @since TODO
*/
public ChildReport(Run<?,?> run, AbstractTestResultAction result) {
this.child = run instanceof AbstractBuild ? (AbstractBuild) run : null;
this.run = run;
this.result = result!=null ? result.getResult() : null; this.result = result!=null ? result.getResult() : null;
} }
} }
...@@ -156,7 +140,7 @@ public abstract class AggregatedTestResultAction extends AbstractTestResultActio ...@@ -156,7 +140,7 @@ public abstract class AggregatedTestResultAction extends AbstractTestResultActio
return new AbstractList<ChildReport>() { return new AbstractList<ChildReport>() {
public ChildReport get(int index) { public ChildReport get(int index) {
return new ChildReport( return new ChildReport(
resolveRun(children.get(index)), resolveChild(children.get(index)),
getChildReport(children.get(index))); getChildReport(children.get(index)));
} }
...@@ -167,30 +151,14 @@ public abstract class AggregatedTestResultAction extends AbstractTestResultActio ...@@ -167,30 +151,14 @@ public abstract class AggregatedTestResultAction extends AbstractTestResultActio
} }
protected abstract String getChildName(AbstractTestResultAction tr); protected abstract String getChildName(AbstractTestResultAction tr);
public abstract AbstractBuild<?,?> resolveChild(Child child);
/**
* @since TODO
*/
public Run<?,?> resolveRun(Child child) {
return resolveChild(child);
}
@Deprecated
public AbstractBuild<?,?> resolveChild(Child child) {
if (Util.isOverridden(AggregatedTestResultAction.class, getClass(), "resolveRun", Child.class)) {
Run<?,?> r = resolveRun(child);
return r instanceof AbstractBuild ? (AbstractBuild) r : null;
} else {
throw new AbstractMethodError("you must override resolveRun");
}
}
/** /**
* Uses {@link #resolveChild(Child)} and obtain the * Uses {@link #resolveChild(Child)} and obtain the
* {@link AbstractTestResultAction} object for the given child. * {@link AbstractTestResultAction} object for the given child.
*/ */
protected AbstractTestResultAction getChildReport(Child child) { protected AbstractTestResultAction getChildReport(Child child) {
Run<?,?> b = resolveRun(child); AbstractBuild<?,?> b = resolveChild(child);
if(b==null) return null; if(b==null) return null;
return b.getAction(AbstractTestResultAction.class); return b.getAction(AbstractTestResultAction.class);
} }
......
...@@ -28,7 +28,7 @@ import hudson.FilePath; ...@@ -28,7 +28,7 @@ import hudson.FilePath;
import hudson.FilePath.FileCallable; import hudson.FilePath.FileCallable;
import hudson.Launcher; import hudson.Launcher;
import hudson.Util; import hudson.Util;
import hudson.model.Run; import hudson.model.AbstractBuild;
import hudson.model.TaskListener; import hudson.model.TaskListener;
import hudson.remoting.VirtualChannel; import hudson.remoting.VirtualChannel;
...@@ -73,8 +73,8 @@ public abstract class DefaultTestResultParserImpl extends TestResultParser imple ...@@ -73,8 +73,8 @@ public abstract class DefaultTestResultParserImpl extends TestResultParser imple
protected abstract TestResult parse(List<File> reportFiles, Launcher launcher, TaskListener listener) throws InterruptedException, IOException; protected abstract TestResult parse(List<File> reportFiles, Launcher launcher, TaskListener listener) throws InterruptedException, IOException;
@Override @Override
public TestResult parseResult(final String testResultLocations, final Run<?,?> build, FilePath workspace, final Launcher launcher, final TaskListener listener) throws InterruptedException, IOException { public TestResult parse(final String testResultLocations, final AbstractBuild build, final Launcher launcher, final TaskListener listener) throws InterruptedException, IOException {
return workspace.act(new FileCallable<TestResult>() { return build.getWorkspace().act(new FileCallable<TestResult>() {
final boolean ignoreTimestampCheck = IGNORE_TIMESTAMP_CHECK; // so that the property can be set on the master final boolean ignoreTimestampCheck = IGNORE_TIMESTAMP_CHECK; // so that the property can be set on the master
final long buildTime = build.getTimestamp().getTimeInMillis(); final long buildTime = build.getTimestamp().getTimeInMillis();
final long nowMaster = System.currentTimeMillis(); final long nowMaster = System.currentTimeMillis();
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
*/ */
package hudson.tasks.test; package hudson.tasks.test;
import hudson.model.Run; import hudson.model.AbstractBuild;
import hudson.tasks.junit.TestAction; import hudson.tasks.junit.TestAction;
import java.util.Collection; import java.util.Collection;
...@@ -189,12 +189,12 @@ public class SimpleCaseResult extends TestResult { ...@@ -189,12 +189,12 @@ public class SimpleCaseResult extends TestResult {
} }
@Override @Override
public Run<?,?> getRun() { public AbstractBuild<?,?> getOwner() {
if (parentAction == null) { if (parentAction == null) {
LOGGER.warning("in Trivial Test Result, parentAction is null, but getRun() called"); LOGGER.warning("in Trivial Test Result, parentAction is null, but getOwner() called");
return null; return null;
} }
return parentAction.run; return parentAction.owner;
} }
@Override @Override
......
...@@ -56,6 +56,8 @@ public abstract class TestObject extends hudson.tasks.junit.TestObject { ...@@ -56,6 +56,8 @@ public abstract class TestObject extends hudson.tasks.junit.TestObject {
private static final Logger LOGGER = Logger.getLogger(TestObject.class.getName()); private static final Logger LOGGER = Logger.getLogger(TestObject.class.getName());
private volatile transient String id; private volatile transient String id;
public abstract AbstractBuild<?, ?> getOwner();
/** /**
* Reverse pointer of {@link TabulatedResult#getChildren()}. * Reverse pointer of {@link TabulatedResult#getChildren()}.
*/ */
...@@ -156,7 +158,7 @@ public abstract class TestObject extends hudson.tasks.junit.TestObject { ...@@ -156,7 +158,7 @@ public abstract class TestObject extends hudson.tasks.junit.TestObject {
buf.insert(0,action.getUrlName()); buf.insert(0,action.getUrlName());
// Now the build // Now the build
Run<?,?> myBuild = cur.getRun(); AbstractBuild<?,?> myBuild = cur.getOwner();
if (myBuild ==null) { if (myBuild ==null) {
LOGGER.warning("trying to get relative path, but we can't determine the build that owns this result."); LOGGER.warning("trying to get relative path, but we can't determine the build that owns this result.");
return ""; // this won't take us to the right place, but it also won't 404. return ""; // this won't take us to the right place, but it also won't 404.
...@@ -199,7 +201,7 @@ public abstract class TestObject extends hudson.tasks.junit.TestObject { ...@@ -199,7 +201,7 @@ public abstract class TestObject extends hudson.tasks.junit.TestObject {
*/ */
@Override @Override
public AbstractTestResultAction getTestResultAction() { public AbstractTestResultAction getTestResultAction() {
Run<?, ?> owner = getRun(); AbstractBuild<?, ?> owner = getOwner();
if (owner != null) { if (owner != null) {
return owner.getAction(AbstractTestResultAction.class); return owner.getAction(AbstractTestResultAction.class);
} else { } else {
...@@ -244,19 +246,12 @@ public abstract class TestObject extends hudson.tasks.junit.TestObject { ...@@ -244,19 +246,12 @@ public abstract class TestObject extends hudson.tasks.junit.TestObject {
*/ */
public abstract TestResult getPreviousResult(); public abstract TestResult getPreviousResult();
@Deprecated
public TestResult getResultInBuild(AbstractBuild<?, ?> build) {
return (TestResult) super.getResultInBuild(build);
}
/** /**
* Gets the counterpart of this {@link TestResult} in the specified run. * Gets the counterpart of this {@link TestResult} in the specified run.
* *
* @return null if no such counter part exists. * @return null if no such counter part exists.
*/ */
@Override public TestResult getResultInRun(Run<?,?> run) { public abstract TestResult getResultInBuild(AbstractBuild<?, ?> build);
return (TestResult) super.getResultInRun(run);
}
/** /**
* Find the test result corresponding to the one identified by <code>id></code> * Find the test result corresponding to the one identified by <code>id></code>
...@@ -424,12 +419,12 @@ public abstract class TestObject extends hudson.tasks.junit.TestObject { ...@@ -424,12 +419,12 @@ public abstract class TestObject extends hudson.tasks.junit.TestObject {
public synchronized HttpResponse doSubmitDescription( public synchronized HttpResponse doSubmitDescription(
@QueryParameter String description) throws IOException, @QueryParameter String description) throws IOException,
ServletException { ServletException {
if (getRun() == null) { if (getOwner() == null) {
LOGGER.severe("getRun() is null, can't save description."); LOGGER.severe("getOwner() is null, can't save description.");
} else { } else {
getRun().checkPermission(Run.UPDATE); getOwner().checkPermission(Run.UPDATE);
setDescription(description); setDescription(description);
getRun().save(); getOwner().save();
} }
return new HttpRedirect("."); return new HttpRedirect(".");
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
package hudson.tasks.test; package hudson.tasks.test;
import hudson.tasks.junit.TestAction; import hudson.tasks.junit.TestAction;
import hudson.model.AbstractBuild;
import hudson.model.Run; import hudson.model.Run;
import hudson.model.Result; import hudson.model.Result;
...@@ -54,7 +55,7 @@ public abstract class TestResult extends TestObject { ...@@ -54,7 +55,7 @@ public abstract class TestResult extends TestObject {
* this test result. * this test result.
*/ */
public AbstractTestResultAction getParentAction() { public AbstractTestResultAction getParentAction() {
return getRun().getAction(AbstractTestResultAction.class); return getOwner().getAction(AbstractTestResultAction.class);
} }
/** /**
...@@ -129,7 +130,7 @@ public abstract class TestResult extends TestObject { ...@@ -129,7 +130,7 @@ public abstract class TestResult extends TestObject {
* @return null if no such counter part exists. * @return null if no such counter part exists.
*/ */
public TestResult getPreviousResult() { public TestResult getPreviousResult() {
Run<?,?> b = getRun(); AbstractBuild<?,?> b = getOwner();
if (b == null) { if (b == null) {
return null; return null;
} }
...@@ -151,7 +152,7 @@ public abstract class TestResult extends TestObject { ...@@ -151,7 +152,7 @@ public abstract class TestResult extends TestObject {
* *
* @return null if no such counter part exists. * @return null if no such counter part exists.
*/ */
@Override public TestResult getResultInRun(Run<?,?> build) { public TestResult getResultInBuild(AbstractBuild<?,?> build) {
AbstractTestResultAction tra = build.getAction(getParentAction().getClass()); AbstractTestResultAction tra = build.getAction(getParentAction().getClass());
if (tra == null) { if (tra == null) {
tra = build.getAction(AbstractTestResultAction.class); tra = build.getAction(AbstractTestResultAction.class);
......
...@@ -26,17 +26,13 @@ package hudson.tasks.test; ...@@ -26,17 +26,13 @@ package hudson.tasks.test;
import hudson.AbortException; import hudson.AbortException;
import hudson.ExtensionList; import hudson.ExtensionList;
import hudson.ExtensionPoint; import hudson.ExtensionPoint;
import hudson.FilePath;
import hudson.Launcher; import hudson.Launcher;
import hudson.Util;
import hudson.model.AbstractBuild; import hudson.model.AbstractBuild;
import hudson.model.Run;
import jenkins.model.Jenkins; import jenkins.model.Jenkins;
import hudson.model.TaskListener; import hudson.model.TaskListener;
import hudson.tasks.Publisher; import hudson.tasks.Publisher;
import java.io.IOException; import java.io.IOException;
import javax.annotation.Nonnull;
/** /**
* Parses test result files and builds in-memory representation of it as {@link TestResult}. * Parses test result files and builds in-memory representation of it as {@link TestResult}.
...@@ -52,7 +48,7 @@ import javax.annotation.Nonnull; ...@@ -52,7 +48,7 @@ import javax.annotation.Nonnull;
* which handles a set of default error checks on user inputs. * which handles a set of default error checks on user inputs.
* *
* <p> * <p>
* Parsers are stateless, and the {@link #parseResult} method * Parsers are stateless, and the {@link #parse(String, AbstractBuild, Launcher, TaskListener)} method
* can be concurrently invoked by multiple threads for different builds. * can be concurrently invoked by multiple threads for different builds.
* *
* @since 1.343 * @since 1.343
...@@ -100,11 +96,10 @@ public abstract class TestResultParser implements ExtensionPoint { ...@@ -100,11 +96,10 @@ public abstract class TestResultParser implements ExtensionPoint {
* </ul> * </ul>
* *
* @param testResultLocations * @param testResultLocations
* GLOB pattern relative to the {@code workspace} that * GLOB pattern relative to the {@linkplain AbstractBuild#getWorkspace() workspace} that
* specifies the locations of the test result files. Never null. * specifies the locations of the test result files. Never null.
* @param run * @param build
* Build for which these tests are parsed. Never null. * Build for which these tests are parsed. Never null.
* @param workspace the workspace in which tests can be found
* @param launcher * @param launcher
* Can be used to fork processes on the machine where the build is running. Never null. * Can be used to fork processes on the machine where the build is running. Never null.
* @param listener * @param listener
...@@ -119,32 +114,9 @@ public abstract class TestResultParser implements ExtensionPoint { ...@@ -119,32 +114,9 @@ public abstract class TestResultParser implements ExtensionPoint {
* @throws AbortException * @throws AbortException
* If you encounter an error that you handled gracefully, throw this exception and Hudson * If you encounter an error that you handled gracefully, throw this exception and Hudson
* will not show a stack trace. * will not show a stack trace.
* @since TODO
*/ */
public TestResult parseResult(String testResultLocations, public abstract TestResult parse(String testResultLocations,
Run<?,?> run, @Nonnull FilePath workspace, Launcher launcher,
TaskListener listener)
throws InterruptedException, IOException {
if (run instanceof AbstractBuild) {
return parse(testResultLocations, (AbstractBuild) run, launcher, listener);
} else {
throw new AbstractMethodError("you must override parseResult");
}
}
@Deprecated
public TestResult parse(String testResultLocations,
AbstractBuild build, Launcher launcher, AbstractBuild build, Launcher launcher,
TaskListener listener) TaskListener listener)
throws InterruptedException, IOException { throws InterruptedException, IOException;
if (Util.isOverridden(TestResultParser.class, getClass(), "parseResult", String.class, Run.class, FilePath.class, Launcher.class, TaskListener.class)) {
FilePath workspace = build.getWorkspace();
if (workspace == null) {
throw new AbortException("no workspace in " + build);
}
return parseResult(testResultLocations, build, workspace, launcher, listener);
} else {
throw new AbstractMethodError("you must override parseResult");
}
}
} }
...@@ -23,10 +23,9 @@ ...@@ -23,10 +23,9 @@
*/ */
package hudson.tasks.test; package hudson.tasks.test;
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject; import hudson.model.AbstractProject;
import hudson.model.Action; import hudson.model.Action;
import hudson.model.Job;
import hudson.model.Run;
import hudson.tasks.junit.JUnitResultArchiver; import hudson.tasks.junit.JUnitResultArchiver;
import org.kohsuke.stapler.Ancestor; import org.kohsuke.stapler.Ancestor;
import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.StaplerRequest;
...@@ -50,24 +49,11 @@ import java.util.List; ...@@ -50,24 +49,11 @@ import java.util.List;
public class TestResultProjectAction implements Action { public class TestResultProjectAction implements Action {
/** /**
* Project that owns this action. * Project that owns this action.
* @since TODO
*/ */
public final Job<?,?> job;
@Deprecated
public final AbstractProject<?,?> project; public final AbstractProject<?,?> project;
/**
* @since TODO
*/
public TestResultProjectAction(Job<?,?> job) {
this.job = job;
project = job instanceof AbstractProject ? (AbstractProject) job : null;
}
@Deprecated
public TestResultProjectAction(AbstractProject<?,?> project) { public TestResultProjectAction(AbstractProject<?,?> project) {
this((Job) project); this.project = project;
} }
/** /**
...@@ -86,9 +72,9 @@ public class TestResultProjectAction implements Action { ...@@ -86,9 +72,9 @@ public class TestResultProjectAction implements Action {
} }
public AbstractTestResultAction getLastTestResultAction() { public AbstractTestResultAction getLastTestResultAction() {
final Run<?,?> tb = job.getLastSuccessfulBuild(); final AbstractBuild<?,?> tb = project.getLastSuccessfulBuild();
Run<?,?> b = job.getLastBuild(); AbstractBuild<?,?> b=project.getLastBuild();
while(b!=null) { while(b!=null) {
AbstractTestResultAction a = b.getAction(AbstractTestResultAction.class); AbstractTestResultAction a = b.getAction(AbstractTestResultAction.class);
if(a!=null && (!b.isBuilding())) return a; if(a!=null && (!b.isBuilding())) return a;
......
...@@ -25,7 +25,7 @@ THE SOFTWARE. ...@@ -25,7 +25,7 @@ THE SOFTWARE.
<?jelly escape-by-default='true'?> <?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define"
xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form"> xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<l:layout title="${it.run} test - ${it.displayName}"> <l:layout title="${it.owner} test - ${it.displayName}">
<st:include page="sidepanel.jelly" /> <st:include page="sidepanel.jelly" />
<l:main-panel> <l:main-panel>
<j:set var="st" value="${it.status}" /> <j:set var="st" value="${it.status}" />
...@@ -50,7 +50,7 @@ THE SOFTWARE. ...@@ -50,7 +50,7 @@ THE SOFTWARE.
${%failingFor(it.age)} ${%failingFor(it.age)}
</j:otherwise> </j:otherwise>
</j:choose> </j:choose>
(${%since.before}<t:buildLink job="${it.run.parent}" number="${it.failedSince}"/>${%since.after}) (${%since.before}<t:buildLink job="${it.owner.project}" number="${it.failedSince}"/>${%since.after})
</div> </div>
</j:if> </j:if>
...@@ -60,7 +60,7 @@ THE SOFTWARE. ...@@ -60,7 +60,7 @@ THE SOFTWARE.
</a> </a>
</div> </div>
<t:editableDescription permission="${it.run.UPDATE}"/> <t:editableDescription permission="${it.owner.UPDATE}"/>
<table style="margin-top: 1em; margin-left:0em;"> <table style="margin-top: 1em; margin-left:0em;">
<j:forEach var="action" items="${it.testActions}"> <j:forEach var="action" items="${it.testActions}">
......
...@@ -36,8 +36,8 @@ THE SOFTWARE. ...@@ -36,8 +36,8 @@ THE SOFTWARE.
<td class="pane-header" style="width:5em">${%Test Result}</td> <td class="pane-header" style="width:5em">${%Test Result}</td>
</tr> </tr>
<tbody> <tbody>
<j:forEach var="b" items="${it.run.parent.builds}" begin="${start}" end="${end}"> <j:forEach var="b" items="${it.owner.parent.builds}" begin="${start}" end="${end}">
<j:set var="test" value="${it.getResultInRun(b)}"/> <j:set var="test" value="${it.getResultInBuild(b)}"/>
<j:if test="${test != null}"> <j:if test="${test != null}">
<tr> <tr>
<td class="pane"> <td class="pane">
......
...@@ -35,8 +35,8 @@ THE SOFTWARE. ...@@ -35,8 +35,8 @@ THE SOFTWARE.
<td class="pane-header" style="width:5em">${%Total}</td> <td class="pane-header" style="width:5em">${%Total}</td>
</tr> </tr>
<tbody> <tbody>
<j:forEach var="b" items="${it.run.parent.builds}" begin="${start}" end="${end}"> <j:forEach var="b" items="${it.owner.parent.builds}" begin="${start}" end="${end}">
<j:set var="p" value="${it.getResultInRun(b)}"/> <j:set var="p" value="${it.getResultInBuild(b)}"/>
<j:if test="${p != null}"> <j:if test="${p != null}">
<tr> <tr>
<td class="pane"> <td class="pane">
......
...@@ -67,11 +67,11 @@ THE SOFTWARE. ...@@ -67,11 +67,11 @@ THE SOFTWARE.
<st:include from="${it.testObject}" it="${it.testObject}" page="list.jelly" optional="true"/> <st:include from="${it.testObject}" it="${it.testObject}" page="list.jelly" optional="true"/>
<div> <div>
<j:if test="${start > 0}"> <j:if test="${start > 0}">
<a href="${app.rootUrl}${it.testObject.run.url}testReport${it.testObject.url}/history${(start-25)>0?'?start='+(start-25):''}">${%Newer}</a> <a href="${app.rootUrl}${it.testObject.owner.url}testReport${it.testObject.url}/history${(start-25)>0?'?start='+(start-25):''}">${%Newer}</a>
</j:if> </j:if>
   
<j:if test="${it.testObject.run.parent.builds.size() > end}"> <j:if test="${it.testObject.owner.project.builds.size() > end}">
<a href="${app.rootUrl}${it.testObject.run.url}testReport${it.testObject.url}/history?start=${end+1}">${%Older}</a> <a href="${app.rootUrl}${it.testObject.owner.url}testReport${it.testObject.url}/history?start=${end+1}">${%Older}</a>
</j:if> </j:if>
</div> </div>
</l:main-panel> </l:main-panel>
......
...@@ -30,10 +30,12 @@ PackageResult.getChildTitle=Class ...@@ -30,10 +30,12 @@ PackageResult.getChildTitle=Class
ClassResult.getTitle=Test Result : {0} ClassResult.getTitle=Test Result : {0}
JUnitParser.DisplayName=JUnit Parser JUnitParser.DisplayName=JUnit Parser
JUnitParser.TestResultLocationMessage=JUnit xml files: JUnitParser.TestResultLocationMessage=JUnit xml files:
JUnitParser.no_workspace_found=No workspace found for {0}
JUnitResultArchiver.DisplayName=Publish JUnit test result report JUnitResultArchiver.DisplayName=Publish JUnit test result report
JUnitResultArchiver.NoTestReportFound=No test report files were found. Configuration error? JUnitResultArchiver.NoTestReportFound=No test report files were found. Configuration error?
JUnitResultArchiver.Recording=Recording test results JUnitResultArchiver.Recording=Recording test results
JUnitResultArchiver.ResultIsEmpty=None of the test reports contained any result JUnitResultArchiver.ResultIsEmpty=None of the test reports contained any result
JUnitResultArchiver.BadXML=Incorrect XML attributes for test results found in {0}
JUnitResultArchiver.HealthScaleFactorAnalysis={0}% failing tests scores as {1}% health. {2}% failing tests scores as {3}% health JUnitResultArchiver.HealthScaleFactorAnalysis={0}% failing tests scores as {1}% health. {2}% failing tests scores as {3}% health
CaseResult.Status.Passed=Passed CaseResult.Status.Passed=Passed
......
...@@ -32,6 +32,7 @@ TestResult.getTitle=Test Resultat ...@@ -32,6 +32,7 @@ TestResult.getTitle=Test Resultat
JUnitResultArchiver.DisplayName=Publicer JUnit testrapport JUnitResultArchiver.DisplayName=Publicer JUnit testrapport
TestResult.getDisplayName=Testresultater TestResult.getDisplayName=Testresultater
CaseResult.Status.Failed=Fejlet CaseResult.Status.Failed=Fejlet
JUnitResultArchiver.BadXML=Ukorrekt XML attribut fundet for test resultater i {0}
JUnitResultArchiver.ResultIsEmpty=Ingen af testrapporterne indeholder resultater JUnitResultArchiver.ResultIsEmpty=Ingen af testrapporterne indeholder resultater
JUnitResultArchiver.NoTestReportFound=Ingen testrapporter fundet. Konfigurationsfejl? JUnitResultArchiver.NoTestReportFound=Ingen testrapporter fundet. Konfigurationsfejl?
PackageResult.getTitle=Testresultat : {0} PackageResult.getTitle=Testresultat : {0}
...@@ -39,3 +39,4 @@ CaseResult.Status.Skipped=Ausgelassen ...@@ -39,3 +39,4 @@ CaseResult.Status.Skipped=Ausgelassen
CaseResult.Status.Fixed=Repariert CaseResult.Status.Fixed=Repariert
CaseResult.Status.Regression=Regression CaseResult.Status.Regression=Regression
JUnitResultArchiver.BadXML=Testergebnisse enthalten ungültige XML-Attribute in {0}
...@@ -32,6 +32,7 @@ JUnitResultArchiver.DisplayName=Publicar los resultadod de tests JUnit ...@@ -32,6 +32,7 @@ JUnitResultArchiver.DisplayName=Publicar los resultadod de tests JUnit
JUnitResultArchiver.NoTestReportFound=No se encontraron ficheros con resultados de tests. ¿Hay algun error en la configuración? JUnitResultArchiver.NoTestReportFound=No se encontraron ficheros con resultados de tests. ¿Hay algun error en la configuración?
JUnitResultArchiver.Recording=Grabando resultados de tests JUnitResultArchiver.Recording=Grabando resultados de tests
JUnitResultArchiver.ResultIsEmpty=Ninguno de los informes de tests contiene resultados JUnitResultArchiver.ResultIsEmpty=Ninguno de los informes de tests contiene resultados
JUnitResultArchiver.BadXML=Formato incorrecto en los atributos XML del fichero de resultados en {0}
CaseResult.Status.Passed=Pasados CaseResult.Status.Passed=Pasados
CaseResult.Status.Failed=Fallidos CaseResult.Status.Failed=Fallidos
......
...@@ -30,13 +30,15 @@ PackageResult.getChildTitle=\u30af\u30e9\u30b9 ...@@ -30,13 +30,15 @@ PackageResult.getChildTitle=\u30af\u30e9\u30b9
ClassResult.getTitle=\u30c6\u30b9\u30c8\u7d50\u679c : {0} ClassResult.getTitle=\u30c6\u30b9\u30c8\u7d50\u679c : {0}
JUnitParser.DisplayName=JUnit\u30d1\u30fc\u30b5\u30fc JUnitParser.DisplayName=JUnit\u30d1\u30fc\u30b5\u30fc
JUnitParser.TestResultLocationMessage=JUnit\u306eXML\u30d5\u30a1\u30a4\u30eb : JUnitParser.TestResultLocationMessage=JUnit\u306eXML\u30d5\u30a1\u30a4\u30eb :
JUnitParser.no_workspace_found={0}\u306e\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002
JUnitResultArchiver.DisplayName=JUnit\u30c6\u30b9\u30c8\u7d50\u679c\u306e\u96c6\u8a08 JUnitResultArchiver.DisplayName=JUnit\u30c6\u30b9\u30c8\u7d50\u679c\u306e\u96c6\u8a08
JUnitResultArchiver.NoTestReportFound=\u30c6\u30b9\u30c8\u306e\u30ec\u30dd\u30fc\u30c8\u30d5\u30a1\u30a4\u30eb\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002\u8a2d\u5b9a\u30df\u30b9? JUnitResultArchiver.NoTestReportFound=\u30c6\u30b9\u30c8\u306e\u30ec\u30dd\u30fc\u30c8\u30d5\u30a1\u30a4\u30eb\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002\u8a2d\u5b9a\u30df\u30b9?
JUnitResultArchiver.Recording=\u30c6\u30b9\u30c8\u7d50\u679c\u3092\u4fdd\u5b58\u4e2d JUnitResultArchiver.Recording=\u30c6\u30b9\u30c8\u7d50\u679c\u3092\u4fdd\u5b58\u4e2d
JUnitResultArchiver.ResultIsEmpty=\u30c6\u30b9\u30c8\u306e\u30ec\u30dd\u30fc\u30c8\u306b\u4f55\u3082\u7d50\u679c\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u305b\u3093 JUnitResultArchiver.ResultIsEmpty=\u30c6\u30b9\u30c8\u306e\u30ec\u30dd\u30fc\u30c8\u306b\u4f55\u3082\u7d50\u679c\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u305b\u3093
JUnitResultArchiver.BadXML={0} \u306b\u3001\u30c6\u30b9\u30c8\u7d50\u679c\u306eXML\u306b\u4e0d\u9069\u5207\u306a\u5c5e\u6027\u304c\u3042\u308a\u307e\u3059
CaseResult.Status.Passed=OK CaseResult.Status.Passed=OK
CaseResult.Status.Failed=\u5931\u6557 CaseResult.Status.Failed=\u5931\u6557
CaseResult.Status.Skipped=\u30b9\u30ad\u30c3\u30d7 CaseResult.Status.Skipped=\u30b9\u30ad\u30c3\u30d7
CaseResult.Status.Fixed=\u4fee\u6b63OK CaseResult.Status.Fixed=\u4fee\u6b63OK
CaseResult.Status.Regression=\u30ea\u30b0\u30ec\u30c3\u30b7\u30e7\u30f3 CaseResult.Status.Regression=\u30ea\u30b0\u30ec\u30c3\u30b7\u30e7\u30f3
\ No newline at end of file
...@@ -33,6 +33,7 @@ CaseResult.Status.Regression=Regress\u00e3o ...@@ -33,6 +33,7 @@ CaseResult.Status.Regression=Regress\u00e3o
# Recording test results # Recording test results
JUnitResultArchiver.Recording=Gravando o resultado dos testes JUnitResultArchiver.Recording=Gravando o resultado dos testes
# Incorrect XML attributes for test results found in {0} # Incorrect XML attributes for test results found in {0}
JUnitResultArchiver.BadXML=Atributos XML incorretos para teste de resultados em {0}
# Fixed # Fixed
CaseResult.Status.Fixed=Fixo CaseResult.Status.Fixed=Fixo
# None of the test reports contained any result # None of the test reports contained any result
......
...@@ -30,10 +30,12 @@ PackageResult.getChildTitle=\u985e\u5225 ...@@ -30,10 +30,12 @@ PackageResult.getChildTitle=\u985e\u5225
ClassResult.getTitle=\u6e2c\u8a66\u7d50\u679c: {0} ClassResult.getTitle=\u6e2c\u8a66\u7d50\u679c: {0}
JUnitParser.DisplayName=JUnit \u5256\u6790\u7a0b\u5f0f JUnitParser.DisplayName=JUnit \u5256\u6790\u7a0b\u5f0f
JUnitParser.TestResultLocationMessage=JUnit XML \u6a94: JUnitParser.TestResultLocationMessage=JUnit XML \u6a94:
JUnitParser.no_workspace_found=\u627e\u4e0d\u5230 {0} \u7684\u5de5\u4f5c\u5340
JUnitResultArchiver.DisplayName=\u767c\u4f48 JUnit \u6e2c\u8a66\u7d50\u679c\u5831\u544a JUnitResultArchiver.DisplayName=\u767c\u4f48 JUnit \u6e2c\u8a66\u7d50\u679c\u5831\u544a
JUnitResultArchiver.NoTestReportFound=\u627e\u4e0d\u5230\u6e2c\u8a66\u7d50\u679c\u5831\u544a\u3002\u8a2d\u5b9a\u932f\u4e86\u55ce? JUnitResultArchiver.NoTestReportFound=\u627e\u4e0d\u5230\u6e2c\u8a66\u7d50\u679c\u5831\u544a\u3002\u8a2d\u5b9a\u932f\u4e86\u55ce?
JUnitResultArchiver.Recording=\u8a18\u9304\u6e2c\u8a66\u7d50\u679c JUnitResultArchiver.Recording=\u8a18\u9304\u6e2c\u8a66\u7d50\u679c
JUnitResultArchiver.ResultIsEmpty=\u6e2c\u8a66\u5831\u544a\u4e2d\u90fd\u6c92\u6709\u7d50\u679c JUnitResultArchiver.ResultIsEmpty=\u6e2c\u8a66\u5831\u544a\u4e2d\u90fd\u6c92\u6709\u7d50\u679c
JUnitResultArchiver.BadXML=\u5728 {0} \u7684\u6e2c\u8a66\u7d50\u679c\u4e2d\u767c\u73fe\u932f\u8aa4\u7684 XML \u5c6c\u6027
CaseResult.Status.Passed=\u901a\u904e CaseResult.Status.Passed=\u901a\u904e
CaseResult.Status.Failed=\u5931\u6557 CaseResult.Status.Failed=\u5931\u6557
......
...@@ -64,7 +64,7 @@ THE SOFTWARE. ...@@ -64,7 +64,7 @@ THE SOFTWARE.
<li class="${elementClass}" style="${elementStyle}"> <li class="${elementClass}" style="${elementStyle}">
<!-- child test results are referenced from their parent builds --> <!-- child test results are referenced from their parent builds -->
<j:set var="build" value="${testObject.run}" /> <j:set var="build" value="${testObject.owner}" />
<a href="${it.getTestResultPath(testObject)}"> <a href="${it.getTestResultPath(testObject)}">
<st:out value="${testObject.fullDisplayName}" /> <st:out value="${testObject.fullDisplayName}" />
</a> </a>
......
...@@ -35,8 +35,8 @@ THE SOFTWARE. ...@@ -35,8 +35,8 @@ THE SOFTWARE.
<td class="pane-header" style="width:5em">${%Total}</td> <td class="pane-header" style="width:5em">${%Total}</td>
</tr> </tr>
<tbody> <tbody>
<j:forEach var="b" items="${it.run.parent.builds}" begin="${start}" end="${end}"> <j:forEach var="b" items="${it.owner.parent.builds}" begin="${start}" end="${end}">
<j:set var="p" value="${it.getResultInRun(b)}"/> <j:set var="p" value="${it.getResultInBuild(b)}"/>
<j:if test="${p != null}"> <j:if test="${p != null}">
<tr> <tr>
<td class="pane"> <td class="pane">
......
...@@ -32,16 +32,16 @@ THE SOFTWARE. ...@@ -32,16 +32,16 @@ THE SOFTWARE.
<l:tasks> <l:tasks>
<j:set var="buildUrl" value="${h.decompose(request)}" /> <j:set var="buildUrl" value="${h.decompose(request)}" />
<j:set var="baseUrl" value="${request.findAncestor(it).relativePath}"/> <j:set var="baseUrl" value="${request.findAncestor(it).relativePath}"/>
<st:include it="${it.run}" page="tasks.jelly" optional="true"/> <st:include it="${it.owner}" page="tasks.jelly" optional="true"/>
<l:task href="${baseUrl}/history" icon="icon-graph icon-md" title="${%History}"/> <l:task href="${baseUrl}/history" icon="icon-graph icon-md" title="${%History}"/>
<st:include it="${it.run}" page="actions.jelly" optional="true" /> <st:include it="${it.owner}" page="actions.jelly" optional="true" />
<t:actions actions="${it.testActions}" /> <t:actions actions="${it.testActions}" />
<j:if test="${it.run.previousBuild!=null}"> <j:if test="${it.owner.previousBuild!=null}">
<l:task href="${buildUrl.previousBuildUrl}" icon="icon-previous icon-md" title="${%Previous Build}"/> <l:task href="${buildUrl.previousBuildUrl}" icon="icon-previous icon-md" title="${%Previous Build}"/>
</j:if> </j:if>
<j:if test="${it.run.nextBuild!=null}"> <j:if test="${it.owner.nextBuild!=null}">
<l:task href="${buildUrl.nextBuildUrl}" icon="icon-next icon-md" title="${%Next Build}"/> <l:task href="${buildUrl.nextBuildUrl}" icon="icon-next icon-md" title="${%Next Build}"/>
</j:if> </j:if>
</l:tasks> </l:tasks>
......
...@@ -24,7 +24,7 @@ THE SOFTWARE. ...@@ -24,7 +24,7 @@ THE SOFTWARE.
<?jelly escape-by-default='true'?> <?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:test="/lib/test"> <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:test="/lib/test">
<l:layout title="${it.run} ${it.displayName}"> <l:layout title="${it.owner} ${it.displayName}">
<st:include page="sidepanel.jelly" /> <st:include page="sidepanel.jelly" />
<l:main-panel> <l:main-panel>
<h1><st:out value="${it.title}" /></h1> <h1><st:out value="${it.title}" /></h1>
...@@ -39,7 +39,7 @@ THE SOFTWARE. ...@@ -39,7 +39,7 @@ THE SOFTWARE.
</a> </a>
</div> </div>
<t:editableDescription permission="${it.run.UPDATE}"/> <t:editableDescription permission="${it.owner.UPDATE}"/>
<table style="margin-top: 1em; margin-left:0em;"> <table style="margin-top: 1em; margin-left:0em;">
<j:forEach var="action" items="${it.testActions}"> <j:forEach var="action" items="${it.testActions}">
......
...@@ -25,11 +25,11 @@ THE SOFTWARE. ...@@ -25,11 +25,11 @@ THE SOFTWARE.
<?jelly escape-by-default='true'?> <?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt" xmlns:local="local"> <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt" xmlns:local="local">
<l:layout title="Test"> <l:layout title="Test">
<st:include page="sidepanel.jelly" it="${it.job}" /> <st:include page="sidepanel.jelly" it="${it.project}" />
<l:main-panel> <l:main-panel>
<div> <div>
<img src="trend?${request.queryString}" lazymap="trendMap?rel=../&amp;${request.queryString}" alt="[Test result trend chart]"/> <img src="trend?${request.queryString}" lazymap="trendMap?rel=../&amp;${request.queryString}" alt="[Test result trend chart]"/>
</div> </div>
</l:main-panel> </l:main-panel>
</l:layout> </l:layout>
</j:jelly> </j:jelly>
\ No newline at end of file
...@@ -26,7 +26,7 @@ THE SOFTWARE. ...@@ -26,7 +26,7 @@ THE SOFTWARE.
<?jelly escape-by-default='true'?> <?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:t="/lib/hudson"> <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:t="/lib/hudson">
<table style="margin-top: 1em; margin-left: 1em;"> <table style="margin-top: 1em; margin-left: 1em;">
<j:set var="tr" value="${it.job.lastCompletedBuild.getAction(it.class.classLoader.loadClass('hudson.tasks.test.AbstractTestResultAction'))}"/> <j:set var="tr" value="${it.project.lastCompletedBuild.getAction(it.class.classLoader.loadClass('hudson.tasks.test.AbstractTestResultAction'))}"/>
<j:if test="${tr != null}"> <j:if test="${tr != null}">
<t:summary icon="clipboard.png"> <t:summary icon="clipboard.png">
<a href="lastCompletedBuild/${tr.urlName}/">${%Latest Test Result}</a> <a href="lastCompletedBuild/${tr.urlName}/">${%Latest Test Result}</a>
......
...@@ -66,7 +66,7 @@ public class JUnitParserTest extends HudsonTestCase { ...@@ -66,7 +66,7 @@ public class JUnitParserTest extends HudsonTestCase {
} }
System.out.println("...touched everything"); System.out.println("...touched everything");
hudson.tasks.junit.TestResult result = (new JUnitParser()).parseResult( testResultLocation, build, build.getWorkspace(), launcher, listener); hudson.tasks.junit.TestResult result = (new JUnitParser()).parse( testResultLocation, build, launcher, listener);
System.out.println("back from parse"); System.out.println("back from parse");
assertNotNull("we should have a non-null result", result); assertNotNull("we should have a non-null result", result);
......
...@@ -27,7 +27,7 @@ import com.gargoylesoftware.htmlunit.html.HtmlPage; ...@@ -27,7 +27,7 @@ import com.gargoylesoftware.htmlunit.html.HtmlPage;
import hudson.model.FreeStyleBuild; import hudson.model.FreeStyleBuild;
import hudson.model.FreeStyleProject; import hudson.model.FreeStyleProject;
import hudson.model.Result; import hudson.model.Result;
import hudson.model.Run; import hudson.model.AbstractBuild;
import org.jvnet.hudson.test.HudsonTestCase; import org.jvnet.hudson.test.HudsonTestCase;
import org.jvnet.hudson.test.TouchBuilder; import org.jvnet.hudson.test.TouchBuilder;
...@@ -50,13 +50,13 @@ public class TestResultExtensionTest extends HudsonTestCase { ...@@ -50,13 +50,13 @@ public class TestResultExtensionTest extends HudsonTestCase {
assertBuildStatus(Result.SUCCESS, build); assertBuildStatus(Result.SUCCESS, build);
TrivialTestResultAction action = build.getAction(TrivialTestResultAction.class); TrivialTestResultAction action = build.getAction(TrivialTestResultAction.class);
assertNotNull("we should have an action", action); assertNotNull("we should have an action", action);
assertNotNull("parent action should have an owner", action.run); assertNotNull("parent action should have an owner", action.owner);
Object resultObject = action.getResult(); Object resultObject = action.getResult();
assertNotNull("we should have a result"); assertNotNull("we should have a result");
assertTrue("result should be an TestResult", assertTrue("result should be an TestResult",
resultObject instanceof TestResult); resultObject instanceof TestResult);
TestResult result = (TestResult) resultObject; TestResult result = (TestResult) resultObject;
Run<?,?> ownerBuild = result.getRun(); AbstractBuild<?,?> ownerBuild = result.getOwner();
assertNotNull("we should have an owner", ownerBuild); assertNotNull("we should have an owner", ownerBuild);
assertNotNull("we should have a list of test actions", result.getTestActions()); assertNotNull("we should have a list of test actions", result.getTestActions());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册