mirror of https://github.com/apache/maven.git
[MNG-2362] Deployed POM is not valid XML
o Added IT git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@747519 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5154107880
commit
43e824ecee
|
@ -244,6 +244,7 @@ public class IntegrationTestSuite
|
||||||
suite.addTestSuite( MavenITmng2591MergeInheritedPluginConfigTest.class );
|
suite.addTestSuite( MavenITmng2591MergeInheritedPluginConfigTest.class );
|
||||||
suite.addTestSuite( MavenITmng2562TimestampTest.class );
|
suite.addTestSuite( MavenITmng2562TimestampTest.class );
|
||||||
suite.addTestSuite( MavenITmng2539PluginDependenciesComeFromPluginReposTest.class );
|
suite.addTestSuite( MavenITmng2539PluginDependenciesComeFromPluginReposTest.class );
|
||||||
|
suite.addTestSuite( MavenITmng2362DeployedPomEncodingTest.class );
|
||||||
suite.addTestSuite( MavenITmng2339BadProjectInterpolationTest.class );
|
suite.addTestSuite( MavenITmng2339BadProjectInterpolationTest.class );
|
||||||
suite.addTestSuite( MavenITmng2318LocalParentResolutionTest.class );
|
suite.addTestSuite( MavenITmng2318LocalParentResolutionTest.class );
|
||||||
suite.addTestSuite( MavenITmng2293CustomPluginParamImplTest.class );
|
suite.addTestSuite( MavenITmng2293CustomPluginParamImplTest.class );
|
||||||
|
|
|
@ -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 );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Binary file not shown.
|
@ -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>
|
|
@ -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>
|
Binary file not shown.
|
@ -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>
|
Loading…
Reference in New Issue