From 60126b1482e6bff58458815fc0b7a7eccd36e64b Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Sat, 2 Jul 2022 23:58:47 +0200 Subject: [PATCH] Prepare for Doxia 2.0.0 --- pom.xml | 58 ++------ .../verify.groovy | 28 ++-- src/it/full-pom/pom.xml | 2 +- src/it/minimal-pom/pom.xml | 2 +- src/it/multi-module/pom.xml | 5 +- src/it/multi-module/verify.groovy | 4 +- .../AbstractProjectInfoReport.java | 14 +- .../renderer/DependenciesRenderer.java | 126 +----------------- .../AbstractProjectInfoTestCase.java | 22 +-- .../projectinfo/CiManagementReportTest.java | 13 +- .../DependencyConvergenceReportTest.java | 2 +- .../DependencyManagementReportTest.java | 4 +- .../report/projectinfo/IndexReportTest.java | 4 +- .../IssueManagementReportTest.java | 8 +- .../projectinfo/LicensesReportTest.java | 24 ++-- .../projectinfo/MailingListsReportTest.java | 20 +-- .../report/projectinfo/ModulesReportTest.java | 7 +- .../PluginManagementReportTest.java | 4 +- .../report/projectinfo/ScmReportTest.java | 15 ++- .../report/projectinfo/SummaryReportTest.java | 10 +- .../report/projectinfo/TeamReportTest.java | 17 +-- .../ci-management-plugin-config.xml | 3 +- ...nagement-plugin-with-ci-section-config.xml | 3 +- .../dependency-convergence-plugin-config.xml | 3 +- .../dependency-management-plugin-config.xml | 1 + .../plugin-configs/index-plugin-config.xml | 3 +- .../issue-management-plugin-config.xml | 3 +- .../licenses-plugin-config-linkonly.xml | 3 +- .../plugin-configs/licenses-plugin-config.xml | 3 +- .../mailing-lists-plugin-config-fr.xml | 62 +++++++++ ...ailing-lists-plugin-config-invalidlink.xml | 1 + .../mailing-lists-plugin-config.xml | 1 + .../plugin-configs/modules-plugin-config.xml | 6 +- ...le-settings-interpolated-plugin-config.xml | 8 +- ...ugin-management-plugin-config-MPIR-375.xml | 6 +- .../plugin-management-plugin-config.xml | 2 +- .../plugin-configs/scm-plugin-config.xml | 3 +- .../scm-wrong-url-plugin-config.xml | 3 +- .../plugin-configs/summary-plugin-config.xml | 3 +- .../plugin-configs/team-plugin-config.xml | 3 +- 40 files changed, 198 insertions(+), 311 deletions(-) create mode 100644 src/test/resources/plugin-configs/mailing-lists-plugin-config-fr.xml diff --git a/pom.xml b/pom.xml index c6119626..c77cd1b5 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ under the License. maven-project-info-reports-plugin - 3.4.3-SNAPSHOT + 4.0.0-M1-SNAPSHOT maven-plugin Apache Maven Project Info Reports Plugin @@ -119,14 +119,14 @@ under the License. 8 - 1.11.1 - 1.11.1 + 2.0.0-M5 + 2.0.0-M5 3.2.5 1.13.0 1.0.0.v20140518 - 3.12.1 - 1.11.1 - 2.22.2 + 4.0.0-M5 + 2.0.0-M2 + 3.0.0-M8 ParameterNumber,MethodLength 2023-01-06T21:01:13Z @@ -135,12 +135,12 @@ under the License. org.apache.maven.reporting maven-reporting-api - 3.1.1 + 4.0.0-M4 org.apache.maven.reporting maven-reporting-impl - 3.2.0 + 4.0.0-M4 org.apache.maven @@ -326,56 +326,18 @@ under the License. org.apache.maven.doxia doxia-sink-api ${doxiaVersion} - - - org.codehaus.plexus - plexus-container-default - - org.apache.maven.doxia doxia-core ${doxiaVersion} - - - org.codehaus.plexus - plexus-container-default - - - - org.apache.maven.doxia - doxia-decoration-model - ${doxia-sitetoolsVersion} - - - org.apache.maven.doxia - doxia-site-renderer - ${doxia-sitetoolsVersion} - - - org.codehaus.plexus - plexus-container-default - - - org.codehaus.plexus - plexus-component-api - - - org.apache.maven.doxia doxia-integration-tools - ${doxia-sitetoolsVersion} - - - org.codehaus.plexus - plexus-container-default - - + ${doxiaSitetoolsVersion} @@ -393,7 +355,7 @@ under the License. org.codehaus.plexus plexus-utils - 3.4.2 + 3.5.0 org.codehaus.plexus 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 2edcd4e6..2a344fe9 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 = '''\ -maven-model-3.3.9.jar -164 kB -71 -54 -3 -1.7 -Yes +maven-model-3.3.9.jar +164 kB +71 +54 +3 +1.7 +Yes ''' def jacksonDataTypeJsr310 = '''\ -jackson-datatype-jsr310-2.6.4.jar -78.1 kB -69 -51 -5 -1.8 -Yes +jackson-datatype-jsr310-2.6.4.jar +78.1 kB +69 +51 +5 +1.8 +Yes ''' 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 c6e92f39..ff4ef622 100644 --- a/src/it/full-pom/pom.xml +++ b/src/it/full-pom/pom.xml @@ -174,7 +174,7 @@ maven-site-plugin @sitePluginVersion@ - 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 + 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 diff --git a/src/it/minimal-pom/pom.xml b/src/it/minimal-pom/pom.xml index a2c013b7..0c928146 100644 --- a/src/it/minimal-pom/pom.xml +++ b/src/it/minimal-pom/pom.xml @@ -44,7 +44,7 @@ maven-site-plugin @sitePluginVersion@ - en,cs,de,es,fr,hu,it,ja,ko,nl,no,pl,pt,pt_BR,sk,sv,tr,zh_CN,zh_TW + default,en,cs,de,es,fr,hu,it,ja,ko,nl,no,pl,pt,pt_BR,sk,sv,tr,zh_CN,zh_TW diff --git a/src/it/multi-module/pom.xml b/src/it/multi-module/pom.xml index 60cd695d..cccb3d06 100644 --- a/src/it/multi-module/pom.xml +++ b/src/it/multi-module/pom.xml @@ -26,7 +26,7 @@ org.apache apache - 16 + 28 org.apache.maven.plugins.project-info-reports.its @@ -79,9 +79,6 @@ org.apache.maven.plugins maven-site-plugin @sitePluginVersion@ - - en - diff --git a/src/it/multi-module/verify.groovy b/src/it/multi-module/verify.groovy index 7fdfb6b9..afc2cb45 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( 'dep/target/classes' ) -assert mainDependencies.text.contains( 'dep-1.0-SNAPSHOT.jar' ) +assert !mainDependencies.text.contains( 'dep/target/classes' ) +assert mainDependencies.text.contains( 'dep-1.0-SNAPSHOT.jar' ) 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 4d6f9c99..4a38938c 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/AbstractProjectInfoReport.java +++ b/src/main/java/org/apache/maven/report/projectinfo/AbstractProjectInfoReport.java @@ -102,14 +102,6 @@ public abstract class AbstractProjectInfoReport @Parameter( property = "project.pluginArtifactRepositories" ) protected List pluginRepositories; - /** - * The reactor projects. - * - * @since 2.10 - */ - @Parameter( defaultValue = "${reactorProjects}", required = true, readonly = true ) - protected List reactorProjects; - /** * The current user system settings for use in Maven. * @@ -226,11 +218,6 @@ protected MavenSession getSession() return session; } - /** - * Reactor projects - * - * @return List of projects - */ protected List getReactorProjects() { return reactorProjects; @@ -329,6 +316,7 @@ public String getDescription( Locale locale ) return getI18nString( locale, "description" ); } + // TODO Review, especially Locale.getDefault() private static class CustomI18N implements I18N { 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 02f848aa..7ebcdc70 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 @@ -43,7 +43,6 @@ 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; @@ -96,11 +95,6 @@ public class DependenciesRenderer /** Used to format file length values */ private final DecimalFormat fileLengthDecimalFormat; - /** - * @since 2.1.1 - */ - private int section; - /** Counter for unique IDs that is consistent across generations. */ private int idCounter = 0; @@ -236,124 +230,6 @@ public void renderBody() } } - // ---------------------------------------------------------------------- - // 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 anchor, String name ) - { - 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 // ---------------------------------------------------------------------- @@ -742,7 +618,7 @@ private void renderDependenciesForScope( String scope, List artifacts, String anchorByScope = ( isTransitive ? getI18nString( "transitive.title" ) + "_" + scope : getI18nString( "title" ) + "_" + scope ); - startSection( anchorByScope, scope ); + startSection( scope, anchorByScope ); paragraph( getI18nString( "intro." + scope ) ); 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 4ae02cad..85a3452b 100644 --- a/src/test/java/org/apache/maven/report/projectinfo/AbstractProjectInfoTestCase.java +++ b/src/test/java/org/apache/maven/report/projectinfo/AbstractProjectInfoTestCase.java @@ -21,8 +21,10 @@ import java.io.File; import java.io.IOException; -import java.util.Locale; +import java.util.Collections; +import java.util.List; +import org.apache.maven.doxia.tools.SiteTool; import org.apache.maven.plugin.LegacySupport; import org.apache.maven.plugin.testing.AbstractMojoTestCase; import org.apache.maven.plugin.testing.ArtifactStubFactory; @@ -38,6 +40,8 @@ import org.eclipse.aether.DefaultRepositorySystemSession; import org.eclipse.aether.repository.LocalRepository; +import com.meterware.httpunit.HttpUnitOptions; + /** * Abstract class to test reports generation with HTTPUnit framework. * @@ -50,11 +54,6 @@ public abstract class AbstractProjectInfoTestCase { private ArtifactStubFactory artifactStubFactory; - /** - * The default locale is English. - */ - protected static final Locale DEFAULT_LOCALE = Locale.ENGLISH; - /** * The current project to be test. */ @@ -72,14 +71,13 @@ protected void setUp() // 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 @@ -102,7 +100,7 @@ protected String getString( String key ) throw new IllegalArgumentException( "The key cannot be empty" ); } - return i18n.getString( key, Locale.getDefault() ).trim(); + return i18n.getString( key, SiteTool.DEFAULT_LOCALE ).trim(); } /** @@ -187,9 +185,13 @@ protected AbstractProjectInfoReport createReportMojo( String goal, File pluginXm (DefaultRepositorySystemSession) legacySupport.getRepositorySession(); repoSession.setLocalRepositoryManager( new SimpleLocalRepositoryManagerFactory().newInstance( repoSession, new LocalRepository( artifactStubFactory.getWorkingDir() ) ) ); + List reactorProjects = mojo.getReactorProjects() != null ? mojo.getReactorProjects() : Collections.emptyList(); + setVariableValueToObject( mojo, "session", legacySupport.getSession() ); + setVariableValueToObject( mojo, "reactorProjects", reactorProjects ); setVariableValueToObject( mojo, "remoteRepositories", mojo.getProject().getRemoteArtifactRepositories() ); setVariableValueToObject( mojo, "pluginRepositories", mojo.getProject().getPluginArtifactRepositories() ); + setVariableValueToObject( mojo, "siteDirectory", new File( mojo.getProject().getBasedir(), "src/site" ) ); return mojo; } 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 027c328c..2acf6a53 100644 --- a/src/test/java/org/apache/maven/report/projectinfo/CiManagementReportTest.java +++ b/src/test/java/org/apache/maven/report/projectinfo/CiManagementReportTest.java @@ -69,9 +69,9 @@ public void testReport() assertEquals( expectedTitle, response.getTitle() ); // 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() ); + TextBlock[] textBlocks = response. getTextBlocks(); + assertEquals( getString( "report.ci-management.name" ), textBlocks[1].getText() ); + assertEquals( getString( "report.ci-management.nocim" ), textBlocks[2].getText() ); } /** @@ -99,9 +99,10 @@ public void testCiNameReport() // Test the texts TextBlock[] textBlocks = response.getTextBlocks(); - assertTrue( textBlocks[1].getText().startsWith( "This project uses " ) ); - assertEquals(3, textBlocks[1].getNode().getChildNodes().getLength()); - HTMLAnchorElement anchor = (HTMLAnchorElement) textBlocks[1].getNode().getChildNodes().item( 1 ); + TextBlock textBlock = textBlocks[2]; + assertTrue( textBlock.getText().startsWith( "This project uses " ) ); + assertEquals(3, textBlock.getNode().getChildNodes().getLength()); + HTMLAnchorElement anchor = (HTMLAnchorElement) textBlock.getNode().getChildNodes().item( 1 ); assertEquals( "https://www.jetbrains.com/teamcity/", anchor.getAttribute( "href" ) ); assertEquals( "TeamCity", anchor.getFirstChild().getNodeValue() ); } 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 91768f24..d10f836e 100644 --- a/src/test/java/org/apache/maven/report/projectinfo/DependencyConvergenceReportTest.java +++ b/src/test/java/org/apache/maven/report/projectinfo/DependencyConvergenceReportTest.java @@ -69,6 +69,6 @@ public void testReport() // 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() ); } } 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 143cb2d1..ea86af27 100644 --- a/src/test/java/org/apache/maven/report/projectinfo/DependencyManagementReportTest.java +++ b/src/test/java/org/apache/maven/report/projectinfo/DependencyManagementReportTest.java @@ -78,7 +78,7 @@ public void testReport() // 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() ); } } 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 ccd6e377..cd6897e6 100644 --- a/src/test/java/org/apache/maven/report/projectinfo/IndexReportTest.java +++ b/src/test/java/org/apache/maven/report/projectinfo/IndexReportTest.java @@ -71,7 +71,7 @@ public void testReport() // 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() ); + textBlocks[1].getText() ); + assertEquals( getString( "report.index.nodescription" ), textBlocks[2].getText() ); } } 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 0f235bfe..414b96b8 100644 --- a/src/test/java/org/apache/maven/report/projectinfo/IssueManagementReportTest.java +++ b/src/test/java/org/apache/maven/report/projectinfo/IssueManagementReportTest.java @@ -70,7 +70,7 @@ public void testReport() // Test the links WebLink[] weblinks = response.getLinks(); - assertEquals( 3, weblinks.length ); + assertEquals( 4, weblinks.length ); assertEquals( "JIRA", weblinks[1].getText() ); @@ -78,8 +78,8 @@ public void testReport() // 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() ); } } 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 95fdf525..1ca2492b 100644 --- a/src/test/java/org/apache/maven/report/projectinfo/LicensesReportTest.java +++ b/src/test/java/org/apache/maven/report/projectinfo/LicensesReportTest.java @@ -70,15 +70,15 @@ public void testReport() // 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( "http://maven.apache.org/", links[1].getURLString() ); } public void testReportLinksOnly() @@ -105,15 +105,15 @@ public void testReportLinksOnly() // 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() ); } 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 2a96e15d..61c2a504 100644 --- a/src/test/java/org/apache/maven/report/projectinfo/MailingListsReportTest.java +++ b/src/test/java/org/apache/maven/report/projectinfo/MailingListsReportTest.java @@ -20,7 +20,6 @@ */ import java.net.URL; -import java.util.Locale; import com.meterware.httpunit.GetMethodWebRequest; import com.meterware.httpunit.TextBlock; @@ -71,8 +70,8 @@ public void testReport() // 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"); @@ -97,19 +96,8 @@ public void testReport() 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( "mailing-lists", "mailing-lists-plugin-config-fr.xml" ); + assertTrue( "Test html generated", getGeneratedReport( "mailing-lists.html" ).exists() ); } /** 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 7a1463a0..ae98a70d 100644 --- a/src/test/java/org/apache/maven/report/projectinfo/ModulesReportTest.java +++ b/src/test/java/org/apache/maven/report/projectinfo/ModulesReportTest.java @@ -87,9 +87,10 @@ public void testReport() // 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 ); 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 68cd90ed..3de654d9 100644 --- a/src/test/java/org/apache/maven/report/projectinfo/PluginManagementReportTest.java +++ b/src/test/java/org/apache/maven/report/projectinfo/PluginManagementReportTest.java @@ -114,7 +114,7 @@ public void testReport() // 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() ); } /** @@ -159,7 +159,7 @@ public void testReportEclipseM2EPluginLifecycleMapping() // 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 ) 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 6f23220d..05bec0d8 100644 --- a/src/test/java/org/apache/maven/report/projectinfo/ScmReportTest.java +++ b/src/test/java/org/apache/maven/report/projectinfo/ScmReportTest.java @@ -72,13 +72,14 @@ public void testReport() // 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() ); } /** 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 a7164883..5a7e560a 100644 --- a/src/test/java/org/apache/maven/report/projectinfo/SummaryReportTest.java +++ b/src/test/java/org/apache/maven/report/projectinfo/SummaryReportTest.java @@ -70,10 +70,10 @@ public void testReport() // 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() ); } } 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 82d2c4d1..37cbce67 100644 --- a/src/test/java/org/apache/maven/report/projectinfo/TeamReportTest.java +++ b/src/test/java/org/apache/maven/report/projectinfo/TeamReportTest.java @@ -78,14 +78,15 @@ public void testReport() // 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); diff --git a/src/test/resources/plugin-configs/ci-management-plugin-config.xml b/src/test/resources/plugin-configs/ci-management-plugin-config.xml index 1aede558..56eff3d0 100644 --- a/src/test/resources/plugin-configs/ci-management-plugin-config.xml +++ b/src/test/resources/plugin-configs/ci-management-plugin-config.xml @@ -24,6 +24,7 @@ under the License. 1.0-SNAPSHOT jar ci mangement project info + http://maven.apache.org junit @@ -44,4 +45,4 @@ under the License. - \ No newline at end of file + diff --git a/src/test/resources/plugin-configs/ci-management-plugin-with-ci-section-config.xml b/src/test/resources/plugin-configs/ci-management-plugin-with-ci-section-config.xml index 3ec898ed..b329f91c 100644 --- a/src/test/resources/plugin-configs/ci-management-plugin-with-ci-section-config.xml +++ b/src/test/resources/plugin-configs/ci-management-plugin-with-ci-section-config.xml @@ -24,6 +24,7 @@ under the License. 1.0-SNAPSHOT jar ci management project info + http://maven.apache.org junit @@ -48,4 +49,4 @@ under the License. TeamCity https://example.com - \ No newline at end of file + diff --git a/src/test/resources/plugin-configs/dependency-convergence-plugin-config.xml b/src/test/resources/plugin-configs/dependency-convergence-plugin-config.xml index 831f98e2..e252f05d 100644 --- a/src/test/resources/plugin-configs/dependency-convergence-plugin-config.xml +++ b/src/test/resources/plugin-configs/dependency-convergence-plugin-config.xml @@ -24,6 +24,7 @@ under the License. 1.0-SNAPSHOT pom dependency convergence project info + http://maven.apache.org junit @@ -48,4 +49,4 @@ under the License. - \ No newline at end of file + diff --git a/src/test/resources/plugin-configs/dependency-management-plugin-config.xml b/src/test/resources/plugin-configs/dependency-management-plugin-config.xml index 867689a4..7630a657 100644 --- a/src/test/resources/plugin-configs/dependency-management-plugin-config.xml +++ b/src/test/resources/plugin-configs/dependency-management-plugin-config.xml @@ -24,6 +24,7 @@ under the License. 1.0-SNAPSHOT jar dependency management project info + http://maven.apache.org junit diff --git a/src/test/resources/plugin-configs/index-plugin-config.xml b/src/test/resources/plugin-configs/index-plugin-config.xml index 78277252..7cc0fc53 100644 --- a/src/test/resources/plugin-configs/index-plugin-config.xml +++ b/src/test/resources/plugin-configs/index-plugin-config.xml @@ -24,6 +24,7 @@ under the License. 1.0-SNAPSHOT jar index project info + http://maven.apache.org junit @@ -44,4 +45,4 @@ under the License. - \ No newline at end of file + diff --git a/src/test/resources/plugin-configs/issue-management-plugin-config.xml b/src/test/resources/plugin-configs/issue-management-plugin-config.xml index 889df8c1..56c6f49b 100644 --- a/src/test/resources/plugin-configs/issue-management-plugin-config.xml +++ b/src/test/resources/plugin-configs/issue-management-plugin-config.xml @@ -24,6 +24,7 @@ under the License. 1.0-SNAPSHOT jar issue management project info + http://maven.apache.org junit @@ -48,4 +49,4 @@ under the License. - \ No newline at end of file + diff --git a/src/test/resources/plugin-configs/licenses-plugin-config-linkonly.xml b/src/test/resources/plugin-configs/licenses-plugin-config-linkonly.xml index a6be1a9e..62c32657 100644 --- a/src/test/resources/plugin-configs/licenses-plugin-config-linkonly.xml +++ b/src/test/resources/plugin-configs/licenses-plugin-config-linkonly.xml @@ -24,6 +24,7 @@ under the License. 1.0-SNAPSHOT jar licenses project info + http://maven.apache.org The Apache Software License, Version 2.0 @@ -54,4 +55,4 @@ under the License. - \ No newline at end of file + diff --git a/src/test/resources/plugin-configs/licenses-plugin-config.xml b/src/test/resources/plugin-configs/licenses-plugin-config.xml index 88028d47..d03ba8e1 100644 --- a/src/test/resources/plugin-configs/licenses-plugin-config.xml +++ b/src/test/resources/plugin-configs/licenses-plugin-config.xml @@ -24,6 +24,7 @@ under the License. 1.0-SNAPSHOT jar licenses project info + http://maven.apache.org The Apache Software License, Version 2.0 @@ -53,4 +54,4 @@ under the License. - \ No newline at end of file + 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 00000000..c50e7eb9 --- /dev/null +++ b/src/test/resources/plugin-configs/mailing-lists-plugin-config-fr.xml @@ -0,0 +1,62 @@ + + + + 4.0.0 + org.apache.maven.plugin.projectinfo.tests + mailing-lists + 1.0-SNAPSHOT + jar + mailing lists project info + http://maven.apache.org + + + junit + junit + 3.8.1 + test + + + + + Test List + test@maven.apache.org + MAILTO:test-subscribe@maven.apache.org + + + Test List 2 + test2@maven.apache.org + MAILTO:test-subscribe2@maven.apache.org + https://example.com/unsubscribe + + + + + + maven-project-info-reports-plugin + + target/test-harness/mailing-lists + ${localRepository} + fr + + + + + + diff --git a/src/test/resources/plugin-configs/mailing-lists-plugin-config-invalidlink.xml b/src/test/resources/plugin-configs/mailing-lists-plugin-config-invalidlink.xml index 6f4cde9a..3ed9413e 100644 --- a/src/test/resources/plugin-configs/mailing-lists-plugin-config-invalidlink.xml +++ b/src/test/resources/plugin-configs/mailing-lists-plugin-config-invalidlink.xml @@ -24,6 +24,7 @@ under the License. 1.0-SNAPSHOT jar mailing lists project info + http://maven.apache.org junit diff --git a/src/test/resources/plugin-configs/mailing-lists-plugin-config.xml b/src/test/resources/plugin-configs/mailing-lists-plugin-config.xml index 2cd6e45b..c35c7104 100644 --- a/src/test/resources/plugin-configs/mailing-lists-plugin-config.xml +++ b/src/test/resources/plugin-configs/mailing-lists-plugin-config.xml @@ -24,6 +24,7 @@ under the License. 1.0-SNAPSHOT jar mailing lists project info + http://maven.apache.org junit diff --git a/src/test/resources/plugin-configs/modules-plugin-config.xml b/src/test/resources/plugin-configs/modules-plugin-config.xml index b78319e2..1340a643 100644 --- a/src/test/resources/plugin-configs/modules-plugin-config.xml +++ b/src/test/resources/plugin-configs/modules-plugin-config.xml @@ -24,7 +24,7 @@ under the License. 1.0-SNAPSHOT pom modules project info - + http://maven.apache.org junit @@ -33,12 +33,10 @@ under the License. test - subproject1 subproject2 - @@ -51,4 +49,4 @@ under the License. - \ No newline at end of file + diff --git a/src/test/resources/plugin-configs/modules-variable-settings-interpolated-plugin-config.xml b/src/test/resources/plugin-configs/modules-variable-settings-interpolated-plugin-config.xml index 318521c9..1560b785 100644 --- a/src/test/resources/plugin-configs/modules-variable-settings-interpolated-plugin-config.xml +++ b/src/test/resources/plugin-configs/modules-variable-settings-interpolated-plugin-config.xml @@ -24,7 +24,7 @@ under the License. 1.0-SNAPSHOT pom modules project info - + http://maven.apache.org junit @@ -33,11 +33,9 @@ under the License. test - subproject-site-url - @@ -51,12 +49,10 @@ under the License. - projectSite ${sitePublishLocation}/foo/${project.artifactId} - - \ No newline at end of file + diff --git a/src/test/resources/plugin-configs/plugin-management-plugin-config-MPIR-375.xml b/src/test/resources/plugin-configs/plugin-management-plugin-config-MPIR-375.xml index fc99bcd2..114447ab 100644 --- a/src/test/resources/plugin-configs/plugin-management-plugin-config-MPIR-375.xml +++ b/src/test/resources/plugin-configs/plugin-management-plugin-config-MPIR-375.xml @@ -24,11 +24,11 @@ under the License. 1.0-SNAPSHOT jar plugin management project info - + http://maven.apache.org - org.eclipse.m2e @@ -71,7 +71,7 @@ under the License. target/test-harness/plugin-management ${localRepository} - + org.eclipse.m2e:lifecycle-mapping diff --git a/src/test/resources/plugin-configs/plugin-management-plugin-config.xml b/src/test/resources/plugin-configs/plugin-management-plugin-config.xml index c06ed756..ac962fe1 100644 --- a/src/test/resources/plugin-configs/plugin-management-plugin-config.xml +++ b/src/test/resources/plugin-configs/plugin-management-plugin-config.xml @@ -24,6 +24,7 @@ under the License. 1.0-SNAPSHOT jar plugin management project info + http://maven.apache.org junit @@ -31,7 +32,6 @@ under the License. 3.8.1 - diff --git a/src/test/resources/plugin-configs/scm-plugin-config.xml b/src/test/resources/plugin-configs/scm-plugin-config.xml index cc4fa04c..6f0cdede 100644 --- a/src/test/resources/plugin-configs/scm-plugin-config.xml +++ b/src/test/resources/plugin-configs/scm-plugin-config.xml @@ -24,6 +24,7 @@ under the License. 1.0-SNAPSHOT jar scm project info + http://maven.apache.org junit @@ -50,4 +51,4 @@ under the License. - \ No newline at end of file + diff --git a/src/test/resources/plugin-configs/scm-wrong-url-plugin-config.xml b/src/test/resources/plugin-configs/scm-wrong-url-plugin-config.xml index ce9c1eb4..ceaf5aeb 100644 --- a/src/test/resources/plugin-configs/scm-wrong-url-plugin-config.xml +++ b/src/test/resources/plugin-configs/scm-wrong-url-plugin-config.xml @@ -24,6 +24,7 @@ under the License. 1.0-SNAPSHOT jar scm project info + http://maven.apache.org junit @@ -45,4 +46,4 @@ under the License. - \ No newline at end of file + diff --git a/src/test/resources/plugin-configs/summary-plugin-config.xml b/src/test/resources/plugin-configs/summary-plugin-config.xml index d47e9c8c..e53e5748 100644 --- a/src/test/resources/plugin-configs/summary-plugin-config.xml +++ b/src/test/resources/plugin-configs/summary-plugin-config.xml @@ -24,6 +24,7 @@ under the License. 1.0-SNAPSHOT jar summary project info + http://maven.apache.org junit @@ -44,4 +45,4 @@ under the License. - \ No newline at end of file + diff --git a/src/test/resources/plugin-configs/team-plugin-config.xml b/src/test/resources/plugin-configs/team-plugin-config.xml index f94a7b66..d6f2f895 100644 --- a/src/test/resources/plugin-configs/team-plugin-config.xml +++ b/src/test/resources/plugin-configs/team-plugin-config.xml @@ -24,6 +24,7 @@ under the License. 1.0-SNAPSHOT jar team project info + http://maven.apache.org junit @@ -61,4 +62,4 @@ under the License. - \ No newline at end of file +