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 2010/04/06 23:09:05 UTC

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

Author: bentmann
Date: Tue Apr  6 21:09:05 2010
New Revision: 931328

URL: http://svn.apache.org/viewvc?rev=931328&view=rev
Log:
[MNG-4022] Incorrect merge behavior using profile driven plugin configuration

o Added IT

Added:
    maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4022IdempotentPluginConfigMergingTest.java   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4022/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4022/pom.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=931328&r1=931327&r2=931328&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 Apr  6 21:09:05 2010
@@ -233,6 +233,7 @@ public class IntegrationTestSuite
         suite.addTestSuite( MavenITmng4034ManagedProfileDependencyTest.class );
         suite.addTestSuite( MavenITmng4026ReactorDependenciesOrderTest.class );
         suite.addTestSuite( MavenITmng4023ParentProfileOneTimeInjectionTest.class );
+        suite.addTestSuite( MavenITmng4022IdempotentPluginConfigMergingTest.class );
         suite.addTestSuite( MavenITmng4016PrefixedPropertyInterpolationTest.class );
         suite.addTestSuite( MavenITmng4009InheritProfileEffectsTest.class );
         suite.addTestSuite( MavenITmng4008MergedFilterOrderTest.class );

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4022IdempotentPluginConfigMergingTest.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4022IdempotentPluginConfigMergingTest.java?rev=931328&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4022IdempotentPluginConfigMergingTest.java (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4022IdempotentPluginConfigMergingTest.java Tue Apr  6 21:09:05 2010
@@ -0,0 +1,68 @@
+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 org.apache.maven.it.Verifier;
+import org.apache.maven.it.util.ResourceExtractor;
+
+import java.io.File;
+import java.util.Properties;
+
+/**
+ * This is a test set for <a href="http://jira.codehaus.org/browse/MNG-4022">MNG-4022</a>.
+ * 
+ * @author Benjamin Bentmann
+ */
+public class MavenITmng4022IdempotentPluginConfigMergingTest
+    extends AbstractMavenIntegrationTestCase
+{
+
+    public MavenITmng4022IdempotentPluginConfigMergingTest()
+    {
+        super( "[3.0-beta-1,)" );
+    }
+
+    /**
+     * Test that merging of equal plugin configuration is idempotent. This is especially interesting for lists with
+     * empty elements.
+     */
+    public void testit()
+        throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4022" );
+
+        Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+        verifier.setAutoclean( false );
+        verifier.deleteDirectory( "target" );
+        verifier.getCliOptions().add( "-Pmng4022a,mng4022b" );
+        verifier.executeGoal( "validate" );
+        verifier.verifyErrorFreeLog();
+        verifier.resetStreams();
+
+        Properties props = verifier.loadProperties( "target/config.properties" );
+        assertEquals( "5", props.getProperty( "stringParams" ) );
+        assertEquals( "", props.getProperty( "stringParams.0", "" ) );
+        assertEquals( "one", props.getProperty( "stringParams.1", "" ) );
+        assertEquals( "", props.getProperty( "stringParams.2", "" ) );
+        assertEquals( "two", props.getProperty( "stringParams.3", "" ) );
+        assertEquals( "", props.getProperty( "stringParams.4", "" ) );
+    }
+
+}

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

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

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4022/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4022/pom.xml?rev=931328&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4022/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4022/pom.xml Tue Apr  6 21:09:05 2010
@@ -0,0 +1,103 @@
+<?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.mng4022</groupId>
+  <artifactId>test</artifactId>
+  <version>1</version>
+
+  <name>Maven Integration Test :: MNG-4022</name> 
+  <description>
+    Test that merging of equal plugin configuration is idempotent. This is especially interesting for lists with
+    empty elements.
+  </description>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.its.plugins</groupId>
+        <artifactId>maven-it-plugin-configuration</artifactId>
+        <version>2.1-SNAPSHOT</version>
+        <configuration>
+          <propertiesFile>target/config.properties</propertiesFile>
+        </configuration>
+        <executions>
+          <execution>
+            <phase>validate</phase>
+            <goals>
+              <goal>config</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+  <profiles>
+    <!-- NOTE: Activation of these two profiles triggers merging of the same plugin configuration -->
+    <profile>
+      <id>mng4022a</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.its.plugins</groupId>
+            <artifactId>maven-it-plugin-configuration</artifactId>
+            <version>2.1-SNAPSHOT</version>
+            <configuration>
+              <!-- NOTE: It's crucial to have the first and last list item be empty -->
+              <stringParams>
+                <stringParam/>
+                <stringParam>one</stringParam>
+                <stringParam/>
+                <stringParam>two</stringParam>
+                <stringParam/>
+              </stringParams>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+    <profile>
+      <id>mng4022b</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.its.plugins</groupId>
+            <artifactId>maven-it-plugin-configuration</artifactId>
+            <version>2.1-SNAPSHOT</version>
+            <configuration>
+              <!-- NOTE: It's crucial to have the first and last list item be empty -->
+              <stringParams>
+                <stringParam/>
+                <stringParam>one</stringParam>
+                <stringParam/>
+                <stringParam>two</stringParam>
+                <stringParam/>
+              </stringParams>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+</project>

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

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