diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java b/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java index 821ad43b73..2021252c73 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java @@ -91,6 +91,7 @@ public class IntegrationTestSuite // suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class ); // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137 + suite.addTestSuite( MavenITmng4053PluginConfigAttributesTest.class ); suite.addTestSuite( MavenITmng4040ProfileInjectedModulesTest.class ); suite.addTestSuite( MavenITmng4036ParentResolutionFromSettingsRepoTest.class ); suite.addTestSuite( MavenITmng4034ManagedProfileDependencyTest.class ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4053PluginConfigAttributesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4053PluginConfigAttributesTest.java new file mode 100644 index 0000000000..fe9c7f2b25 --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4053PluginConfigAttributesTest.java @@ -0,0 +1,96 @@ +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.ResourceExtractor; + +import java.io.File; +import java.util.Properties; + +/** + * This is a test set for MNG-4053. + * + * @author Benjamin Bentmann + */ +public class MavenITmng4053PluginConfigAttributesTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng4053PluginConfigAttributesTest() + { + super( ALL_MAVEN_VERSIONS ); + } + + /** + * Verify that attributes in plugin configuration elements are not erroneously duplicated to other elements when + * no plugin management is used. + */ + public void testitWithoutPluginMngt() + throws Exception + { + testit( "test-1" ); + } + + /** + * Verify that attributes in plugin configuration elements are not erroneously duplicated to other elements when + * plugin management is used. + */ + public void testitWithPluginMngt() + throws Exception + { + testit( "test-2" ); + } + + /** + * Verify that attributes in plugin configuration elements are not erroneously duplicated to other elements when + * plugin management and a profile are used. + */ + public void testitWithPluginMngtAndProfile() + throws Exception + { + testit( "test-3" ); + } + + private void testit( String test ) + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4053/" + test ); + + Verifier verifier = new Verifier( testDir.getAbsolutePath() ); + verifier.setAutoclean( false ); + verifier.deleteDirectory( "target" ); + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + Properties props = verifier.loadProperties( "target/config.properties" ); + + assertEquals( "src", props.getProperty( "domParam.children.copy.0.attributes.todir" ) ); + assertEquals( "true", props.getProperty( "domParam.children.copy.0.attributes.overwrite" ) ); + assertEquals( "2", props.getProperty( "domParam.children.copy.0.attributes" ) ); + + assertEquals( "target", props.getProperty( "domParam.children.copy.0.children.fileset.0.attributes.dir" ) ); + assertEquals( null, props.getProperty( "domParam.children.copy.0.children.fileset.0.attributes.todir" ) ); + assertEquals( null, props.getProperty( "domParam.children.copy.0.children.fileset.0.attributes.overwrite" ) ); + assertEquals( "1", props.getProperty( "domParam.children.copy.0.children.fileset.0.attributes" ) ); + } + +} diff --git a/its/core-it-suite/src/test/resources/MNG-4053/test-1/pom.xml b/its/core-it-suite/src/test/resources/MNG-4053/test-1/pom.xml new file mode 100644 index 0000000000..628fe09f82 --- /dev/null +++ b/its/core-it-suite/src/test/resources/MNG-4053/test-1/pom.xml @@ -0,0 +1,61 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4053 + test1 + 1.0-SNAPSHOT + + Maven Integration Test :: MNG-4053 + + Verify that attributes in plugin configuration elements are not erroneously duplicated to other elements when + no plugin management is used. + + + + + + + org.apache.maven.its.plugins + maven-it-plugin-configuration + 2.1-SNAPSHOT + + + validate + + config + + + target/config.properties + + + + + + + + + + + + diff --git a/its/core-it-suite/src/test/resources/MNG-4053/test-2/pom.xml b/its/core-it-suite/src/test/resources/MNG-4053/test-2/pom.xml new file mode 100644 index 0000000000..404fc2aeae --- /dev/null +++ b/its/core-it-suite/src/test/resources/MNG-4053/test-2/pom.xml @@ -0,0 +1,70 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4053 + test2 + 1.0-SNAPSHOT + + Maven Integration Test :: MNG-4053 + + Verify that attributes in plugin configuration elements are not erroneously duplicated to other elements when + plugin management is used. + + + + + + + + org.apache.maven.its.plugins + maven-it-plugin-configuration + 2.1-SNAPSHOT + + + + + + org.apache.maven.its.plugins + maven-it-plugin-configuration + 2.1-SNAPSHOT + + + validate + + config + + + target/config.properties + + + + + + + + + + + + diff --git a/its/core-it-suite/src/test/resources/MNG-4053/test-3/pom.xml b/its/core-it-suite/src/test/resources/MNG-4053/test-3/pom.xml new file mode 100644 index 0000000000..7b9edcd0ee --- /dev/null +++ b/its/core-it-suite/src/test/resources/MNG-4053/test-3/pom.xml @@ -0,0 +1,82 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4053 + test3 + 1.0-SNAPSHOT + + Maven Integration Test :: MNG-4053 + + Verify that attributes in plugin configuration elements are not erroneously duplicated to other elements when + plugin management and a profile are used. + + + + + + + + org.apache.maven.its.plugins + maven-it-plugin-configuration + 2.1-SNAPSHOT + + + + + + + + + maven-core-it + + true + + + + + org.apache.maven.its.plugins + maven-it-plugin-configuration + 2.1-SNAPSHOT + + + validate + + config + + + target/config.properties + + + + + + + + + + + + + +