Author: bentmann Date: Tue Feb 24 09:38:25 2009 New Revision: 747316 URL: http://svn.apache.org/viewvc?rev=747316&view=rev Log: [MNG-2820] Deployment is stripping out the license header from the POM
o Added IT Added: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2820PomCommentsTest.java (with props) maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2820/ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2820/main.jar (with props) maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2820/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=747316&r1=747315&r2=747316&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 09:38:25 2009 @@ -232,6 +232,7 @@ 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 ); Added: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2820PomCommentsTest.java URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2820PomCommentsTest.java?rev=747316&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2820PomCommentsTest.java (added) +++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2820PomCommentsTest.java Tue Feb 24 09:38:25 2009 @@ -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 ); + } + +} Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2820PomCommentsTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2820PomCommentsTest.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2820/main.jar URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2820/main.jar?rev=747316&view=auto ============================================================================== Binary file - no diff available. Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2820/main.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2820/pom.xml URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2820/pom.xml?rev=747316&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2820/pom.xml (added) +++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2820/pom.xml Tue Feb 24 09:38:25 2009 @@ -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 +--> Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2820/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2820/pom.xml ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision