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

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

上级 6e6ca263
......@@ -27,6 +27,7 @@ import hudson.util.TextFile;
import org.apache.commons.io.FileUtils;
import org.jvnet.localizer.Localizable;
import hudson.model.AbstractBuild;
import hudson.model.Run;
import hudson.tasks.test.TestResult;
......@@ -373,8 +374,8 @@ public class CaseResult extends TestResult implements Comparable<CaseResult> {
CaseResult prev = getPreviousResult();
if(prev!=null && !prev.isPassed())
this.failedSince = prev.getFailedSince();
else if (getRun() != null) {
this.failedSince = getRun().getNumber();
else if (getOwner() != null) {
this.failedSince = getOwner().getNumber();
} else {
LOGGER.warning("trouble calculating getFailedSince. We've got prev, but no owner.");
// failedSince will be 0, which isn't correct.
......@@ -384,7 +385,7 @@ public class CaseResult extends TestResult implements Comparable<CaseResult> {
}
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> {
public int getAge() {
if(isPassed())
return 0;
else if (getRun() != null) {
return getRun().getNumber()-getFailedSince()+1;
else if (getOwner() != null) {
return getOwner().getNumber()-getFailedSince()+1;
} else {
LOGGER.fine("Trying to get age of a CaseResult without an owner");
return 0;
......@@ -552,14 +553,14 @@ public class CaseResult extends TestResult implements Comparable<CaseResult> {
}
@Override
public Run<?,?> getRun() {
public AbstractBuild<?,?> getOwner() {
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.getRun();
return tr.getOwner();
}
public void setParentSuiteResult(SuiteResult parent) {
......@@ -574,7 +575,7 @@ public class CaseResult extends TestResult implements Comparable<CaseResult> {
if(prev!=null && !prev.isPassed())
this.failedSince = prev.failedSince;
else
this.failedSince = getRun().getNumber();
this.failedSince = getOwner().getNumber();
}
}
......
......@@ -23,7 +23,7 @@
*/
package hudson.tasks.junit;
import hudson.model.Run;
import hudson.model.AbstractBuild;
import hudson.tasks.test.TabulatedResult;
import hudson.tasks.test.TestResult;
import hudson.tasks.test.TestObject;
......@@ -58,8 +58,8 @@ public final class ClassResult extends TabulatedResult implements Comparable<Cla
}
@Override
public Run<?, ?> getRun() {
return (parent==null ? null: parent.getRun());
public AbstractBuild<?, ?> getOwner() {
return (parent==null ? null: parent.getOwner());
}
public PackageResult getParent() {
......
......@@ -24,7 +24,6 @@
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;
......@@ -69,7 +68,7 @@ public class History {
}
public boolean historyAvailable() {
if (testObject.getRun().getParent().getBuilds().size() > 1)
if (testObject.getOwner().getParent().getBuilds().size() > 1)
return true;
else
return false;
......@@ -77,10 +76,10 @@ public class History {
public List<TestResult> getList(int start, int end) {
List<TestResult> list = new ArrayList<TestResult>();
end = Math.min(end, testObject.getRun().getParent().getBuilds().size());
for (Run<?,?> b: testObject.getRun().getParent().getBuilds().subList(start, end)) {
end = Math.min(end, testObject.getOwner().getParent().getBuilds().size());
for (AbstractBuild<?,?> b: testObject.getOwner().getParent().getBuilds().subList(start, end)) {
if (b.isBuilding()) continue;
TestResult o = testObject.getResultInRun(b);
TestResult o = testObject.getResultInBuild(b);
if (o != null) {
list.add(o);
}
......@@ -89,7 +88,7 @@ public class History {
}
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 {
public String generateToolTip(CategoryDataset dataset, int row,
int column) {
ChartLabel label = (ChartLabel) dataset.getColumnKey(column);
return label.o.getRun().getDisplayName() + " : "
return label.o.getOwner().getDisplayName() + " : "
+ label.o.getDurationString();
}
};
......@@ -254,14 +253,14 @@ public class History {
}
private void generateUrl() {
Run<?,?> build = o.getRun();
AbstractBuild<?,?> build = o.getOwner();
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.getRun().number - that.o.getRun().number;
return this.o.getOwner().number - that.o.getOwner().number;
}
@Override
......@@ -284,9 +283,8 @@ public class History {
@Override
public String toString() {
Run<?, ?> run = o.getRun();
String l = run.getDisplayName();
String s = run instanceof AbstractBuild ? ((AbstractBuild) run).getBuiltOnStr() : null;
String l = o.getOwner().getDisplayName();
String s = o.getOwner().getBuiltOnStr();
if (s != null)
l += ' ' + s;
return l;
......
......@@ -25,8 +25,8 @@ package hudson.tasks.junit;
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 class JUnitParser extends TestResultParser {
}
@Override
public TestResult parseResult(String testResultLocations,
Run<?,?> build, FilePath workspace, Launcher launcher,
public TestResult parse(String testResultLocations,
AbstractBuild build, Launcher launcher,
TaskListener listener)
throws InterruptedException, IOException
{
......@@ -80,6 +80,10 @@ public class JUnitParser extends TestResultParser {
// [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));
}
......
......@@ -30,17 +30,17 @@ import hudson.FilePath;
import hudson.Launcher;
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.Action;
import hudson.model.BuildListener;
import hudson.model.Descriptor;
import hudson.model.Result;
import hudson.model.Run;
import hudson.model.Saveable;
import hudson.model.TaskListener;
import hudson.tasks.BuildStepDescriptor;
import hudson.tasks.BuildStepMonitor;
import hudson.tasks.Publisher;
import hudson.tasks.Recorder;
import hudson.tasks.junit.TestResultAction.Data;
import hudson.tasks.test.TestResultProjectAction;
import hudson.util.DescribableList;
import hudson.util.FormValidation;
import net.sf.json.JSONObject;
......@@ -52,18 +52,18 @@ import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
import java.io.IOException;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
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.
*
* @author Kohsuke Kawaguchi
*/
public class JUnitResultArchiver extends Recorder implements SimpleBuildStep {
public class JUnitResultArchiver extends Recorder {
/**
* {@link FileSet} "includes" string, like "foo/bar/*.xml"
......@@ -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.
* @since 1.358
*/
private boolean keepLongStdio;
private final boolean keepLongStdio;
/**
* {@link TestDataPublisher}s configured for this archiver, to process the recorded data.
* For compatibility reasons, can be null.
* @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) {
this.testResults = testResults;
this(testResults, false, null);
}
@Deprecated
......@@ -104,44 +108,44 @@ public class JUnitResultArchiver extends Recorder implements SimpleBuildStep {
this(testResults, keepLongStdio, testDataPublishers, 1.0);
}
@Deprecated
@DataBoundConstructor
public JUnitResultArchiver(
String testResults,
boolean keepLongStdio,
DescribableList<TestDataPublisher, Descriptor<TestDataPublisher>> testDataPublishers,
double healthScaleFactor) {
this.testResults = testResults;
setKeepLongStdio(keepLongStdio);
setTestDataPublishers(testDataPublishers);
setHealthScaleFactor(healthScaleFactor);
this.keepLongStdio = keepLongStdio;
this.testDataPublishers = testDataPublishers;
this.healthScaleFactor = Math.max(0.0,healthScaleFactor);
}
private TestResult parse(String expandedTestResults, Run<?,?> run, @Nonnull FilePath workspace, Launcher launcher, TaskListener listener)
throws IOException, InterruptedException
{
return new JUnitParser(isKeepLongStdio()).parseResult(expandedTestResults, run, workspace, launcher, listener);
}
@Deprecated
/**
* In progress. Working on delegating the actual parsing to the JUnitParser.
*/
protected TestResult parse(String expandedTestResults, AbstractBuild build, Launcher launcher, BuildListener listener)
throws IOException, InterruptedException
{
return parse(expandedTestResults, build, build.getWorkspace(), launcher, listener);
return new JUnitParser(isKeepLongStdio()).parse(expandedTestResults, build, launcher, listener);
}
@Override
public void perform(Run build, FilePath workspace, Launcher launcher,
TaskListener listener) throws InterruptedException, IOException {
public boolean perform(AbstractBuild build, Launcher launcher,
BuildListener listener) throws InterruptedException, IOException {
listener.getLogger().println(Messages.JUnitResultArchiver_Recording());
TestResultAction action;
final String testResults = build.getEnvironment(listener).expand(this.testResults);
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?
action = new TestResultAction(build, result, listener);
try {
// 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?
result.freeze(action);
if (result.isEmpty()) {
......@@ -153,7 +157,7 @@ public class JUnitResultArchiver extends Recorder implements SimpleBuildStep {
List<Data> data = new ArrayList<Data>();
if (testDataPublishers != null) {
for (TestDataPublisher tdp : testDataPublishers) {
Data d = tdp.contributeTestData(build, workspace, launcher, listener, result);
Data d = tdp.getTestData(build, launcher, listener, result);
if (d != null) {
data.add(d);
}
......@@ -165,21 +169,23 @@ public class JUnitResultArchiver extends Recorder implements SimpleBuildStep {
if (build.getResult() == Result.FAILURE)
// most likely a build failed before it gets to the test phase.
// don't report confusing error message.
return;
return true;
listener.getLogger().println(e.getMessage());
build.setResult(Result.FAILURE);
return;
return true;
} catch (IOException e) {
e.printStackTrace(listener.error("Failed to archive test reports"));
build.setResult(Result.FAILURE);
return;
return true;
}
build.addAction(action);
if (action.getResult().getFailCount() > 0)
build.setResult(Result.UNSTABLE);
return true;
}
/**
......@@ -204,19 +210,14 @@ public class JUnitResultArchiver extends Recorder implements SimpleBuildStep {
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() {
return testDataPublishers;
}
/** @since TODO */
public final void setTestDataPublishers(DescribableList<TestDataPublisher,Descriptor<TestDataPublisher>> testDataPublishers) {
this.testDataPublishers = testDataPublishers;
}
@Override
public Collection<Action> getProjectActions(AbstractProject<?, ?> project) {
return Collections.<Action>singleton(new TestResultProjectAction(project));
}
/**
* @return the keepLongStdio
......@@ -225,11 +226,6 @@ public class JUnitResultArchiver extends Recorder implements SimpleBuildStep {
return keepLongStdio;
}
/** @since TODO */
@DataBoundSetter public final void setKeepLongStdio(boolean keepLongStdio) {
this.keepLongStdio = keepLongStdio;
}
private static final long serialVersionUID = 1L;
@Extension
......
......@@ -23,7 +23,7 @@
*/
package hudson.tasks.junit;
import hudson.model.Run;
import hudson.model.AbstractBuild;
import hudson.tasks.test.MetaTabulatedResult;
import hudson.tasks.test.TestResult;
import org.kohsuke.stapler.StaplerRequest;
......@@ -55,8 +55,8 @@ public final class PackageResult extends MetaTabulatedResult implements Comparab
}
@Override
public Run<?,?> getRun() {
return (parent == null ? null : parent.getRun());
public AbstractBuild<?, ?> getOwner() {
return (parent == null ? null : parent.getOwner());
}
public hudson.tasks.junit.TestResult getParent() {
......
......@@ -26,14 +26,11 @@ package hudson.tasks.junit;
import hudson.DescriptorExtensionList;
import hudson.Extension;
import hudson.ExtensionPoint;
import hudson.FilePath;
import hudson.Launcher;
import hudson.Util;
import hudson.model.*;
import jenkins.model.Jenkins;
import java.io.IOException;
import javax.annotation.Nonnull;
/**
* Contributes {@link TestAction}s to test results.
......@@ -53,32 +50,10 @@ public abstract class TestDataPublisher extends AbstractDescribableImpl<TestData
*
* @return
* can be null to indicate that there's nothing to contribute for this test result.
* @since TODO
*/
public TestResultAction.Data contributeTestData(
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(
public abstract TestResultAction.Data getTestData(
AbstractBuild<?, ?> build, Launcher launcher,
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");
}
}
BuildListener listener, TestResult testResult) throws IOException, InterruptedException;
public static DescriptorExtensionList<TestDataPublisher, Descriptor<TestDataPublisher>> all() {
return Jenkins.getInstance().<TestDataPublisher, Descriptor<TestDataPublisher>>getDescriptorList(TestDataPublisher.class);
......
......@@ -23,11 +23,9 @@
*/
package hudson.tasks.junit;
import hudson.Util;
import hudson.model.AbstractBuild;
import hudson.model.AbstractModelObject;
import hudson.model.Api;
import hudson.model.Run;
import hudson.tasks.test.AbstractTestResultAction;
import org.kohsuke.stapler.export.ExportedBean;
......@@ -46,23 +44,8 @@ import java.util.List;
*/
@ExportedBean
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();
......@@ -86,26 +69,8 @@ public abstract class TestObject extends AbstractModelObject implements Serializ
* @return null if no such counter part exists.
*/
public abstract TestObject getPreviousResult();
@Deprecated
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");
}
}
public abstract TestObject getResultInBuild(AbstractBuild<?,?> build);
/**
* Time took to run this test. In seconds.
......
......@@ -25,6 +25,7 @@ package hudson.tasks.junit;
import hudson.AbortException;
import hudson.Util;
import hudson.model.AbstractBuild;
import hudson.model.Run;
import hudson.tasks.test.AbstractTestResultAction;
import hudson.tasks.test.MetaTabulatedResult;
......@@ -295,8 +296,8 @@ public final class TestResult extends MetaTabulatedResult {
}
@Override
public Run<?,?> getRun() {
return (parentAction == null? null: parentAction.run);
public AbstractBuild<?,?> getOwner() {
return (parentAction == null? null: parentAction.owner);
}
@Override
......
......@@ -26,13 +26,11 @@ package hudson.tasks.junit;
import com.thoughtworks.xstream.XStream;
import hudson.XmlFile;
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.Action;
import hudson.model.BuildListener;
import hudson.model.Run;
import hudson.model.TaskListener;
import hudson.tasks.test.AbstractTestResultAction;
import hudson.tasks.test.TestObject;
import hudson.tasks.test.TestResultProjectAction;
import hudson.util.HeapSpaceStringConverter;
import hudson.util.XStream2;
import org.kohsuke.stapler.StaplerProxy;
......@@ -41,12 +39,10 @@ import java.io.File;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import jenkins.tasks.SimpleBuildStep;
/**
* {@link Action} that displays the JUnit test result.
......@@ -57,7 +53,7 @@ import jenkins.tasks.SimpleBuildStep;
*
* @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;
// Hudson < 1.25 didn't set these fields, so use Integer
......@@ -70,13 +66,6 @@ public class TestResultAction extends AbstractTestResultAction<TestResultAction>
@Deprecated
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);
setResult(result, listener);
}
......@@ -86,15 +75,10 @@ public class TestResultAction extends AbstractTestResultAction<TestResultAction>
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.
* @since TODO
*/
public synchronized void setResult(TestResult result, TaskListener listener) {
public synchronized void setResult(TestResult result, BuildListener listener) {
result.freeze(this);
totalCount = result.getTotalCount();
......@@ -111,13 +95,8 @@ public class TestResultAction extends AbstractTestResultAction<TestResultAction>
this.result = new WeakReference<TestResult>(result);
}
@Deprecated
public void setResult(TestResult result, BuildListener listener) {
setResult(result, (TaskListener) listener);
}
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() {
......@@ -215,7 +194,7 @@ public class TestResultAction extends AbstractTestResultAction<TestResultAction>
* Resolves {@link TestAction}s for the given {@link TestObject}.
*
* <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
*/
......
......@@ -37,7 +37,6 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import jenkins.model.RunAction2;
import jenkins.model.lazy.LazyBuildMixIn;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.CategoryAxis;
......@@ -65,12 +64,6 @@ import org.kohsuke.stapler.export.ExportedBean;
*/
@ExportedBean
public abstract class AbstractTestResultAction<T extends AbstractTestResultAction> implements HealthReportingAction, RunAction2 {
/**
* @since TODO
*/
public transient Run<?,?> run;
@Deprecated
public transient AbstractBuild<?,?> owner;
private Map<String,String> descriptions = new ConcurrentHashMap<String, String>();
......@@ -78,28 +71,18 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio
/** @since 1.545 */
protected AbstractTestResultAction() {}
/**
* @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 Use the default constructor and just call {@link Run#addAction} to associate the build with the action. */
@Deprecated
protected AbstractTestResultAction(AbstractBuild owner) {
this((Run) owner);
this.owner = owner;
}
@Override public void onAttached(Run<?, ?> r) {
this.run = r;
this.owner = r instanceof AbstractBuild ? (AbstractBuild<?,?>) r : null;
this.owner = (AbstractBuild<?,?>) r;
}
@Override public void onLoad(Run<?, ?> r) {
this.run = r;
this.owner = r instanceof AbstractBuild ? (AbstractBuild<?,?>) r : null;
this.owner = (AbstractBuild<?,?>) r;
}
/**
......@@ -209,15 +192,10 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio
}
private <U extends AbstractTestResultAction> U getPreviousResult(Class<U> type, boolean eager) {
Run<?,?> b = run;
Set<Integer> loadedBuilds;
if (!eager && run.getParent() instanceof LazyBuildMixIn.LazyLoadingJob) {
loadedBuilds = ((LazyBuildMixIn.LazyLoadingJob<?,?>) run.getParent()).getLazyBuildMixIn()._getRuns().getLoadedBuilds().keySet();
} else {
loadedBuilds = null;
}
Set<Integer> loadedBuilds = eager ? null : owner.getProject()._getRuns().getLoadedBuilds().keySet();
AbstractBuild<?,?> b = owner;
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)
return null;
U r = b.getAction(type);
......@@ -259,7 +237,7 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio
return;
}
if(req.checkIfModified(run.getTimestamp(),rsp))
if(req.checkIfModified(owner.getTimestamp(),rsp))
return;
ChartUtil.generateGraph(req,rsp,createChart(req,buildDataSet(req)),calcDefaultSize());
......@@ -269,7 +247,7 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio
* Generates a clickable map HTML for {@link #doGraph(StaplerRequest, StaplerResponse)}.
*/
public void doGraphMap( StaplerRequest req, StaplerResponse rsp) throws IOException {
if(req.checkIfModified(run.getTimestamp(),rsp))
if(req.checkIfModified(owner.getTimestamp(),rsp))
return;
ChartUtil.generateClickableMap(req,rsp,createChart(req,buildDataSet(req)),calcDefaultSize());
}
......@@ -301,10 +279,10 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio
DataSetBuilder<String,NumberOnlyBuildLabel> dsb = new DataSetBuilder<String,NumberOnlyBuildLabel>();
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) {
dsb.add( a.getSkipCount(), "skipped", new NumberOnlyBuildLabel(a.run));
dsb.add( a.getTotalCount()-a.getFailCount()-a.getSkipCount(),"total", 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.owner));
}
}
return dsb.build();
......@@ -359,20 +337,20 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio
@Override
public String generateURL(CategoryDataset dataset, int row, int column) {
NumberOnlyBuildLabel label = (NumberOnlyBuildLabel) dataset.getColumnKey(column);
return relPath+label.getRun().getNumber()+"/testReport/";
return relPath+label.build.getNumber()+"/testReport/";
}
@Override
public String generateToolTip(CategoryDataset dataset, int row, int column) {
NumberOnlyBuildLabel label = (NumberOnlyBuildLabel) dataset.getColumnKey(column);
AbstractTestResultAction a = label.getRun().getAction(AbstractTestResultAction.class);
AbstractTestResultAction a = label.build.getAction(AbstractTestResultAction.class);
switch (row) {
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:
return String.valueOf(Messages.AbstractTestResultAction_skip(label.getRun().getDisplayName(), a.getSkipCount()));
return String.valueOf(Messages.AbstractTestResultAction_skip(label.build.getDisplayName(), a.getSkipCount()));
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 @@
*/
package hudson.tasks.test;
import hudson.Util;
import hudson.model.AbstractBuild;
import hudson.model.Run;
import org.kohsuke.stapler.export.Exported;
import org.kohsuke.stapler.export.ExportedBean;
......@@ -35,7 +33,7 @@ import java.util.List;
/**
* {@link AbstractTestResultAction} that aggregates all the test results
* from the corresponding {@link Run}s.
* from the corresponding {@link AbstractBuild}s.
*
* <p>
* (This has nothing to do with {@link AggregatedTestResultPublisher}, unfortunately)
......@@ -123,27 +121,13 @@ public abstract class AggregatedTestResultAction extends AbstractTestResultActio
*/
@ExportedBean(defaultVisibility=2)
public static final class ChildReport {
@Deprecated
@Exported
public final AbstractBuild<?,?> child;
/**
* @since TODO
*/
@Exported(name="child")
public final Run<?,?> run;
@Exported
public final Object result;
@Deprecated
public ChildReport(AbstractBuild<?, ?> child, AbstractTestResultAction result) {
this((Run) child, result);
}
/**
* @since TODO
*/
public ChildReport(Run<?,?> run, AbstractTestResultAction result) {
this.child = run instanceof AbstractBuild ? (AbstractBuild) run : null;
this.run = run;
this.child = child;
this.result = result!=null ? result.getResult() : null;
}
}
......@@ -156,7 +140,7 @@ public abstract class AggregatedTestResultAction extends AbstractTestResultActio
return new AbstractList<ChildReport>() {
public ChildReport get(int index) {
return new ChildReport(
resolveRun(children.get(index)),
resolveChild(children.get(index)),
getChildReport(children.get(index)));
}
......@@ -167,30 +151,14 @@ public abstract class AggregatedTestResultAction extends AbstractTestResultActio
}
protected abstract String getChildName(AbstractTestResultAction tr);
/**
* @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");
}
}
public abstract AbstractBuild<?,?> resolveChild(Child child);
/**
* Uses {@link #resolveChild(Child)} and obtain the
* {@link AbstractTestResultAction} object for the given child.
*/
protected AbstractTestResultAction getChildReport(Child child) {
Run<?,?> b = resolveRun(child);
AbstractBuild<?,?> b = resolveChild(child);
if(b==null) return null;
return b.getAction(AbstractTestResultAction.class);
}
......
......@@ -28,7 +28,7 @@ import hudson.FilePath;
import hudson.FilePath.FileCallable;
import hudson.Launcher;
import hudson.Util;
import hudson.model.Run;
import hudson.model.AbstractBuild;
import hudson.model.TaskListener;
import hudson.remoting.VirtualChannel;
......@@ -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;
@Override
public TestResult parseResult(final String testResultLocations, final Run<?,?> build, FilePath workspace, final Launcher launcher, final TaskListener listener) throws InterruptedException, IOException {
return workspace.act(new FileCallable<TestResult>() {
public TestResult parse(final String testResultLocations, final AbstractBuild build, final Launcher launcher, final TaskListener listener) throws InterruptedException, IOException {
return build.getWorkspace().act(new FileCallable<TestResult>() {
final boolean ignoreTimestampCheck = IGNORE_TIMESTAMP_CHECK; // so that the property can be set on the master
final long buildTime = build.getTimestamp().getTimeInMillis();
final long nowMaster = System.currentTimeMillis();
......
......@@ -23,7 +23,7 @@
*/
package hudson.tasks.test;
import hudson.model.Run;
import hudson.model.AbstractBuild;
import hudson.tasks.junit.TestAction;
import java.util.Collection;
......@@ -189,12 +189,12 @@ public class SimpleCaseResult extends TestResult {
}
@Override
public Run<?,?> getRun() {
public AbstractBuild<?,?> getOwner() {
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 parentAction.run;
return parentAction.owner;
}
@Override
......
......@@ -56,6 +56,8 @@ public abstract class TestObject extends hudson.tasks.junit.TestObject {
private static final Logger LOGGER = Logger.getLogger(TestObject.class.getName());
private volatile transient String id;
public abstract AbstractBuild<?, ?> getOwner();
/**
* Reverse pointer of {@link TabulatedResult#getChildren()}.
*/
......@@ -156,7 +158,7 @@ public abstract class TestObject extends hudson.tasks.junit.TestObject {
buf.insert(0,action.getUrlName());
// Now the build
Run<?,?> myBuild = cur.getRun();
AbstractBuild<?,?> myBuild = cur.getOwner();
if (myBuild ==null) {
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.
......@@ -199,7 +201,7 @@ public abstract class TestObject extends hudson.tasks.junit.TestObject {
*/
@Override
public AbstractTestResultAction getTestResultAction() {
Run<?, ?> owner = getRun();
AbstractBuild<?, ?> owner = getOwner();
if (owner != null) {
return owner.getAction(AbstractTestResultAction.class);
} else {
......@@ -244,19 +246,12 @@ public abstract class TestObject extends hudson.tasks.junit.TestObject {
*/
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.
*
* @return null if no such counter part exists.
*/
@Override public TestResult getResultInRun(Run<?,?> run) {
return (TestResult) super.getResultInRun(run);
}
public abstract TestResult getResultInBuild(AbstractBuild<?, ?> build);
/**
* 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 {
public synchronized HttpResponse doSubmitDescription(
@QueryParameter String description) throws IOException,
ServletException {
if (getRun() == null) {
LOGGER.severe("getRun() is null, can't save description.");
if (getOwner() == null) {
LOGGER.severe("getOwner() is null, can't save description.");
} else {
getRun().checkPermission(Run.UPDATE);
getOwner().checkPermission(Run.UPDATE);
setDescription(description);
getRun().save();
getOwner().save();
}
return new HttpRedirect(".");
......
......@@ -24,6 +24,7 @@
package hudson.tasks.test;
import hudson.tasks.junit.TestAction;
import hudson.model.AbstractBuild;
import hudson.model.Run;
import hudson.model.Result;
......@@ -54,7 +55,7 @@ public abstract class TestResult extends TestObject {
* this test result.
*/
public AbstractTestResultAction getParentAction() {
return getRun().getAction(AbstractTestResultAction.class);
return getOwner().getAction(AbstractTestResultAction.class);
}
/**
......@@ -129,7 +130,7 @@ public abstract class TestResult extends TestObject {
* @return null if no such counter part exists.
*/
public TestResult getPreviousResult() {
Run<?,?> b = getRun();
AbstractBuild<?,?> b = getOwner();
if (b == null) {
return null;
}
......@@ -151,7 +152,7 @@ public abstract class TestResult extends TestObject {
*
* @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());
if (tra == null) {
tra = build.getAction(AbstractTestResultAction.class);
......
......@@ -26,17 +26,13 @@ package hudson.tasks.test;
import hudson.AbortException;
import hudson.ExtensionList;
import hudson.ExtensionPoint;
import hudson.FilePath;
import hudson.Launcher;
import hudson.Util;
import hudson.model.AbstractBuild;
import hudson.model.Run;
import jenkins.model.Jenkins;
import hudson.model.TaskListener;
import hudson.tasks.Publisher;
import java.io.IOException;
import javax.annotation.Nonnull;
/**
* Parses test result files and builds in-memory representation of it as {@link TestResult}.
......@@ -52,7 +48,7 @@ import javax.annotation.Nonnull;
* which handles a set of default error checks on user inputs.
*
* <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.
*
* @since 1.343
......@@ -100,11 +96,10 @@ public abstract class TestResultParser implements ExtensionPoint {
* </ul>
*
* @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.
* @param run
* @param build
* Build for which these tests are parsed. Never null.
* @param workspace the workspace in which tests can be found
* @param launcher
* Can be used to fork processes on the machine where the build is running. Never null.
* @param listener
......@@ -119,32 +114,9 @@ public abstract class TestResultParser implements ExtensionPoint {
* @throws AbortException
* If you encounter an error that you handled gracefully, throw this exception and Hudson
* will not show a stack trace.
* @since TODO
*/
public TestResult parseResult(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,
public abstract TestResult parse(String testResultLocations,
AbstractBuild build, Launcher launcher,
TaskListener listener)
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");
}
}
throws InterruptedException, IOException;
}
......@@ -23,10 +23,9 @@
*/
package hudson.tasks.test;
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.Action;
import hudson.model.Job;
import hudson.model.Run;
import hudson.tasks.junit.JUnitResultArchiver;
import org.kohsuke.stapler.Ancestor;
import org.kohsuke.stapler.StaplerRequest;
......@@ -50,24 +49,11 @@ import java.util.List;
public class TestResultProjectAction implements Action {
/**
* Project that owns this action.
* @since TODO
*/
public final Job<?,?> job;
@Deprecated
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) {
this((Job) project);
this.project = project;
}
/**
......@@ -86,9 +72,9 @@ public class TestResultProjectAction implements Action {
}
public AbstractTestResultAction getLastTestResultAction() {
final Run<?,?> tb = job.getLastSuccessfulBuild();
final AbstractBuild<?,?> tb = project.getLastSuccessfulBuild();
Run<?,?> b = job.getLastBuild();
AbstractBuild<?,?> b=project.getLastBuild();
while(b!=null) {
AbstractTestResultAction a = b.getAction(AbstractTestResultAction.class);
if(a!=null && (!b.isBuilding())) return a;
......
......@@ -25,7 +25,7 @@ THE SOFTWARE.
<?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">
<l:layout title="${it.run} test - ${it.displayName}">
<l:layout title="${it.owner} test - ${it.displayName}">
<st:include page="sidepanel.jelly" />
<l:main-panel>
<j:set var="st" value="${it.status}" />
......@@ -50,7 +50,7 @@ THE SOFTWARE.
${%failingFor(it.age)}
</j:otherwise>
</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>
</j:if>
......@@ -60,7 +60,7 @@ THE SOFTWARE.
</a>
</div>
<t:editableDescription permission="${it.run.UPDATE}"/>
<t:editableDescription permission="${it.owner.UPDATE}"/>
<table style="margin-top: 1em; margin-left:0em;">
<j:forEach var="action" items="${it.testActions}">
......
......@@ -36,8 +36,8 @@ THE SOFTWARE.
<td class="pane-header" style="width:5em">${%Test Result}</td>
</tr>
<tbody>
<j:forEach var="b" items="${it.run.parent.builds}" begin="${start}" end="${end}">
<j:set var="test" value="${it.getResultInRun(b)}"/>
<j:forEach var="b" items="${it.owner.parent.builds}" begin="${start}" end="${end}">
<j:set var="test" value="${it.getResultInBuild(b)}"/>
<j:if test="${test != null}">
<tr>
<td class="pane">
......
......@@ -35,8 +35,8 @@ THE SOFTWARE.
<td class="pane-header" style="width:5em">${%Total}</td>
</tr>
<tbody>
<j:forEach var="b" items="${it.run.parent.builds}" begin="${start}" end="${end}">
<j:set var="p" value="${it.getResultInRun(b)}"/>
<j:forEach var="b" items="${it.owner.parent.builds}" begin="${start}" end="${end}">
<j:set var="p" value="${it.getResultInBuild(b)}"/>
<j:if test="${p != null}">
<tr>
<td class="pane">
......
......@@ -67,11 +67,11 @@ THE SOFTWARE.
<st:include from="${it.testObject}" it="${it.testObject}" page="list.jelly" optional="true"/>
<div>
<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 test="${it.testObject.run.parent.builds.size() > end}">
<a href="${app.rootUrl}${it.testObject.run.url}testReport${it.testObject.url}/history?start=${end+1}">${%Older}</a>
<j:if test="${it.testObject.owner.project.builds.size() > end}">
<a href="${app.rootUrl}${it.testObject.owner.url}testReport${it.testObject.url}/history?start=${end+1}">${%Older}</a>
</j:if>
</div>
</l:main-panel>
......
......@@ -30,10 +30,12 @@ PackageResult.getChildTitle=Class
ClassResult.getTitle=Test Result : {0}
JUnitParser.DisplayName=JUnit Parser
JUnitParser.TestResultLocationMessage=JUnit xml files:
JUnitParser.no_workspace_found=No workspace found for {0}
JUnitResultArchiver.DisplayName=Publish JUnit test result report
JUnitResultArchiver.NoTestReportFound=No test report files were found. Configuration error?
JUnitResultArchiver.Recording=Recording test results
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
CaseResult.Status.Passed=Passed
......
......@@ -32,6 +32,7 @@ TestResult.getTitle=Test Resultat
JUnitResultArchiver.DisplayName=Publicer JUnit testrapport
TestResult.getDisplayName=Testresultater
CaseResult.Status.Failed=Fejlet
JUnitResultArchiver.BadXML=Ukorrekt XML attribut fundet for test resultater i {0}
JUnitResultArchiver.ResultIsEmpty=Ingen af testrapporterne indeholder resultater
JUnitResultArchiver.NoTestReportFound=Ingen testrapporter fundet. Konfigurationsfejl?
PackageResult.getTitle=Testresultat : {0}
......@@ -39,3 +39,4 @@ CaseResult.Status.Skipped=Ausgelassen
CaseResult.Status.Fixed=Repariert
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
JUnitResultArchiver.NoTestReportFound=No se encontraron ficheros con resultados de tests. ¿Hay algun error en la configuración?
JUnitResultArchiver.Recording=Grabando resultados de tests
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.Failed=Fallidos
......
......@@ -30,13 +30,15 @@ PackageResult.getChildTitle=\u30af\u30e9\u30b9
ClassResult.getTitle=\u30c6\u30b9\u30c8\u7d50\u679c : {0}
JUnitParser.DisplayName=JUnit\u30d1\u30fc\u30b5\u30fc
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.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.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.Failed=\u5931\u6557
CaseResult.Status.Skipped=\u30b9\u30ad\u30c3\u30d7
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
# Recording test results
JUnitResultArchiver.Recording=Gravando o resultado dos testes
# Incorrect XML attributes for test results found in {0}
JUnitResultArchiver.BadXML=Atributos XML incorretos para teste de resultados em {0}
# Fixed
CaseResult.Status.Fixed=Fixo
# None of the test reports contained any result
......
......@@ -30,10 +30,12 @@ PackageResult.getChildTitle=\u985e\u5225
ClassResult.getTitle=\u6e2c\u8a66\u7d50\u679c: {0}
JUnitParser.DisplayName=JUnit \u5256\u6790\u7a0b\u5f0f
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.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.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.Failed=\u5931\u6557
......
......@@ -64,7 +64,7 @@ THE SOFTWARE.
<li class="${elementClass}" style="${elementStyle}">
<!-- 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)}">
<st:out value="${testObject.fullDisplayName}" />
</a>
......
......@@ -35,8 +35,8 @@ THE SOFTWARE.
<td class="pane-header" style="width:5em">${%Total}</td>
</tr>
<tbody>
<j:forEach var="b" items="${it.run.parent.builds}" begin="${start}" end="${end}">
<j:set var="p" value="${it.getResultInRun(b)}"/>
<j:forEach var="b" items="${it.owner.parent.builds}" begin="${start}" end="${end}">
<j:set var="p" value="${it.getResultInBuild(b)}"/>
<j:if test="${p != null}">
<tr>
<td class="pane">
......
......@@ -32,16 +32,16 @@ THE SOFTWARE.
<l:tasks>
<j:set var="buildUrl" value="${h.decompose(request)}" />
<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}"/>
<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}" />
<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}"/>
</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}"/>
</j:if>
</l:tasks>
......
......@@ -24,7 +24,7 @@ THE SOFTWARE.
<?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">
<l:layout title="${it.run} ${it.displayName}">
<l:layout title="${it.owner} ${it.displayName}">
<st:include page="sidepanel.jelly" />
<l:main-panel>
<h1><st:out value="${it.title}" /></h1>
......@@ -39,7 +39,7 @@ THE SOFTWARE.
</a>
</div>
<t:editableDescription permission="${it.run.UPDATE}"/>
<t:editableDescription permission="${it.owner.UPDATE}"/>
<table style="margin-top: 1em; margin-left:0em;">
<j:forEach var="action" items="${it.testActions}">
......
......@@ -25,11 +25,11 @@ THE SOFTWARE.
<?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">
<l:layout title="Test">
<st:include page="sidepanel.jelly" it="${it.job}" />
<st:include page="sidepanel.jelly" it="${it.project}" />
<l:main-panel>
<div>
<img src="trend?${request.queryString}" lazymap="trendMap?rel=../&amp;${request.queryString}" alt="[Test result trend chart]"/>
</div>
</l:main-panel>
</l:layout>
</j:jelly>
</j:jelly>
\ No newline at end of file
......@@ -26,7 +26,7 @@ THE SOFTWARE.
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:t="/lib/hudson">
<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}">
<t:summary icon="clipboard.png">
<a href="lastCompletedBuild/${tr.urlName}/">${%Latest Test Result}</a>
......
......@@ -66,7 +66,7 @@ public class JUnitParserTest extends HudsonTestCase {
}
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");
assertNotNull("we should have a non-null result", result);
......
......@@ -27,7 +27,7 @@ import com.gargoylesoftware.htmlunit.html.HtmlPage;
import hudson.model.FreeStyleBuild;
import hudson.model.FreeStyleProject;
import hudson.model.Result;
import hudson.model.Run;
import hudson.model.AbstractBuild;
import org.jvnet.hudson.test.HudsonTestCase;
import org.jvnet.hudson.test.TouchBuilder;
......@@ -50,13 +50,13 @@ public class TestResultExtensionTest extends HudsonTestCase {
assertBuildStatus(Result.SUCCESS, build);
TrivialTestResultAction action = build.getAction(TrivialTestResultAction.class);
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();
assertNotNull("we should have a result");
assertTrue("result should be an TestResult",
resultObject instanceof TestResult);
TestResult result = (TestResult) resultObject;
Run<?,?> ownerBuild = result.getRun();
AbstractBuild<?,?> ownerBuild = result.getOwner();
assertNotNull("we should have an owner", ownerBuild);
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.
先完成此消息的编辑!
想要评论请 注册