[MNG-2820] Deployment is stripping out the license header from the POM

o Added IT

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@747316 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-02-24 09:38:25 +00:00
parent b4b0dcd876
commit 3accb9f65f
4 changed files with 168 additions and 0 deletions

View File

@ -232,6 +232,7 @@ public static Test suite()
suite.addTestSuite( MavenITmng2861RelocationsAndRangesTest.class );
suite.addTestSuite( MavenITmng2843PluginConfigPropertiesInjectionTest.class );
suite.addTestSuite( MavenITmng2831CustomArtifactHandlerAndCustomLifecycleTest.class );
suite.addTestSuite( MavenITmng2820PomCommentsTest.class );
suite.addTestSuite( MavenITmng2790LastUpdatedMetadataTest.class );
suite.addTestSuite( MavenITmng2749ExtensionAvailableToPluginTest.class );
suite.addTestSuite( MavenITmng2744checksumVerificationTest.class );

View File

@ -0,0 +1,86 @@
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-2820">MNG-2820</a>.
*
* @author Benjamin Bentmann
*/
public class MavenITmng2820PomCommentsTest
extends AbstractMavenIntegrationTestCase
{
public MavenITmng2820PomCommentsTest()
{
// FIXME: Get this passing again for 2.1.0
super( "[2.0.5,2.1.0),(2.1.0,)" );
}
/**
* Verify that installed/deployed POMs retain any XML-comments like license headers.
*/
public void testit()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2820" );
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
verifier.setAutoclean( false );
verifier.deleteDirectory( "target" );
verifier.deleteArtifacts( "org.apache.maven.its.mng2820" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
File installed = new File( verifier.getArtifactPath( "org.apache.maven.its.mng2820", "test", "0.1", "pom" ) );
assertPomComments( installed );
File deployed = new File( testDir, "target/repo/org/apache/maven/its/mng2820/test/0.1/test-0.1.pom" );
assertPomComments( deployed );
}
private void assertPomComments( File pomFile )
throws Exception
{
String pom = FileUtils.fileRead( pomFile, "UTF-8" );
assertPomComment( pom, "DOCUMENT-COMMENT-PRE-1" );
assertPomComment( pom, "DOCUMENT-COMMENT-PRE-2" );
assertPomComment( pom, "DOCUMENT-COMMENT-POST-1" );
assertPomComment( pom, "DOCUMENT-COMMENT-POST-2" );
assertPomComment( pom, "MODEL-COMMENT" );
assertPomComment( pom, "INLINE-COMMENT-1" );
assertPomComment( pom, "INLINE-COMMENT-2" );
assertPomComment( pom, "INLINE-COMMENT-3" );
}
private void assertPomComment( String pom, String comment )
throws Exception
{
assertTrue( "Missing comment: " + comment, pom.indexOf( comment ) >= 0 );
}
}

Binary file not shown.

View File

@ -0,0 +1,81 @@
<?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.
-->
<!-- DOCUMENT-COMMENT-PRE-1 -->
<!--
DOCUMENT-COMMENT-PRE-2
-->
<project>
<!-- MODEL-COMMENT -->
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.its.mng2820</groupId>
<artifactId>test</artifactId>
<version>0.1</version>
<name>Maven Integration Test :: MNG-2820</name>
<description>
<!-- INLINE-COMMENT-1 -->
<!-- INLINE-COMMENT-2 -->
Verify that installed/deployed POMs retain any XML-comments like license headers.
<!-- INLINE-COMMENT-3 -->
</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>
<!-- DOCUMENT-COMMENT-POST-1 -->
<!--
DOCUMENT-COMMENT-POST-2
-->