mirror of https://github.com/apache/maven.git
[MNG-2309] Profile activation order is random
o Added IT git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@757195 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9c2e480a90
commit
669dc6041d
|
@ -262,6 +262,7 @@ public class IntegrationTestSuite
|
|||
suite.addTestSuite( MavenITmng2362DeployedPomEncodingTest.class );
|
||||
suite.addTestSuite( MavenITmng2339BadProjectInterpolationTest.class );
|
||||
suite.addTestSuite( MavenITmng2318LocalParentResolutionTest.class );
|
||||
suite.addTestSuite( MavenITmng2309ProfileInjectionOrderTest.class );
|
||||
suite.addTestSuite( MavenITmng2293CustomPluginParamImplTest.class );
|
||||
suite.addTestSuite( MavenITmng2277AggregatorAndResolutionPluginsTest.class );
|
||||
suite.addTestSuite( MavenITmng2254PomEncodingTest.class );
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
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 java.io.File;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.maven.it.Verifier;
|
||||
import org.apache.maven.it.util.ResourceExtractor;
|
||||
|
||||
/**
|
||||
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-2309">MNG-2309</a>.
|
||||
*
|
||||
* @author Benjamin Bentmann
|
||||
* @version $Id$
|
||||
*/
|
||||
public class MavenITmng2309ProfileInjectionOrderTest
|
||||
extends AbstractMavenIntegrationTestCase
|
||||
{
|
||||
|
||||
public MavenITmng2309ProfileInjectionOrderTest()
|
||||
{
|
||||
super( "[2.0.5,)" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that profiles are injected in declaration order, with the last profile being the most dominant.
|
||||
*/
|
||||
public void testitMNG2309()
|
||||
throws Exception
|
||||
{
|
||||
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2309" );
|
||||
|
||||
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
|
||||
verifier.setAutoclean( false );
|
||||
verifier.getCliOptions().add( "--settings" );
|
||||
verifier.getCliOptions().add( "settings.xml" );
|
||||
verifier.getCliOptions().add( "-P"
|
||||
+ "pom-a,pom-b,pom-e,pom-c,pom-d"
|
||||
+ ",profiles-a,profiles-b,profiles-e,profiles-c,profiles-d"
|
||||
+ ",settings-a,settings-b,settings-e,settings-c,settings-d" );
|
||||
verifier.executeGoal( "validate" );
|
||||
verifier.verifyErrorFreeLog();
|
||||
verifier.resetStreams();
|
||||
|
||||
Properties props = verifier.loadProperties( "target/pom.properties" );
|
||||
assertEquals( "e", props.getProperty( "project.properties.pomProperty" ) );
|
||||
assertEquals( "e", props.getProperty( "project.properties.settingsProperty" ) );
|
||||
if ( matchesVersionRange( "(,3.0-alpha-1)" ) )
|
||||
{
|
||||
// MNG-4060, profiles.xml support dropped
|
||||
assertEquals( "e", props.getProperty( "project.properties.profilesProperty" ) );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
<?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.mng2309</groupId>
|
||||
<artifactId>test</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Maven Integration Test :: MNG-2309</name>
|
||||
<description>
|
||||
Test that profiles are injected in declaration order, with the last profile being the most dominant.
|
||||
</description>
|
||||
|
||||
<profiles>
|
||||
<!-- NOTE: Using intentionally more than two profiles to prevent random test success -->
|
||||
<profile>
|
||||
<id>pom-a</id>
|
||||
<properties>
|
||||
<pomProperty>a</pomProperty>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>pom-b</id>
|
||||
<properties>
|
||||
<pomProperty>b</pomProperty>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>pom-c</id>
|
||||
<properties>
|
||||
<pomProperty>c</pomProperty>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>pom-d</id>
|
||||
<properties>
|
||||
<pomProperty>d</pomProperty>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>pom-e</id>
|
||||
<properties>
|
||||
<pomProperty>e</pomProperty>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.its.plugins</groupId>
|
||||
<artifactId>maven-it-plugin-expression</artifactId>
|
||||
<version>2.1-SNAPSHOT</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>eval</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputFile>target/pom.properties</outputFile>
|
||||
<expressions>
|
||||
<expression>project/properties</expression>
|
||||
</expressions>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,56 @@
|
|||
<?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.
|
||||
-->
|
||||
|
||||
<profilesXml>
|
||||
<profiles>
|
||||
<!-- NOTE: Using intentionally more than two profiles to prevent random test success -->
|
||||
<profile>
|
||||
<id>profiles-a</id>
|
||||
<properties>
|
||||
<profilesProperty>a</profilesProperty>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>profiles-b</id>
|
||||
<properties>
|
||||
<profilesProperty>b</profilesProperty>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>profiles-c</id>
|
||||
<properties>
|
||||
<profilesProperty>c</profilesProperty>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>profiles-d</id>
|
||||
<properties>
|
||||
<profilesProperty>d</profilesProperty>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>profiles-e</id>
|
||||
<properties>
|
||||
<profilesProperty>e</profilesProperty>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
</profilesXml>
|
|
@ -0,0 +1,56 @@
|
|||
<?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.
|
||||
-->
|
||||
|
||||
<settings>
|
||||
<profiles>
|
||||
<!-- NOTE: Using intentionally more than two profiles to prevent random test success -->
|
||||
<profile>
|
||||
<id>settings-a</id>
|
||||
<properties>
|
||||
<settingsProperty>a</settingsProperty>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>settings-b</id>
|
||||
<properties>
|
||||
<settingsProperty>b</settingsProperty>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>settings-c</id>
|
||||
<properties>
|
||||
<settingsProperty>c</settingsProperty>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>settings-d</id>
|
||||
<properties>
|
||||
<settingsProperty>d</settingsProperty>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>settings-e</id>
|
||||
<properties>
|
||||
<settingsProperty>e</settingsProperty>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
</settings>
|
Loading…
Reference in New Issue