[MNG-4053] [regression] XML attributes in plugin configuration get duplicated to other elements in combination with plugin management

o Added IT

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@747921 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-02-25 21:04:36 +00:00
parent 453415277c
commit 3dfa46e91d
5 changed files with 310 additions and 0 deletions

View File

@ -91,6 +91,7 @@ public class IntegrationTestSuite
// suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class ); // suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class );
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137 // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
suite.addTestSuite( MavenITmng4053PluginConfigAttributesTest.class );
suite.addTestSuite( MavenITmng4040ProfileInjectedModulesTest.class ); suite.addTestSuite( MavenITmng4040ProfileInjectedModulesTest.class );
suite.addTestSuite( MavenITmng4036ParentResolutionFromSettingsRepoTest.class ); suite.addTestSuite( MavenITmng4036ParentResolutionFromSettingsRepoTest.class );
suite.addTestSuite( MavenITmng4034ManagedProfileDependencyTest.class ); suite.addTestSuite( MavenITmng4034ManagedProfileDependencyTest.class );

View File

@ -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 <a href="http://jira.codehaus.org/browse/MNG-4053">MNG-4053</a>.
*
* @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" ) );
}
}

View File

@ -0,0 +1,61 @@
<?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.mng4053</groupId>
<artifactId>test1</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Maven Integration Test :: MNG-4053</name>
<description>
Verify that attributes in plugin configuration elements are not erroneously duplicated to other elements when
no plugin management is used.
</description>
<build>
<!-- NOTE: This test does not use plugin management for the IT plugin -->
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-configuration</artifactId>
<version>2.1-SNAPSHOT</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>config</goal>
</goals>
<configuration>
<propertiesFile>target/config.properties</propertiesFile>
<domParam>
<copy todir="src" overwrite="true">
<fileset dir="target"/>
</copy>
</domParam>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,70 @@
<?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.mng4053</groupId>
<artifactId>test2</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Maven Integration Test :: MNG-4053</name>
<description>
Verify that attributes in plugin configuration elements are not erroneously duplicated to other elements when
plugin management is used.
</description>
<build>
<!-- NOTE: This test used plugin management for the IT plugin -->
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-configuration</artifactId>
<version>2.1-SNAPSHOT</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-configuration</artifactId>
<version>2.1-SNAPSHOT</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>config</goal>
</goals>
<configuration>
<propertiesFile>target/config.properties</propertiesFile>
<domParam>
<copy todir="src" overwrite="true">
<fileset dir="target"/>
</copy>
</domParam>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,82 @@
<?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.mng4053</groupId>
<artifactId>test3</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Maven Integration Test :: MNG-4053</name>
<description>
Verify that attributes in plugin configuration elements are not erroneously duplicated to other elements when
plugin management and a profile are used.
</description>
<build>
<!-- NOTE: This test used plugin management for the IT plugin -->
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-configuration</artifactId>
<version>2.1-SNAPSHOT</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<!-- NOTE: This test injects the plugin configuration via a profile -->
<id>maven-core-it</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-configuration</artifactId>
<version>2.1-SNAPSHOT</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>config</goal>
</goals>
<configuration>
<propertiesFile>target/config.properties</propertiesFile>
<domParam>
<copy todir="src" overwrite="true">
<fileset dir="target"/>
</copy>
</domParam>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>