You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2009/03/24 15:01:41 UTC

svn commit: r757806 - in /maven/core-integration-testing/trunk/core-it-suite/src/test: java/org/apache/maven/it/ resources/mng-4107/

Author: bentmann
Date: Tue Mar 24 14:01:39 2009
New Revision: 757806

URL: http://svn.apache.org/viewvc?rev=757806&view=rev
Log:
[MNG-4107] [regression] User settings can't override properties used for POM interpolation

o Added IT

Added:
    maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4107InterpolationUsesDominantProfileSourceTest.java   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4107/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4107/pom.xml   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4107/profiles.xml   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4107/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=757806&r1=757805&r2=757806&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 Tue Mar 24 14:01:39 2009
@@ -92,6 +92,7 @@
         // suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class );
         // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
 
+        suite.addTestSuite( MavenITmng4107InterpolationUsesDominantProfileSourceTest.class );
         suite.addTestSuite( MavenITmng4106InterpolationUsesDominantProfileTest.class );
         suite.addTestSuite( MavenITmng4102InheritedPropertyInterpolationTest.class );
         suite.addTestSuite( MavenITmng4091BadPluginDescriptorTest.class );

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4107InterpolationUsesDominantProfileSourceTest.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4107InterpolationUsesDominantProfileSourceTest.java?rev=757806&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4107InterpolationUsesDominantProfileSourceTest.java (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4107InterpolationUsesDominantProfileSourceTest.java Tue Mar 24 14:01:39 2009
@@ -0,0 +1,79 @@
+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-4107">MNG-4107</a>.
+ * 
+ * @author Benjamin Bentmann
+ * @version $Id$
+ */
+public class MavenITmng4107InterpolationUsesDominantProfileSourceTest
+    extends AbstractMavenIntegrationTestCase
+{
+
+    public MavenITmng4107InterpolationUsesDominantProfileSourceTest()
+    {
+        super( "[2.0.5,)" );
+    }
+
+    /**
+     * Test that POM interpolation uses the property values from the dominant profile source (POM vs. profiles.xml
+     * vs. settings.xml). This boils down to the proper order of profile injection and interpolation, i.e.
+     * interpolate after profiles from all sources are injected.
+     */
+    public void testitMNG4107()
+        throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4107" );
+
+        Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+        verifier.setAutoclean( false );
+        verifier.getCliOptions().add( "--settings" );
+        verifier.getCliOptions().add( "settings.xml" );
+        verifier.executeGoal( "validate" );
+        verifier.verifyErrorFreeLog();
+        verifier.resetStreams();
+
+        Properties props = verifier.loadProperties( "target/pom.properties" );
+
+        assertEquals( "applied", props.getProperty( "project.properties.pomProfile" ) );
+        assertEquals( "applied", props.getProperty( "project.properties.settingsProfile" ) );
+        assertEquals( "settings", props.getProperty( "project.properties.pomVsSettings" ) );
+        assertEquals( "settings", props.getProperty( "project.properties.pomVsSettingsInterpolated" ) );
+
+        if ( matchesVersionRange( "(,3.0-alpha-1)" ) )
+        {
+            // MNG-4060, profiles.xml support dropped
+            assertEquals( "applied", props.getProperty( "project.properties.profilesProfile" ) );
+            assertEquals( "profiles", props.getProperty( "project.properties.pomVsProfiles" ) );
+            assertEquals( "profiles", props.getProperty( "project.properties.pomVsProfilesInterpolated" ) );
+            assertEquals( "settings", props.getProperty( "project.properties.profilesVsSettings" ) );
+            assertEquals( "settings", props.getProperty( "project.properties.profilesVsSettingsInterpolated" ) );
+        }
+    }
+
+}

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

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

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4107/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4107/pom.xml?rev=757806&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4107/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4107/pom.xml Tue Mar 24 14:01:39 2009
@@ -0,0 +1,81 @@
+<?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.mng4107</groupId>
+  <artifactId>test</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+
+  <name>Maven Integration Test :: MNG-4107</name> 
+  <description>
+    Test that POM interpolation uses the property values from the dominant profile source (POM vs. profiles.xml
+    vs. settings.xml). This boils down to the proper order of profile injection and interpolation, i.e.
+    interpolate after profiles from all sources are injected.
+  </description>
+
+  <properties>
+    <!-- collect the effective property values as derived by interpolation -->
+    <pomVsProfilesInterpolated>${pomVsProfiles}</pomVsProfilesInterpolated>
+    <pomVsSettingsInterpolated>${pomVsSettings}</pomVsSettingsInterpolated>
+    <profilesVsSettingsInterpolated>${profilesVsSettings}</profilesVsSettingsInterpolated>
+  </properties>
+
+  <profiles>
+    <profile>
+      <id>pom</id>
+      <activation>
+        <activeByDefault>true</activeByDefault>
+      </activation>
+      <properties>
+        <pomProfile>applied</pomProfile>
+        <pomVsProfiles>pom</pomVsProfiles>
+        <pomVsSettings>pom</pomVsSettings>
+      </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-4107/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

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

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4107/profiles.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4107/profiles.xml?rev=757806&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4107/profiles.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4107/profiles.xml Tue Mar 24 14:01:39 2009
@@ -0,0 +1,36 @@
+<?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>
+    <profile>
+      <id>profiles</id>
+      <activation>
+        <activeByDefault>true</activeByDefault>
+      </activation>
+      <properties>
+        <profilesProfile>applied</profilesProfile>
+        <pomVsProfiles>profiles</pomVsProfiles>
+        <profilesVsSettings>profiles</profilesVsSettings>
+      </properties>
+    </profile>
+  </profiles>
+</profilesXml>

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

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

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4107/settings.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4107/settings.xml?rev=757806&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4107/settings.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4107/settings.xml Tue Mar 24 14:01:39 2009
@@ -0,0 +1,36 @@
+<?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>
+    <profile>
+      <id>settings</id>
+      <activation>
+        <activeByDefault>true</activeByDefault>
+      </activation>
+      <properties>
+        <settingsProfile>applied</settingsProfile>
+        <pomVsSettings>settings</pomVsSettings>
+        <profilesVsSettings>settings</profilesVsSettings>
+      </properties>
+    </profile>
+  </profiles>
+</settings>

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

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