use of htmlpublisher.HtmlPublisherTarget in project htmlpublisher-plugin by jenkinsci.
the class PublishHTMLStepTest method testDeprecationWarningNotDisplayedWhenNotTryingToResolveParameters.
@Test
public void testDeprecationWarningNotDisplayedWhenNotTryingToResolveParameters() throws Exception {
writeTestHTML("index.html");
final HtmlPublisherTarget target = new HtmlPublisherTarget("testReport", TEST_REPORT_DIR, "test", false, false, false);
setupAndRunProject(target);
// Ensure that the report has been attached properly
r.assertBuildStatus(Result.SUCCESS, run);
r.assertLogNotContains("*** WARNING ***", run);
}
use of htmlpublisher.HtmlPublisherTarget in project htmlpublisher-plugin by jenkinsci.
the class PublishHTMLStepTest method publishMissingReport_allowMissing.
@Test
public void publishMissingReport_allowMissing() throws Exception {
final HtmlPublisherTarget target = new HtmlPublisherTarget("testReport", "testReportDirNonExistent", "index.html", false, false, true);
target.setReportTitles("index");
setupAndRunProject(target);
// Ensure that the report has been attached
r.assertBuildStatus(Result.SUCCESS, run);
HtmlPublisherTarget.HTMLBuildAction report = run.getAction(HtmlPublisherTarget.HTMLBuildAction.class);
assertNull("Report should be missing", report);
}
use of htmlpublisher.HtmlPublisherTarget in project htmlpublisher-plugin by jenkinsci.
the class PublishHTMLStepTest method configRoundTrip.
private void configRoundTrip(String reportName, String reportDir, String reportFiles, boolean keepAll, boolean alwaysLinkToLastBuild, boolean allowMissing) throws Exception {
final HtmlPublisherTarget target = new HtmlPublisherTarget(reportName, reportDir, reportFiles, false, false, false);
target.setReportTitles("index");
configRoundTrip(target);
}
use of htmlpublisher.HtmlPublisherTarget in project htmlpublisher-plugin by jenkinsci.
the class PublishHTMLStepTest method publishMissingReportFolder.
@Test
public void publishMissingReportFolder() throws Exception {
final String missingReportDir = "testReportDirNonExistent";
final HtmlPublisherTarget target = new HtmlPublisherTarget("testReport", missingReportDir, "index.html", false, false, false);
target.setReportTitles("index");
setupAndRunProject(target);
File missingReportDirFile = new File(testWorkspace, "workspace/" + TEST_PROJECT_NAME + "/" + missingReportDir);
// Ensure that the report has been attached
r.assertBuildStatus(Result.FAILURE, run);
HtmlPublisherTarget.HTMLBuildAction report = run.getAction(HtmlPublisherTarget.HTMLBuildAction.class);
assertNull("Report should be missing", report);
r.assertLogContains("Specified HTML directory '" + missingReportDirFile + "' does not exist.", run);
}
use of htmlpublisher.HtmlPublisherTarget in project htmlpublisher-plugin by jenkinsci.
the class PublishHTMLStepExecution method run.
@Override
protected Void run() throws Exception {
final HtmlPublisherTarget target = step.getTarget();
if (target == null) {
throw new AbortException("Cannot publish the report. Target is not specified");
}
boolean res = HtmlPublisher.publishReports(getContext().get(Run.class), getContext().get(FilePath.class), getContext().get(TaskListener.class), Collections.singletonList(target), HtmlPublisher.class);
if (!res) {
throw new AbortException("Cannot publish HTML files");
}
return null;
}
Aggregations