Skip to content
Permalink
Browse files
[JENKINS-20924]
  • Loading branch information
kinow committed Dec 9, 2013
1 parent e5c61ff commit c890b89c2b8fa43bf348914dd1188434014741a2
@@ -61,6 +61,7 @@ public class TapParser {
private boolean hasFailedTests;
private boolean includeCommentDiagnostics;
private boolean validateNumberOfTests;
private boolean planRequired;

/**
* @deprecated
@@ -88,8 +89,11 @@ public TapParser(Boolean outputTapToConsole, Boolean enableSubtests, Boolean tod
this.includeCommentDiagnostics = includeCommentDiagnostics;
}

/**
* @deprecated
*/
public TapParser(Boolean outputTapToConsole, Boolean enableSubtests, Boolean todoIsFailure, Boolean includeCommentDiagnostics, Boolean validateNumberOfTests, PrintStream logger) {
this.outputTapToConsole = outputTapToConsole;
this.outputTapToConsole = outputTapToConsole;
this.enableSubtests = enableSubtests;
this.todoIsFailure = todoIsFailure;
this.logger = logger;
@@ -98,7 +102,20 @@ public TapParser(Boolean outputTapToConsole, Boolean enableSubtests, Boolean tod
this.validateNumberOfTests = validateNumberOfTests;
}

public boolean hasParserErrors() {
public TapParser(Boolean outputTapToConsole2, Boolean enableSubtests2, Boolean todoIsFailure2,
Boolean includeCommentDiagnostics2, Boolean validateNumberOfTests2, Boolean planRequired,
PrintStream logger2) {
this.outputTapToConsole = outputTapToConsole;
this.enableSubtests = enableSubtests;
this.todoIsFailure = todoIsFailure;
this.logger = logger;
this.parserErrors = false;
this.includeCommentDiagnostics = includeCommentDiagnostics;
this.validateNumberOfTests = validateNumberOfTests;
this.planRequired = planRequired;
}

public boolean hasParserErrors() {
return this.parserErrors;
}

@@ -126,11 +143,8 @@ public TapResult parse(FilePath[] results, AbstractBuild<?, ?> build) {
log("Parsing TAP test result [" + tapFile + "].");

final Tap13Parser parser;
if(enableSubtests != null) {
parser = new Tap13Parser(enableSubtests);
} else {
parser = new Tap13Parser();
}
parser = new Tap13Parser();
//TODO: parser = new Tap13Parser("UTF-8", enableSubtests, planRequired);
final TestSet testSet = parser.parseFile(tapFile);

if (this.validateNumberOfTests) {
@@ -69,7 +69,25 @@ public class TapPublisher extends Recorder implements MatrixAggregatable {
private final Boolean todoIsFailure;
private final Boolean includeCommentDiagnostics;
private final Boolean validateNumberOfTests;
private final Boolean planRequired;

/**
* Kept for backward compatibility. To be removed in next major release.
* @deprecated
*/
public TapPublisher(String testResults,
Boolean failIfNoResults,
Boolean failedTestsMarkBuildAsFailure,
Boolean outputTapToConsole,
Boolean enableSubtests,
Boolean discardOldReports,
Boolean todoIsFailure,
Boolean includeCommentDiagnostics,
Boolean validateNumberOfTests) {
this(testResults, failIfNoResults, failedTestsMarkBuildAsFailure, outputTapToConsole, enableSubtests,
discardOldReports, todoIsFailure, includeCommentDiagnostics, validateNumberOfTests, Boolean.TRUE);
}

@DataBoundConstructor
public TapPublisher(String testResults,
Boolean failIfNoResults,
@@ -79,7 +97,8 @@ public TapPublisher(String testResults,
Boolean discardOldReports,
Boolean todoIsFailure,
Boolean includeCommentDiagnostics,
Boolean validateNumberOfTests) {
Boolean validateNumberOfTests,
Boolean planRequired) {
this.testResults = testResults;
this.failIfNoResults = BooleanUtils.toBooleanDefaultIfNull(failIfNoResults, false);
this.failedTestsMarkBuildAsFailure = BooleanUtils.toBooleanDefaultIfNull(failedTestsMarkBuildAsFailure, false);
@@ -89,6 +108,7 @@ public TapPublisher(String testResults,
this.todoIsFailure = BooleanUtils.toBooleanDefaultIfNull(todoIsFailure, true);
this.includeCommentDiagnostics = BooleanUtils.toBooleanDefaultIfNull(includeCommentDiagnostics, true);
this.validateNumberOfTests = BooleanUtils.toBooleanDefaultIfNull(validateNumberOfTests, false);
this.planRequired = BooleanUtils.toBooleanDefaultIfNull(planRequired, Boolean.TRUE); // true is the old behaviour
}

public Object readResolve() {
@@ -101,7 +121,8 @@ public Object readResolve() {
Boolean todoIsFailure = BooleanUtils.toBooleanDefaultIfNull(this.getTodoIsFailure(), true);
Boolean includeCommentDiagnostics = BooleanUtils.toBooleanDefaultIfNull(this.getIncludeCommentDiagnostics(), true);
Boolean validateNumberOfTests = BooleanUtils.toBooleanDefaultIfNull(this.getValidateNumberOfTests(), false);
return new TapPublisher(testResults, failIfNoResults, failedTestsMarkBuildAsFailure, outputTapToConsole, enableSubtests, discardOldReports, todoIsFailure, includeCommentDiagnostics, validateNumberOfTests);
Boolean planRequired = BooleanUtils.toBooleanDefaultIfNull(this.getPlanRequired(), true);
return new TapPublisher(testResults, failIfNoResults, failedTestsMarkBuildAsFailure, outputTapToConsole, enableSubtests, discardOldReports, todoIsFailure, includeCommentDiagnostics, validateNumberOfTests, planRequired);
}

/**
@@ -160,6 +181,10 @@ public Boolean getIncludeCommentDiagnostics() {
public Boolean getValidateNumberOfTests() {
return validateNumberOfTests;
}

public Boolean getPlanRequired() {
return planRequired;
}

/**
* Gets the directory where the plug-in saves its TAP streams before processing them and
@@ -277,7 +302,7 @@ private TapResult loadResults(AbstractBuild<?, ?> owner, PrintStream logger) {
try {
results = tapDir.list("**/*.*");

final TapParser parser = new TapParser(getOutputTapToConsole(), getEnableSubtests(), getTodoIsFailure(), getIncludeCommentDiagnostics(), getValidateNumberOfTests(), logger);
final TapParser parser = new TapParser(getOutputTapToConsole(), getEnableSubtests(), getTodoIsFailure(), getIncludeCommentDiagnostics(), getValidateNumberOfTests(), getPlanRequired(), logger);
final TapResult result = parser.parse(results, owner);
result.setOwner(owner);
return result;
@@ -28,5 +28,8 @@
<f:entry title="Validate number of tests">
<f:checkbox name="TapPublisher.validateNumberOfTests" value="${instance.validateNumberOfTests}" checked="${instance.validateNumberOfTests}" />
</f:entry>
<f:entry title="Is TAP plan required?">
<f:checkbox name="TapPublisher.planRequired" value="${instance.planRequired}" checked="${instance.planRequired}" default="true" />
</f:entry>
</f:advanced>
</j:jelly>

0 comments on commit c890b89

Please sign in to comment.