Author: bentmann
Date: Sun Mar 22 14:59:46 2009
New Revision: 757195

URL: http://svn.apache.org/viewvc?rev=757195&view=rev
Log:
[MNG-2309] Profile activation order is random

o Added IT

Added:
    
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2309ProfileInjectionOrderTest.java
   (with props)
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2309/
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2309/pom.xml
   (with props)
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2309/profiles.xml
   (with props)
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2309/settings.xml
   (with props)
Modified:
    
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java

Modified: 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java?rev=757195&r1=757194&r2=757195&view=diff
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
 (original)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
 Sun Mar 22 14:59:46 2009
@@ -262,6 +262,7 @@
         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 );

Added: 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2309ProfileInjectionOrderTest.java
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2309ProfileInjectionOrderTest.java?rev=757195&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2309ProfileInjectionOrderTest.java
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2309ProfileInjectionOrderTest.java
 Sun Mar 22 14:59:46 2009
@@ -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" ) );
+        }
+    }
+
+}

Propchange: 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2309ProfileInjectionOrderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2309ProfileInjectionOrderTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2309/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2309/pom.xml?rev=757195&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2309/pom.xml
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2309/pom.xml
 Sun Mar 22 14:59:46 2009
@@ -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>

Propchange: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2309/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2309/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2309/profiles.xml
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2309/profiles.xml?rev=757195&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2309/profiles.xml
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2309/profiles.xml
 Sun Mar 22 14:59:46 2009
@@ -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>

Propchange: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2309/profiles.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2309/profiles.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2309/settings.xml
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2309/settings.xml?rev=757195&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2309/settings.xml
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2309/settings.xml
 Sun Mar 22 14:59:46 2009
@@ -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>

Propchange: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2309/settings.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2309/settings.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision


Reply via email to