[MNG-4416] [regression] Plugins are not properly ordered after merging with profile plugins

o Added IT

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@830914 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-10-29 12:32:19 +00:00
parent 7fe1416202
commit 87ee1e0d2d
3 changed files with 222 additions and 0 deletions

View File

@ -85,6 +85,7 @@ public class IntegrationTestSuite
// suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class );
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
suite.addTestSuite( MavenITmng4416PluginOrderAfterProfileInjectionTest.class );
suite.addTestSuite( MavenITmng4415InheritedPluginOrderTest.class );
suite.addTestSuite( MavenITmng4413MirroringOfDependencyRepoTest.class );
suite.addTestSuite( MavenITmng4412OfflineModeInPluginTest.class );

View File

@ -0,0 +1,88 @@
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.ArrayList;
import java.util.List;
import java.util.Properties;
/**
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-4416">MNG-4416</a>.
*
* @author Benjamin Bentmann
*/
public class MavenITmng4416PluginOrderAfterProfileInjectionTest
extends AbstractMavenIntegrationTestCase
{
public MavenITmng4416PluginOrderAfterProfileInjectionTest()
{
super( "[2.0.5,)" );
}
/**
* Test that merging of plugins during profile injection follows these rules regarding ordering:
* model: X -> A -> B -> D -> E
* profile: Y -> A -> C -> D -> F
* result: X -> Y -> A -> B -> C -> D -> E -> F
*/
public void testit()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4416" );
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
verifier.setAutoclean( false );
verifier.deleteDirectory( "target" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
Properties props = verifier.loadProperties( "target/it.properties" );
assertNotNull( props.getProperty( "project.build.plugins" ) );
List expected = new ArrayList();
expected.add( "maven-it-plugin-error" );
expected.add( "maven-it-plugin-configuration" );
expected.add( "maven-it-plugin-dependency-resolution" );
expected.add( "maven-it-plugin-packaging" );
expected.add( "maven-it-plugin-log-file" );
expected.add( "maven-it-plugin-expression" );
expected.add( "maven-it-plugin-fork" );
expected.add( "maven-it-plugin-touch" );
List actual = new ArrayList();
int count = Integer.parseInt( props.getProperty( "project.build.plugins" ) );
for ( int i = 0; i < count; i++ )
{
actual.add( props.getProperty( "project.build.plugins." + i + ".artifactId" ) );
}
actual.retainAll( expected );
assertEquals( actual, expected );
}
}

View File

@ -0,0 +1,133 @@
<?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.mng4416</groupId>
<artifactId>test</artifactId>
<version>0.1</version>
<name>Maven Integration Test :: MNG-4416</name>
<description>
Test that merging of plugins during profile injection follows these rules regarding ordering:
model: X -> A -> B -> D -> E
profile: Y -> A -> C -> D -> F
result: X -> Y -> A -> B -> C -> D -> E -> F
</description>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-error</artifactId>
<version>2.1-SNAPSHOT</version>
</plugin>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-dependency-resolution</artifactId>
<version>2.1-SNAPSHOT</version>
</plugin>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-packaging</artifactId>
<version>2.1-SNAPSHOT</version>
</plugin>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-expression</artifactId>
<version>2.1-SNAPSHOT</version>
</plugin>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-fork</artifactId>
<version>2.1-SNAPSHOT</version>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>test</id>
<activation>
<property>
<name>!skip-mng4416</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-configuration</artifactId>
<version>2.1-SNAPSHOT</version>
</plugin>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-dependency-resolution</artifactId>
<version>2.1-SNAPSHOT</version>
</plugin>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-log-file</artifactId>
<version>2.1-SNAPSHOT</version>
<configuration>
<logFile>target/it.properties</logFile>
</configuration>
<executions>
<execution>
<id>first</id>
<phase>validate</phase>
<goals>
<goal>reset</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-expression</artifactId>
<version>2.1-SNAPSHOT</version>
<configuration>
<outputFile>target/it.properties</outputFile>
<expressions>
<expression>project/build/plugins</expression>
</expressions>
</configuration>
<executions>
<execution>
<id>second</id>
<phase>validate</phase>
<goals>
<goal>eval</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-touch</artifactId>
<version>2.1-SNAPSHOT</version>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>