Author: bentmann
Date: Sun Mar 22 15:10:33 2009
New Revision: 757197
URL: http://svn.apache.org/viewvc?rev=757197&view=rev
Log:
[MNG-2309] Profile activation order is random
o Added UT
Added:
maven/components/trunk/maven-project/src/test/resources-project-builder/profile-injection-order/
(with props)
maven/components/trunk/maven-project/src/test/resources-project-builder/profile-injection-order/pom.xml
(with props)
Modified:
maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java
Modified:
maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java
URL:
http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java?rev=757197&r1=757196&r2=757197&view=diff
==============================================================================
---
maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java
(original)
+++
maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java
Sun Mar 22 15:10:33 2009
@@ -1170,6 +1170,16 @@
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 @@
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 @@
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));
Propchange:
maven/components/trunk/maven-project/src/test/resources-project-builder/profile-injection-order/
------------------------------------------------------------------------------
bugtraq:label = Enter issue ID:
Propchange:
maven/components/trunk/maven-project/src/test/resources-project-builder/profile-injection-order/
------------------------------------------------------------------------------
bugtraq:message = Issue id: %BUGID%
Propchange:
maven/components/trunk/maven-project/src/test/resources-project-builder/profile-injection-order/
------------------------------------------------------------------------------
bugtraq:number = false
Propchange:
maven/components/trunk/maven-project/src/test/resources-project-builder/profile-injection-order/
------------------------------------------------------------------------------
bugtraq:url = http://jira.codehaus.org/browse/%BUGID%
Added:
maven/components/trunk/maven-project/src/test/resources-project-builder/profile-injection-order/pom.xml
URL:
http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/test/resources-project-builder/profile-injection-order/pom.xml?rev=757197&view=auto
==============================================================================
---
maven/components/trunk/maven-project/src/test/resources-project-builder/profile-injection-order/pom.xml
(added)
+++
maven/components/trunk/maven-project/src/test/resources-project-builder/profile-injection-order/pom.xml
Sun Mar 22 15:10:33 2009
@@ -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>
Propchange:
maven/components/trunk/maven-project/src/test/resources-project-builder/profile-injection-order/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/components/trunk/maven-project/src/test/resources-project-builder/profile-injection-order/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision