You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2009/02/24 20:26:42 UTC

svn commit: r747519 - in /maven/core-integration-testing/trunk/core-it-suite/src/test: java/org/apache/maven/it/ resources/mng-2362/ resources/mng-2362/latin-1/ resources/mng-2362/utf-8/

Author: bentmann
Date: Tue Feb 24 19:26:42 2009
New Revision: 747519

URL: http://svn.apache.org/viewvc?rev=747519&view=rev
Log:
[MNG-2362] Deployed POM is not valid XML

o Added IT

Added:
    maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2362DeployedPomEncodingTest.java   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2362/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2362/latin-1/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2362/latin-1/main.jar   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2362/latin-1/pom.xml   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2362/pom.xml   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2362/utf-8/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2362/utf-8/main.jar   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2362/utf-8/pom.xml   (with props)
Modified:
    maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java

Modified: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java?rev=747519&r1=747518&r2=747519&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java (original)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java Tue Feb 24 19:26:42 2009
@@ -244,6 +244,7 @@
         suite.addTestSuite( MavenITmng2591MergeInheritedPluginConfigTest.class );
         suite.addTestSuite( MavenITmng2562TimestampTest.class );
         suite.addTestSuite( MavenITmng2539PluginDependenciesComeFromPluginReposTest.class );
+        suite.addTestSuite( MavenITmng2362DeployedPomEncodingTest.class );
         suite.addTestSuite( MavenITmng2339BadProjectInterpolationTest.class );
         suite.addTestSuite( MavenITmng2318LocalParentResolutionTest.class );
         suite.addTestSuite( MavenITmng2293CustomPluginParamImplTest.class );

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2362DeployedPomEncodingTest.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2362DeployedPomEncodingTest.java?rev=747519&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2362DeployedPomEncodingTest.java (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2362DeployedPomEncodingTest.java Tue Feb 24 19:26:42 2009
@@ -0,0 +1,100 @@
+package org.apache.maven.it;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.it.Verifier;
+import org.apache.maven.it.util.FileUtils;
+import org.apache.maven.it.util.ResourceExtractor;
+
+import java.io.File;
+
+/**
+ * This is a test set for <a href="http://jira.codehaus.org/browse/MNG-2362">MNG-2362</a>.
+ * 
+ * @author Benjamin Bentmann
+ */
+public class MavenITmng2362DeployedPomEncodingTest
+    extends AbstractMavenIntegrationTestCase
+{
+
+    public MavenITmng2362DeployedPomEncodingTest()
+    {
+        super( "[2.0.5,)" );
+    }
+
+    /**
+     * Verify that installed/deployed POMs retain their original file encoding and don't get messed up by some
+     * transformation that erroneously uses the platform's default encoding for reading/writing them.
+     */
+    public void testit()
+        throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2362" );
+
+        Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+        verifier.setAutoclean( false );
+        verifier.deleteDirectory( "utf-8/target" );
+        verifier.deleteDirectory( "latin-1/target" );
+        verifier.deleteArtifacts( "org.apache.maven.its.mng2362" );
+        verifier.executeGoal( "validate" );
+        verifier.verifyErrorFreeLog();
+        verifier.resetStreams();
+
+        File pomFile;
+
+        pomFile = new File( verifier.getArtifactPath( "org.apache.maven.its.mng2362", "utf-8", "0.1", "pom" ) );
+        assertPomUtf8( pomFile );
+
+        pomFile = new File( testDir, "utf-8/target/repo/org/apache/maven/its/mng2362/utf-8/0.1/utf-8-0.1.pom" );
+        assertPomUtf8( pomFile );
+
+        pomFile = new File( verifier.getArtifactPath( "org.apache.maven.its.mng2362", "latin-1", "0.1", "pom" ) );
+        assertPomLatin1( pomFile );
+
+        pomFile = new File( testDir, "latin-1/target/repo/org/apache/maven/its/mng2362/latin-1/0.1/latin-1-0.1.pom" );
+        assertPomLatin1( pomFile );
+    }
+
+    private void assertPomUtf8( File pomFile )
+        throws Exception
+    {
+        String pom = FileUtils.fileRead( pomFile, "UTF-8" );
+        String chars = "\u00DF\u0131\u03A3\u042F\u05D0\u20AC";
+        assertPom( pomFile, pom, chars );
+    }
+
+    private void assertPomLatin1( File pomFile )
+        throws Exception
+    {
+        String pom = FileUtils.fileRead( pomFile, "ISO-8859-1" );
+        String chars = "\u00C4\u00D6\u00DC\u00E4\u00F6\u00FC\u00DF";
+        assertPom( pomFile, pom, chars );
+    }
+
+    private void assertPom( File pomFile, String pom, String chars )
+        throws Exception
+    {
+        String prefix = "TEST-CHARS: ";
+        int pos = pom.indexOf( prefix );
+        assertTrue( "Corrupt data " + pom.substring( pos, pos + prefix.length() + chars.length() ) + " in " + pomFile, 
+            pom.indexOf( prefix + chars ) >= 0 );
+    }
+
+}

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2362DeployedPomEncodingTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2362DeployedPomEncodingTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2362/latin-1/main.jar
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2362/latin-1/main.jar?rev=747519&view=auto
==============================================================================
Binary file - no diff available.

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2362/latin-1/main.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2362/latin-1/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2362/latin-1/pom.xml?rev=747519&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2362/latin-1/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2362/latin-1/pom.xml Tue Feb 24 19:26:42 2009
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!--
+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.
+-->
+
+<!--
+
+NOTE: This file being encoded in Latin-1 is essential part of this test!
+
+-->
+
+<project>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.mng2362</groupId>
+  <artifactId>latin-1</artifactId>
+  <version>0.1</version>
+
+  <name>Maven Integration Test :: MNG-2362</name>
+  <description>
+    TEST-CHARS: ÄÖÜäöüß
+  </description>
+
+  <distributionManagement>
+    <repository>
+      <id>maven-core-it</id>
+      <url>file:///${basedir}/target/repo</url>
+    </repository>
+  </distributionManagement>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.its.plugins</groupId>
+        <artifactId>maven-it-plugin-artifact</artifactId>
+        <version>2.1-SNAPSHOT</version>
+        <executions>
+          <execution>
+            <id>test</id>
+            <phase>validate</phase>
+            <configuration>
+              <mainFile>main.jar</mainFile>
+            </configuration>
+            <goals>
+              <goal>set</goal>
+              <goal>attach-pom</goal>
+              <goal>install</goal>
+              <goal>deploy</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2362/latin-1/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2362/latin-1/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2362/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2362/pom.xml?rev=747519&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2362/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2362/pom.xml Tue Feb 24 19:26:42 2009
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.mng2362</groupId>
+  <artifactId>test</artifactId>
+  <version>0.1</version>
+  <packaging>pom</packaging>
+
+  <name>Maven Integration Test :: MNG-2362</name>
+  <description>
+    Verify that installed/deployed POMs retain their original file encoding and don't get messed up by some
+    transformation that erroneously uses the platform's default encoding for reading/writing them.
+  </description>
+
+  <modules>
+    <module>utf-8</module>
+    <module>latin-1</module>
+  </modules>
+</project>

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2362/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2362/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2362/utf-8/main.jar
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2362/utf-8/main.jar?rev=747519&view=auto
==============================================================================
Binary file - no diff available.

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2362/utf-8/main.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2362/utf-8/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2362/utf-8/pom.xml?rev=747519&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2362/utf-8/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2362/utf-8/pom.xml Tue Feb 24 19:26:42 2009
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<!--
+
+NOTE: This file being encoded in UTF-8 is essential part of this test!
+
+-->
+
+<project>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.mng2362</groupId>
+  <artifactId>utf-8</artifactId>
+  <version>0.1</version>
+
+  <name>Maven Integration Test :: MNG-2362</name>
+  <description>
+    TEST-CHARS: ßıΣЯא€
+  </description>
+
+  <distributionManagement>
+    <repository>
+      <id>maven-core-it</id>
+      <url>file:///${basedir}/target/repo</url>
+    </repository>
+  </distributionManagement>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.its.plugins</groupId>
+        <artifactId>maven-it-plugin-artifact</artifactId>
+        <version>2.1-SNAPSHOT</version>
+        <executions>
+          <execution>
+            <id>test</id>
+            <phase>validate</phase>
+            <configuration>
+              <mainFile>main.jar</mainFile>
+            </configuration>
+            <goals>
+              <goal>set</goal>
+              <goal>attach-pom</goal>
+              <goal>install</goal>
+              <goal>deploy</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2362/utf-8/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2362/utf-8/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision