Author: brianf Date: Tue Oct 16 18:40:02 2007 New Revision: 585319 URL: http://svn.apache.org/viewvc?rev=585319&view=rev Log: MNG2025 patch to add encoding unit tests
Added: maven/components/branches/maven-2.0.x/maven-project/src/test/resources/iso-8859-15-encoded-pom.xml maven/components/branches/maven-2.0.x/maven-project/src/test/resources/utf-8-encoded-pom.xml Modified: maven/components/branches/maven-2.0.x/maven-project/src/test/java/org/apache/maven/project/MavenProjectTest.java Modified: maven/components/branches/maven-2.0.x/maven-project/src/test/java/org/apache/maven/project/MavenProjectTest.java URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-project/src/test/java/org/apache/maven/project/MavenProjectTest.java?rev=585319&r1=585318&r2=585319&view=diff ============================================================================== --- maven/components/branches/maven-2.0.x/maven-project/src/test/java/org/apache/maven/project/MavenProjectTest.java (original) +++ maven/components/branches/maven-2.0.x/maven-project/src/test/java/org/apache/maven/project/MavenProjectTest.java Tue Oct 16 18:40:02 2007 @@ -155,4 +155,29 @@ MavenProject clonedProject = new MavenProject( projectToClone ); assertNotNull( "clonedProject - distributionManagement", clonedProject.getDistributionManagementArtifactRepository() ); } + + /** + * + * Maven uses FileReaders by default to read POMs. + * @throws Exception + */ + public void testUTF8EncodedProject() throws Exception + { + File f = getFileForClasspathResource( "utf-8-encoded-pom.xml" ); + MavenProject utf8EncodedProject = getProject( f ); + + assertEquals( "öäüß", utf8EncodedProject.getDescription() ); + } + + /** + * This test case will not fail, because 8bit encodings won't corrupt the parser. + * @throws Exception + */ + public void testISOEncodedProject() throws Exception + { + File f = getFileForClasspathResource( "iso-8859-15-encoded-pom.xml" ); + MavenProject isoEncodedProject = getProject( f ); + + assertEquals( "öäüß", isoEncodedProject.getDescription() ); + } } Added: maven/components/branches/maven-2.0.x/maven-project/src/test/resources/iso-8859-15-encoded-pom.xml URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-project/src/test/resources/iso-8859-15-encoded-pom.xml?rev=585319&view=auto ============================================================================== --- maven/components/branches/maven-2.0.x/maven-project/src/test/resources/iso-8859-15-encoded-pom.xml (added) +++ maven/components/branches/maven-2.0.x/maven-project/src/test/resources/iso-8859-15-encoded-pom.xml Tue Oct 16 18:40:02 2007 @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="ISO-8859-15"?> + +<project> + <modelVersion>4.0.0</modelVersion> + <groupId>maven</groupId> + <artifactId>maven-core</artifactId> + <name>Maven</name> + <version>2.0-SNAPSHOT</version> + <description>öäüß</description> + <build> + <plugins> + <plugin> + <artifactId>maven-plexus-plugin</artifactId> + <version>1.0</version> + <configuration> + <plexusConfiguration>src/conf/plexus.conf</plexusConfiguration> + <plexusConfigurationPropertiesFile>src/conf/plexus.properties</plexusConfigurationPropertiesFile> + <plexusApplicationName>Continuum</plexusApplicationName> + </configuration> + <executions> + <execution> + <goals> + <goal>plexus:runtime</goal> + </goals> + <configuration> + <plexusApplicationName>ContinuumPro</plexusApplicationName> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> Added: maven/components/branches/maven-2.0.x/maven-project/src/test/resources/utf-8-encoded-pom.xml URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-project/src/test/resources/utf-8-encoded-pom.xml?rev=585319&view=auto ============================================================================== --- maven/components/branches/maven-2.0.x/maven-project/src/test/resources/utf-8-encoded-pom.xml (added) +++ maven/components/branches/maven-2.0.x/maven-project/src/test/resources/utf-8-encoded-pom.xml Tue Oct 16 18:40:02 2007 @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<project> + <modelVersion>4.0.0</modelVersion> + <groupId>maven</groupId> + <artifactId>maven-core</artifactId> + <name>Maven</name> + <version>2.0-SNAPSHOT</version> + <description>öäüÃ</description> + <build> + <plugins> + <plugin> + <artifactId>maven-plexus-plugin</artifactId> + <version>1.0</version> + <configuration> + <plexusConfiguration>src/conf/plexus.conf</plexusConfiguration> + <plexusConfigurationPropertiesFile>src/conf/plexus.properties</plexusConfigurationPropertiesFile> + <plexusApplicationName>Continuum</plexusApplicationName> + </configuration> + <executions> + <execution> + <goals> + <goal>plexus:runtime</goal> + </goals> + <configuration> + <plexusApplicationName>ContinuumPro</plexusApplicationName> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project>