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 2008/11/20 22:06:10 UTC

svn commit: r719374 - in /maven/core-integration-testing/trunk/core-it-suite/src/test: java/org/apache/maven/it/IntegrationTestSuite.java java/org/apache/maven/it/MavenITmng3864PerExecPluginConfigTest.java resources/mng-3864/ resources/mng-3864/pom.xml

Author: bentmann
Date: Thu Nov 20 13:06:10 2008
New Revision: 719374

URL: http://svn.apache.org/viewvc?rev=719374&view=rev
Log:
[MNG-3864] Collection elements inside a per-execution plugin config are collapsed in combination with pluginManagement

o Added IT

Added:
    maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3864PerExecPluginConfigTest.java   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3864/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3864/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=719374&r1=719373&r2=719374&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 Thu Nov 20 13:06:10 2008
@@ -88,6 +88,7 @@
         // suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class );
         // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
 
+        suite.addTestSuite( MavenITmng3864PerExecPluginConfigTest.class );
         suite.addTestSuite( MavenITmng3863AutoPluginGroupIdTest.class );
         suite.addTestSuite( MavenITmng3853ProfileInjectedDistReposTest.class );
         suite.addTestSuite( MavenITmng3852PluginConfigWithHeterogeneousListTest.class );

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3864PerExecPluginConfigTest.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3864PerExecPluginConfigTest.java?rev=719374&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3864PerExecPluginConfigTest.java (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3864PerExecPluginConfigTest.java Thu Nov 20 13:06:10 2008
@@ -0,0 +1,106 @@
+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-3864">MNG-3864</a>.
+ * 
+ * @author Benjamin Bentmann
+ * @version $Id$
+ */
+public class MavenITmng3864PerExecPluginConfigTest
+    extends AbstractMavenIntegrationTestCase
+{
+
+    public MavenITmng3864PerExecPluginConfigTest()
+    {
+    }
+
+    /**
+     * Verify that plain per-execution plugin configuration works correctly.
+     */
+    public void testitMNG3864()
+        throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3864" );
+
+        Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+        verifier.setAutoclean( false );
+        verifier.deleteDirectory( "target" );
+        verifier.executeGoal( "validate" );
+        verifier.verifyErrorFreeLog();
+        verifier.resetStreams();
+
+        Properties props = verifier.loadProperties( "target/plugin-config.properties" );
+
+        assertEquals( new File( testDir, "pom.xml" ), new File( props.getProperty( "fileParam" ) ) );
+        assertEquals( "true", props.getProperty( "booleanParam" ) );
+        assertEquals( "42", props.getProperty( "byteParam" ) );
+        assertEquals( "-12345", props.getProperty( "shortParam" ) );
+        assertEquals( "0", props.getProperty( "integerParam" ) );
+        assertEquals( "9876543210", props.getProperty( "longParam" ) );
+        assertEquals( "0.0", props.getProperty( "floatParam" ) );
+        assertEquals( "-1.5", props.getProperty( "doubleParam" ) );
+        assertEquals( "X", props.getProperty( "characterParam" ) );
+        assertEquals( "Hello World!", props.getProperty( "stringParam" ) );
+        assertEquals( "2008-11-09 11:59:03", props.getProperty( "dateParam" ) );
+        assertEquals( "http://maven.apache.org/", props.getProperty( "urlParam" ) );
+
+        assertEquals( "4", props.getProperty( "stringParams" ) );
+        assertEquals( "one", props.getProperty( "stringParams.0" ) );
+        assertEquals( "two", props.getProperty( "stringParams.1" ) );
+        assertEquals( "three", props.getProperty( "stringParams.2" ) );
+        assertEquals( "four", props.getProperty( "stringParams.3" ) );
+
+        assertEquals( "4", props.getProperty( "listParam" ) );
+        assertEquals( "one", props.getProperty( "listParam.0" ) );
+        assertEquals( "two", props.getProperty( "listParam.1" ) );
+        assertEquals( "three", props.getProperty( "listParam.2" ) );
+        assertEquals( "four", props.getProperty( "listParam.3" ) );
+
+        assertEquals( "1", props.getProperty( "setParam" ) );
+        assertEquals( "item", props.getProperty( "setParam.0" ) );
+
+        assertEquals( "2", props.getProperty( "mapParam" ) );
+        assertEquals( "value1", props.getProperty( "mapParam.key1" ) );
+        assertEquals( "value2", props.getProperty( "mapParam.key2" ) );
+
+        assertEquals( "2", props.getProperty( "propertiesParam" ) );
+        assertEquals( "value1", props.getProperty( "propertiesParam.key1" ) );
+        assertEquals( "value2", props.getProperty( "propertiesParam.key2" ) );
+
+        assertEquals( "field", props.getProperty( "beanParam.fieldParam" ) );
+        assertEquals( "setter", props.getProperty( "beanParam.setterParam" ) );
+        assertEquals( "true", props.getProperty( "beanParam.setterCalled" ) );
+
+        assertEquals( "4", props.getProperty( "domParam.children" ) );
+        assertEquals( "one", props.getProperty( "domParam.children.echo.0.value" ) );
+        assertEquals( "two", props.getProperty( "domParam.children.echo.1.value" ) );
+        assertEquals( "three", props.getProperty( "domParam.children.echo.2.value" ) );
+        assertEquals( "four", props.getProperty( "domParam.children.echo.3.value" ) );
+    }
+
+}

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

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

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3864/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3864/pom.xml?rev=719374&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3864/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3864/pom.xml Thu Nov 20 13:06:10 2008
@@ -0,0 +1,117 @@
+<?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.mng3864</groupId>
+  <artifactId>test1</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <name>Maven Integration Test :: MNG-3864</name> 
+  <description>
+    Verify that plain per-execution plugin configuration works correctly.
+  </description>
+
+  <build>
+    <pluginManagement>
+      <!--
+      NOTE: The usage of <pluginManagement> for the employed IT plugin is crucial to exhibit the bug!
+      -->
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.its.plugins</groupId>
+          <artifactId>maven-it-plugin-configuration</artifactId>
+          <version>2.1-SNAPSHOT</version>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.its.plugins</groupId>
+        <artifactId>maven-it-plugin-configuration</artifactId>
+        <executions>
+          <execution>
+            <phase>validate</phase>
+            <goals>
+              <goal>config</goal>
+            </goals>
+            <configuration>
+              <propertiesFile>target/plugin-config.properties</propertiesFile>
+              <booleanParam>true</booleanParam>
+              <byteParam>42</byteParam>
+              <shortParam>-12345</shortParam>
+              <integerParam>0</integerParam>
+              <longParam>9876543210</longParam>
+              <floatParam>0.0</floatParam>
+              <doubleParam>-1.5</doubleParam>
+              <characterParam>X</characterParam>
+              <stringParam>Hello World!</stringParam>
+              <fileParam>pom.xml</fileParam>
+              <dateParam>2008-11-09 11:59:03.0 PM</dateParam>
+              <urlParam>http://maven.apache.org/</urlParam>
+              <stringParams>
+                <stringParam>one</stringParam>
+                <stringParam>two</stringParam>
+                <stringParam>three</stringParam>
+                <stringParam>four</stringParam>
+              </stringParams>
+              <listParam>
+                <listParam>one</listParam>
+                <listParam>two</listParam>
+                <listParam>three</listParam>
+                <listParam>four</listParam>
+              </listParam>
+              <setParam>
+                <setParam>item</setParam>
+                <setParam>item</setParam>
+              </setParam>
+              <mapParam>
+                <key1>value1</key1>
+                <key2>value2</key2>
+              </mapParam>
+              <propertiesParam>
+                <property>
+                  <name>key1</name>
+                  <value>value1</value>
+                </property>
+                <property>
+                  <name>key2</name>
+                  <value>value2</value>
+                </property>
+              </propertiesParam>
+              <beanParam>
+                <fieldParam>field</fieldParam>
+                <setterParam>setter</setterParam>
+              </beanParam>
+              <domParam>
+                <echo>one</echo>
+                <echo>two</echo>
+                <echo>three</echo>
+                <echo>four</echo>
+              </domParam>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

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

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