maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r800721 - in /maven/core-integration-testing/trunk/core-it-suite/src/test: java/org/apache/maven/it/MavenITmng3203DefaultLifecycleExecIdTest.java java/org/apache/maven/it/MavenITmng3401CLIDefaultExecIdTest.java resources/mng-3401/pom.xml
Date Tue, 04 Aug 2009 10:16:20 GMT
Author: bentmann
Date: Tue Aug  4 10:16:20 2009
New Revision: 800721

URL: http://svn.apache.org/viewvc?rev=800721&view=rev
Log:
[MNG-4280] [regression] Direct CLI invocation of goal causes "default-cli" config to be processed
twice, duplicating list values

o Strengthened existing IT to check configuration handling in detail

Modified:
    maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3203DefaultLifecycleExecIdTest.java
    maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3401CLIDefaultExecIdTest.java
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3401/pom.xml

Modified: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3203DefaultLifecycleExecIdTest.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3203DefaultLifecycleExecIdTest.java?rev=800721&r1=800720&r2=800721&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3203DefaultLifecycleExecIdTest.java
(original)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3203DefaultLifecycleExecIdTest.java
Tue Aug  4 10:16:20 2009
@@ -23,7 +23,6 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
 import org.apache.maven.it.AbstractMavenIntegrationTestCase;
 import org.apache.maven.it.Verifier;
 import org.apache.maven.it.util.ResourceExtractor;
@@ -40,10 +39,10 @@
 public class MavenITmng3203DefaultLifecycleExecIdTest
     extends AbstractMavenIntegrationTestCase
 {
+
     public MavenITmng3203DefaultLifecycleExecIdTest()
-        throws InvalidVersionSpecificationException
     {
-        super( "(2.1.99,)" );
+        super( "[2.2.0,)" );
     }
 
     public void testitMNG3203 ()

Modified: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3401CLIDefaultExecIdTest.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3401CLIDefaultExecIdTest.java?rev=800721&r1=800720&r2=800721&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3401CLIDefaultExecIdTest.java
(original)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3401CLIDefaultExecIdTest.java
Tue Aug  4 10:16:20 2009
@@ -1,3 +1,5 @@
+package org.apache.maven.it;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -17,57 +19,53 @@
  * under the License.
  */
 
-package org.apache.maven.it;
-
 import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.Properties;
 
-import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
-import org.apache.maven.it.AbstractMavenIntegrationTestCase;
-import org.apache.maven.it.Verifier;
-import org.apache.maven.it.VerificationException;
 import org.apache.maven.it.util.ResourceExtractor;
 
 /**
  * This is a test set for <a href="http://jira.codehaus.org/browse/MNG-3401">MNG-3401</a>.
- *
- * @todo Fill in a better description of what this test verifies!
  * 
  * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
  * @author jdcasey
- * 
  */
 public class MavenITmng3401CLIDefaultExecIdTest
     extends AbstractMavenIntegrationTestCase
 {
+
     public MavenITmng3401CLIDefaultExecIdTest()
-        throws InvalidVersionSpecificationException
     {
-        super( "(2.1.99,)" );
+        super( "[2.2.0,)" );
     }
 
-    public void testitMNG3401 ()
+    /**
+     * Test that the configuration of an execution block with the id "default-cli" applies
to direct CLI
+     * invocations of a goal as well.
+     */
+    public void testitMNG3401()
         throws Exception
     {
-        // The testdir is computed from the location of this
-        // file.
         File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3401"
);
 
         Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+        verifier.setAutoclean( false );
+        verifier.deleteDirectory( "target" );
+        verifier.executeGoal( "org.apache.maven.its.plugins:maven-it-plugin-configuration:2.1-SNAPSHOT:config"
);
+        verifier.verifyErrorFreeLog();
+        verifier.resetStreams();
 
-		try
-		{
-	        verifier.executeGoal( "org.apache.maven.its.plugins:maven-it-plugin-touch:touch"
);
-
-	        verifier.verifyErrorFreeLog();
-	        fail( "Failed to incorporate 'default-cli' execution for touch mojo." );
-		}
-		catch ( VerificationException e )
-		{
-			// expected
-		}
+        Properties props = verifier.loadProperties( "target/config.properties" );
 
-        verifier.resetStreams();
+        assertEquals( "PASSED", props.getProperty( "stringParam" ) );
+
+        assertEquals( "4", props.getProperty( "stringParams" ) );
+        assertEquals( "a", props.getProperty( "stringParams.0" ) );
+        assertEquals( "c", props.getProperty( "stringParams.1" ) );
+        assertEquals( "b", props.getProperty( "stringParams.2" ) );
+        assertEquals( "d", props.getProperty( "stringParams.3" ) );
+
+        assertEquals( "maven-core-it", props.getProperty( "defaultParam" ) );
     }
+
 }

Modified: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3401/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3401/pom.xml?rev=800721&r1=800720&r2=800721&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3401/pom.xml
(original)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3401/pom.xml
Tue Aug  4 10:16:20 2009
@@ -5,18 +5,37 @@
   <artifactId>mng-3401</artifactId>
   <version>1</version>
   <packaging>pom</packaging>
+
+  <name>Maven Integration Test :: MNG-3401</name>
+  <description>
+    Test that the configuration of an execution block with the id "default-cli" applies to
direct CLI
+    invocations of a goal as well.
+  </description>
   
   <build>
     <plugins>
       <plugin>
         <groupId>org.apache.maven.its.plugins</groupId>
-        <artifactId>maven-it-plugin-touch</artifactId>
+        <artifactId>maven-it-plugin-configuration</artifactId>
         <version>2.1-SNAPSHOT</version>
+        <configuration>
+          <!-- plugin-level config still applies as well but is recessive -->
+          <propertiesFile>target/config.properties</propertiesFile>
+          <stringParam>FAILED</stringParam>
+        </configuration>
         <executions>
           <execution>
             <id>default-cli</id>
             <configuration>
-              <fail>true</fail>
+              <stringParam>PASSED</stringParam>
+              <!-- NOTE: Intentionally using append mode here to check the config gets
processed only once -->
+              <stringParams combine.children="append">
+                <!-- NOTE: These values are deliberately not in alpha order! -->
+                <stringParam>a</stringParam>
+                <stringParam>c</stringParam>
+                <stringParam>b</stringParam>
+                <stringParam>d</stringParam>
+              </stringParams>
             </configuration>
           </execution>
         </executions>



Mime
View raw message