From 1110b988fe49f87d1cbe31d977c4d2b761a63338 Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Sun, 7 May 2023 01:34:04 +0200 Subject: [PATCH] [SUREFIRE-2228] Upgrade to Doxia 2.0.0 Milestone Stack This closes #629 --- maven-surefire-report-plugin/pom.xml | 7 +- .../report/AbstractSurefireReport.java | 14 +- .../surefire/report/FailsafeOnlyReport.java | 2 +- .../report/SurefireReportRenderer.java | 66 +++------- .../src/site/apt/usage.apt.vm | 2 +- .../surefire/report/Surefire597Test.java | 22 ++-- .../surefire/report/SurefireReportTest.java | 122 ++++++++++-------- .../report/stubs/AnchorTestCasesStub.java | 27 ++++ .../surefire/report/stubs/EnclosedStub.java | 27 ++++ .../stubs/EnclosedTrimStackTraceStub.java | 27 ++++ .../report/stubs/LinkXrefFalseStub.java | 27 ++++ .../report/stubs/NestedClassStub.java | 27 ++++ .../stubs/NestedClassTrimStackTraceStub.java | 27 ++++ .../surefire/report/stubs/ReportTestStub.java | 27 ++++ ...ojectStub2.java => ReportingNullStub.java} | 8 +- .../report/stubs/SingleErrorStub.java | 27 ++++ .../report/stubs/SuccessFalseStub.java | 27 ++++ .../report/stubs/Surefire1183Stub.java | 27 ++++ .../stubs/SurefireReportMavenProjectStub.java | 30 +++-- .../plugin-config.xml | 3 +- .../plugin-config.xml | 3 +- .../plugin-config.xml | 3 +- .../plugin-config.xml | 3 +- .../plugin-config.xml | 3 +- .../unit/surefire-1183/plugin-config.xml | 31 ++--- .../plugin-config.xml | 3 +- .../plugin-config.xml | 3 +- .../plugin-config.xml | 3 +- .../plugin-config.xml | 3 +- .../plugin-config.xml | 3 +- pom.xml | 20 --- .../maven/surefire/its/AggregateReportIT.java | 4 +- .../surefire/its/CheckTestNgReportTestIT.java | 2 +- .../surefire/its/fixture/MavenLauncher.java | 4 +- .../surefire/its/fixture/OutputValidator.java | 5 + .../its/fixture/SurefireLauncher.java | 2 +- .../Surefire260TestWithIdenticalNamesIT.java | 5 +- ...urefire570MultipleReportDirectoriesIT.java | 14 +- .../jiras/Surefire740TruncatedCommaIT.java | 6 +- .../its/jiras/Surefire772BothReportsIT.java | 26 ++-- .../jiras/Surefire772NoFailsafeReportsIT.java | 26 ++-- .../jiras/Surefire772NoSurefireReportsIT.java | 34 ++--- .../jiras/Surefire772SpecifiedReportsIT.java | 26 ++-- .../resources/surefire-1490-custom/pom.xml | 4 +- .../resources/surefire-1490-default/pom.xml | 4 +- .../pom.xml | 4 +- .../pom.xml | 2 +- 47 files changed, 521 insertions(+), 271 deletions(-) create mode 100644 maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/AnchorTestCasesStub.java create mode 100644 maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/EnclosedStub.java create mode 100644 maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/EnclosedTrimStackTraceStub.java create mode 100644 maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/LinkXrefFalseStub.java create mode 100644 maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/NestedClassStub.java create mode 100644 maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/NestedClassTrimStackTraceStub.java create mode 100644 maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/ReportTestStub.java rename maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/{SurefireReportMavenProjectStub2.java => ReportingNullStub.java} (86%) create mode 100644 maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/SingleErrorStub.java create mode 100644 maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/SuccessFalseStub.java create mode 100644 maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/Surefire1183Stub.java diff --git a/maven-surefire-report-plugin/pom.xml b/maven-surefire-report-plugin/pom.xml index ddf9c29c85..b38cf24792 100644 --- a/maven-surefire-report-plugin/pom.xml +++ b/maven-surefire-report-plugin/pom.xml @@ -46,7 +46,7 @@ - 1.12.0 + 2.0.0-M12 @@ -111,13 +111,10 @@ doxia-core ${doxiaVersion} - - org.apache.maven.reporting - maven-reporting-api - org.apache.maven.reporting maven-reporting-impl + 4.0.0-M15 org.codehaus.plexus diff --git a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/AbstractSurefireReport.java b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/AbstractSurefireReport.java index 5ad5dc6633..d6f141f740 100644 --- a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/AbstractSurefireReport.java +++ b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/AbstractSurefireReport.java @@ -37,7 +37,6 @@ import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; import org.apache.maven.reporting.AbstractMavenReport; -import org.apache.maven.reporting.MavenReportException; import org.apache.maven.settings.Settings; import org.apache.maven.shared.utils.PathTool; import org.codehaus.plexus.i18n.I18N; @@ -149,16 +148,16 @@ protected boolean isGeneratedWhenNoResults() { * {@inheritDoc} */ @Override - public void executeReport(Locale locale) throws MavenReportException { + public void executeReport(Locale locale) { SurefireReportRenderer r = new SurefireReportRenderer( getSink(), getI18N(locale), getI18Nsection(), locale, getConsoleLogger(), - showSuccess, getReportsDirectories(), - determineXrefLocation()); + determineXrefLocation(), + showSuccess); r.render(); } @@ -263,7 +262,8 @@ private String determineXrefLocation() { String location = null; if (linkXRef) { - String relativePath = PathTool.getRelativePath(getOutputDirectory(), xrefLocation.getAbsolutePath()); + String relativePath = PathTool.getRelativePath( + getReportOutputDirectory().getAbsolutePath(), xrefLocation.getAbsolutePath()); if (relativePath == null || relativePath.isEmpty()) { relativePath = "."; } @@ -346,6 +346,10 @@ protected MavenProject getProject() { return project; } + protected List getReactorProjects() { + return reactorProjects; + } + // TODO Review, especially Locale.getDefault() private static class CustomI18N implements I18N { private final MavenProject project; diff --git a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/FailsafeOnlyReport.java b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/FailsafeOnlyReport.java index 7e6b208404..ae2b620789 100644 --- a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/FailsafeOnlyReport.java +++ b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/FailsafeOnlyReport.java @@ -61,7 +61,7 @@ public class FailsafeOnlyReport extends AbstractSurefireReport { @Override protected File getSurefireReportsDirectory(MavenProject subProject) { String buildDir = subProject.getBuild().getDirectory(); - return new File(buildDir + "/failsafe-reports"); + return new File(buildDir, "failsafe-reports"); } @Override diff --git a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportRenderer.java b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportRenderer.java index e19c2bca28..c9dafe73fa 100644 --- a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportRenderer.java +++ b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportRenderer.java @@ -50,9 +50,9 @@ public class SurefireReportRenderer extends AbstractMavenReportRenderer { private final Locale locale; private final SurefireReportParser parser; - private final boolean showSuccess; - private final String xrefLocation; private final List testSuites; + private final String xrefLocation; + private final boolean showSuccess; public SurefireReportRenderer( Sink sink, @@ -60,9 +60,9 @@ public SurefireReportRenderer( String i18nSection, Locale locale, ConsoleLogger consoleLogger, - boolean showSuccess, List reportsDirectories, - String xrefLocation) { + String xrefLocation, + boolean showSuccess) { super(sink); this.i18n = i18n; this.i18nSection = i18nSection; @@ -112,11 +112,7 @@ private String formatI18nString(String section, String key, Object... args) { public void renderBody() { javaScript(javascriptToggleDisplayCode()); - sink.section1(); - sink.sectionTitle1(); - sink.text(getTitle()); - sink.sectionTitle1_(); - sink.section1_(); + startSection(getTitle()); renderSectionSummary(); @@ -125,16 +121,14 @@ public void renderBody() { renderSectionTestCases(); renderSectionFailureDetails(); + + endSection(); } private void renderSectionSummary() { Map summary = parser.getSummary(testSuites); - sink.section1(); - sinkAnchor("Summary"); - sink.sectionTitle1(); - sink.text(getI18nString("surefire", "label.summary")); - sink.sectionTitle1_(); + startSection(getI18nString("surefire", "label.summary"), "Summary"); constructHotLinks(); @@ -168,7 +162,7 @@ private void renderSectionSummary() { sink.lineBreak(); - sink.section1_(); + endSection(); } private void renderSectionPackages() { @@ -177,11 +171,7 @@ private void renderSectionPackages() { return; } - sink.section1(); - sinkAnchor("Package_List"); - sink.sectionTitle1(); - sink.text(getI18nString("surefire", "label.packagelist")); - sink.sectionTitle1_(); + startSection(getI18nString("surefire", "label.packagelist"), "Package_List"); constructHotLinks(); @@ -227,11 +217,7 @@ private void renderSectionPackages() { List testSuiteList = entry.getValue(); - sink.section2(); - sinkAnchor(packageName); - sink.sectionTitle2(); - sink.text(packageName); - sink.sectionTitle2_(); + startSection(packageName); boolean showTable = false; @@ -266,12 +252,12 @@ private void renderSectionPackages() { endTable(); } - sink.section2_(); + endSection(); } sink.lineBreak(); - sink.section1_(); + endSection(); } private void renderSectionTestSuite(ReportTestSuite suite) { @@ -320,11 +306,7 @@ private void renderSectionTestCases() { return; } - sink.section1(); - sinkAnchor("Test_Cases"); - sink.sectionTitle1(); - sink.text(getI18nString("surefire", "label.testcases")); - sink.sectionTitle1_(); + startSection(getI18nString("surefire", "label.testcases"), "Test_Cases"); constructHotLinks(); @@ -332,11 +314,7 @@ private void renderSectionTestCases() { List testCases = suite.getTestCases(); if (!testCases.isEmpty()) { - sink.section2(); - sinkAnchor(suite.getPackageName() + '.' + suite.getName()); - sink.sectionTitle2(); - sink.text(suite.getName()); - sink.sectionTitle2_(); + startSection(suite.getName(), suite.getPackageName() + '.' + suite.getName()); boolean showTable = false; @@ -360,13 +338,13 @@ private void renderSectionTestCases() { endTable(); } - sink.section2_(); + endSection(); } } sink.lineBreak(); - sink.section1_(); + endSection(); } private void constructTestCaseSection(ReportTestCase testCase) { @@ -469,7 +447,7 @@ private void constructTestCaseSection(ReportTestCase testCase) { } private String toHtmlId(String id) { - return DoxiaUtils.isValidId(id) ? id : DoxiaUtils.encodeId(id, true); + return DoxiaUtils.isValidId(id) ? id : DoxiaUtils.encodeId(id); } private void renderSectionFailureDetails() { @@ -478,11 +456,7 @@ private void renderSectionFailureDetails() { return; } - sink.section1(); - sinkAnchor("Failure_Details"); - sink.sectionTitle1(); - sink.text(getI18nString("surefire", "label.failuredetails")); - sink.sectionTitle1_(); + startSection(getI18nString("surefire", "label.failuredetails"), "Failure_Details"); constructHotLinks(); @@ -554,7 +528,7 @@ private void renderSectionFailureDetails() { sink.lineBreak(); - sink.section1_(); + endSection(); } private void constructHotLinks() { diff --git a/maven-surefire-report-plugin/src/site/apt/usage.apt.vm b/maven-surefire-report-plugin/src/site/apt/usage.apt.vm index 969d441d75..a6d93a70a1 100644 --- a/maven-surefire-report-plugin/src/site/apt/usage.apt.vm +++ b/maven-surefire-report-plugin/src/site/apt/usage.apt.vm @@ -59,7 +59,7 @@ Usage mvn surefire-report:report +---+ - A HTML report should be generated in <<<$\{basedir\}/target/site/surefire-report.html>>>. + An HTML report should be generated in <<<$\{basedir\}/target/reports/surefire.html>>>. [images/surefire-sample2.png] Sample standalone surefire-report diff --git a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Surefire597Test.java b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Surefire597Test.java index 598c916785..b1a9ddb890 100644 --- a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Surefire597Test.java +++ b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Surefire597Test.java @@ -48,12 +48,12 @@ public void testCorruptedTestCaseFailureWithMissingErrorTypeAndMessage() throws i18n.initialize(); ConsoleLogger consoleLogger = new NullConsoleLogger(); SurefireReportRenderer r = new SurefireReportRenderer( - sink, i18n, "surefire", SiteTool.DEFAULT_LOCALE, consoleLogger, true, singletonList(report), null); + sink, i18n, "surefire", SiteTool.DEFAULT_LOCALE, consoleLogger, singletonList(report), null, true); r.render(); String xml = writer.toString(); assertThat( xml, - containsString(toSystemNewLine("\n" + containsString(toSystemNewLine("
\n" + "\n" + "\n" + "\n" @@ -62,7 +62,7 @@ public void testCorruptedTestCaseFailureWithMissingErrorTypeAndMessage() throws + "\n" + "\n" + "\n" - + "\n" + + "\n" + "\n" + "\n" + "\n" @@ -72,7 +72,7 @@ public void testCorruptedTestCaseFailureWithMissingErrorTypeAndMessage() throws + "
TestsErrorsSuccess RateTime
11100
"))); assertThat( xml, - containsString(toSystemNewLine("\n" + containsString(toSystemNewLine("
\n" + "\n" + "\n" + "\n" @@ -82,7 +82,7 @@ public void testCorruptedTestCaseFailureWithMissingErrorTypeAndMessage() throws + "\n" + "\n" + "\n" - + "\n" + + "\n" + "\n" + "\n" + "\n" @@ -91,7 +91,7 @@ public void testCorruptedTestCaseFailureWithMissingErrorTypeAndMessage() throws + "
PackageTestsSuccess RateTime
surefiresurefire1100 s
"))); assertThat( xml, - containsString(toSystemNewLine("\n" + containsString(toSystemNewLine("
\n" + "\n" + "\n" + "\n" @@ -102,7 +102,7 @@ public void testCorruptedTestCaseFailureWithMissingErrorTypeAndMessage() throws + "\n" + "\n" + "\n" - + "\n" + + "\n" + "\n" + "\n" + "\n" @@ -112,15 +112,15 @@ public void testCorruptedTestCaseFailureWithMissingErrorTypeAndMessage() throws + "
-ClassSuccess RateTime
\"\"MyTest110 s
"))); assertThat( xml, - containsString(toSystemNewLine("\n" + containsString(toSystemNewLine("
\n" + "\n" - + "\n" + + "\n" + "\n" + "\n" - + "\n" + + "\n" + "\n" + "\n" - + "\n" + + "\n" + "
\"\"test
--java.lang.RuntimeException: java.lang.IndexOutOfBoundsException: msg
--\n" + "
surefire.MyTest:13
"))); } diff --git a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportTest.java b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportTest.java index 3da193a92d..df12fbedca 100644 --- a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportTest.java +++ b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportTest.java @@ -19,16 +19,19 @@ package org.apache.maven.plugins.surefire.report; import java.io.File; -import java.io.UnsupportedEncodingException; -import java.net.URL; -import java.net.URLDecoder; -import java.util.Locale; +import java.util.Collections; +import java.util.List; +import org.apache.maven.model.Plugin; import org.apache.maven.plugin.LegacySupport; +import org.apache.maven.plugin.MojoExecution; +import org.apache.maven.plugin.descriptor.MojoDescriptor; +import org.apache.maven.plugin.descriptor.PluginDescriptor; import org.apache.maven.plugin.testing.AbstractMojoTestCase; import org.apache.maven.plugin.testing.ArtifactStubFactory; import org.apache.maven.plugin.testing.stubs.MavenProjectStub; import org.apache.maven.plugins.surefire.report.stubs.DependencyArtifactStubFactory; +import org.apache.maven.project.MavenProject; import org.apache.maven.shared.utils.io.FileUtils; import org.eclipse.aether.DefaultRepositorySystemSession; import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory; @@ -45,28 +48,20 @@ public class SurefireReportTest extends AbstractMojoTestCase { private ArtifactStubFactory artifactStubFactory; - // Can be removed with Doxia 2.0.0 - private Locale origLocale; - @Override protected void setUp() throws Exception { super.setUp(); artifactStubFactory = new DependencyArtifactStubFactory(getTestFile("target"), true, false); artifactStubFactory.getWorkingDir().mkdirs(); - - origLocale = Locale.getDefault(); - Locale.setDefault(Locale.ROOT); } - @Override - protected void tearDown() throws Exception { - Locale.setDefault(origLocale); - super.tearDown(); + protected File getPluginXmlFile(String projectDirName) { + return new File(getBasedir(), "src/test/resources/unit/" + projectDirName + "/plugin-config.xml"); } protected SurefireReport createReportMojo(File pluginXmlFile) throws Exception { SurefireReport mojo = (SurefireReport) lookupMojo("report", pluginXmlFile); - assertNotNull("Mojo found.", mojo); + assertNotNull("Mojo not found.", mojo); LegacySupport legacySupport = lookup(LegacySupport.class); legacySupport.setSession(newMavenSession(new MavenProjectStub())); @@ -75,13 +70,22 @@ protected SurefireReport createReportMojo(File pluginXmlFile) throws Exception { repoSession.setLocalRepositoryManager(new SimpleLocalRepositoryManagerFactory() .newInstance(repoSession, new LocalRepository(artifactStubFactory.getWorkingDir()))); - // setVariableValueToObject( mojo, "session", legacySupport.getSession() ); - setVariableValueToObject(mojo, "remoteRepositories", mojo.getProject().getRemoteArtifactRepositories()); + List reactorProjects = + mojo.getReactorProjects() != null ? mojo.getReactorProjects() : Collections.emptyList(); + + setVariableValueToObject(mojo, "mojoExecution", getMockMojoExecution()); + // setVariableValueToObject(mojo, "session", legacySupport.getSession()); + setVariableValueToObject(mojo, "repoSession", legacySupport.getRepositorySession()); + setVariableValueToObject(mojo, "reactorProjects", reactorProjects); + setVariableValueToObject( + mojo, "remoteProjectRepositories", mojo.getProject().getRemoteProjectRepositories()); + setVariableValueToObject( + mojo, "siteDirectory", new File(mojo.getProject().getBasedir(), "src/site")); return mojo; } public void testBasicSurefireReport() throws Exception { - File testPom = new File(getUnitBaseDir(), "basic-surefire-report-test/plugin-config.xml"); + File testPom = getPluginXmlFile("basic-surefire-report-test"); SurefireReport mojo = createReportMojo(testPom); File outputDir = (File) getVariableValueFromObject(mojo, "outputDirectory"); boolean showSuccess = (Boolean) getVariableValueFromObject(mojo, "showSuccess"); @@ -111,14 +115,24 @@ public void testBasicSurefireReport() throws Exception { assertTrue(idx >= 0); } - private File getUnitBaseDir() throws UnsupportedEncodingException { - URL resource = getClass().getResource("/unit"); - // URLDecoder.decode necessary for JDK 1.5+, where spaces are escaped to %20 - return new File(URLDecoder.decode(resource.getPath(), "UTF-8")).getAbsoluteFile(); + private MojoExecution getMockMojoExecution() { + MojoDescriptor md = new MojoDescriptor(); + md.setGoal("report"); + + MojoExecution me = new MojoExecution(md); + + PluginDescriptor pd = new PluginDescriptor(); + Plugin p = new Plugin(); + p.setGroupId("org.apache.maven.plugins"); + p.setArtifactId("maven-surefire-report-plugin"); + pd.setPlugin(p); + md.setPluginDescriptor(pd); + + return me; } public void testBasicSurefireReportIfShowSuccessIsFalse() throws Exception { - File testPom = new File(getUnitBaseDir(), "basic-surefire-report-success-false/plugin-config.xml"); + File testPom = getPluginXmlFile("basic-surefire-report-success-false"); SurefireReport mojo = createReportMojo(testPom); boolean showSuccess = (Boolean) getVariableValueFromObject(mojo, "showSuccess"); assertFalse(showSuccess); @@ -132,7 +146,7 @@ public void testBasicSurefireReportIfShowSuccessIsFalse() throws Exception { } public void testBasicSurefireReportIfLinkXrefIsFalse() throws Exception { - File testPom = new File(getUnitBaseDir(), "basic-surefire-report-linkxref-false/plugin-config.xml"); + File testPom = getPluginXmlFile("basic-surefire-report-linkxref-false"); SurefireReport mojo = createReportMojo(testPom); boolean linkXRef = (Boolean) getVariableValueFromObject(mojo, "linkXRef"); assertFalse(linkXRef); @@ -146,7 +160,7 @@ public void testBasicSurefireReportIfLinkXrefIsFalse() throws Exception { } public void testBasicSurefireReportIfReportingIsNull() throws Exception { - File testPom = new File(getUnitBaseDir(), "basic-surefire-report-reporting-null/plugin-config.xml"); + File testPom = getPluginXmlFile("basic-surefire-report-reporting-null"); SurefireReport mojo = createReportMojo(testPom); mojo.execute(); File report = new File(getBasedir(), "target/site/unit/basic-surefire-report-reporting-null/surefire.html"); @@ -159,7 +173,7 @@ public void testBasicSurefireReportIfReportingIsNull() throws Exception { @SuppressWarnings("checkstyle:methodname") public void testBasicSurefireReport_AnchorTestCases() throws Exception { - File testPom = new File(getUnitBaseDir(), "basic-surefire-report-anchor-test-cases/plugin-config.xml"); + File testPom = getPluginXmlFile("basic-surefire-report-anchor-test-cases"); SurefireReport mojo = createReportMojo(testPom); mojo.execute(); File report = new File(getBasedir(), "target/site/unit/basic-surefire-report-anchor-test-cases/surefire.html"); @@ -175,7 +189,7 @@ public void testBasicSurefireReport_AnchorTestCases() throws Exception { } public void testSurefireReportSingleError() throws Exception { - File testPom = new File(getUnitBaseDir(), "surefire-report-single-error/plugin-config.xml"); + File testPom = getPluginXmlFile("surefire-report-single-error"); SurefireReport mojo = createReportMojo(testPom); mojo.execute(); File report = new File(getBasedir(), "target/site/unit/surefire-report-single-error/surefire.html"); @@ -185,7 +199,7 @@ public void testSurefireReportSingleError() throws Exception { assertThat( htmlContent, containsString(toSystemNewLine("\n" - + "1\n" + + "1\n" + "1\n" + "0\n" + "0\n" @@ -195,7 +209,7 @@ public void testSurefireReportSingleError() throws Exception { assertThat( htmlContent, containsString(toSystemNewLine("\n" - + "surefire\n" + + "surefire\n" + "1\n" + "1\n" + "0\n" @@ -205,9 +219,9 @@ public void testSurefireReportSingleError() throws Exception { assertThat( htmlContent, containsString(toSystemNewLine("\n" - + "" + + "" + "" - + "\"\"" + + "" + "" + "\n" + "MyTest\n" @@ -262,7 +276,7 @@ public void testSurefireReportSingleError() throws Exception { } public void testSurefireReportNestedClassTrimStackTrace() throws Exception { - File testPom = new File(getUnitBaseDir(), "surefire-report-nestedClass-trimStackTrace/plugin-config.xml"); + File testPom = getPluginXmlFile("surefire-report-nestedClass-trimStackTrace"); SurefireReport mojo = createReportMojo(testPom); mojo.execute(); File report = @@ -273,7 +287,7 @@ public void testSurefireReportNestedClassTrimStackTrace() throws Exception { assertThat( htmlContent, containsString(toSystemNewLine("\n" - + "1\n" + + "1\n" + "1\n" + "0\n" + "0\n" @@ -283,7 +297,7 @@ public void testSurefireReportNestedClassTrimStackTrace() throws Exception { assertThat( htmlContent, containsString(toSystemNewLine("\n" - + "surefire\n" + + "surefire\n" + "1\n" + "1\n" + "0\n" @@ -293,9 +307,9 @@ public void testSurefireReportNestedClassTrimStackTrace() throws Exception { assertThat( htmlContent, containsString(toSystemNewLine("\n" - + "" + + "" + "" - + "\"\"" + + "" + "" + "\n" + "MyTest\n" @@ -326,7 +340,7 @@ public void testSurefireReportNestedClassTrimStackTrace() throws Exception { } public void testSurefireReportNestedClass() throws Exception { - File testPom = new File(getUnitBaseDir(), "surefire-report-nestedClass/plugin-config.xml"); + File testPom = getPluginXmlFile("surefire-report-nestedClass"); SurefireReport mojo = createReportMojo(testPom); mojo.execute(); File report = new File(getBasedir(), "target/site/unit/surefire-report-nestedClass/surefire.html"); @@ -336,7 +350,7 @@ public void testSurefireReportNestedClass() throws Exception { assertThat( htmlContent, containsString(toSystemNewLine("\n" - + "1\n" + + "1\n" + "1\n" + "0\n" + "0\n" @@ -346,7 +360,7 @@ public void testSurefireReportNestedClass() throws Exception { assertThat( htmlContent, containsString(toSystemNewLine("\n" - + "surefire\n" + + "surefire\n" + "1\n" + "1\n" + "0\n" @@ -356,9 +370,9 @@ public void testSurefireReportNestedClass() throws Exception { assertThat( htmlContent, containsString(toSystemNewLine("\n" - + "" + + "" + "" - + "\"\"" + + "" + "" + "\n" + "MyTest\n" @@ -413,7 +427,7 @@ public void testSurefireReportNestedClass() throws Exception { } public void testSurefireReportEnclosedTrimStackTrace() throws Exception { - File testPom = new File(getUnitBaseDir(), "surefire-report-enclosed-trimStackTrace/plugin-config.xml"); + File testPom = getPluginXmlFile("surefire-report-enclosed-trimStackTrace"); SurefireReport mojo = createReportMojo(testPom); mojo.execute(); File report = new File(getBasedir(), "target/site/unit/surefire-report-enclosed-trimStackTrace/surefire.html"); @@ -423,7 +437,7 @@ public void testSurefireReportEnclosedTrimStackTrace() throws Exception { assertThat( htmlContent, containsString(toSystemNewLine("\n" - + "1\n" + + "1\n" + "1\n" + "0\n" + "0\n" @@ -433,7 +447,7 @@ public void testSurefireReportEnclosedTrimStackTrace() throws Exception { assertThat( htmlContent, containsString(toSystemNewLine("\n" - + "surefire\n" + + "surefire\n" + "1\n" + "1\n" + "0\n" @@ -443,9 +457,9 @@ public void testSurefireReportEnclosedTrimStackTrace() throws Exception { assertThat( htmlContent, containsString(toSystemNewLine("\n" - + "" + + "" + "" - + "\"\"" + + "" + "" + "\n" + "MyTest$A\n" @@ -476,7 +490,7 @@ public void testSurefireReportEnclosedTrimStackTrace() throws Exception { } public void testSurefireReportEnclosed() throws Exception { - File testPom = new File(getUnitBaseDir(), "surefire-report-enclosed/plugin-config.xml"); + File testPom = getPluginXmlFile("surefire-report-enclosed"); SurefireReport mojo = createReportMojo(testPom); mojo.execute(); File report = new File(getBasedir(), "target/site/unit/surefire-report-enclosed/surefire.html"); @@ -486,7 +500,7 @@ public void testSurefireReportEnclosed() throws Exception { assertThat( htmlContent, containsString(toSystemNewLine("\n" - + "1\n" + + "1\n" + "1\n" + "0\n" + "0\n" @@ -496,7 +510,7 @@ public void testSurefireReportEnclosed() throws Exception { assertThat( htmlContent, containsString(toSystemNewLine("\n" - + "surefire\n" + + "surefire\n" + "1\n" + "1\n" + "0\n" @@ -506,9 +520,9 @@ public void testSurefireReportEnclosed() throws Exception { assertThat( htmlContent, containsString(toSystemNewLine("\n" - + "" + + "" + "" - + "\"\"" + + "" + "" + "\n" + "MyTest$A\n" @@ -573,7 +587,7 @@ public void testSurefireReportEnclosed() throws Exception { } public void testCustomTitleAndDescriptionReport() throws Exception { - File testPom = new File(getUnitBaseDir(), "surefire-1183/plugin-config.xml"); + File testPom = getPluginXmlFile("surefire-1183"); SurefireReport mojo = createReportMojo(testPom); File outputDir = (File) getVariableValueFromObject(mojo, "outputDirectory"); @@ -594,6 +608,8 @@ public void testCustomTitleAndDescriptionReport() throws Exception { assertTrue(report.exists()); String htmlContent = FileUtils.fileRead(report); - assertTrue(htmlContent.contains("

Acceptance Test

")); + assertThat( + htmlContent, + containsString(toSystemNewLine("
\n

Acceptance Test

"))); } } diff --git a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/AnchorTestCasesStub.java b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/AnchorTestCasesStub.java new file mode 100644 index 0000000000..3b69f4ba88 --- /dev/null +++ b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/AnchorTestCasesStub.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.maven.plugins.surefire.report.stubs; + +public class AnchorTestCasesStub extends SurefireReportMavenProjectStub { + + @Override + protected String getProjectDirName() { + return "basic-surefire-report-anchor-test-cases"; + } +} diff --git a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/EnclosedStub.java b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/EnclosedStub.java new file mode 100644 index 0000000000..bdcce6b04b --- /dev/null +++ b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/EnclosedStub.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.maven.plugins.surefire.report.stubs; + +public class EnclosedStub extends SurefireReportMavenProjectStub { + + @Override + protected String getProjectDirName() { + return "surefire-report-enclosed"; + } +} diff --git a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/EnclosedTrimStackTraceStub.java b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/EnclosedTrimStackTraceStub.java new file mode 100644 index 0000000000..f5ba0e74b2 --- /dev/null +++ b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/EnclosedTrimStackTraceStub.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.maven.plugins.surefire.report.stubs; + +public class EnclosedTrimStackTraceStub extends SurefireReportMavenProjectStub { + + @Override + protected String getProjectDirName() { + return "surefire-report-enclosed-trimStackTrace"; + } +} diff --git a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/LinkXrefFalseStub.java b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/LinkXrefFalseStub.java new file mode 100644 index 0000000000..7bf7cf44b1 --- /dev/null +++ b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/LinkXrefFalseStub.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.maven.plugins.surefire.report.stubs; + +public class LinkXrefFalseStub extends SurefireReportMavenProjectStub { + + @Override + protected String getProjectDirName() { + return "basic-surefire-report-linkxref-false"; + } +} diff --git a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/NestedClassStub.java b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/NestedClassStub.java new file mode 100644 index 0000000000..6f1547b37c --- /dev/null +++ b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/NestedClassStub.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.maven.plugins.surefire.report.stubs; + +public class NestedClassStub extends SurefireReportMavenProjectStub { + + @Override + protected String getProjectDirName() { + return "surefire-report-nestedClass"; + } +} diff --git a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/NestedClassTrimStackTraceStub.java b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/NestedClassTrimStackTraceStub.java new file mode 100644 index 0000000000..1a30076f59 --- /dev/null +++ b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/NestedClassTrimStackTraceStub.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.maven.plugins.surefire.report.stubs; + +public class NestedClassTrimStackTraceStub extends SurefireReportMavenProjectStub { + + @Override + protected String getProjectDirName() { + return "surefire-report-nestedClass-trimStackTrace"; + } +} diff --git a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/ReportTestStub.java b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/ReportTestStub.java new file mode 100644 index 0000000000..d04125a722 --- /dev/null +++ b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/ReportTestStub.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.maven.plugins.surefire.report.stubs; + +public class ReportTestStub extends SurefireReportMavenProjectStub { + + @Override + protected String getProjectDirName() { + return "basic-surefire-report-test"; + } +} diff --git a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/SurefireReportMavenProjectStub2.java b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/ReportingNullStub.java similarity index 86% rename from maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/SurefireReportMavenProjectStub2.java rename to maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/ReportingNullStub.java index 1e4a58d6ec..86b557ab05 100644 --- a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/SurefireReportMavenProjectStub2.java +++ b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/ReportingNullStub.java @@ -22,12 +22,11 @@ import java.util.List; import org.apache.maven.model.ReportPlugin; -import org.apache.maven.plugin.testing.stubs.MavenProjectStub; /** * @author Allan Ramirez */ -public class SurefireReportMavenProjectStub2 extends MavenProjectStub { +public class ReportingNullStub extends SurefireReportMavenProjectStub { /** * {@inheritDoc} */ @@ -35,4 +34,9 @@ public class SurefireReportMavenProjectStub2 extends MavenProjectStub { public List getReportPlugins() { return new ArrayList<>(); } + + @Override + protected String getProjectDirName() { + return "basic-surefire-report-reporting-null"; + } } diff --git a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/SingleErrorStub.java b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/SingleErrorStub.java new file mode 100644 index 0000000000..60e83182e7 --- /dev/null +++ b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/SingleErrorStub.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.maven.plugins.surefire.report.stubs; + +public class SingleErrorStub extends SurefireReportMavenProjectStub { + + @Override + protected String getProjectDirName() { + return "surefire-report-single-error"; + } +} diff --git a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/SuccessFalseStub.java b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/SuccessFalseStub.java new file mode 100644 index 0000000000..afe3559512 --- /dev/null +++ b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/SuccessFalseStub.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.maven.plugins.surefire.report.stubs; + +public class SuccessFalseStub extends SurefireReportMavenProjectStub { + + @Override + protected String getProjectDirName() { + return "basic-surefire-report-success-false"; + } +} diff --git a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/Surefire1183Stub.java b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/Surefire1183Stub.java new file mode 100644 index 0000000000..e39849618e --- /dev/null +++ b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/Surefire1183Stub.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.maven.plugins.surefire.report.stubs; + +public class Surefire1183Stub extends SurefireReportMavenProjectStub { + + @Override + protected String getProjectDirName() { + return "surefire-1183"; + } +} diff --git a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/SurefireReportMavenProjectStub.java b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/SurefireReportMavenProjectStub.java index de27f52f86..952b6ff392 100644 --- a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/SurefireReportMavenProjectStub.java +++ b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/SurefireReportMavenProjectStub.java @@ -18,22 +18,35 @@ */ package org.apache.maven.plugins.surefire.report.stubs; +import java.io.File; import java.util.Collections; import java.util.List; +import org.apache.maven.RepositoryUtils; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; import org.apache.maven.artifact.repository.MavenArtifactRepository; import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout; -import org.apache.maven.model.Model; -import org.apache.maven.model.ReportPlugin; -import org.apache.maven.model.Reporting; import org.apache.maven.plugin.testing.stubs.MavenProjectStub; +import org.eclipse.aether.repository.RemoteRepository; /** * @author Allan Ramirez */ -public class SurefireReportMavenProjectStub extends MavenProjectStub { +public abstract class SurefireReportMavenProjectStub extends MavenProjectStub { + + protected abstract String getProjectDirName(); + + @Override + public File getBasedir() { + return new File(super.getBasedir() + "/src/test/resources/unit/" + getProjectDirName()); + } + + @Override + public File getFile() { + return new File(getBasedir(), "plugin-config.xml"); + } + /** * {@inheritDoc} */ @@ -47,10 +60,6 @@ public List getReportPlugins() { reportPlugin.setVersion("2.0-SNAPSHOT"); reporting.addPlugin(reportPlugin); - Model model = new Model(); - - model.setReporting(reporting); - return reporting.getPlugins(); } @@ -65,4 +74,9 @@ public List getRemoteArtifactRepositories() { return Collections.singletonList(repository); } + + @Override + public List getRemoteProjectRepositories() { + return RepositoryUtils.toRepos(getRemoteArtifactRepositories()); + } } diff --git a/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-anchor-test-cases/plugin-config.xml b/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-anchor-test-cases/plugin-config.xml index e943053647..2e31083fc7 100644 --- a/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-anchor-test-cases/plugin-config.xml +++ b/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-anchor-test-cases/plugin-config.xml @@ -24,8 +24,7 @@ maven-surefire-report-plugin ${basedir}/target/site/unit/basic-surefire-report-anchor-test-cases - ${localRepository} - + true ${basedir}/src/test/resources/unit/basic-surefire-report-anchor-test-cases/surefire-reports diff --git a/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-linkxref-false/plugin-config.xml b/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-linkxref-false/plugin-config.xml index d175839c6e..e4e34dedec 100644 --- a/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-linkxref-false/plugin-config.xml +++ b/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-linkxref-false/plugin-config.xml @@ -24,8 +24,7 @@ maven-surefire-report-plugin ${basedir}/target/site/unit/basic-surefire-report-linkxref-false - ${localRepository} - + true ${basedir}/src/test/resources/unit/basic-surefire-report-linkxref-false/surefire-reports diff --git a/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-reporting-null/plugin-config.xml b/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-reporting-null/plugin-config.xml index dfe6b6767a..76f2af4550 100644 --- a/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-reporting-null/plugin-config.xml +++ b/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-reporting-null/plugin-config.xml @@ -24,8 +24,7 @@ maven-surefire-report-plugin ${basedir}/target/site/unit/basic-surefire-report-reporting-null - ${localRepository} - + true ${basedir}/src/test/resources/unit/basic-surefire-report-reporting-null/surefire-reports diff --git a/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-success-false/plugin-config.xml b/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-success-false/plugin-config.xml index eae36a0080..e00d008fde 100644 --- a/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-success-false/plugin-config.xml +++ b/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-success-false/plugin-config.xml @@ -24,8 +24,7 @@ maven-surefire-report-plugin ${basedir}/target/site/unit/basic-surefire-report-success-false - ${localRepository} - + false ${basedir}/src/test/resources/unit/basic-surefire-report-success-false/surefire-reports diff --git a/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-test/plugin-config.xml b/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-test/plugin-config.xml index 08cc7a39ef..1d469a52e2 100644 --- a/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-test/plugin-config.xml +++ b/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-test/plugin-config.xml @@ -24,8 +24,7 @@ maven-surefire-report-plugin ${basedir}/target/site/unit/basic-surefire-report-test - ${localRepository} - + true ${basedir}/src/test/resources/unit/basic-surefire-report-test/surefire-reports diff --git a/maven-surefire-report-plugin/src/test/resources/unit/surefire-1183/plugin-config.xml b/maven-surefire-report-plugin/src/test/resources/unit/surefire-1183/plugin-config.xml index 2a4c04a0b7..ebf5dc8fdb 100644 --- a/maven-surefire-report-plugin/src/test/resources/unit/surefire-1183/plugin-config.xml +++ b/maven-surefire-report-plugin/src/test/resources/unit/surefire-1183/plugin-config.xml @@ -18,21 +18,18 @@ --> - - - - - maven-surefire-report-plugin - - - acceptance-test - ${localRepository} - ${basedir}/src/test/resources/unit/surefire-1183/src/site/custom/surefire-report.properties - ${basedir}/target/site/unit/surefire-1183 - ${basedir}/src/test/resources/unit/surefire-1183/acceptancetest-reports - - - - + + + + maven-surefire-report-plugin + + + acceptance-test + ${basedir}/src/test/resources/unit/surefire-1183/src/site/custom/surefire-report.properties + ${basedir}/target/site/unit/surefire-1183 + ${basedir}/src/test/resources/unit/surefire-1183/acceptancetest-reports + + + + diff --git a/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-enclosed-trimStackTrace/plugin-config.xml b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-enclosed-trimStackTrace/plugin-config.xml index 492c62a3bc..fddf49aaaf 100644 --- a/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-enclosed-trimStackTrace/plugin-config.xml +++ b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-enclosed-trimStackTrace/plugin-config.xml @@ -24,8 +24,7 @@ maven-surefire-report-plugin ${basedir}/target/site/unit/surefire-report-enclosed-trimStackTrace - ${localRepository} - + true ${basedir}/src/test/resources/unit/surefire-report-enclosed-trimStackTrace/surefire-reports diff --git a/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-enclosed/plugin-config.xml b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-enclosed/plugin-config.xml index 25527c3703..092107a52c 100644 --- a/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-enclosed/plugin-config.xml +++ b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-enclosed/plugin-config.xml @@ -24,8 +24,7 @@ maven-surefire-report-plugin ${basedir}/target/site/unit/surefire-report-enclosed - ${localRepository} - + true ${basedir}/src/test/resources/unit/surefire-report-enclosed/surefire-reports diff --git a/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-nestedClass-trimStackTrace/plugin-config.xml b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-nestedClass-trimStackTrace/plugin-config.xml index ce9bc49718..d4bf13fa74 100644 --- a/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-nestedClass-trimStackTrace/plugin-config.xml +++ b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-nestedClass-trimStackTrace/plugin-config.xml @@ -24,8 +24,7 @@ maven-surefire-report-plugin ${basedir}/target/site/unit/surefire-report-nestedClass-trimStackTrace - ${localRepository} - + true ${basedir}/src/test/resources/unit/surefire-report-nestedClass-trimStackTrace/surefire-reports diff --git a/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-nestedClass/plugin-config.xml b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-nestedClass/plugin-config.xml index 27302b0a9a..542475533c 100644 --- a/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-nestedClass/plugin-config.xml +++ b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-nestedClass/plugin-config.xml @@ -24,8 +24,7 @@ maven-surefire-report-plugin ${basedir}/target/site/unit/surefire-report-nestedClass - ${localRepository} - + true ${basedir}/src/test/resources/unit/surefire-report-nestedClass/surefire-reports diff --git a/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-single-error/plugin-config.xml b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-single-error/plugin-config.xml index 70767d4b46..045f0d93d2 100644 --- a/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-single-error/plugin-config.xml +++ b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-single-error/plugin-config.xml @@ -24,8 +24,7 @@ maven-surefire-report-plugin ${basedir}/target/site/unit/surefire-report-single-error - ${localRepository} - + true ${basedir}/src/test/resources/unit/surefire-report-single-error/surefire-reports diff --git a/pom.xml b/pom.xml index 07d6d1a4ac..14180a1ebd 100644 --- a/pom.xml +++ b/pom.xml @@ -126,11 +126,6 @@ commons-io ${commonsIoVersion} - - org.apache.maven.reporting - maven-reporting-api - 3.1.1 - org.apache.maven maven-core @@ -169,21 +164,6 @@ maven-shared-utils ${mavenSharedUtilsVersion} - - org.apache.maven.reporting - maven-reporting-impl - 3.2.0 - - - org.apache.maven - maven-core - - - org.apache.maven - maven-plugin-api - - - org.apache.maven.shared maven-common-artifact-filters diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/AggregateReportIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/AggregateReportIT.java index 8a5293faa4..920f1da1d6 100644 --- a/surefire-its/src/test/java/org/apache/maven/surefire/its/AggregateReportIT.java +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/AggregateReportIT.java @@ -42,8 +42,8 @@ public class AggregateReportIT extends SurefireJUnit4IntegrationTestCase { public void aggregateReport() { OutputValidator outputValidator = unpack("/aggregate-report").addSurefireReportGoal().executeCurrentGoals(); - TestFile surefireReportHtml = outputValidator.getSiteFile("surefire.html"); - assertTrue("surefire report missing: " + surefireReportHtml.getAbsolutePath(), surefireReportHtml.exists()); + TestFile reportFile = outputValidator.getReportsFile("surefire.html"); + assertTrue("surefire report missing: " + reportFile.getAbsolutePath(), reportFile.exists()); // TODO HtmlUnit tests on the surefire report diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/CheckTestNgReportTestIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/CheckTestNgReportTestIT.java index 30aaefcf3d..3b364e3068 100644 --- a/surefire-its/src/test/java/org/apache/maven/surefire/its/CheckTestNgReportTestIT.java +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/CheckTestNgReportTestIT.java @@ -38,7 +38,7 @@ public void testNgReport() { .addSurefireReportGoal() .executeCurrentGoals() .verifyErrorFree(3) - .getSiteFile("surefire.html") + .getReportsFile("surefire.html") .assertFileExists(); } diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/MavenLauncher.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/MavenLauncher.java index 55cc0b6b40..05c8d8c965 100755 --- a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/MavenLauncher.java +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/MavenLauncher.java @@ -307,9 +307,9 @@ public MavenLauncher showExceptionMessages() { return this; } - public MavenLauncher deleteSiteDir() { + public MavenLauncher deleteReportsDir() { try { - FileUtils.deleteDirectory(getValidator().getSubFile("site")); + FileUtils.deleteDirectory(getValidator().getSubFile("reports")); } catch (IOException e) { throw new SurefireVerifierException(e); } diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/OutputValidator.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/OutputValidator.java index 42819c5d8e..87596dd762 100644 --- a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/OutputValidator.java +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/OutputValidator.java @@ -178,6 +178,11 @@ public TestFile getSiteFile(String fileName) { return new TestFile(new File(targetDir, fileName), this); } + public TestFile getReportsFile(String fileName) { + File targetDir = getSubFile("target/reports"); + return new TestFile(new File(targetDir, fileName), this); + } + public File getBaseDir() { return baseDir; } diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java index 2df39a478a..f691f4bfc0 100755 --- a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java @@ -329,7 +329,7 @@ public File getUnpackedAt() { } public SurefireLauncher addFailsafeReportOnlyGoal() { - mavenLauncher.addGoal(getReportPluginGoal(":failsafe-report-only")); + mavenLauncher.addGoal(getReportPluginGoal("failsafe-report-only")); return this; } diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire260TestWithIdenticalNamesIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire260TestWithIdenticalNamesIT.java index 07e6da39ce..995ec35615 100644 --- a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire260TestWithIdenticalNamesIT.java +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire260TestWithIdenticalNamesIT.java @@ -46,12 +46,11 @@ public class Surefire260TestWithIdenticalNamesIT extends SurefireJUnit4Integrati public void testWithIdenticalNames() throws IOException { OutputValidator validator = unpack("surefire-260-testWithIdenticalNames") .failNever() - .addGoal("site") .addSurefireReportGoal() .executeCurrentGoals(); - TestFile siteFile = validator.getSiteFile("surefire.html"); - final URI uri = siteFile.toURI(); + TestFile reportsFile = validator.getReportsFile("surefire.html"); + final URI uri = reportsFile.toURI(); try (WebClient webClient = new WebClient()) { HtmlPage page = webClient.getPage(uri.toURL()); diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire570MultipleReportDirectoriesIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire570MultipleReportDirectoriesIT.java index 95a9809309..516153e0d6 100644 --- a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire570MultipleReportDirectoriesIT.java +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire570MultipleReportDirectoriesIT.java @@ -38,10 +38,10 @@ public void testReportWithAggregate() { surefireLauncher.executeTest(); surefireLauncher.addGoal("-Daggregate=true"); OutputValidator validator = surefireLauncher.executeSurefireReport(); - TestFile siteFile = validator.getSiteFile("surefire.html"); - siteFile.assertContainsText("MyModule1ClassTest"); - siteFile.assertContainsText("MyModule2ClassTest"); - siteFile.assertContainsText("MyDummyClassM1Test"); + TestFile reportFile = validator.getReportsFile("surefire.html"); + reportFile.assertContainsText("MyModule1ClassTest"); + reportFile.assertContainsText("MyModule2ClassTest"); + reportFile.assertContainsText("MyDummyClassM1Test"); } @Test @@ -51,9 +51,9 @@ public void testReportWithoutAggregate() throws Exception { surefireLauncher.reset(); surefireLauncher.executeSurefireReport(); OutputValidator module1 = surefireLauncher.getSubProjectValidator("module1"); - TestFile siteFile = module1.getSiteFile("surefire.html"); - siteFile.assertContainsText("MyModule1ClassTest"); - siteFile.assertContainsText("MyDummyClassM1Test"); + TestFile reportFile = module1.getReportsFile("surefire.html"); + reportFile.assertContainsText("MyModule1ClassTest"); + reportFile.assertContainsText("MyDummyClassM1Test"); } public SurefireLauncher unpack() { diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire740TruncatedCommaIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire740TruncatedCommaIT.java index 78340ce3bc..e0137ac682 100644 --- a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire740TruncatedCommaIT.java +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire740TruncatedCommaIT.java @@ -39,8 +39,8 @@ public void testRussianLocaleReport() { .addSurefireReportGoal() .executeCurrentGoals(); - TestFile siteFile = validator.getSiteFile("surefire.html"); - assertTrue("Expecting file", siteFile.exists()); - siteFile.assertContainsText("027"); // Avoid asserting with the "," or "." ;) + TestFile reportFile = validator.getReportsFile("surefire.html"); + assertTrue("Expecting file", reportFile.exists()); + reportFile.assertContainsText("027"); // Avoid asserting with the "," or "." ;) } } diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire772BothReportsIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire772BothReportsIT.java index 5042988ad7..8fbfa01dc1 100644 --- a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire772BothReportsIT.java +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire772BothReportsIT.java @@ -36,7 +36,7 @@ public class Surefire772BothReportsIT extends SurefireJUnit4IntegrationTestCase public SurefireLauncher unpack() { SurefireLauncher unpack = unpack("/surefire-772-both-reports"); - unpack.maven().deleteSiteDir().skipClean().failNever(); + unpack.maven().deleteReportsDir().skipClean().failNever(); return unpack; } @@ -45,11 +45,11 @@ public void testReportGeneration() { OutputValidator outputValidator = unpack().addFailsafeReportOnlyGoal().addSurefireReportOnlyGoal().executeCurrentGoals(); - TestFile siteFile = outputValidator.getSiteFile("surefire.html"); - assertTrue("Expecting surefire report file", siteFile.isFile()); + TestFile reportFile = outputValidator.getReportsFile("surefire.html"); + assertTrue("Expecting surefire report file", reportFile.isFile()); - siteFile = outputValidator.getSiteFile("failsafe.html"); - assertTrue("Expecting failsafe report file", siteFile.isFile()); + reportFile = outputValidator.getReportsFile("failsafe.html"); + assertTrue("Expecting failsafe report file", reportFile.isFile()); } @Test @@ -59,11 +59,11 @@ public void testSkippedFailsafeReportGeneration() { .addSurefireReportOnlyGoal() .executeCurrentGoals(); - TestFile siteFile = validator.getSiteFile("surefire.html"); - assertTrue("Expecting surefire report file", siteFile.isFile()); + TestFile reportFile = validator.getReportsFile("surefire.html"); + assertTrue("Expecting surefire report file", reportFile.isFile()); - siteFile = validator.getSiteFile("failsafe.html"); - assertFalse("Expecting no failsafe report file", siteFile.isFile()); + reportFile = validator.getReportsFile("failsafe.html"); + assertFalse("Expecting no failsafe report file", reportFile.isFile()); } @Test @@ -74,10 +74,10 @@ public void testSkippedSurefireReportGeneration() { .addSurefireReportOnlyGoal() .executeCurrentGoals(); - TestFile siteFile = validator.getSiteFile("surefire.html"); - assertFalse("Expecting no surefire report file", siteFile.isFile()); + TestFile reportFile = validator.getReportsFile("surefire.html"); + assertFalse("Expecting no surefire report file", reportFile.isFile()); - siteFile = validator.getSiteFile("failsafe.html"); - assertTrue("Expecting failsafe report file", siteFile.isFile()); + reportFile = validator.getReportsFile("failsafe.html"); + assertTrue("Expecting failsafe report file", reportFile.isFile()); } } diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire772NoFailsafeReportsIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire772NoFailsafeReportsIT.java index aa4bd21b68..6aa685e745 100644 --- a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire772NoFailsafeReportsIT.java +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire772NoFailsafeReportsIT.java @@ -41,7 +41,7 @@ public void testReportGeneration() throws Exception { unpack().addFailsafeReportOnlyGoal().addSurefireReportOnlyGoal().executeCurrentGoals(); assertSurefireReportPresent(site); - assertNoFailsefeReport(site); + assertNoFailsafeReport(site); } @Test @@ -51,7 +51,7 @@ public void testSkippedFailsafeReportGeneration() throws Exception { .addSurefireReportOnlyGoal() .executeCurrentGoals(); assertSurefireReportPresent(validator); - assertNoFailsefeReport(validator); + assertNoFailsafeReport(validator); } @Test @@ -73,27 +73,27 @@ public void testSkipForcedFailsafeReportGeneration() throws Exception { .executeCurrentGoals(); assertSurefireReportPresent(validator); - assertNoFailsefeReport(validator); + assertNoFailsafeReport(validator); } - private void assertNoFailsefeReport(OutputValidator site) { - TestFile siteFile = site.getSiteFile("failsafe.html"); - assertFalse("Expecting no failsafe report file", siteFile.isFile()); + private void assertNoFailsafeReport(OutputValidator validator) { + TestFile reportFile = validator.getReportsFile("failsafe.html"); + assertFalse("Expecting no failsafe report file", reportFile.isFile()); } - private void assertFailsafeReport(OutputValidator site) { - TestFile siteFile = site.getSiteFile("failsafe.html"); - assertTrue("Expecting no failsafe report file", siteFile.isFile()); + private void assertFailsafeReport(OutputValidator validator) { + TestFile reportFile = validator.getReportsFile("failsafe.html"); + assertTrue("Expecting no failsafe report file", reportFile.isFile()); } - private void assertSurefireReportPresent(OutputValidator site) { - TestFile siteFile = site.getSiteFile("surefire.html"); - assertTrue("Expecting surefire report file", siteFile.isFile()); + private void assertSurefireReportPresent(OutputValidator validator) { + TestFile reportFile = validator.getReportsFile("surefire.html"); + assertTrue("Expecting surefire report file", reportFile.isFile()); } private SurefireLauncher unpack() throws VerificationException { final SurefireLauncher unpack = unpack("surefire-772-no-failsafe-reports"); - unpack.maven().deleteSiteDir().skipClean().failNever().verifyFileNotPresent("site"); + unpack.maven().deleteReportsDir().skipClean().failNever().verifyFileNotPresent("reports"); return unpack; } } diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire772NoSurefireReportsIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire772NoSurefireReportsIT.java index 845909210b..4ca1b4366a 100644 --- a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire772NoSurefireReportsIT.java +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire772NoSurefireReportsIT.java @@ -38,11 +38,11 @@ public void testReportGeneration() { OutputValidator validator = unpack().addFailsafeReportOnlyGoal().addSurefireReportOnlyGoal().executeCurrentGoals(); - TestFile siteFile = validator.getSiteFile("surefire.html"); - assertTrue("Expecting surefire report file", siteFile.isFile()); + TestFile reportFile = validator.getReportsFile("surefire.html"); + assertTrue("Expecting surefire report file", reportFile.isFile()); - siteFile = validator.getSiteFile("failsafe.html"); - assertTrue("Expecting failsafe report file", siteFile.isFile()); + reportFile = validator.getReportsFile("failsafe.html"); + assertTrue("Expecting failsafe report file", reportFile.isFile()); } @Test @@ -52,11 +52,11 @@ public void testSkippedSurefireReportGeneration() { .addSurefireReportOnlyGoal() .executeCurrentGoals(); - TestFile siteFile = validator.getSiteFile("surefire.html"); - assertFalse("Expecting no surefire report file", siteFile.isFile()); + TestFile reportFile = validator.getReportsFile("surefire.html"); + assertFalse("Expecting no surefire report file", reportFile.isFile()); - siteFile = validator.getSiteFile("failsafe.html"); - assertTrue("Expecting failsafe report file", siteFile.isFile()); + reportFile = validator.getReportsFile("failsafe.html"); + assertTrue("Expecting failsafe report file", reportFile.isFile()); } @Test @@ -66,11 +66,11 @@ public void testOptionalSurefireReportGeneration() { .addSurefireReportOnlyGoal() .executeCurrentGoals(); - TestFile siteFile = validator.getSiteFile("surefire.html"); - assertFalse("Expecting no surefire report file", siteFile.isFile()); + TestFile reportFile = validator.getReportsFile("surefire.html"); + assertFalse("Expecting no surefire report file", reportFile.isFile()); - siteFile = validator.getSiteFile("failsafe.html"); - assertTrue("Expecting failsafe report file", siteFile.isFile()); + reportFile = validator.getReportsFile("failsafe.html"); + assertTrue("Expecting failsafe report file", reportFile.isFile()); } @Test @@ -81,16 +81,16 @@ public void testSkipOptionalSurefireReportGeneration() { .addSurefireReportOnlyGoal() .executeCurrentGoals(); - TestFile siteFile = validator.getSiteFile("surefire.html"); - assertFalse("Expecting no surefire report file", siteFile.isFile()); + TestFile reportFile = validator.getReportsFile("surefire.html"); + assertFalse("Expecting no surefire report file", reportFile.isFile()); - siteFile = validator.getSiteFile("failsafe.html"); - assertTrue("Expecting failsafe report file", siteFile.isFile()); + reportFile = validator.getReportsFile("failsafe.html"); + assertTrue("Expecting failsafe report file", reportFile.isFile()); } public SurefireLauncher unpack() { SurefireLauncher unpack = unpack("/surefire-772-no-surefire-reports"); - unpack.maven().failNever().deleteSiteDir().skipClean(); + unpack.maven().failNever().deleteReportsDir().skipClean(); return unpack; } } diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire772SpecifiedReportsIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire772SpecifiedReportsIT.java index fc37d7b6f9..405fd452b1 100644 --- a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire772SpecifiedReportsIT.java +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire772SpecifiedReportsIT.java @@ -38,11 +38,11 @@ public void testReportGeneration() { OutputValidator validator = unpack().addFailsafeReportOnlyGoal().addSurefireReportOnlyGoal().executeCurrentGoals(); - TestFile siteFile = validator.getSiteFile("surefire.html"); - assertTrue("Expecting surefire report file", siteFile.isFile()); + TestFile reportFile = validator.getReportsFile("surefire.html"); + assertTrue("Expecting surefire report file", reportFile.isFile()); - siteFile = validator.getSiteFile("failsafe.html"); - assertTrue("Expecting failsafe report file", siteFile.isFile()); + reportFile = validator.getReportsFile("failsafe.html"); + assertTrue("Expecting failsafe report file", reportFile.isFile()); } @Test @@ -52,11 +52,11 @@ public void testSkippedFailsafeReportGeneration() { .addSurefireReportOnlyGoal() .executeCurrentGoals(); - TestFile siteFile = validator.getSiteFile("surefire.html"); - assertTrue("Expecting surefire report file", siteFile.isFile()); + TestFile reportFile = validator.getReportsFile("surefire.html"); + assertTrue("Expecting surefire report file", reportFile.isFile()); - siteFile = validator.getSiteFile("failsafe.html"); - assertFalse("Expecting no failsafe report file", siteFile.isFile()); + reportFile = validator.getReportsFile("failsafe.html"); + assertFalse("Expecting no failsafe report file", reportFile.isFile()); } @Test @@ -66,16 +66,16 @@ public void testSkippedSurefireReportGeneration() { .addSurefireReportOnlyGoal() .executeCurrentGoals(); - TestFile siteFile = validator.getSiteFile("surefire.html"); - assertFalse("Expecting no surefire report file", siteFile.isFile()); + TestFile reportFile = validator.getReportsFile("surefire.html"); + assertFalse("Expecting no surefire report file", reportFile.isFile()); - siteFile = validator.getSiteFile("failsafe.html"); - assertTrue("Expecting failsafe report file", siteFile.isFile()); + reportFile = validator.getReportsFile("failsafe.html"); + assertTrue("Expecting failsafe report file", reportFile.isFile()); } public SurefireLauncher unpack() { SurefireLauncher unpack = unpack("/surefire-772-specified-reports"); - unpack.maven().deleteSiteDir().skipClean().failNever(); + unpack.maven().deleteReportsDir().skipClean().failNever(); return unpack; } } diff --git a/surefire-its/src/test/resources/surefire-1490-custom/pom.xml b/surefire-its/src/test/resources/surefire-1490-custom/pom.xml index 4fda5847f2..e74cc7a477 100644 --- a/surefire-its/src/test/resources/surefire-1490-custom/pom.xml +++ b/surefire-its/src/test/resources/surefire-1490-custom/pom.xml @@ -48,7 +48,7 @@ org.apache.maven.plugins maven-site-plugin - 3.12.1 + 3.20.0 @@ -93,7 +93,7 @@ maven-project-info-reports-plugin - 3.6.1 + 3.7.0 diff --git a/surefire-its/src/test/resources/surefire-1490-default/pom.xml b/surefire-its/src/test/resources/surefire-1490-default/pom.xml index 186063a9d9..b059f65bfa 100644 --- a/surefire-its/src/test/resources/surefire-1490-default/pom.xml +++ b/surefire-its/src/test/resources/surefire-1490-default/pom.xml @@ -48,7 +48,7 @@ org.apache.maven.plugins maven-site-plugin - 3.12.1 + 3.20.0 @@ -93,7 +93,7 @@ maven-project-info-reports-plugin - 3.6.1 + 3.7.0 diff --git a/surefire-its/src/test/resources/surefire-260-testWithIdenticalNames/pom.xml b/surefire-its/src/test/resources/surefire-260-testWithIdenticalNames/pom.xml index d6bfdf9566..eee2fc04d4 100644 --- a/surefire-its/src/test/resources/surefire-260-testWithIdenticalNames/pom.xml +++ b/surefire-its/src/test/resources/surefire-260-testWithIdenticalNames/pom.xml @@ -57,7 +57,7 @@ org.apache.maven.plugins maven-site-plugin - 3.12.1 + 3.20.0 @@ -67,7 +67,7 @@ org.apache.maven.plugins maven-project-info-reports-plugin - 3.6.1 + 3.7.0 false diff --git a/surefire-its/src/test/resources/surefire-570-multipleReportDirectories/pom.xml b/surefire-its/src/test/resources/surefire-570-multipleReportDirectories/pom.xml index 9a9b1df35b..4bca6f4509 100644 --- a/surefire-its/src/test/resources/surefire-570-multipleReportDirectories/pom.xml +++ b/surefire-its/src/test/resources/surefire-570-multipleReportDirectories/pom.xml @@ -57,7 +57,7 @@ org.apache.maven.plugins maven-site-plugin - 3.12.1 + 3.20.0