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/08/15 14:47:33 UTC
svn commit: r985664 - in
/maven/core-integration-testing/trunk/core-it-suite/src/test:
java/org/apache/maven/it/ resources/mng-4615/ resources/mng-4615/test-0/
resources/mng-4615/test-1/ resources/mng-4615/test-2a/
resources/mng-4615/test-2b/
Author: bentmann
Date: Sun Aug 15 12:47:32 2010
New Revision: 985664
URL: http://svn.apache.org/viewvc?rev=985664&view=rev
Log:
[MNG-4764] @required plugin parameters using default-value with expressions are not validated
o Extended related IT
Added:
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/test-0/
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/test-0/pom.xml (with props)
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/test-1/
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/test-1/pom.xml (with props)
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/test-2a/
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/test-2a/pom.xml (with props)
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/test-2b/
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/test-2b/pom.xml (with props)
Removed:
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/pom.xml
Modified:
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4615ValidateRequiredPluginParameterTest.java
Modified: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4615ValidateRequiredPluginParameterTest.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4615ValidateRequiredPluginParameterTest.java?rev=985664&r1=985663&r2=985664&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4615ValidateRequiredPluginParameterTest.java (original)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4615ValidateRequiredPluginParameterTest.java Sun Aug 15 12:47:32 2010
@@ -41,15 +41,38 @@ public class MavenITmng4615ValidateRequi
/**
* Verify that Maven validates required mojo parameters (and doesn't just have the plugins die with NPEs).
+ * This scenario checks the case of all required parameters being set via plugin configuration.
*/
- public void testit()
+ public void testitAllSet()
throws Exception
{
- File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4615" );
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4615/test-0" );
Verifier verifier = newVerifier( testDir.getAbsolutePath() );
verifier.setAutoclean( false );
verifier.deleteDirectory( "target" );
+ verifier.executeGoal( "validate" );
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ Properties props = verifier.loadProperties( "target/config.properties" );
+ assertEquals( "one", props.get( "requiredParam" ) );
+ assertEquals( "two", props.get( "requiredParamWithDefault" ) );
+ }
+
+ /**
+ * Verify that Maven validates required mojo parameters (and doesn't just have the plugins die with NPEs).
+ * This scenario checks the case of a parameter missing its backing system property.
+ */
+ public void testitExprMissing()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4615/test-1" );
+
+ Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+ verifier.setAutoclean( false );
+ verifier.deleteDirectory( "target" );
+ verifier.setLogFileName( "log-a.txt" );
try
{
verifier.executeGoal( "validate" );
@@ -61,26 +84,80 @@ public class MavenITmng4615ValidateRequi
// expected
}
- // sanity check that adding the param makes it work
+ verifier.resetStreams();
+ }
+
+ /**
+ * Verify that Maven validates required mojo parameters (and doesn't just have the plugins die with NPEs).
+ * This scenario checks the case of a parameter having its backing system property set.
+ */
+ public void testitExprSet()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4615/test-1" );
- verifier.setLogFileName( "log-2.txt" );
- verifier.getCliOptions().add( "-Pmng4615" );
+ Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+ verifier.setAutoclean( false );
verifier.deleteDirectory( "target" );
+ verifier.setSystemProperty( "config.requiredParam", "CLI" );
+ verifier.setLogFileName( "log-b.txt" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
Properties props = verifier.loadProperties( "target/config.properties" );
- assertEquals( "PROFILE", props.get( "requiredParam" ) );
+ assertEquals( "CLI", props.get( "requiredParam" ) );
+ assertEquals( "two", props.get( "requiredParamWithDefault" ) );
+ }
- verifier.setLogFileName( "log-3.txt" );
- verifier.getCliOptions().remove( "-Pmng4615" );
- verifier.setSystemProperty( "config.requiredParam", "CLI" );
+ /**
+ * Verify that Maven validates required mojo parameters (and doesn't just have the plugins die with NPEs).
+ * This scenario checks the case of a parameter missing its backing POM value.
+ */
+ public void testitPomValMissing()
+ throws Exception
+ {
+ // cf. MNG-4764
+ requiresMavenVersion( "[3.0-beta-2,)" );
+
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4615/test-2a" );
+
+ Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+ verifier.setAutoclean( false );
+ verifier.deleteDirectory( "target" );
+ try
+ {
+ verifier.executeGoal( "validate" );
+ verifier.verifyErrorFreeLog();
+ fail( "Build did not fail despite required plugin parameter missing" );
+ }
+ catch ( VerificationException e )
+ {
+ // expected
+ }
+
+ verifier.resetStreams();
+ }
+
+ /**
+ * Verify that Maven validates required mojo parameters (and doesn't just have the plugins die with NPEs).
+ * This scenario checks the case of a parameter having its backing POM value set.
+ */
+ public void testitPomValSet()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4615/test-2b" );
+
+ Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+ verifier.setAutoclean( false );
verifier.deleteDirectory( "target" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
- props = verifier.loadProperties( "target/config.properties" );
- assertEquals( "CLI", props.get( "requiredParam" ) );
-
verifier.resetStreams();
+
+ Properties props = verifier.loadProperties( "target/config.properties" );
+ assertEquals( "one", props.get( "requiredParam" ) );
+ assertEquals( "http://foo.bar/", props.get( "requiredParamWithDefault" ) );
}
}
Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/test-0/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/test-0/pom.xml?rev=985664&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/test-0/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/test-0/pom.xml Sun Aug 15 12:47:32 2010
@@ -0,0 +1,59 @@
+<?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.mng4615</groupId>
+ <artifactId>test</artifactId>
+ <version>0.1</version>
+ <packaging>jar</packaging>
+
+ <name>Maven Integration Test :: MNG-4615</name>
+ <description>
+ Verify that Maven validates required mojo parameters (and doesn't just have the plugins die with NPEs).
+ This scenario checks the case of all required parameters being set via plugin configuration.
+ </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>
+ <requiredParam>one</requiredParam>
+ <requiredParamWithDefault>two</requiredParamWithDefault>
+ </configuration>
+ <executions>
+ <execution>
+ <id>test</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>required-config</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/test-0/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/test-0/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/test-1/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/test-1/pom.xml?rev=985664&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/test-1/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/test-1/pom.xml Sun Aug 15 12:47:32 2010
@@ -0,0 +1,59 @@
+<?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.mng4615</groupId>
+ <artifactId>test</artifactId>
+ <version>0.1</version>
+ <packaging>jar</packaging>
+
+ <name>Maven Integration Test :: MNG-4615</name>
+ <description>
+ Verify that Maven validates required mojo parameters (and doesn't just have the plugins die with NPEs).
+ This scenario checks the case of a parameter missing its backing system property.
+ </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>
+ <!-- missing <requiredParam>one</requiredParam> -->
+ <requiredParamWithDefault>two</requiredParamWithDefault>
+ </configuration>
+ <executions>
+ <execution>
+ <id>test</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>required-config</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/test-1/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/test-1/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/test-2a/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/test-2a/pom.xml?rev=985664&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/test-2a/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/test-2a/pom.xml Sun Aug 15 12:47:32 2010
@@ -0,0 +1,60 @@
+<?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.mng4615</groupId>
+ <artifactId>test</artifactId>
+ <version>0.1</version>
+ <packaging>jar</packaging>
+
+ <name>Maven Integration Test :: MNG-4615</name>
+ <description>
+ Verify that Maven validates required mojo parameters (and doesn't just have the plugins die with NPEs).
+ This scenario checks the case of a parameter missing its backing POM value.
+ </description>
+ <!-- missing: <url>http://foo.bar/</url> -->
+
+ <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>
+ <requiredParam>one</requiredParam>
+ <!-- missing: <requiredParamWithDefault>two</requiredParamWithDefault> -->
+ </configuration>
+ <executions>
+ <execution>
+ <id>test</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>required-config</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/test-2a/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/test-2a/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/test-2b/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/test-2b/pom.xml?rev=985664&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/test-2b/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/test-2b/pom.xml Sun Aug 15 12:47:32 2010
@@ -0,0 +1,60 @@
+<?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.mng4615</groupId>
+ <artifactId>test</artifactId>
+ <version>0.1</version>
+ <packaging>jar</packaging>
+
+ <name>Maven Integration Test :: MNG-4615</name>
+ <description>
+ Verify that Maven validates required mojo parameters (and doesn't just have the plugins die with NPEs).
+ This scenario checks the case of a parameter defaulting to its backing POM value.
+ </description>
+ <url>http://foo.bar/</url>
+
+ <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>
+ <requiredParam>one</requiredParam>
+ <!-- missing: <requiredParamWithDefault>two</requiredParamWithDefault> -->
+ </configuration>
+ <executions>
+ <execution>
+ <id>test</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>required-config</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/test-2b/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4615/test-2b/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision