提交 aa595459 编写于 作者: J Jesse Glick

Some more forgotten uses of AbstractBuild.

上级 99a94834
......@@ -296,7 +296,7 @@ public final class TestResult extends MetaTabulatedResult {
@Override
public Run<?,?> getRun() {
return (parentAction == null? null: parentAction.owner);
return (parentAction == null? null: parentAction.run);
}
@Override
......
......@@ -117,7 +117,7 @@ public class TestResultAction extends AbstractTestResultAction<TestResultAction>
}
private XmlFile getDataFile() {
return new XmlFile(XSTREAM,new File(owner.getRootDir(), "junitResult.xml"));
return new XmlFile(XSTREAM, new File(run.getRootDir(), "junitResult.xml"));
}
public synchronized TestResult getResult() {
......
......@@ -251,7 +251,7 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio
return;
}
if(req.checkIfModified(owner.getTimestamp(),rsp))
if(req.checkIfModified(run.getTimestamp(),rsp))
return;
ChartUtil.generateGraph(req,rsp,createChart(req,buildDataSet(req)),calcDefaultSize());
......@@ -261,7 +261,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(owner.getTimestamp(),rsp))
if(req.checkIfModified(run.getTimestamp(),rsp))
return;
ChartUtil.generateClickableMap(req,rsp,createChart(req,buildDataSet(req)),calcDefaultSize());
}
......@@ -293,10 +293,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) ) {
dsb.add( a.getFailCount(), "failed", new NumberOnlyBuildLabel(a.owner));
dsb.add( a.getFailCount(), "failed", new NumberOnlyBuildLabel(a.run));
if(!failureOnly) {
dsb.add( a.getSkipCount(), "skipped", new NumberOnlyBuildLabel(a.owner));
dsb.add( a.getTotalCount()-a.getFailCount()-a.getSkipCount(),"total", new NumberOnlyBuildLabel(a.owner));
dsb.add( a.getSkipCount(), "skipped", new NumberOnlyBuildLabel(a.run));
dsb.add( a.getTotalCount()-a.getFailCount()-a.getSkipCount(),"total", new NumberOnlyBuildLabel(a.run));
}
}
return dsb.build();
......@@ -351,20 +351,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.build.getNumber()+"/testReport/";
return relPath+label.getRun().getNumber()+"/testReport/";
}
@Override
public String generateToolTip(CategoryDataset dataset, int row, int column) {
NumberOnlyBuildLabel label = (NumberOnlyBuildLabel) dataset.getColumnKey(column);
AbstractTestResultAction a = label.build.getAction(AbstractTestResultAction.class);
AbstractTestResultAction a = label.getRun().getAction(AbstractTestResultAction.class);
switch (row) {
case 0:
return String.valueOf(Messages.AbstractTestResultAction_fail(label.build.getDisplayName(), a.getFailCount()));
return String.valueOf(Messages.AbstractTestResultAction_fail(label.getRun().getDisplayName(), a.getFailCount()));
case 1:
return String.valueOf(Messages.AbstractTestResultAction_skip(label.build.getDisplayName(), a.getSkipCount()));
return String.valueOf(Messages.AbstractTestResultAction_skip(label.getRun().getDisplayName(), a.getSkipCount()));
default:
return String.valueOf(Messages.AbstractTestResultAction_test(label.build.getDisplayName(), a.getTotalCount()));
return String.valueOf(Messages.AbstractTestResultAction_test(label.getRun().getDisplayName(), a.getTotalCount()));
}
}
};
......
......@@ -194,7 +194,7 @@ public class SimpleCaseResult extends TestResult {
LOGGER.warning("in Trivial Test Result, parentAction is null, but getRun() called");
return null;
}
return parentAction.owner;
return parentAction.run;
}
@Override
......
......@@ -24,6 +24,7 @@
package hudson.util;
import hudson.model.AbstractBuild;
import hudson.model.Run;
import hudson.tasks.junit.History;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.NumberAxis;
......@@ -47,31 +48,48 @@ public class ChartUtil {
* Can be used as a graph label. Only displays numbers.
*/
public static final class NumberOnlyBuildLabel implements Comparable<NumberOnlyBuildLabel> {
private final Run<?,?> run;
@Deprecated
public final AbstractBuild build;
/** @since TODO */
public NumberOnlyBuildLabel(Run<?,?> run) {
this.run = run;
this.build = run instanceof AbstractBuild ? (AbstractBuild) run : null;
}
@Deprecated
public NumberOnlyBuildLabel(AbstractBuild build) {
this.run = build;
this.build = build;
}
/* @since TODO */
public Run<?, ?> getRun() {
return run;
}
public int compareTo(NumberOnlyBuildLabel that) {
return this.build.number-that.build.number;
return this.run.number-that.run.number;
}
@Override
public boolean equals(Object o) {
if(!(o instanceof NumberOnlyBuildLabel)) return false;
NumberOnlyBuildLabel that = (NumberOnlyBuildLabel) o;
return build==that.build;
return run==that.run;
}
@Override
public int hashCode() {
return build.hashCode();
return run.hashCode();
}
@Override
public String toString() {
return build.getDisplayName();
return run.getDisplayName();
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册