[MNG-3938] [regression] Plugin executions with default id are not always merged

o Added IT

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@728741 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2008-12-22 18:59:19 +00:00
parent f512164c2e
commit 36696db2a0
6 changed files with 376 additions and 0 deletions

View File

@ -90,6 +90,7 @@ public class IntegrationTestSuite
// suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class );
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
suite.addTestSuite( MavenITmng3938MergePluginExecutionsTest.class );
suite.addTestSuite( MavenITmng3937MergedPluginExecutionGoalsTest.class );
suite.addTestSuite( MavenITmng3927PluginDefaultExecutionConfigTest.class );
suite.addTestSuite( MavenITmng3924XmlMarkupInterpolationTest.class );

View File

@ -0,0 +1,87 @@
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.Arrays;
import java.util.List;
/**
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-3938">MNG-3938</a>.
*
* @author Benjamin Bentmann
* @version $Id$
*/
public class MavenITmng3938MergePluginExecutionsTest
extends AbstractMavenIntegrationTestCase
{
public MavenITmng3938MergePluginExecutionsTest()
{
super( "(2.0.4,)" );
}
/**
* Test that plugin executions with the same id are merged during inheritance, especially executions using the
* default id, regardless whether the id is given explicitly by the user or implicitly assumed from defaults, when
* no <pluginManagement> is involved.
*/
public void testitWithoutPluginManagement()
throws Exception
{
testitMNG3938( "test-1" );
}
/**
* Test that plugin executions with the same id are merged during inheritance, especially executions using the
* default id, regardless whether the id is given explicitly by the user or implicitly assumed from defaults, when
* <pluginManagement> is involved.
*/
public void testitWithPluginManagement()
throws Exception
{
testitMNG3938( "test-2" );
}
private void testitMNG3938( String project )
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3938" );
Verifier verifier = new Verifier( new File( new File( testDir, project ), "sub" ).getAbsolutePath() );
verifier.setAutoclean( false );
verifier.deleteDirectory( "target" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
List lines = verifier.loadLines( "target/default.log", "UTF-8" );
assertEquals( Arrays.asList( new String[] { "child" } ), lines );
lines = verifier.loadLines( "target/non-default.log", "UTF-8" );
assertEquals( Arrays.asList( new String[] { "child" } ), lines );
verifier.assertFileNotPresent( "target/parent.log" );
}
}

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.mng3938</groupId>
<artifactId>parent</artifactId>
<version>0.1</version>
<packaging>pom</packaging>
<name>Maven Integration Test :: MNG-3938</name>
<description>
Test that plugin executions with the same id are merged during inheritance, especially executions using the
default id, regardless whether the id is given explicitly by the user or implicitly assumed from defaults.
</description>
<build>
<!-- This project does not use plugin management for the test plugin -->
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-log-file</artifactId>
<version>2.1-SNAPSHOT</version>
<executions>
<execution>
<!-- NOTE: Implicitly reference "default" id here, i.e. omit the <id> element -->
<phase>validate</phase>
<goals>
<goal>log-string</goal>
</goals>
<configuration>
<logFile>target/parent.log</logFile>
<string>parent</string>
</configuration>
</execution>
<execution>
<id>non-default</id>
<phase>validate</phase>
<goals>
<goal>log-string</goal>
</goals>
<configuration>
<logFile>target/parent.log</logFile>
<string>parent</string>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,73 @@
<?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>
<parent>
<groupId>org.apache.maven.its.mng3938</groupId>
<artifactId>parent</artifactId>
<version>0.1</version>
</parent>
<artifactId>child</artifactId>
<name>Maven Integration Test :: MNG-3938</name>
<description>
Test that plugin executions with the same id are merged during inheritance, especially executions using the
default id, regardless whether the id is given explicitly by the user or implicitly assumed from defaults.
</description>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-log-file</artifactId>
<version>2.1-SNAPSHOT</version>
<executions>
<execution>
<!-- NOTE: Explicitly reference "default" id here -->
<id>default</id>
<phase>validate</phase>
<goals>
<goal>log-string</goal>
</goals>
<configuration>
<logFile>target/default.log</logFile>
<string>child</string>
</configuration>
</execution>
<execution>
<id>non-default</id>
<phase>validate</phase>
<goals>
<goal>log-string</goal>
</goals>
<configuration>
<logFile>target/non-default.log</logFile>
<string>child</string>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,72 @@
<?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.mng3938</groupId>
<artifactId>parent</artifactId>
<version>0.1</version>
<packaging>pom</packaging>
<name>Maven Integration Test :: MNG-3938</name>
<description>
Test that plugin executions with the same id are merged during inheritance, especially executions using the
default id, regardless whether the id is given explicitly by the user or implicitly assumed from defaults.
</description>
<build>
<!-- This project uses plugin management for the test plugin -->
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-log-file</artifactId>
<version>2.1-SNAPSHOT</version>
<executions>
<execution>
<!-- NOTE: Implicitly reference "default" id here, i.e. omit the <id> element -->
<phase>validate</phase>
<goals>
<goal>log-string</goal>
</goals>
<configuration>
<logFile>target/parent.log</logFile>
<string>parent</string>
</configuration>
</execution>
<execution>
<id>non-default</id>
<phase>validate</phase>
<goals>
<goal>log-string</goal>
</goals>
<configuration>
<logFile>target/parent.log</logFile>
<string>parent</string>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

View File

@ -0,0 +1,73 @@
<?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>
<parent>
<groupId>org.apache.maven.its.mng3938</groupId>
<artifactId>parent</artifactId>
<version>0.1</version>
</parent>
<artifactId>child</artifactId>
<name>Maven Integration Test :: MNG-3938</name>
<description>
Test that plugin executions with the same id are merged during inheritance, especially executions using the
default id, regardless whether the id is given explicitly by the user or implicitly assumed from defaults.
</description>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-log-file</artifactId>
<version>2.1-SNAPSHOT</version>
<executions>
<execution>
<!-- NOTE: Explicitly reference "default" id here -->
<id>default</id>
<phase>validate</phase>
<goals>
<goal>log-string</goal>
</goals>
<configuration>
<logFile>target/default.log</logFile>
<string>child</string>
</configuration>
</execution>
<execution>
<id>non-default</id>
<phase>validate</phase>
<goals>
<goal>log-string</goal>
</goals>
<configuration>
<logFile>target/non-default.log</logFile>
<string>child</string>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>