From 7a43fdfa2c336ff7909f98c7fcbfb6302eea3fe0 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Mon, 11 Aug 2014 14:46:02 -0400 Subject: [PATCH] Reverting portions of patch that were moved to junit-plugin. --- .../java/hudson/tasks/junit/CaseResult.java | 17 ++-- .../java/hudson/tasks/junit/ClassResult.java | 6 +- .../main/java/hudson/tasks/junit/History.java | 22 +++-- .../java/hudson/tasks/junit/JUnitParser.java | 10 ++- .../tasks/junit/JUnitResultArchiver.java | 88 +++++++++---------- .../hudson/tasks/junit/PackageResult.java | 6 +- .../hudson/tasks/junit/TestDataPublisher.java | 29 +----- .../java/hudson/tasks/junit/TestObject.java | 41 +-------- .../java/hudson/tasks/junit/TestResult.java | 5 +- .../hudson/tasks/junit/TestResultAction.java | 31 ++----- .../tasks/test/AbstractTestResultAction.java | 56 ++++-------- .../test/AggregatedTestResultAction.java | 44 ++-------- .../test/DefaultTestResultParserImpl.java | 6 +- .../hudson/tasks/test/SimpleCaseResult.java | 8 +- .../java/hudson/tasks/test/TestObject.java | 23 ++--- .../java/hudson/tasks/test/TestResult.java | 7 +- .../hudson/tasks/test/TestResultParser.java | 38 ++------ .../tasks/test/TestResultProjectAction.java | 22 +---- .../hudson/tasks/junit/CaseResult/index.jelly | 6 +- .../hudson/tasks/junit/CaseResult/list.jelly | 4 +- .../hudson/tasks/junit/ClassResult/list.jelly | 4 +- .../hudson/tasks/junit/History/index.jelly | 6 +- .../hudson/tasks/junit/Messages.properties | 2 + .../hudson/tasks/junit/Messages_da.properties | 1 + .../hudson/tasks/junit/Messages_de.properties | 1 + .../hudson/tasks/junit/Messages_es.properties | 1 + .../hudson/tasks/junit/Messages_ja.properties | 4 +- .../tasks/junit/Messages_pt_BR.properties | 1 + .../tasks/junit/Messages_zh_TW.properties | 2 + .../AbstractTestResultAction/summary.jelly | 2 +- .../tasks/test/MetaTabulatedResult/list.jelly | 4 +- .../tasks/test/TestObject/sidepanel.jelly | 8 +- .../hudson/tasks/test/TestResult/index.jelly | 4 +- .../test/TestResultProjectAction/index.jelly | 4 +- .../TestResultProjectAction/jobMain.jelly | 2 +- .../hudson/tasks/junit/JUnitParserTest.java | 2 +- .../tasks/test/TestResultExtensionTest.java | 6 +- 37 files changed, 176 insertions(+), 347 deletions(-) diff --git a/core/src/main/java/hudson/tasks/junit/CaseResult.java b/core/src/main/java/hudson/tasks/junit/CaseResult.java index d8678ab49e..f87765b00b 100644 --- a/core/src/main/java/hudson/tasks/junit/CaseResult.java +++ b/core/src/main/java/hudson/tasks/junit/CaseResult.java @@ -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 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 { } public Run getFailedSinceRun() { - return getRun().getParent().getBuildByNumber(getFailedSince()); + return getOwner().getParent().getBuildByNumber(getFailedSince()); } /** @@ -395,8 +396,8 @@ public class CaseResult extends TestResult implements Comparable { 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 { } @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 { if(prev!=null && !prev.isPassed()) this.failedSince = prev.failedSince; else - this.failedSince = getRun().getNumber(); + this.failedSince = getOwner().getNumber(); } } diff --git a/core/src/main/java/hudson/tasks/junit/ClassResult.java b/core/src/main/java/hudson/tasks/junit/ClassResult.java index 74bb0a4859..6f046dbd28 100644 --- a/core/src/main/java/hudson/tasks/junit/ClassResult.java +++ b/core/src/main/java/hudson/tasks/junit/ClassResult.java @@ -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 getRun() { - return (parent==null ? null: parent.getRun()); + public AbstractBuild getOwner() { + return (parent==null ? null: parent.getOwner()); } public PackageResult getParent() { diff --git a/core/src/main/java/hudson/tasks/junit/History.java b/core/src/main/java/hudson/tasks/junit/History.java index baaf1f9973..c2d0c783c8 100644 --- a/core/src/main/java/hudson/tasks/junit/History.java +++ b/core/src/main/java/hudson/tasks/junit/History.java @@ -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 getList(int start, int end) { List list = new ArrayList(); - 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 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; diff --git a/core/src/main/java/hudson/tasks/junit/JUnitParser.java b/core/src/main/java/hudson/tasks/junit/JUnitParser.java index b3756e00be..97b02f4fac 100644 --- a/core/src/main/java/hudson/tasks/junit/JUnitParser.java +++ b/core/src/main/java/hudson/tasks/junit/JUnitParser.java @@ -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)); } diff --git a/core/src/main/java/hudson/tasks/junit/JUnitResultArchiver.java b/core/src/main/java/hudson/tasks/junit/JUnitResultArchiver.java index 26014a3a75..223a1e812e 100644 --- a/core/src/main/java/hudson/tasks/junit/JUnitResultArchiver.java +++ b/core/src/main/java/hudson/tasks/junit/JUnitResultArchiver.java @@ -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> testDataPublishers; + private final DescribableList> 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> 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 = new ArrayList(); 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> getTestDataPublishers() { return testDataPublishers; } - /** @since TODO */ - public final void setTestDataPublishers(DescribableList> testDataPublishers) { - this.testDataPublishers = testDataPublishers; - } + @Override + public Collection getProjectActions(AbstractProject project) { + return Collections.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 diff --git a/core/src/main/java/hudson/tasks/junit/PackageResult.java b/core/src/main/java/hudson/tasks/junit/PackageResult.java index 3e0cc2bdff..f64ad327c2 100644 --- a/core/src/main/java/hudson/tasks/junit/PackageResult.java +++ b/core/src/main/java/hudson/tasks/junit/PackageResult.java @@ -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() { diff --git a/core/src/main/java/hudson/tasks/junit/TestDataPublisher.java b/core/src/main/java/hudson/tasks/junit/TestDataPublisher.java index 18f53d2bd0..751fb60707 100644 --- a/core/src/main/java/hudson/tasks/junit/TestDataPublisher.java +++ b/core/src/main/java/hudson/tasks/junit/TestDataPublisher.java @@ -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 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> all() { return Jenkins.getInstance().>getDescriptorList(TestDataPublisher.class); diff --git a/core/src/main/java/hudson/tasks/junit/TestObject.java b/core/src/main/java/hudson/tasks/junit/TestObject.java index 83d2ff4e78..108e235903 100644 --- a/core/src/main/java/hudson/tasks/junit/TestObject.java +++ b/core/src/main/java/hudson/tasks/junit/TestObject.java @@ -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. diff --git a/core/src/main/java/hudson/tasks/junit/TestResult.java b/core/src/main/java/hudson/tasks/junit/TestResult.java index c462cbae61..5010a6e87f 100644 --- a/core/src/main/java/hudson/tasks/junit/TestResult.java +++ b/core/src/main/java/hudson/tasks/junit/TestResult.java @@ -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 diff --git a/core/src/main/java/hudson/tasks/junit/TestResultAction.java b/core/src/main/java/hudson/tasks/junit/TestResultAction.java index 1d87288a8a..e290210ad0 100644 --- a/core/src/main/java/hudson/tasks/junit/TestResultAction.java +++ b/core/src/main/java/hudson/tasks/junit/TestResultAction.java @@ -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 implements StaplerProxy, SimpleBuildStep.LastBuildAction { +public class TestResultAction extends AbstractTestResultAction implements StaplerProxy { private transient WeakReference result; // Hudson < 1.25 didn't set these fields, so use Integer @@ -70,13 +66,6 @@ public class TestResultAction extends AbstractTestResultAction @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 this(null, result, listener); } - @Override public Collection getProjectActions() { - return Collections.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 this.result = new WeakReference(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 * Resolves {@link TestAction}s for the given {@link TestObject}. * *

- * 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 */ diff --git a/core/src/main/java/hudson/tasks/test/AbstractTestResultAction.java b/core/src/main/java/hudson/tasks/test/AbstractTestResultAction.java index 2b38f6564d..ad0ad68a35 100644 --- a/core/src/main/java/hudson/tasks/test/AbstractTestResultAction.java +++ b/core/src/main/java/hudson/tasks/test/AbstractTestResultAction.java @@ -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 implements HealthReportingAction, RunAction2 { - - /** - * @since TODO - */ - public transient Run run; - @Deprecated public transient AbstractBuild owner; private Map descriptions = new ConcurrentHashMap(); @@ -78,28 +71,18 @@ public abstract class AbstractTestResultAction 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 U getPreviousResult(Class type, boolean eager) { - Run b = run; - Set loadedBuilds; - if (!eager && run.getParent() instanceof LazyBuildMixIn.LazyLoadingJob) { - loadedBuilds = ((LazyBuildMixIn.LazyLoadingJob) run.getParent()).getLazyBuildMixIn()._getRuns().getLoadedBuilds().keySet(); - } else { - loadedBuilds = null; - } + Set 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 dsb = new DataSetBuilder(); 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 * (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() { 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); } diff --git a/core/src/main/java/hudson/tasks/test/DefaultTestResultParserImpl.java b/core/src/main/java/hudson/tasks/test/DefaultTestResultParserImpl.java index c525892bf8..ffd6db2859 100644 --- a/core/src/main/java/hudson/tasks/test/DefaultTestResultParserImpl.java +++ b/core/src/main/java/hudson/tasks/test/DefaultTestResultParserImpl.java @@ -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 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() { + public TestResult parse(final String testResultLocations, final AbstractBuild build, final Launcher launcher, final TaskListener listener) throws InterruptedException, IOException { + return build.getWorkspace().act(new FileCallable() { 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(); diff --git a/core/src/main/java/hudson/tasks/test/SimpleCaseResult.java b/core/src/main/java/hudson/tasks/test/SimpleCaseResult.java index 1c662e2b15..f157ed0896 100644 --- a/core/src/main/java/hudson/tasks/test/SimpleCaseResult.java +++ b/core/src/main/java/hudson/tasks/test/SimpleCaseResult.java @@ -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 diff --git a/core/src/main/java/hudson/tasks/test/TestObject.java b/core/src/main/java/hudson/tasks/test/TestObject.java index 3f71a6c4b0..4df98e0e8b 100644 --- a/core/src/main/java/hudson/tasks/test/TestObject.java +++ b/core/src/main/java/hudson/tasks/test/TestObject.java @@ -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 id> @@ -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("."); diff --git a/core/src/main/java/hudson/tasks/test/TestResult.java b/core/src/main/java/hudson/tasks/test/TestResult.java index 882c15e12e..6538104993 100644 --- a/core/src/main/java/hudson/tasks/test/TestResult.java +++ b/core/src/main/java/hudson/tasks/test/TestResult.java @@ -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); diff --git a/core/src/main/java/hudson/tasks/test/TestResultParser.java b/core/src/main/java/hudson/tasks/test/TestResultParser.java index 3a7313f994..029051ca4d 100644 --- a/core/src/main/java/hudson/tasks/test/TestResultParser.java +++ b/core/src/main/java/hudson/tasks/test/TestResultParser.java @@ -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. * *

- * 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 { * * * @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; } diff --git a/core/src/main/java/hudson/tasks/test/TestResultProjectAction.java b/core/src/main/java/hudson/tasks/test/TestResultProjectAction.java index 5e2bf28a7d..f92553c814 100644 --- a/core/src/main/java/hudson/tasks/test/TestResultProjectAction.java +++ b/core/src/main/java/hudson/tasks/test/TestResultProjectAction.java @@ -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; diff --git a/core/src/main/resources/hudson/tasks/junit/CaseResult/index.jelly b/core/src/main/resources/hudson/tasks/junit/CaseResult/index.jelly index a141fbd0c9..b68fefc07c 100644 --- a/core/src/main/resources/hudson/tasks/junit/CaseResult/index.jelly +++ b/core/src/main/resources/hudson/tasks/junit/CaseResult/index.jelly @@ -25,7 +25,7 @@ THE SOFTWARE. - + @@ -50,7 +50,7 @@ THE SOFTWARE. ${%failingFor(it.age)} - (${%since.before}${%since.after}) + (${%since.before}${%since.after}) @@ -60,7 +60,7 @@ THE SOFTWARE. - + diff --git a/core/src/main/resources/hudson/tasks/junit/CaseResult/list.jelly b/core/src/main/resources/hudson/tasks/junit/CaseResult/list.jelly index 3e3739748b..99f9b4218f 100644 --- a/core/src/main/resources/hudson/tasks/junit/CaseResult/list.jelly +++ b/core/src/main/resources/hudson/tasks/junit/CaseResult/list.jelly @@ -36,8 +36,8 @@ THE SOFTWARE. - - + + - - + + - - + +
${%Test Result}
diff --git a/core/src/main/resources/hudson/tasks/junit/ClassResult/list.jelly b/core/src/main/resources/hudson/tasks/junit/ClassResult/list.jelly index ee86d9c6df..3c631ef775 100644 --- a/core/src/main/resources/hudson/tasks/junit/ClassResult/list.jelly +++ b/core/src/main/resources/hudson/tasks/junit/ClassResult/list.jelly @@ -35,8 +35,8 @@ THE SOFTWARE. ${%Total}
diff --git a/core/src/main/resources/hudson/tasks/junit/History/index.jelly b/core/src/main/resources/hudson/tasks/junit/History/index.jelly index 7d0c303a93..cda7a24512 100644 --- a/core/src/main/resources/hudson/tasks/junit/History/index.jelly +++ b/core/src/main/resources/hudson/tasks/junit/History/index.jelly @@ -67,11 +67,11 @@ THE SOFTWARE. diff --git a/core/src/main/resources/hudson/tasks/junit/Messages.properties b/core/src/main/resources/hudson/tasks/junit/Messages.properties index ee534eae27..c9a2d36ae6 100644 --- a/core/src/main/resources/hudson/tasks/junit/Messages.properties +++ b/core/src/main/resources/hudson/tasks/junit/Messages.properties @@ -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 diff --git a/core/src/main/resources/hudson/tasks/junit/Messages_da.properties b/core/src/main/resources/hudson/tasks/junit/Messages_da.properties index 42d77273c6..61a5ae7024 100644 --- a/core/src/main/resources/hudson/tasks/junit/Messages_da.properties +++ b/core/src/main/resources/hudson/tasks/junit/Messages_da.properties @@ -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} diff --git a/core/src/main/resources/hudson/tasks/junit/Messages_de.properties b/core/src/main/resources/hudson/tasks/junit/Messages_de.properties index 59bce33d23..1bd30c63b6 100644 --- a/core/src/main/resources/hudson/tasks/junit/Messages_de.properties +++ b/core/src/main/resources/hudson/tasks/junit/Messages_de.properties @@ -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} diff --git a/core/src/main/resources/hudson/tasks/junit/Messages_es.properties b/core/src/main/resources/hudson/tasks/junit/Messages_es.properties index bdd0b28bf5..fb3f561d52 100644 --- a/core/src/main/resources/hudson/tasks/junit/Messages_es.properties +++ b/core/src/main/resources/hudson/tasks/junit/Messages_es.properties @@ -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 diff --git a/core/src/main/resources/hudson/tasks/junit/Messages_ja.properties b/core/src/main/resources/hudson/tasks/junit/Messages_ja.properties index ef9f6ce240..a35112a493 100644 --- a/core/src/main/resources/hudson/tasks/junit/Messages_ja.properties +++ b/core/src/main/resources/hudson/tasks/junit/Messages_ja.properties @@ -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 diff --git a/core/src/main/resources/hudson/tasks/junit/Messages_pt_BR.properties b/core/src/main/resources/hudson/tasks/junit/Messages_pt_BR.properties index b8d4d8fa9e..37cf0bff91 100644 --- a/core/src/main/resources/hudson/tasks/junit/Messages_pt_BR.properties +++ b/core/src/main/resources/hudson/tasks/junit/Messages_pt_BR.properties @@ -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 diff --git a/core/src/main/resources/hudson/tasks/junit/Messages_zh_TW.properties b/core/src/main/resources/hudson/tasks/junit/Messages_zh_TW.properties index 641d3c0c88..ea92963571 100644 --- a/core/src/main/resources/hudson/tasks/junit/Messages_zh_TW.properties +++ b/core/src/main/resources/hudson/tasks/junit/Messages_zh_TW.properties @@ -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 diff --git a/core/src/main/resources/hudson/tasks/test/AbstractTestResultAction/summary.jelly b/core/src/main/resources/hudson/tasks/test/AbstractTestResultAction/summary.jelly index f78c96aed8..38bc5c55af 100644 --- a/core/src/main/resources/hudson/tasks/test/AbstractTestResultAction/summary.jelly +++ b/core/src/main/resources/hudson/tasks/test/AbstractTestResultAction/summary.jelly @@ -64,7 +64,7 @@ THE SOFTWARE.
  • - + diff --git a/core/src/main/resources/hudson/tasks/test/MetaTabulatedResult/list.jelly b/core/src/main/resources/hudson/tasks/test/MetaTabulatedResult/list.jelly index a61070f3a1..277272f560 100644 --- a/core/src/main/resources/hudson/tasks/test/MetaTabulatedResult/list.jelly +++ b/core/src/main/resources/hudson/tasks/test/MetaTabulatedResult/list.jelly @@ -35,8 +35,8 @@ THE SOFTWARE.
  • ${%Total}
    diff --git a/core/src/main/resources/hudson/tasks/test/TestObject/sidepanel.jelly b/core/src/main/resources/hudson/tasks/test/TestObject/sidepanel.jelly index e585afa6aa..d6578f0e99 100644 --- a/core/src/main/resources/hudson/tasks/test/TestObject/sidepanel.jelly +++ b/core/src/main/resources/hudson/tasks/test/TestObject/sidepanel.jelly @@ -32,16 +32,16 @@ THE SOFTWARE. - + - + - + - + diff --git a/core/src/main/resources/hudson/tasks/test/TestResult/index.jelly b/core/src/main/resources/hudson/tasks/test/TestResult/index.jelly index 25eec852a4..1022814bf3 100644 --- a/core/src/main/resources/hudson/tasks/test/TestResult/index.jelly +++ b/core/src/main/resources/hudson/tasks/test/TestResult/index.jelly @@ -24,7 +24,7 @@ THE SOFTWARE. - +

    @@ -39,7 +39,7 @@ THE SOFTWARE. - + diff --git a/core/src/main/resources/hudson/tasks/test/TestResultProjectAction/index.jelly b/core/src/main/resources/hudson/tasks/test/TestResultProjectAction/index.jelly index a6bc08f6c2..e63803a6fa 100644 --- a/core/src/main/resources/hudson/tasks/test/TestResultProjectAction/index.jelly +++ b/core/src/main/resources/hudson/tasks/test/TestResultProjectAction/index.jelly @@ -25,11 +25,11 @@ THE SOFTWARE. - +
    [Test result trend chart]
    -
    + \ No newline at end of file diff --git a/core/src/main/resources/hudson/tasks/test/TestResultProjectAction/jobMain.jelly b/core/src/main/resources/hudson/tasks/test/TestResultProjectAction/jobMain.jelly index aa1dce4277..1fc26a0a02 100644 --- a/core/src/main/resources/hudson/tasks/test/TestResultProjectAction/jobMain.jelly +++ b/core/src/main/resources/hudson/tasks/test/TestResultProjectAction/jobMain.jelly @@ -26,7 +26,7 @@ THE SOFTWARE.
    - + ${%Latest Test Result} diff --git a/test/src/test/java/hudson/tasks/junit/JUnitParserTest.java b/test/src/test/java/hudson/tasks/junit/JUnitParserTest.java index 34b616216a..c4970ad024 100644 --- a/test/src/test/java/hudson/tasks/junit/JUnitParserTest.java +++ b/test/src/test/java/hudson/tasks/junit/JUnitParserTest.java @@ -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); diff --git a/test/src/test/java/hudson/tasks/test/TestResultExtensionTest.java b/test/src/test/java/hudson/tasks/test/TestResultExtensionTest.java index e4e99bf724..c6cc57b29f 100644 --- a/test/src/test/java/hudson/tasks/test/TestResultExtensionTest.java +++ b/test/src/test/java/hudson/tasks/test/TestResultExtensionTest.java @@ -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()); -- GitLab