提交 37c5bc2f 编写于 作者: J Jesse Glick

Deprecating getTestResultAction as an unwanted link from the model package to...

Deprecating getTestResultAction as an unwanted link from the model package to hudson.tasks.test package.
上级 4946fb25
......@@ -1039,14 +1039,14 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
}
/**
* Gets {@link AbstractTestResultAction} associated with this build if any.
* @deprecated Use {@link #getAction(Class)} on {@link AbstractTestResultAction}.
*/
public AbstractTestResultAction getTestResultAction() {
return getAction(AbstractTestResultAction.class);
}
/**
* Gets {@link AggregatedTestResultAction} associated with this build if any.
* @deprecated Use {@link #getAction(Class)} on {@link AggregatedTestResultAction}.
*/
public AggregatedTestResultAction getAggregatedTestResultAction() {
return getAction(AggregatedTestResultAction.class);
......
......@@ -2034,9 +2034,9 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
*/
private @Nonnull Summary determineDetailedUnstableSummary(Boolean worseOverride) {
if(((Run)this) instanceof AbstractBuild) {
AbstractTestResultAction trN = ((AbstractBuild)(Run)this).getTestResultAction();
AbstractTestResultAction trN = ((AbstractBuild)(Run)this).getAction(AbstractTestResultAction.class);
Run prev = getPreviousBuild();
AbstractTestResultAction trP = prev==null ? null : ((AbstractBuild) prev).getTestResultAction();
AbstractTestResultAction trP = prev==null ? null : ((AbstractBuild) prev).getAction(AbstractTestResultAction.class);
if(trP==null) {
if(trN!=null && trN.getFailCount()>0)
return new Summary(worseOverride != null ? worseOverride : true,
......
......@@ -55,7 +55,7 @@ public abstract class TestResult extends TestObject {
* this test result.
*/
public AbstractTestResultAction getParentAction() {
return getOwner().getTestResultAction();
return getOwner().getAction(AbstractTestResultAction.class);
}
/**
......
......@@ -76,7 +76,7 @@ public class TestResultProjectAction implements Action {
AbstractBuild<?,?> b=project.getLastBuild();
while(b!=null) {
AbstractTestResultAction a = b.getTestResultAction();
AbstractTestResultAction a = b.getAction(AbstractTestResultAction.class);
if(a!=null && (!b.isBuilding())) return a;
if(b==tb)
// if even the last successful build didn't produce the test result,
......
$b.getTestResultAction() :: $b instanceof hudson.model.AbstractBuild => $b.getAction(hudson.tasks.test.AbstractTestResultAction.class);;
$b.getAggregatedTestResultAction() :: $b instanceof hudson.model.AbstractBuild => $b.getAction(hudson.tasks.test.AggregatedTestResultAction.class);;
......@@ -187,7 +187,7 @@ public class BuildStatusSummaryTest {
when(this.build.getResult()).thenReturn(Result.UNSTABLE);
when(this.prevBuild.getResult()).thenReturn(Result.UNSTABLE);
// Null test result action recorded
when(((AbstractBuild) this.build).getTestResultAction()).thenReturn(null);
when(((AbstractBuild) this.build).getAction(AbstractTestResultAction.class)).thenReturn(null);
Summary summary = this.build.getBuildStatusSummary();
......@@ -293,6 +293,6 @@ public class BuildStatusSummaryTest {
AbstractTestResultAction testResult = mock(AbstractTestResultAction.class);
when(testResult.getFailCount()).thenReturn(failedTests);
when(build.getTestResultAction()).thenReturn(testResult);
when(build.getAction(AbstractTestResultAction.class)).thenReturn(testResult);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册