mirror of https://github.com/apache/maven.git
[MNG-2309] Profile activation order is random
o Added UT git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@757197 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ca9d6e96b9
commit
7d4a6c3ca7
|
@ -1170,6 +1170,16 @@ public class PomConstructionTest
|
|||
assertEquals( "run", pom.getValue( "reporting/plugins[1]/reportSets[1]/reports[1]" ) );
|
||||
}
|
||||
|
||||
/* FIXME: MNG-2309
|
||||
public void testProfileInjectionOrder()
|
||||
throws Exception
|
||||
{
|
||||
PomTestWrapper pom =
|
||||
buildPomFromMavenProject( "profile-injection-order", "pom-a", "pom-b", "pom-e", "pom-c", "pom-d" );
|
||||
assertEquals( "e", pom.getValue( "properties[1]/pomProperty" ) );
|
||||
}
|
||||
//*/
|
||||
|
||||
|
||||
private void assertPathSuffixEquals( String expected, Object actual )
|
||||
{
|
||||
|
@ -1194,7 +1204,7 @@ public class PomConstructionTest
|
|||
return new PomTestWrapper( pomFile, mavenProjectBuilder.buildModel( pomFile, null, null, null ) );
|
||||
}
|
||||
|
||||
private PomTestWrapper buildPomFromMavenProject( String pomPath, String profileId )
|
||||
private PomTestWrapper buildPomFromMavenProject( String pomPath, String... profileIds )
|
||||
throws IOException
|
||||
{
|
||||
File pomFile = new File( testDirectory , pomPath );
|
||||
|
@ -1205,9 +1215,9 @@ public class PomConstructionTest
|
|||
ProjectBuilderConfiguration config = new DefaultProjectBuilderConfiguration();
|
||||
config.setLocalRepository(new DefaultArtifactRepository("default", "", new DefaultRepositoryLayout()));
|
||||
ProfileActivationContext pCtx = new ProfileActivationContext(null, true);
|
||||
if(profileId != null)
|
||||
if ( profileIds != null )
|
||||
{
|
||||
pCtx.setExplicitlyActiveProfileIds(Arrays.asList(profileId));
|
||||
pCtx.setExplicitlyActiveProfileIds( Arrays.asList( profileIds ) );
|
||||
}
|
||||
|
||||
config.setGlobalProfileManager(new DefaultProfileManager(this.getContainer(), pCtx));
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
<?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>
|
||||
</project>
|
Loading…
Reference in New Issue