This is an automated email from the ASF dual-hosted git repository. michaelo pushed a commit to branch doxia-2.0.0 in repository https://gitbox.apache.org/repos/asf/maven-project-info-reports-plugin.git
commit 79f39d98772ac594d177292a1d37118ef1dc8bea Author: Michael Osipov <micha...@apache.org> AuthorDate: Sat Jul 2 23:58:47 2022 +0200 Prepare for Doxia 2.0.0 --- pom.xml | 90 ++++++++-------- src/it/MPIR-431/verify.groovy | 53 +++++----- src/it/MPIR-437/verify.groovy | 14 +-- src/it/dependencies-java-1.7-and-1.8/verify.groovy | 28 ++--- src/it/full-pom/pom.xml | 2 +- src/it/minimal-pom/pom.xml | 2 +- src/it/mpir-229/verify.groovy | 2 +- src/it/multi-module/pom.xml | 3 - src/it/multi-module/verify.groovy | 4 +- .../projectinfo/AbstractProjectInfoRenderer.java | 31 ------ .../projectinfo/AbstractProjectInfoReport.java | 41 +++----- .../report/projectinfo/CiManagementReport.java | 3 +- .../report/projectinfo/DependenciesReport.java | 5 +- .../projectinfo/DependencyConvergenceReport.java | 8 +- .../projectinfo/DependencyManagementReport.java | 3 +- .../projectinfo/DistributionManagementReport.java | 3 +- .../report/projectinfo/IssueManagementReport.java | 3 +- .../maven/report/projectinfo/LicensesReport.java | 7 +- .../report/projectinfo/MailingListsReport.java | 3 +- .../maven/report/projectinfo/ModulesReport.java | 3 +- .../report/projectinfo/PluginManagementReport.java | 3 +- .../maven/report/projectinfo/PluginsReport.java | 3 +- .../apache/maven/report/projectinfo/ScmReport.java | 3 +- .../maven/report/projectinfo/TeamReport.java | 5 +- .../renderer/DependenciesRenderer.java | 116 --------------------- .../projectinfo/AbstractProjectInfoTestCase.java | 49 +++++++-- .../report/projectinfo/CiManagementReportTest.java | 20 ++-- .../report/projectinfo/DependenciesReportTest.java | 23 ++-- .../DependencyConvergenceReportTest.java | 9 +- .../DependencyManagementReportTest.java | 11 +- .../maven/report/projectinfo/IndexReportTest.java | 11 +- .../projectinfo/IssueManagementReportTest.java | 15 ++- .../report/projectinfo/LicensesReportTest.java | 33 +++--- .../report/projectinfo/MailingListsReportTest.java | 33 +++--- .../report/projectinfo/ModulesReportTest.java | 16 ++- .../projectinfo/PluginManagementReportTest.java | 13 ++- .../maven/report/projectinfo/ScmReportTest.java | 24 +++-- .../report/projectinfo/SummaryReportTest.java | 17 +-- .../maven/report/projectinfo/TeamReportTest.java | 24 +++-- .../projectinfo/stubs/ProjectInfoProjectStub.java | 7 ++ .../mailing-lists-plugin-config-fr.xml | 62 +++++++++++ 41 files changed, 408 insertions(+), 397 deletions(-) diff --git a/pom.xml b/pom.xml index bc29c99..7b218c5 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ under the License. </parent> <artifactId>maven-project-info-reports-plugin</artifactId> - <version>3.4.6-SNAPSHOT</version> + <version>4.0.0-M1-SNAPSHOT</version> <packaging>maven-plugin</packaging> <name>Apache Maven Project Info Reports Plugin</name> @@ -114,14 +114,14 @@ under the License. </distributionManagement> <properties> - <doxiaVersion>1.11.1</doxiaVersion> - <doxiaSitetoolsVersion>1.11.1</doxiaSitetoolsVersion> + <doxiaVersion>2.0.0-M8</doxiaVersion> + <doxiaSitetoolsVersion>2.0.0-M13</doxiaSitetoolsVersion> <mavenVersion>3.2.5</mavenVersion> <scmVersion>1.13.0</scmVersion> <aetherVersion>1.0.0.v20140518</aetherVersion> - <sitePluginVersion>3.12.1</sitePluginVersion> - <fluidoSkinVersion>1.11.1</fluidoSkinVersion> - <surefire.version>3.1.0</surefire.version> + <sitePluginVersion>4.0.0-M11</sitePluginVersion> + <fluidoSkinVersion>2.0.0-M8</fluidoSkinVersion> + <surefire.version>3.1.2</surefire.version> <checkstyle.violation.ignore>ParameterNumber,MethodLength</checkstyle.violation.ignore> <project.build.outputTimestamp>2023-06-03T12:55:40Z</project.build.outputTimestamp> </properties> @@ -130,12 +130,12 @@ under the License. <dependency> <groupId>org.apache.maven.reporting</groupId> <artifactId>maven-reporting-api</artifactId> - <version>3.1.1</version> + <version>4.0.0-M8</version> </dependency> <dependency> <groupId>org.apache.maven.reporting</groupId> <artifactId>maven-reporting-impl</artifactId> - <version>3.2.0</version> + <version>4.0.0-M11</version> <exclusions> <exclusion> <groupId>org.apache.maven</groupId> @@ -303,56 +303,18 @@ under the License. <groupId>org.apache.maven.doxia</groupId> <artifactId>doxia-sink-api</artifactId> <version>${doxiaVersion}</version> - <exclusions> - <exclusion> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-container-default</artifactId> - </exclusion> - </exclusions> </dependency> <dependency> <groupId>org.apache.maven.doxia</groupId> <artifactId>doxia-core</artifactId> <version>${doxiaVersion}</version> - <exclusions> - <exclusion> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-container-default</artifactId> - </exclusion> - </exclusions> </dependency> <!-- Doxia Sitetools --> - <dependency> - <groupId>org.apache.maven.doxia</groupId> - <artifactId>doxia-decoration-model</artifactId> - <version>${doxiaSitetoolsVersion}</version> - </dependency> - <dependency> - <groupId>org.apache.maven.doxia</groupId> - <artifactId>doxia-site-renderer</artifactId> - <version>${doxiaSitetoolsVersion}</version> - <exclusions> - <exclusion> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-container-default</artifactId> - </exclusion> - <exclusion> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-component-api</artifactId> - </exclusion> - </exclusions> - </dependency> <dependency> <groupId>org.apache.maven.doxia</groupId> <artifactId>doxia-integration-tools</artifactId> <version>${doxiaSitetoolsVersion}</version> - <exclusions> - <exclusion> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-container-default</artifactId> - </exclusion> - </exclusions> </dependency> <!-- Plexus --> @@ -495,6 +457,13 @@ under the License. <keyalg>RSA</keyalg> </configuration> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <argLine>-Dfile.encoding=UTF-8</argLine> + </configuration> + </plugin> </plugins> </pluginManagement> <plugins> @@ -559,6 +528,35 @@ under the License. </properties> <build> <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-clean-plugin</artifactId> + <!-- + This is necessary if "mvn site" has been invoked previously with 3.x + and leaves 0-byte files in the local repository for MRM Maven Plugin + to serve which are broken from a consumer's PoV. + --> + <executions> + <execution> + <id>delete-0-byte-site-descriptors</id> + <goals> + <goal>clean</goal> + </goals> + <phase>pre-integration-test</phase> + <configuration> + <excludeDefaultDirectories>true</excludeDefaultDirectories> + <filesets> + <fileset> + <directory>${settings.localRepository}/org/apache/apache</directory> + <includes> + <include>**/*-site*.xml</include> + </includes> + </fileset> + </filesets> + </configuration> + </execution> + </executions> + </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-invoker-plugin</artifactId> diff --git a/src/it/MPIR-431/verify.groovy b/src/it/MPIR-431/verify.groovy index d5e8e38..caa2163 100644 --- a/src/it/MPIR-431/verify.groovy +++ b/src/it/MPIR-431/verify.groovy @@ -18,36 +18,37 @@ */ String html = new File( basedir, 'target/site/dependencies.html' ).text +// Revise after DOXIA-704 def summaryLine = '''\ <tr class="b"> -<td align="right">compile: 1</td> -<td align="right">compile: 45.5 kB</td> -<td align="right">compile: 47</td> -<td align="right">compile: 36</td> -<td align="right">compile: 4</td> -<td rowspan="3" style="vertical-align: middle;" align="center">1.3</td> -<td align="right">compile: 1</td></tr> +<td style="text-align: right;">compile: 1</td> +<td style="text-align: right;">compile: 45.5 kB</td> +<td style="text-align: right;">compile: 47</td> +<td style="text-align: right;">compile: 36</td> +<td style="text-align: right;">compile: 4</td> +<td rowspan="3" style="text-align: center; vertical-align: middle;">1.3</td> +<td style="text-align: right;">compile: 1</td></tr> <tr class="a"> -<td align="right">runtime: 1</td> -<td align="right">runtime: 284.2 kB</td> -<td align="right">runtime: 155</td> -<td align="right">runtime: 133</td> -<td align="right">runtime: 10</td> -<td align="right">runtime: 1</td></tr> +<td style="text-align: right;">runtime: 1</td> +<td style="text-align: right;">runtime: 284.2 kB</td> +<td style="text-align: right;">runtime: 155</td> +<td style="text-align: right;">runtime: 133</td> +<td style="text-align: right;">runtime: 10</td> +<td style="text-align: right;">runtime: 1</td></tr> <tr class="b"> -<td align="right">provided: 1</td> -<td align="right">provided: 85.7 kB</td> -<td align="right">provided: 209</td> -<td align="right">provided: 192</td> -<td align="right">provided: 4</td> -<td align="right">-</td></tr> +<td style="text-align: right;">provided: 1</td> +<td style="text-align: right;">provided: 85.7 kB</td> +<td style="text-align: right;">provided: 209</td> +<td style="text-align: right;">provided: 192</td> +<td style="text-align: right;">provided: 4</td> +<td style="text-align: right;">-</td></tr> <tr class="a"> -<td align="right">test: 3</td> -<td align="right">test: 2.2 MB</td> -<td align="right">test: 1619</td> -<td align="right">test: 1493</td> -<td align="right">test: 91</td> -<td align="center">1.8</td> -<td align="right">test: 3</td></tr>''' +<td style="text-align: right;">test: 3</td> +<td style="text-align: right;">test: 2.2 MB</td> +<td style="text-align: right;">test: 1619</td> +<td style="text-align: right;">test: 1493</td> +<td style="text-align: right;">test: 91</td> +<td style="text-align: center;">1.8</td> +<td style="text-align: right;">test: 3</td></tr>''' assert html.contains( summaryLine.replaceAll( "\n", System.lineSeparator() ) ) diff --git a/src/it/MPIR-437/verify.groovy b/src/it/MPIR-437/verify.groovy index 343724b..7b79e84 100644 --- a/src/it/MPIR-437/verify.groovy +++ b/src/it/MPIR-437/verify.groovy @@ -19,13 +19,13 @@ File dependencies = new File( basedir, 'target/site/dependencies.html' ) def summaryRow = '''\ <tr class="b"> -<td align="right">1</td> -<td align="right">78.8 kB</td> -<td align="right">141</td> -<td align="right">-</td> -<td align="right">-</td> -<td align="center">-</td> -<td align="right">-</td></tr> +<td style="text-align: right;">1</td> +<td style="text-align: right;">78.8 kB</td> +<td style="text-align: right;">141</td> +<td style="text-align: right;">-</td> +<td style="text-align: right;">-</td> +<td style="text-align: center;">-</td> +<td style="text-align: right;">-</td></tr> ''' assert dependencies.text.contains( summaryRow.replaceAll( "\n", System.lineSeparator() ) ) diff --git a/src/it/dependencies-java-1.7-and-1.8/verify.groovy b/src/it/dependencies-java-1.7-and-1.8/verify.groovy index 2edcd4e..2a344fe 100644 --- a/src/it/dependencies-java-1.7-and-1.8/verify.groovy +++ b/src/it/dependencies-java-1.7-and-1.8/verify.groovy @@ -19,24 +19,24 @@ File dependencies = new File( basedir, 'target/site/dependencies.html' ) def mavenModel = '''\ <tr class="a"> -<td align="left">maven-model-3.3.9.jar</td> -<td align="right">164 kB</td> -<td align="right">71</td> -<td align="right">54</td> -<td align="right">3</td> -<td align="center">1.7</td> -<td align="center">Yes</td></tr> +<td style="text-align: left;">maven-model-3.3.9.jar</td> +<td style="text-align: right;">164 kB</td> +<td style="text-align: right;">71</td> +<td style="text-align: right;">54</td> +<td style="text-align: right;">3</td> +<td style="text-align: center;">1.7</td> +<td style="text-align: center;">Yes</td></tr> ''' def jacksonDataTypeJsr310 = '''\ <tr class="a"> -<td align="left">jackson-datatype-jsr310-2.6.4.jar</td> -<td align="right">78.1 kB</td> -<td align="right">69</td> -<td align="right">51</td> -<td align="right">5</td> -<td align="center">1.8</td> -<td align="center">Yes</td></tr> +<td style="text-align: left;">jackson-datatype-jsr310-2.6.4.jar</td> +<td style="text-align: right;">78.1 kB</td> +<td style="text-align: right;">69</td> +<td style="text-align: right;">51</td> +<td style="text-align: right;">5</td> +<td style="text-align: center;">1.8</td> +<td style="text-align: center;">Yes</td></tr> ''' assert dependencies.text.contains( mavenModel.replaceAll( "\n", System.getProperty( "line.separator" ) ) ) diff --git a/src/it/full-pom/pom.xml b/src/it/full-pom/pom.xml index 5edf25c..97cccb2 100644 --- a/src/it/full-pom/pom.xml +++ b/src/it/full-pom/pom.xml @@ -192,7 +192,7 @@ <artifactId>maven-site-plugin</artifactId> <version>@sitePluginVersion@</version> <configuration> - <locales>en,cs,de,en,es,fr,gl,hu,it,ja,ko,lt,nl,no,pl,pt,pt_BR,ru,sk,sv,tr,zh_CN,zh_TW</locales> + <locales>default,en,cs,de,en,es,fr,gl,hu,it,ja,ko,lt,nl,no,pl,pt,pt_BR,ru,sk,sv,tr,zh_CN,zh_TW</locales> </configuration> </plugin> </plugins> diff --git a/src/it/minimal-pom/pom.xml b/src/it/minimal-pom/pom.xml index a2c013b..0c92814 100644 --- a/src/it/minimal-pom/pom.xml +++ b/src/it/minimal-pom/pom.xml @@ -44,7 +44,7 @@ <artifactId>maven-site-plugin</artifactId> <version>@sitePluginVersion@</version> <configuration> - <locales>en,cs,de,es,fr,hu,it,ja,ko,nl,no,pl,pt,pt_BR,sk,sv,tr,zh_CN,zh_TW</locales> + <locales>default,en,cs,de,es,fr,hu,it,ja,ko,nl,no,pl,pt,pt_BR,sk,sv,tr,zh_CN,zh_TW</locales> </configuration> </plugin> </plugins> diff --git a/src/it/mpir-229/verify.groovy b/src/it/mpir-229/verify.groovy index 4d7db4b..6cf4daa 100644 --- a/src/it/mpir-229/verify.groovy +++ b/src/it/mpir-229/verify.groovy @@ -17,4 +17,4 @@ * under the License. */ File modulesPage = new File( basedir, 'target/site/modules.html' ) -assert modulesPage.text.contains( '<a href="mpir-229-module1-1.0-SNAPSHOT/index.html" title="mpir-229-module1"><span class="none"></span>mpir-229-module1</a>' ) \ No newline at end of file +assert modulesPage.text.contains( '<a href="mpir-229-module1-1.0-SNAPSHOT/index.html">mpir-229-module1</a>' ) diff --git a/src/it/multi-module/pom.xml b/src/it/multi-module/pom.xml index 0cbf1da..50d8223 100644 --- a/src/it/multi-module/pom.xml +++ b/src/it/multi-module/pom.xml @@ -79,9 +79,6 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-site-plugin</artifactId> <version>@sitePluginVersion@</version> - <configuration> - <locales>en</locales> - </configuration> </plugin> </plugins> </build> diff --git a/src/it/multi-module/verify.groovy b/src/it/multi-module/verify.groovy index 7fdfb6b..afc2cb4 100644 --- a/src/it/multi-module/verify.groovy +++ b/src/it/multi-module/verify.groovy @@ -21,5 +21,5 @@ File mainDependencies = new File( basedir, 'main/target/site/dependencies.html' // Dependency File Details section should display dep-1.0-SNAPSHOT.jar packaged from previous build (package phase), // not dep/target/classes from current build (site phase) -assert !mainDependencies.text.contains( '<td align="left">dep/target/classes</td>' ) -assert mainDependencies.text.contains( '<td align="left">dep-1.0-SNAPSHOT.jar</td>' ) +assert !mainDependencies.text.contains( '<td style="text-align: left;">dep/target/classes</td>' ) +assert mainDependencies.text.contains( '<td style="text-align: left;">dep-1.0-SNAPSHOT.jar</td>' ) diff --git a/src/main/java/org/apache/maven/report/projectinfo/AbstractProjectInfoRenderer.java b/src/main/java/org/apache/maven/report/projectinfo/AbstractProjectInfoRenderer.java index 12aaa68..5a7f505 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/AbstractProjectInfoRenderer.java +++ b/src/main/java/org/apache/maven/report/projectinfo/AbstractProjectInfoRenderer.java @@ -91,36 +91,5 @@ public abstract class AbstractProjectInfoRenderer extends AbstractMavenReportRen } } - /* FIXME The next two methods need to be retained until Doxia and Maven Reporting Impl properly implement - * the difference of a (boxed) real verbatim text and (boxed) source code. - */ - /** - * {@inheritDoc} - */ - @Override - protected void verbatimText(String text) { - sink.verbatim(null); - - text(text); - - sink.verbatim_(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void verbatimLink(String text, String href) { - if (href == null || href.isEmpty()) { - verbatimText(text); - } else { - sink.verbatim(null); - - link(href, text); - - sink.verbatim_(); - } - } - protected abstract String getI18Nsection(); } diff --git a/src/main/java/org/apache/maven/report/projectinfo/AbstractProjectInfoReport.java b/src/main/java/org/apache/maven/report/projectinfo/AbstractProjectInfoReport.java index 9829e94..a621423 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/AbstractProjectInfoReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/AbstractProjectInfoReport.java @@ -35,11 +35,13 @@ import java.util.ResourceBundle; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.execution.MavenSession; import org.apache.maven.model.Plugin; +import org.apache.maven.plugin.MojoExecution; import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; import org.apache.maven.project.ProjectBuilder; import org.apache.maven.reporting.AbstractMavenReport; +import org.apache.maven.reporting.MavenReportException; import org.apache.maven.repository.RepositorySystem; import org.apache.maven.settings.Settings; import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver; @@ -91,6 +93,9 @@ public abstract class AbstractProjectInfoReport extends AbstractMavenReport { @Parameter(defaultValue = "${session}", readonly = true, required = true) private MavenSession session; + @Parameter(defaultValue = "${project.remoteArtifactRepositories}", readonly = true, required = true) + protected List<ArtifactRepository> remoteRepositories; + /** * Plugin repositories used for the project. * @@ -99,14 +104,6 @@ public abstract class AbstractProjectInfoReport extends AbstractMavenReport { @Parameter(defaultValue = "${project.pluginArtifactRepositories}", readonly = true, required = true) protected List<ArtifactRepository> pluginRepositories; - /** - * The reactor projects. - * - * @since 2.10 - */ - @Parameter(defaultValue = "${reactorProjects}", required = true, readonly = true) - protected List<MavenProject> reactorProjects; - /** * The current user system settings for use in Maven. * @@ -149,12 +146,18 @@ public abstract class AbstractProjectInfoReport extends AbstractMavenReport { @Parameter private List<LicenseMapping> licenseMappings; + /** + * The local repository. + */ + @Parameter(defaultValue = "${localRepository}", readonly = true, required = true) + protected ArtifactRepository localRepository; + // ---------------------------------------------------------------------- // Public methods // ---------------------------------------------------------------------- @Override - public boolean canGenerateReport() { + public boolean canGenerateReport() throws MavenReportException { return !skip; } @@ -187,21 +190,6 @@ public abstract class AbstractProjectInfoReport extends AbstractMavenReport { return coll == null || coll.isEmpty(); } - @Override - protected String getOutputDirectory() { - return outputDirectory.getAbsolutePath(); - } - - @Override - public File getReportOutputDirectory() { - return outputDirectory; - } - - @Override - public void setReportOutputDirectory(File reportOutputDirectory) { - this.outputDirectory = reportOutputDirectory; - } - @Override protected MavenProject getProject() { return project; @@ -215,6 +203,10 @@ public abstract class AbstractProjectInfoReport extends AbstractMavenReport { return reactorProjects; } + protected MojoExecution getMojoExecution() { + return mojoExecution; + } + /** * @param pluginId The id of the plugin * @return The information about the plugin. @@ -301,6 +293,7 @@ public abstract class AbstractProjectInfoReport extends AbstractMavenReport { return getI18nString(locale, "description"); } + // TODO Review, especially Locale.getDefault() private static class CustomI18N implements I18N { private final MavenProject project; diff --git a/src/main/java/org/apache/maven/report/projectinfo/CiManagementReport.java b/src/main/java/org/apache/maven/report/projectinfo/CiManagementReport.java index 93f668b..dc3fbf4 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/CiManagementReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/CiManagementReport.java @@ -29,6 +29,7 @@ import org.apache.maven.model.CiManagement; import org.apache.maven.model.Model; import org.apache.maven.model.Notifier; import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.reporting.MavenReportException; import org.codehaus.plexus.i18n.I18N; /** @@ -44,7 +45,7 @@ public class CiManagementReport extends AbstractProjectInfoReport { // ---------------------------------------------------------------------- @Override - public boolean canGenerateReport() { + public boolean canGenerateReport() throws MavenReportException { boolean result = super.canGenerateReport(); if (result && skipEmptyReport) { CiManagement cim = getProject().getModel().getCiManagement(); diff --git a/src/main/java/org/apache/maven/report/projectinfo/DependenciesReport.java b/src/main/java/org/apache/maven/report/projectinfo/DependenciesReport.java index 9011399..2d60f2a 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/DependenciesReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/DependenciesReport.java @@ -42,6 +42,7 @@ import org.apache.maven.report.projectinfo.dependencies.Dependencies; import org.apache.maven.report.projectinfo.dependencies.DependenciesReportConfiguration; import org.apache.maven.report.projectinfo.dependencies.RepositoryUtils; import org.apache.maven.report.projectinfo.dependencies.renderer.DependenciesRenderer; +import org.apache.maven.reporting.MavenReportException; import org.apache.maven.shared.dependency.graph.DependencyGraphBuilder; import org.apache.maven.shared.dependency.graph.DependencyGraphBuilderException; import org.apache.maven.shared.dependency.graph.DependencyNode; @@ -109,7 +110,7 @@ public class DependenciesReport extends AbstractProjectInfoReport { // ---------------------------------------------------------------------- @Override - public boolean canGenerateReport() { + public boolean canGenerateReport() throws MavenReportException { boolean result = super.canGenerateReport(); if (result && skipEmptyReport) { // This seems to be a bit too much but the DependenciesRenderer applies the same logic @@ -124,7 +125,7 @@ public class DependenciesReport extends AbstractProjectInfoReport { @Override public void executeReport(Locale locale) { try { - copyResources(new File(getOutputDirectory())); + copyResources(getReportOutputDirectory()); } catch (IOException e) { getLog().error("Cannot copy resources", e); } diff --git a/src/main/java/org/apache/maven/report/projectinfo/DependencyConvergenceReport.java b/src/main/java/org/apache/maven/report/projectinfo/DependencyConvergenceReport.java index 579829a..b143aa7 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/DependencyConvergenceReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/DependencyConvergenceReport.java @@ -273,7 +273,7 @@ public class DependencyConvergenceReport extends AbstractProjectInfoReport { */ private void generateDependencyDetails(Locale locale, Sink sink, List<ReverseDependencyLink> depList) { sink.table(); - sink.tableRows(null, false); + sink.tableRows(); Map<String, List<ReverseDependencyLink>> artifactMap = getSortedUniqueArtifactMap(depList); @@ -288,7 +288,7 @@ public class DependencyConvergenceReport extends AbstractProjectInfoReport { sink.tableCell(); sink.table(); - sink.tableRows(null, false); + sink.tableRows(); for (String version : artifactMap.keySet()) { sink.tableRow(); @@ -474,7 +474,7 @@ public class DependencyConvergenceReport extends AbstractProjectInfoReport { */ private void generateLegend(Locale locale, Sink sink) { sink.table(); - sink.tableRows(null, false); + sink.tableRows(); sink.tableCaption(); sink.bold(); sink.text(getI18nString(locale, "legend")); @@ -514,7 +514,7 @@ public class DependencyConvergenceReport extends AbstractProjectInfoReport { // Create report sink.table(); - sink.tableRows(null, false); + sink.tableRows(); sink.tableCaption(); sink.bold(); sink.text(getI18nString(locale, "stats.caption")); diff --git a/src/main/java/org/apache/maven/report/projectinfo/DependencyManagementReport.java b/src/main/java/org/apache/maven/report/projectinfo/DependencyManagementReport.java index ca68828..e44a54d 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/DependencyManagementReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/DependencyManagementReport.java @@ -30,6 +30,7 @@ import org.apache.maven.project.ProjectBuildingRequest; import org.apache.maven.report.projectinfo.dependencies.ManagementDependencies; import org.apache.maven.report.projectinfo.dependencies.RepositoryUtils; import org.apache.maven.report.projectinfo.dependencies.renderer.DependencyManagementRenderer; +import org.apache.maven.reporting.MavenReportException; /** * Generates the Project Dependency Management report. @@ -73,7 +74,7 @@ public class DependencyManagementReport extends AbstractProjectInfoReport { // ---------------------------------------------------------------------- @Override - public boolean canGenerateReport() { + public boolean canGenerateReport() throws MavenReportException { boolean result = super.canGenerateReport(); if (result && skipEmptyReport) { result = getManagementDependencies().hasDependencies(); diff --git a/src/main/java/org/apache/maven/report/projectinfo/DistributionManagementReport.java b/src/main/java/org/apache/maven/report/projectinfo/DistributionManagementReport.java index 5cddd2e..59b3d1a 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/DistributionManagementReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/DistributionManagementReport.java @@ -24,6 +24,7 @@ import org.apache.maven.doxia.sink.Sink; import org.apache.maven.model.DistributionManagement; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.project.MavenProject; +import org.apache.maven.reporting.MavenReportException; import org.codehaus.plexus.i18n.I18N; import org.codehaus.plexus.util.StringUtils; @@ -40,7 +41,7 @@ public class DistributionManagementReport extends AbstractProjectInfoReport { // ---------------------------------------------------------------------- @Override - public boolean canGenerateReport() { + public boolean canGenerateReport() throws MavenReportException { boolean result = super.canGenerateReport(); if (result && skipEmptyReport) { result = getProject().getDistributionManagement() != null; diff --git a/src/main/java/org/apache/maven/report/projectinfo/IssueManagementReport.java b/src/main/java/org/apache/maven/report/projectinfo/IssueManagementReport.java index 0be572a..6082348 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/IssueManagementReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/IssueManagementReport.java @@ -24,6 +24,7 @@ import org.apache.maven.doxia.sink.Sink; import org.apache.maven.model.IssueManagement; import org.apache.maven.model.Model; import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.reporting.MavenReportException; import org.codehaus.plexus.i18n.I18N; /** @@ -39,7 +40,7 @@ public class IssueManagementReport extends AbstractProjectInfoReport { // ---------------------------------------------------------------------- @Override - public boolean canGenerateReport() { + public boolean canGenerateReport() throws MavenReportException { boolean result = super.canGenerateReport(); if (result && skipEmptyReport) { result = getProject().getModel().getIssueManagement() != null; diff --git a/src/main/java/org/apache/maven/report/projectinfo/LicensesReport.java b/src/main/java/org/apache/maven/report/projectinfo/LicensesReport.java index 837408f..25d166d 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/LicensesReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/LicensesReport.java @@ -29,11 +29,12 @@ import java.util.regex.Pattern; import org.apache.commons.validator.routines.UrlValidator; import org.apache.maven.doxia.sink.Sink; -import org.apache.maven.doxia.util.HtmlTools; +import org.apache.maven.doxia.util.DoxiaUtils; import org.apache.maven.model.License; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; +import org.apache.maven.reporting.MavenReportException; import org.apache.maven.settings.Settings; import org.codehaus.plexus.i18n.I18N; import org.codehaus.plexus.util.StringUtils; @@ -79,7 +80,7 @@ public class LicensesReport extends AbstractProjectInfoReport { // ---------------------------------------------------------------------- @Override - public boolean canGenerateReport() { + public boolean canGenerateReport() throws MavenReportException { boolean result = super.canGenerateReport(); if (result && skipEmptyReport) { result = !isEmpty(getProject().getModel().getLicenses()); @@ -255,7 +256,7 @@ public class LicensesReport extends AbstractProjectInfoReport { } sink.listItem(); - link("#" + HtmlTools.encodeId(name), name); + link("#" + DoxiaUtils.encodeId(name), name); sink.listItem_(); } sink.list_(); diff --git a/src/main/java/org/apache/maven/report/projectinfo/MailingListsReport.java b/src/main/java/org/apache/maven/report/projectinfo/MailingListsReport.java index 2e10d26..2d4e425 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/MailingListsReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/MailingListsReport.java @@ -29,6 +29,7 @@ import org.apache.maven.model.MailingList; import org.apache.maven.model.Model; import org.apache.maven.plugin.logging.Log; import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.reporting.MavenReportException; import org.codehaus.plexus.i18n.I18N; import org.codehaus.plexus.util.StringUtils; @@ -46,7 +47,7 @@ public class MailingListsReport extends AbstractProjectInfoReport { // ---------------------------------------------------------------------- @Override - public boolean canGenerateReport() { + public boolean canGenerateReport() throws MavenReportException { boolean result = super.canGenerateReport(); if (result && skipEmptyReport) { result = !isEmpty(getProject().getModel().getMailingLists()); diff --git a/src/main/java/org/apache/maven/report/projectinfo/ModulesReport.java b/src/main/java/org/apache/maven/report/projectinfo/ModulesReport.java index 15854ff..3863f5d 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/ModulesReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/ModulesReport.java @@ -36,6 +36,7 @@ import org.apache.maven.project.MavenProject; import org.apache.maven.project.ProjectBuilder; import org.apache.maven.project.ProjectBuildingException; import org.apache.maven.project.ProjectBuildingRequest; +import org.apache.maven.reporting.MavenReportException; import org.codehaus.plexus.i18n.I18N; /** @@ -51,7 +52,7 @@ public class ModulesReport extends AbstractProjectInfoReport { // ---------------------------------------------------------------------- @Override - public boolean canGenerateReport() { + public boolean canGenerateReport() throws MavenReportException { boolean result = super.canGenerateReport(); if (result && skipEmptyReport) { result = !isEmpty(getProject().getModel().getModules()); diff --git a/src/main/java/org/apache/maven/report/projectinfo/PluginManagementReport.java b/src/main/java/org/apache/maven/report/projectinfo/PluginManagementReport.java index c67f435..2c2c7aa 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/PluginManagementReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/PluginManagementReport.java @@ -37,6 +37,7 @@ import org.apache.maven.project.MavenProject; import org.apache.maven.project.ProjectBuilder; import org.apache.maven.project.ProjectBuildingException; import org.apache.maven.project.ProjectBuildingRequest; +import org.apache.maven.reporting.MavenReportException; import org.apache.maven.repository.RepositorySystem; import org.apache.maven.shared.artifact.filter.PatternExcludesArtifactFilter; import org.codehaus.plexus.i18n.I18N; @@ -92,7 +93,7 @@ public class PluginManagementReport extends AbstractProjectInfoReport { } @Override - public boolean canGenerateReport() { + public boolean canGenerateReport() throws MavenReportException { boolean result = super.canGenerateReport(); if (result && skipEmptyReport) { result = getProject().getPluginManagement() != null diff --git a/src/main/java/org/apache/maven/report/projectinfo/PluginsReport.java b/src/main/java/org/apache/maven/report/projectinfo/PluginsReport.java index 70836ac..83a6f98 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/PluginsReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/PluginsReport.java @@ -37,6 +37,7 @@ import org.apache.maven.project.MavenProject; import org.apache.maven.project.ProjectBuilder; import org.apache.maven.project.ProjectBuildingException; import org.apache.maven.project.ProjectBuildingRequest; +import org.apache.maven.reporting.MavenReportException; import org.apache.maven.repository.RepositorySystem; import org.codehaus.plexus.i18n.I18N; import org.codehaus.plexus.util.StringUtils; @@ -54,7 +55,7 @@ public class PluginsReport extends AbstractProjectInfoReport { // ---------------------------------------------------------------------- @Override - public boolean canGenerateReport() { + public boolean canGenerateReport() throws MavenReportException { boolean result = super.canGenerateReport(); if (result && skipEmptyReport) { result = !isEmpty(getProject().getBuildPlugins()) diff --git a/src/main/java/org/apache/maven/report/projectinfo/ScmReport.java b/src/main/java/org/apache/maven/report/projectinfo/ScmReport.java index d86103b..ddee0ac 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/ScmReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/ScmReport.java @@ -29,6 +29,7 @@ import org.apache.maven.plugin.logging.Log; import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.reporting.MavenReportException; import org.apache.maven.scm.manager.ScmManager; import org.apache.maven.scm.provider.cvslib.repository.CvsScmProviderRepository; import org.apache.maven.scm.provider.git.repository.GitScmProviderRepository; @@ -103,7 +104,7 @@ public class ScmReport extends AbstractProjectInfoReport { // ---------------------------------------------------------------------- @Override - public boolean canGenerateReport() { + public boolean canGenerateReport() throws MavenReportException { boolean result = super.canGenerateReport(); if (result && skipEmptyReport) { Scm scm = getProject().getModel().getScm(); diff --git a/src/main/java/org/apache/maven/report/projectinfo/TeamReport.java b/src/main/java/org/apache/maven/report/projectinfo/TeamReport.java index df36d69..10e0823 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/TeamReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/TeamReport.java @@ -33,6 +33,7 @@ import org.apache.maven.model.Developer; import org.apache.maven.model.Model; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.reporting.MavenReportException; import org.codehaus.plexus.i18n.I18N; import org.codehaus.plexus.util.StringUtils; @@ -62,7 +63,7 @@ public class TeamReport extends AbstractProjectInfoReport { // ---------------------------------------------------------------------- @Override - public boolean canGenerateReport() { + public boolean canGenerateReport() throws MavenReportException { boolean result = super.canGenerateReport(); if (result && skipEmptyReport) { result = !isEmpty(getProject().getModel().getDevelopers()) @@ -233,7 +234,7 @@ public class TeamReport extends AbstractProjectInfoReport { if (id == null) { tableCell(null); } else { - tableCell("<a name=\"" + id + "\"></a>" + id, true); + tableCell("<a id=\"" + id + "\"></a>" + id, true); } } } diff --git a/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java b/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java index 4981acc..0b13eb9 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java +++ b/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java @@ -45,7 +45,6 @@ import org.apache.maven.artifact.Artifact; import org.apache.maven.doxia.sink.Sink; import org.apache.maven.doxia.sink.SinkEventAttributes; import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet; -import org.apache.maven.doxia.util.HtmlTools; import org.apache.maven.model.License; import org.apache.maven.plugin.logging.Log; import org.apache.maven.project.MavenProject; @@ -97,10 +96,6 @@ public class DependenciesRenderer extends AbstractProjectInfoRenderer { private final MessageFormat javaVersionFormat = new MessageFormat("{0,choice,0#|1.1#{0,number,0.0}|9#{0,number,0}}", Locale.ROOT); - /** - * @since 2.1.1 - */ - private int section; /** Counter for unique IDs that is consistent across generations. */ private int idCounter = 0; @@ -230,117 +225,6 @@ public class DependenciesRenderer extends AbstractProjectInfoRenderer { } } - // ---------------------------------------------------------------------- - // Protected methods - // ---------------------------------------------------------------------- - - /** {@inheritDoc} */ - // workaround for MPIR-140 - // TODO Remove me when MSHARED-390 has been resolved - @Override - protected void startSection(String name) { - startSection(name, name); - } - - /** - * Start section with a name and a specific anchor. - * - * @param anchor not null - * @param name not null - */ - // TODO Remove me when MSHARED-390 has been resolved - protected void startSection(String name, String anchor) { - section = section + 1; - - super.sink.anchor(HtmlTools.encodeId(anchor)); - super.sink.anchor_(); - - switch (section) { - case 1: - sink.section1(); - sink.sectionTitle1(); - break; - case 2: - sink.section2(); - sink.sectionTitle2(); - break; - case 3: - sink.section3(); - sink.sectionTitle3(); - break; - case 4: - sink.section4(); - sink.sectionTitle4(); - break; - case 5: - sink.section5(); - sink.sectionTitle5(); - break; - - default: - // TODO: warning - just don't start a section - break; - } - - text(name); - - switch (section) { - case 1: - sink.sectionTitle1_(); - break; - case 2: - sink.sectionTitle2_(); - break; - case 3: - sink.sectionTitle3_(); - break; - case 4: - sink.sectionTitle4_(); - break; - case 5: - sink.sectionTitle5_(); - break; - - default: - // TODO: warning - just don't start a section - break; - } - } - - /** {@inheritDoc} */ - // workaround for MPIR-140 - // TODO Remove me when MSHARED-390 has been resolved - @Override - protected void endSection() { - switch (section) { - case 1: - sink.section1_(); - break; - case 2: - sink.section2_(); - break; - case 3: - sink.section3_(); - break; - case 4: - sink.section4_(); - break; - case 5: - sink.section5_(); - break; - - default: - // TODO: warning - just don't start a section - break; - } - - section = section - 1; - - if (section < 0) { - throw new IllegalStateException("Too many closing sections"); - } - } - // ---------------------------------------------------------------------- // Private methods // ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/maven/report/projectinfo/AbstractProjectInfoTestCase.java b/src/test/java/org/apache/maven/report/projectinfo/AbstractProjectInfoTestCase.java index a7aa239..6b2f8ef 100644 --- a/src/test/java/org/apache/maven/report/projectinfo/AbstractProjectInfoTestCase.java +++ b/src/test/java/org/apache/maven/report/projectinfo/AbstractProjectInfoTestCase.java @@ -20,9 +20,16 @@ package org.apache.maven.report.projectinfo; import java.io.File; import java.io.IOException; -import java.util.Locale; +import java.util.Collections; +import java.util.List; +import com.meterware.httpunit.HttpUnitOptions; +import org.apache.maven.doxia.tools.SiteTool; +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; @@ -46,11 +53,6 @@ import org.eclipse.aether.repository.LocalRepository; public abstract class AbstractProjectInfoTestCase extends AbstractMojoTestCase { private ArtifactStubFactory artifactStubFactory; - /** - * The default locale is English. - */ - protected static final Locale DEFAULT_LOCALE = Locale.ENGLISH; - /** * The current project to be test. */ @@ -66,14 +68,13 @@ public abstract class AbstractProjectInfoTestCase extends AbstractMojoTestCase { // required for mojo lookups to work super.setUp(); + HttpUnitOptions.setScriptingEnabled(false); + i18n = getContainer().lookup(I18N.class); setVariableValueToObject(i18n, "defaultBundleName", "project-info-reports"); artifactStubFactory = new DependencyArtifactStubFactory(getTestFile("target"), true, false); artifactStubFactory.getWorkingDir().mkdirs(); - - // Set the default Locale - Locale.setDefault(DEFAULT_LOCALE); } @Override @@ -92,7 +93,7 @@ public abstract class AbstractProjectInfoTestCase extends AbstractMojoTestCase { throw new IllegalArgumentException("The key cannot be empty"); } - return i18n.getString(key, Locale.getDefault()).trim(); + return i18n.getString(key, SiteTool.DEFAULT_LOCALE).trim(); } /** @@ -168,9 +169,19 @@ public abstract class AbstractProjectInfoTestCase extends AbstractMojoTestCase { repoSession.setLocalRepositoryManager(new SimpleLocalRepositoryManagerFactory() .newInstance(repoSession, new LocalRepository(artifactStubFactory.getWorkingDir()))); + List<MavenProject> 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, "remoteRepositories", mojo.getProject().getRemoteArtifactRepositories()); setVariableValueToObject(mojo, "pluginRepositories", mojo.getProject().getPluginArtifactRepositories()); + setVariableValueToObject( + mojo, "siteDirectory", new File(mojo.getProject().getBasedir(), "src/site")); return mojo; } @@ -189,4 +200,22 @@ public abstract class AbstractProjectInfoTestCase extends AbstractMojoTestCase { return new File(outputDir, filename); } + + private MojoExecution getMockMojoExecution() { + MojoDescriptor md = new MojoDescriptor(); + md.setGoal(getGoal()); + + MojoExecution me = new MojoExecution(md); + + PluginDescriptor pd = new PluginDescriptor(); + Plugin p = new Plugin(); + p.setGroupId("org.apache.maven.plugins"); + p.setArtifactId("maven-project-info-reports-plugin"); + pd.setPlugin(p); + md.setPluginDescriptor(pd); + + return me; + } + + protected abstract String getGoal(); } diff --git a/src/test/java/org/apache/maven/report/projectinfo/CiManagementReportTest.java b/src/test/java/org/apache/maven/report/projectinfo/CiManagementReportTest.java index 6b6b4bf..95cb717 100644 --- a/src/test/java/org/apache/maven/report/projectinfo/CiManagementReportTest.java +++ b/src/test/java/org/apache/maven/report/projectinfo/CiManagementReportTest.java @@ -44,7 +44,7 @@ public class CiManagementReportTest extends AbstractProjectInfoTestCase { * @throws Exception if any */ public void testReport() throws Exception { - generateReport("ci-management", "ci-management-plugin-config.xml"); + generateReport(getGoal(), "ci-management-plugin-config.xml"); assertTrue( "Test html generated", getGeneratedReport("ci-management.html").exists()); @@ -65,8 +65,8 @@ public class CiManagementReportTest extends AbstractProjectInfoTestCase { // Test the texts TextBlock[] textBlocks = response.getTextBlocks(); - assertEquals(getString("report.ci-management.name"), textBlocks[0].getText()); - assertEquals(getString("report.ci-management.nocim"), textBlocks[1].getText()); + assertEquals(getString("report.ci-management.name"), textBlocks[1].getText()); + assertEquals(getString("report.ci-management.nocim"), textBlocks[2].getText()); } /** @@ -76,7 +76,7 @@ public class CiManagementReportTest extends AbstractProjectInfoTestCase { * @throws Exception if any */ public void testCiNameReport() throws Exception { - generateReport("ci-management", "ci-management-plugin-with-ci-section-config.xml"); + generateReport(getGoal(), "ci-management-plugin-with-ci-section-config.xml"); assertTrue( "Test html generated", getGeneratedReport("ci-management.html").exists()); @@ -93,11 +93,17 @@ public class CiManagementReportTest extends AbstractProjectInfoTestCase { // Test the texts TextBlock[] textBlocks = response.getTextBlocks(); - assertTrue(textBlocks[1].getText().startsWith("This project uses ")); - assertEquals(3, textBlocks[1].getNode().getChildNodes().getLength()); + TextBlock textBlock = textBlocks[2]; + assertTrue(textBlock.getText().startsWith("This project uses ")); + assertEquals(3, textBlock.getNode().getChildNodes().getLength()); HTMLAnchorElement anchor = - (HTMLAnchorElement) textBlocks[1].getNode().getChildNodes().item(1); + (HTMLAnchorElement) textBlock.getNode().getChildNodes().item(1); assertEquals("https://www.jetbrains.com/teamcity/", anchor.getAttribute("href")); assertEquals("TeamCity", anchor.getFirstChild().getNodeValue()); } + + @Override + protected String getGoal() { + return "ci-management"; + } } diff --git a/src/test/java/org/apache/maven/report/projectinfo/DependenciesReportTest.java b/src/test/java/org/apache/maven/report/projectinfo/DependenciesReportTest.java index 1a2f36e..742f6b5 100644 --- a/src/test/java/org/apache/maven/report/projectinfo/DependenciesReportTest.java +++ b/src/test/java/org/apache/maven/report/projectinfo/DependenciesReportTest.java @@ -44,7 +44,7 @@ public class DependenciesReportTest extends AbstractProjectInfoTestCase { * @throws Exception if any */ public void testReport() throws Exception { - generateReport("dependencies", "dependencies-plugin-config.xml"); + generateReport(getGoal(), "dependencies-plugin-config.xml"); assertTrue( "Test html generated", getGeneratedReport("dependencies.html").exists()); @@ -75,13 +75,18 @@ public class DependenciesReportTest extends AbstractProjectInfoTestCase { // Test the texts TextBlock[] textBlocks = response.getTextBlocks(); - assertEquals(getString("report.dependencies.title"), textBlocks[0].getText()); - assertEquals("test", textBlocks[1].getText()); - assertEquals(getString("report.dependencies.intro.test"), textBlocks[2].getText()); - assertEquals(getString("report.dependencies.transitive.title"), textBlocks[3].getText()); - assertEquals(getString("report.dependencies.transitive.nolist"), textBlocks[4].getText()); - assertEquals(getString("report.dependencies.graph.title"), textBlocks[5].getText()); - assertEquals(getString("report.dependencies.graph.tree.title"), textBlocks[6].getText()); - assertEquals(getString("report.dependencies.graph.tables.licenses"), textBlocks[7].getText()); + assertEquals(getString("report.dependencies.title"), textBlocks[1].getText()); + assertEquals("test", textBlocks[2].getText()); + assertEquals(getString("report.dependencies.intro.test"), textBlocks[3].getText()); + assertEquals(getString("report.dependencies.transitive.title"), textBlocks[4].getText()); + assertEquals(getString("report.dependencies.transitive.nolist"), textBlocks[5].getText()); + assertEquals(getString("report.dependencies.graph.title"), textBlocks[6].getText()); + assertEquals(getString("report.dependencies.graph.tree.title"), textBlocks[7].getText()); + assertEquals(getString("report.dependencies.graph.tables.licenses"), textBlocks[8].getText()); + } + + @Override + protected String getGoal() { + return "dependencies"; } } diff --git a/src/test/java/org/apache/maven/report/projectinfo/DependencyConvergenceReportTest.java b/src/test/java/org/apache/maven/report/projectinfo/DependencyConvergenceReportTest.java index c4df533..f8c7c33 100644 --- a/src/test/java/org/apache/maven/report/projectinfo/DependencyConvergenceReportTest.java +++ b/src/test/java/org/apache/maven/report/projectinfo/DependencyConvergenceReportTest.java @@ -43,7 +43,7 @@ public class DependencyConvergenceReportTest extends AbstractProjectInfoTestCase * @throws Exception if any */ public void testReport() throws Exception { - generateReport("dependency-convergence", "dependency-convergence-plugin-config.xml"); + generateReport(getGoal(), "dependency-convergence-plugin-config.xml"); assertTrue( "Test html generated", getGeneratedReport("dependency-convergence.html").exists()); @@ -67,6 +67,11 @@ public class DependencyConvergenceReportTest extends AbstractProjectInfoTestCase // Test the texts TextBlock[] textBlocks = response.getTextBlocks(); - assertEquals(getString("report.dependency-convergence.reactor.name"), textBlocks[0].getText()); + assertEquals(getString("report.dependency-convergence.reactor.name"), textBlocks[1].getText()); + } + + @Override + protected String getGoal() { + return "dependency-convergence"; } } diff --git a/src/test/java/org/apache/maven/report/projectinfo/DependencyManagementReportTest.java b/src/test/java/org/apache/maven/report/projectinfo/DependencyManagementReportTest.java index d3075aa..2a3bc62 100644 --- a/src/test/java/org/apache/maven/report/projectinfo/DependencyManagementReportTest.java +++ b/src/test/java/org/apache/maven/report/projectinfo/DependencyManagementReportTest.java @@ -44,7 +44,7 @@ public class DependencyManagementReportTest extends AbstractProjectInfoTestCase * @throws Exception if any */ public void testReport() throws Exception { - generateReport("dependency-management", "dependency-management-plugin-config.xml"); + generateReport(getGoal(), "dependency-management-plugin-config.xml"); assertTrue( "Test html generated", getGeneratedReport("dependency-management.html").exists()); @@ -80,7 +80,12 @@ public class DependencyManagementReportTest extends AbstractProjectInfoTestCase // Test the texts TextBlock[] textBlocks = response.getTextBlocks(); - assertEquals(getString("report.dependency-management.title"), textBlocks[0].getText()); - assertEquals("test", textBlocks[1].getText()); + assertEquals(getString("report.dependency-management.title"), textBlocks[1].getText()); + assertEquals("test", textBlocks[2].getText()); + } + + @Override + protected String getGoal() { + return "dependency-management"; } } diff --git a/src/test/java/org/apache/maven/report/projectinfo/IndexReportTest.java b/src/test/java/org/apache/maven/report/projectinfo/IndexReportTest.java index e7aee3a..09450c5 100644 --- a/src/test/java/org/apache/maven/report/projectinfo/IndexReportTest.java +++ b/src/test/java/org/apache/maven/report/projectinfo/IndexReportTest.java @@ -43,7 +43,7 @@ public class IndexReportTest extends AbstractProjectInfoTestCase { * @throws Exception if any */ public void testReport() throws Exception { - generateReport("index", "index-plugin-config.xml"); + generateReport(getGoal(), "index-plugin-config.xml"); assertTrue("Test html generated", getGeneratedReport("index.html").exists()); URL reportURL = getGeneratedReport("index.html").toURI().toURL(); @@ -65,7 +65,12 @@ public class IndexReportTest extends AbstractProjectInfoTestCase { // Test the texts TextBlock[] textBlocks = response.getTextBlocks(); assertEquals( - getString("report.index.title") + " " + getTestMavenProject().getName(), textBlocks[0].getText()); - assertEquals(getString("report.index.nodescription"), textBlocks[1].getText()); + getString("report.index.title") + " " + getTestMavenProject().getName(), textBlocks[1].getText()); + assertEquals(getString("report.index.nodescription"), textBlocks[2].getText()); + } + + @Override + protected String getGoal() { + return "index"; } } diff --git a/src/test/java/org/apache/maven/report/projectinfo/IssueManagementReportTest.java b/src/test/java/org/apache/maven/report/projectinfo/IssueManagementReportTest.java index abc506f..c968b5d 100644 --- a/src/test/java/org/apache/maven/report/projectinfo/IssueManagementReportTest.java +++ b/src/test/java/org/apache/maven/report/projectinfo/IssueManagementReportTest.java @@ -44,7 +44,7 @@ public class IssueManagementReportTest extends AbstractProjectInfoTestCase { * @throws Exception if any */ public void testReport() throws Exception { - generateReport("issue-management", "issue-management-plugin-config.xml"); + generateReport(getGoal(), "issue-management-plugin-config.xml"); assertTrue( "Test html generated", getGeneratedReport("issue-management.html").exists()); @@ -67,7 +67,7 @@ public class IssueManagementReportTest extends AbstractProjectInfoTestCase { // Test the links WebLink[] weblinks = response.getLinks(); - assertEquals(3, weblinks.length); + assertEquals(4, weblinks.length); assertEquals("JIRA", weblinks[1].getText()); @@ -75,8 +75,13 @@ public class IssueManagementReportTest extends AbstractProjectInfoTestCase { // Test the texts TextBlock[] textBlocks = response.getTextBlocks(); - assertEquals(getString("report.issue-management.overview.title"), textBlocks[0].getText()); - assertEquals("This project uses JIRA.", textBlocks[1].getText()); // due to link pattern - assertEquals(getString("report.issue-management.name"), textBlocks[2].getText()); + assertEquals(getString("report.issue-management.overview.title"), textBlocks[1].getText()); + assertEquals("This project uses JIRA.", textBlocks[2].getText()); // due to link pattern + assertEquals(getString("report.issue-management.name"), textBlocks[3].getText()); + } + + @Override + protected String getGoal() { + return "issue-management"; } } diff --git a/src/test/java/org/apache/maven/report/projectinfo/LicensesReportTest.java b/src/test/java/org/apache/maven/report/projectinfo/LicensesReportTest.java index b487eb1..cfdcbe8 100644 --- a/src/test/java/org/apache/maven/report/projectinfo/LicensesReportTest.java +++ b/src/test/java/org/apache/maven/report/projectinfo/LicensesReportTest.java @@ -44,7 +44,7 @@ public class LicensesReportTest extends AbstractProjectInfoTestCase { * @throws Exception if any */ public void testReport() throws Exception { - generateReport("licenses", "licenses-plugin-config.xml"); + generateReport(getGoal(), "licenses-plugin-config.xml"); assertTrue("Test html generated", getGeneratedReport("licenses.html").exists()); URL reportURL = getGeneratedReport("licenses.html").toURI().toURL(); @@ -64,19 +64,19 @@ public class LicensesReportTest extends AbstractProjectInfoTestCase { // Test the texts TextBlock[] textBlocks = response.getTextBlocks(); - assertEquals(getString("report.licenses.overview.title"), textBlocks[0].getText()); - assertEquals(getString("report.licenses.overview.intro"), textBlocks[1].getText()); - assertEquals(getString("report.licenses.title"), textBlocks[2].getText()); - assertEquals("The Apache Software License, Version 2.0", textBlocks[3].getText()); + assertEquals(getString("report.licenses.overview.title"), textBlocks[1].getText()); + assertEquals(getString("report.licenses.overview.intro"), textBlocks[2].getText()); + assertEquals(getString("report.licenses.title"), textBlocks[3].getText()); + assertEquals("The Apache Software License, Version 2.0", textBlocks[4].getText()); // only 1 link in default report final WebLink[] links = response.getLinks(); - assertEquals(1, links.length); - assertEquals("http://maven.apache.org/", links[0].getURLString()); + assertEquals(2, links.length); + assertEquals("https://maven.apache.org/", links[1].getURLString()); } public void testReportLinksOnly() throws Exception { - generateReport("licenses", "licenses-plugin-config-linkonly.xml"); + generateReport(getGoal(), "licenses-plugin-config-linkonly.xml"); assertTrue("Test html generated", getGeneratedReport("licenses.html").exists()); URL reportURL = getGeneratedReport("licenses.html").toURI().toURL(); @@ -96,16 +96,21 @@ public class LicensesReportTest extends AbstractProjectInfoTestCase { // Test the texts TextBlock[] textBlocks = response.getTextBlocks(); - assertEquals(getString("report.licenses.overview.title"), textBlocks[0].getText()); - assertEquals(getString("report.licenses.overview.intro"), textBlocks[1].getText()); - assertEquals(getString("report.licenses.title"), textBlocks[2].getText()); - assertEquals("The Apache Software License, Version 2.0", textBlocks[3].getText()); + assertEquals(getString("report.licenses.overview.title"), textBlocks[1].getText()); + assertEquals(getString("report.licenses.overview.intro"), textBlocks[2].getText()); + assertEquals(getString("report.licenses.title"), textBlocks[3].getText()); + assertEquals("The Apache Software License, Version 2.0", textBlocks[4].getText()); // here's our specific test final WebLink[] links = response.getLinks(); - assertEquals(2, links.length); - assertEquals("http://maven.apache.org/", links[0].getURLString()); + assertEquals(3, links.length); + assertEquals("http://maven.apache.org", links[0].getURLString()); assertEquals("https://www.apache.org/licenses/LICENSE-2.0.txt", links[1].getURLString()); assertEquals("https://www.apache.org/licenses/LICENSE-2.0.txt", links[1].getText()); } + + @Override + protected String getGoal() { + return "licenses"; + } } diff --git a/src/test/java/org/apache/maven/report/projectinfo/MailingListsReportTest.java b/src/test/java/org/apache/maven/report/projectinfo/MailingListsReportTest.java index 9bb86b7..61a63e5 100644 --- a/src/test/java/org/apache/maven/report/projectinfo/MailingListsReportTest.java +++ b/src/test/java/org/apache/maven/report/projectinfo/MailingListsReportTest.java @@ -19,7 +19,6 @@ package org.apache.maven.report.projectinfo; import java.net.URL; -import java.util.Locale; import com.meterware.httpunit.GetMethodWebRequest; import com.meterware.httpunit.TextBlock; @@ -45,7 +44,7 @@ public class MailingListsReportTest extends AbstractProjectInfoTestCase { * @throws Exception if any */ public void testReport() throws Exception { - generateReport("mailing-lists", "mailing-lists-plugin-config.xml"); + generateReport(getGoal(), "mailing-lists-plugin-config.xml"); assertTrue( "Test html generated", getGeneratedReport("mailing-lists.html").exists()); @@ -66,8 +65,8 @@ public class MailingListsReportTest extends AbstractProjectInfoTestCase { // Test the texts TextBlock[] textBlocks = response.getTextBlocks(); - assertEquals(getString("report.mailing-lists.title"), textBlocks[0].getText()); - assertEquals(getString("report.mailing-lists.intro"), textBlocks[1].getText()); + assertEquals(getString("report.mailing-lists.title"), textBlocks[1].getText()); + assertEquals(getString("report.mailing-lists.intro"), textBlocks[2].getText()); // MPIR-385 + MPIR-401: Test links are URIs otherwise assume a plain email address String post = getString("report.mailing-lists.column.post"); @@ -107,8 +106,8 @@ public class MailingListsReportTest extends AbstractProjectInfoTestCase { // Test the texts TextBlock[] textBlocks = response.getTextBlocks(); - assertEquals(getString("report.mailing-lists.title"), textBlocks[0].getText()); - assertEquals("mail list intro text foo", textBlocks[1].getText()); + assertEquals(getString("report.mailing-lists.title"), textBlocks[1].getText()); + assertEquals("mail list intro text foo", textBlocks[2].getText()); } /** @@ -117,18 +116,9 @@ public class MailingListsReportTest extends AbstractProjectInfoTestCase { * @throws Exception if any */ public void testFrenchReport() throws Exception { - Locale oldLocale = Locale.getDefault(); - - try { - Locale.setDefault(Locale.FRENCH); - - generateReport("mailing-lists", "mailing-lists-plugin-config.xml"); - assertTrue( - "Test html generated", - getGeneratedReport("mailing-lists.html").exists()); - } finally { - Locale.setDefault(oldLocale); - } + generateReport(getGoal(), "mailing-lists-plugin-config-fr.xml"); + assertTrue( + "Test html generated", getGeneratedReport("mailing-lists.html").exists()); } /** @@ -137,8 +127,13 @@ public class MailingListsReportTest extends AbstractProjectInfoTestCase { * @throws Exception if any */ public void testInvalidLink() throws Exception { - generateReport("mailing-lists", "mailing-lists-plugin-config-invalidlink.xml"); + generateReport(getGoal(), "mailing-lists-plugin-config-invalidlink.xml"); assertTrue( "Test html generated", getGeneratedReport("mailing-lists.html").exists()); } + + @Override + protected String getGoal() { + return "mailing-lists"; + } } diff --git a/src/test/java/org/apache/maven/report/projectinfo/ModulesReportTest.java b/src/test/java/org/apache/maven/report/projectinfo/ModulesReportTest.java index 79a3b4a..5bf70cd 100644 --- a/src/test/java/org/apache/maven/report/projectinfo/ModulesReportTest.java +++ b/src/test/java/org/apache/maven/report/projectinfo/ModulesReportTest.java @@ -58,7 +58,7 @@ public class ModulesReportTest extends AbstractProjectInfoTestCase { * @throws Exception if any */ public void testReport() throws Exception { - generateReport("modules", "modules-plugin-config.xml"); + generateReport(getGoal(), "modules-plugin-config.xml"); assertTrue("Test html generated", getGeneratedReport("modules.html").exists()); URL reportURL = getGeneratedReport("modules.html").toURI().toURL(); @@ -78,9 +78,10 @@ public class ModulesReportTest extends AbstractProjectInfoTestCase { // Test the texts TextBlock[] textBlocks = response.getTextBlocks(); - assertEquals(2, textBlocks.length); - assertEquals(getString("report.modules.title"), textBlocks[0].getText()); - assertEquals(getString("report.modules.intro"), textBlocks[1].getText()); + // Last one is footer noise + assertEquals(4, textBlocks.length - 1); + assertEquals(getString("report.modules.title"), textBlocks[1].getText()); + assertEquals(getString("report.modules.intro"), textBlocks[2].getText()); String[][] cellTexts = response.getTables()[0].asText(); assertEquals(3, cellTexts.length); @@ -101,7 +102,7 @@ public class ModulesReportTest extends AbstractProjectInfoTestCase { public void testReportModuleLinksVariableSettingsInterpolated() throws Exception { String pluginXml = "modules-variable-settings-interpolated-plugin-config.xml"; File pluginXmlFile = new File(getBasedir(), "src/test/resources/plugin-configs/" + pluginXml); - AbstractProjectInfoReport mojo = createReportMojo("modules", pluginXmlFile); + AbstractProjectInfoReport mojo = createReportMojo(getGoal(), pluginXmlFile); class SubProjectStub extends SubProject1Stub { @Override @@ -124,4 +125,9 @@ public class ModulesReportTest extends AbstractProjectInfoTestCase { "Variable 'sitePublishLocation' should be interpolated", FileUtils.readFileToString(getGeneratedReport("modules.html")).contains("sitePublishLocation")); } + + @Override + protected String getGoal() { + return "modules"; + } } diff --git a/src/test/java/org/apache/maven/report/projectinfo/PluginManagementReportTest.java b/src/test/java/org/apache/maven/report/projectinfo/PluginManagementReportTest.java index 4fa7704..eae4984 100644 --- a/src/test/java/org/apache/maven/report/projectinfo/PluginManagementReportTest.java +++ b/src/test/java/org/apache/maven/report/projectinfo/PluginManagementReportTest.java @@ -74,7 +74,7 @@ public class PluginManagementReportTest extends AbstractProjectInfoTestCase { * @throws Exception if any */ public void testReport() throws Exception { - generateReport("plugin-management", "plugin-management-plugin-config.xml"); + generateReport(getGoal(), "plugin-management-plugin-config.xml"); assertTrue( "Test html generated", getGeneratedReport("plugin-management.html").exists()); @@ -104,7 +104,7 @@ public class PluginManagementReportTest extends AbstractProjectInfoTestCase { // Test the texts TextBlock[] textBlocks = response.getTextBlocks(); - assertEquals(getString("report.plugin-management.title"), textBlocks[0].getText()); + assertEquals(getString("report.plugin-management.title"), textBlocks[1].getText()); } /** @@ -113,7 +113,7 @@ public class PluginManagementReportTest extends AbstractProjectInfoTestCase { * @throws Exception if any */ public void testReportEclipseM2EPluginLifecycleMapping() throws Exception { - generateReport("plugin-management", "plugin-management-plugin-config-MPIR-375.xml"); + generateReport(getGoal(), "plugin-management-plugin-config-MPIR-375.xml"); assertTrue( "Test html generated", getGeneratedReport("plugin-management.html").exists()); @@ -149,7 +149,7 @@ public class PluginManagementReportTest extends AbstractProjectInfoTestCase { // Test the texts TextBlock[] textBlocks = response.getTextBlocks(); - assertEquals(getString("report.plugin-management.title"), textBlocks[0].getText()); + assertEquals(getString("report.plugin-management.title"), textBlocks[1].getText()); } private static ProjectBuildingResult createProjectBuildingResult(Artifact artifact, String url) { @@ -164,4 +164,9 @@ public class PluginManagementReportTest extends AbstractProjectInfoTestCase { return result; } + + @Override + protected String getGoal() { + return "plugin-management"; + } } diff --git a/src/test/java/org/apache/maven/report/projectinfo/ScmReportTest.java b/src/test/java/org/apache/maven/report/projectinfo/ScmReportTest.java index 3570b1e..95b9884 100644 --- a/src/test/java/org/apache/maven/report/projectinfo/ScmReportTest.java +++ b/src/test/java/org/apache/maven/report/projectinfo/ScmReportTest.java @@ -45,7 +45,7 @@ public class ScmReportTest extends AbstractProjectInfoTestCase { * @throws Exception if any */ public void testReport() throws Exception { - generateReport("scm", "scm-plugin-config.xml"); + generateReport(getGoal(), "scm-plugin-config.xml"); assertTrue("Test html generated", getGeneratedReport("scm.html").exists()); URL reportURL = getGeneratedReport("scm.html").toURI().toURL(); @@ -65,13 +65,14 @@ public class ScmReportTest extends AbstractProjectInfoTestCase { // Test the texts TextBlock[] textBlocks = response.getTextBlocks(); - assertEquals(6, textBlocks.length); - assertEquals(getString("report.scm.overview.title"), textBlocks[0].getText()); - assertEquals(getString("report.scm.general.intro"), textBlocks[1].getText()); - assertEquals(getString("report.scm.webaccess.title"), textBlocks[2].getText()); - assertEquals(getString("report.scm.webaccess.nourl"), textBlocks[3].getText()); - assertEquals(getString("report.scm.accessbehindfirewall.title"), textBlocks[4].getText()); - assertEquals(getString("report.scm.accessbehindfirewall.general.intro"), textBlocks[5].getText()); + // Last one is footer noise + assertEquals(8, textBlocks.length - 1); + assertEquals(getString("report.scm.overview.title"), textBlocks[1].getText()); + assertEquals(getString("report.scm.general.intro"), textBlocks[2].getText()); + assertEquals(getString("report.scm.webaccess.title"), textBlocks[3].getText()); + assertEquals(getString("report.scm.webaccess.nourl"), textBlocks[4].getText()); + assertEquals(getString("report.scm.accessbehindfirewall.title"), textBlocks[5].getText()); + assertEquals(getString("report.scm.accessbehindfirewall.general.intro"), textBlocks[6].getText()); } /** @@ -82,7 +83,7 @@ public class ScmReportTest extends AbstractProjectInfoTestCase { public void testReportWithWrongUrl() throws Exception { File pluginXmlFile = new File(getBasedir(), "src/test/resources/plugin-configs/" + "scm-wrong-url-plugin-config.xml"); - Mojo mojo = createReportMojo("scm", pluginXmlFile); + Mojo mojo = createReportMojo(getGoal(), pluginXmlFile); setVariableValueToObject(mojo, "anonymousConnection", "scm:svn"); try { @@ -118,4 +119,9 @@ public class ScmReportTest extends AbstractProjectInfoTestCase { assertTrue("IllegalArgumentException catched", true); } } + + @Override + protected String getGoal() { + return "scm"; + } } diff --git a/src/test/java/org/apache/maven/report/projectinfo/SummaryReportTest.java b/src/test/java/org/apache/maven/report/projectinfo/SummaryReportTest.java index 878025c..56c6ad7 100644 --- a/src/test/java/org/apache/maven/report/projectinfo/SummaryReportTest.java +++ b/src/test/java/org/apache/maven/report/projectinfo/SummaryReportTest.java @@ -43,7 +43,7 @@ public class SummaryReportTest extends AbstractProjectInfoTestCase { * @throws Exception if any */ public void testReport() throws Exception { - generateReport("summary", "summary-plugin-config.xml"); + generateReport(getGoal(), "summary-plugin-config.xml"); assertTrue("Test html generated", getGeneratedReport("summary.html").exists()); URL reportURL = getGeneratedReport("summary.html").toURI().toURL(); @@ -64,10 +64,15 @@ public class SummaryReportTest extends AbstractProjectInfoTestCase { // Test the texts TextBlock[] textBlocks = response.getTextBlocks(); - assertEquals(getString("report.summary.title"), textBlocks[0].getText()); - assertEquals(getString("report.summary.general.title"), textBlocks[1].getText()); - assertEquals(getString("report.summary.organization.title"), textBlocks[2].getText()); - assertEquals(getString("report.summary.noorganization"), textBlocks[3].getText()); - assertEquals(getString("report.summary.build.title"), textBlocks[4].getText()); + assertEquals(getString("report.summary.title"), textBlocks[1].getText()); + assertEquals(getString("report.summary.general.title"), textBlocks[2].getText()); + assertEquals(getString("report.summary.organization.title"), textBlocks[3].getText()); + assertEquals(getString("report.summary.noorganization"), textBlocks[4].getText()); + assertEquals(getString("report.summary.build.title"), textBlocks[5].getText()); + } + + @Override + protected String getGoal() { + return "summary"; } } diff --git a/src/test/java/org/apache/maven/report/projectinfo/TeamReportTest.java b/src/test/java/org/apache/maven/report/projectinfo/TeamReportTest.java index e0b2c2a..e9d9340 100644 --- a/src/test/java/org/apache/maven/report/projectinfo/TeamReportTest.java +++ b/src/test/java/org/apache/maven/report/projectinfo/TeamReportTest.java @@ -48,7 +48,7 @@ public class TeamReportTest extends AbstractProjectInfoTestCase { */ public void testReport() throws Exception { File pluginXmlFile = new File(getBasedir(), "src/test/resources/plugin-configs/" + "team-plugin-config.xml"); - AbstractProjectInfoReport mojo = createReportMojo("team", pluginXmlFile); + AbstractProjectInfoReport mojo = createReportMojo(getGoal(), pluginXmlFile); setVariableValueToObject(mojo, "showAvatarImages", Boolean.TRUE); generateReport(mojo, pluginXmlFile); assertTrue("Test html generated", getGeneratedReport("team.html").exists()); @@ -72,14 +72,15 @@ public class TeamReportTest extends AbstractProjectInfoTestCase { // Test the texts TextBlock[] textBlocks = response.getTextBlocks(); - assertEquals(7, textBlocks.length); - assertEquals(getString("report.team.intro.title"), textBlocks[0].getText()); - assertEquals(getString("report.team.intro.description1"), textBlocks[1].getText()); - assertEquals(getString("report.team.intro.description2"), textBlocks[2].getText()); - assertEquals(getString("report.team.developers.title"), textBlocks[3].getText()); - assertEquals(getString("report.team.developers.intro"), textBlocks[4].getText()); - assertEquals(getString("report.team.contributors.title"), textBlocks[5].getText()); - assertEquals(getString("report.team.nocontributor"), textBlocks[6].getText()); + // Last one is footer noise + assertEquals(9, textBlocks.length - 1); + assertEquals(getString("report.team.intro.title"), textBlocks[1].getText()); + assertEquals(getString("report.team.intro.description1"), textBlocks[2].getText()); + assertEquals(getString("report.team.intro.description2"), textBlocks[3].getText()); + assertEquals(getString("report.team.developers.title"), textBlocks[4].getText()); + assertEquals(getString("report.team.developers.intro"), textBlocks[5].getText()); + assertEquals(getString("report.team.contributors.title"), textBlocks[6].getText()); + assertEquals(getString("report.team.nocontributor"), textBlocks[7].getText()); WebTable[] tables = response.getTables(); assertEquals(1, tables.length); @@ -89,4 +90,9 @@ public class TeamReportTest extends AbstractProjectInfoTestCase { assertEquals(1, links.length); assertEquals("mailto:vsive...@apache.org", links[0].getURLString()); } + + @Override + protected String getGoal() { + return "team"; + } } diff --git a/src/test/java/org/apache/maven/report/projectinfo/stubs/ProjectInfoProjectStub.java b/src/test/java/org/apache/maven/report/projectinfo/stubs/ProjectInfoProjectStub.java index 14b4006..5df9241 100644 --- a/src/test/java/org/apache/maven/report/projectinfo/stubs/ProjectInfoProjectStub.java +++ b/src/test/java/org/apache/maven/report/projectinfo/stubs/ProjectInfoProjectStub.java @@ -25,6 +25,7 @@ import java.util.List; import java.util.Objects; import java.util.Set; +import org.apache.maven.RepositoryUtils; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.DefaultArtifact; import org.apache.maven.artifact.handler.DefaultArtifactHandler; @@ -42,6 +43,7 @@ import org.apache.maven.plugin.testing.stubs.MavenProjectStub; import org.apache.maven.shared.utils.io.IOUtil; import org.codehaus.plexus.util.ReaderFactory; import org.codehaus.plexus.util.xml.XmlStreamReader; +import org.eclipse.aether.repository.RemoteRepository; /** * @author Edwin Punzalan @@ -150,6 +152,11 @@ public abstract class ProjectInfoProjectStub extends MavenProjectStub { return Collections.singletonList(repository); } + @Override + public List<RemoteRepository> getRemoteProjectRepositories() { + return RepositoryUtils.toRepos(getRemoteArtifactRepositories()); + } + @Override public Set<Artifact> getDependencyArtifacts() { Artifact artifact = new DefaultArtifact( diff --git a/src/test/resources/plugin-configs/mailing-lists-plugin-config-fr.xml b/src/test/resources/plugin-configs/mailing-lists-plugin-config-fr.xml new file mode 100644 index 0000000..c50e7eb --- /dev/null +++ b/src/test/resources/plugin-configs/mailing-lists-plugin-config-fr.xml @@ -0,0 +1,62 @@ +<!-- +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. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.maven.plugin.projectinfo.tests</groupId> + <artifactId>mailing-lists</artifactId> + <version>1.0-SNAPSHOT</version> + <packaging>jar</packaging> + <name>mailing lists project info</name> + <url>http://maven.apache.org</url> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + </dependencies> + <mailingLists> + <mailingList> + <name>Test List</name> + <post>t...@maven.apache.org</post> + <subscribe>MAILTO:test-subscr...@maven.apache.org</subscribe> + </mailingList> + <mailingList> + <name>Test List 2</name> + <post>te...@maven.apache.org</post> + <subscribe>MAILTO:test-subscri...@maven.apache.org</subscribe> + <unsubscribe>https://example.com/unsubscribe</unsubscribe> + </mailingList> + </mailingLists> + <build> + <plugins> + <plugin> + <artifactId>maven-project-info-reports-plugin</artifactId> + <configuration> + <outputDirectory>target/test-harness/mailing-lists</outputDirectory> + <localRepository>${localRepository}</localRepository> + <locale>fr</locale> + <project implementation="org.apache.maven.report.projectinfo.stubs.MailingListsStub"/> + </configuration> + </plugin> + </plugins> + </build> +</project>