From be94ddadbe1b87606847a2783676cf373f077358 Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Sat, 6 Dec 2008 13:33:33 +0000 Subject: [PATCH] [MNG-848] assigning a default value in the java code of a mojo seems to take precedence over expression [MNG-866] default-value no longer allows expressions o Added ITs git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@723980 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/maven/it/IntegrationTestSuite.java | 2 + ...48SystemPropOverridesDefaultValueTest.java | 65 +++++++++++++++++++ ...avenITmng0866EvaluateDefaultValueTest.java | 63 ++++++++++++++++++ .../src/test/resources/mng-0848/pom.xml | 54 +++++++++++++++ .../src/test/resources/mng-0866/pom.xml | 54 +++++++++++++++ 5 files changed, 238 insertions(+) create mode 100644 its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0848SystemPropOverridesDefaultValueTest.java create mode 100644 its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0866EvaluateDefaultValueTest.java create mode 100644 its/core-it-suite/src/test/resources/mng-0848/pom.xml create mode 100644 its/core-it-suite/src/test/resources/mng-0866/pom.xml diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java b/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java index 6f3cbe722e..46cab38f50 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java @@ -209,6 +209,8 @@ public class IntegrationTestSuite suite.addTestSuite( MavenITmng1415QuotedSystemPropertiesTest.class ); suite.addTestSuite( MavenITmng1412DependenciesOrderTest.class ); suite.addTestSuite( MavenITmng1323AntrunDependenciesTest.class ); + suite.addTestSuite( MavenITmng0866EvaluateDefaultValueTest.class ); + suite.addTestSuite( MavenITmng0848SystemPropOverridesDefaultValueTest.class ); suite.addTestSuite( MavenITmng0836PluginParentResolutionTest.class ); suite.addTestSuite( MavenITmng0522PluginMgmtConfigTest.class ); suite.addTestSuite( MavenITmng0507ArtifactRelocationTest.class ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0848SystemPropOverridesDefaultValueTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0848SystemPropOverridesDefaultValueTest.java new file mode 100644 index 0000000000..0465fa3e51 --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0848SystemPropOverridesDefaultValueTest.java @@ -0,0 +1,65 @@ +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 MNG-848. + * + * @author Benjamin Bentmann + * @version $Id$ + */ +public class MavenITmng0848SystemPropOverridesDefaultValueTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng0848SystemPropOverridesDefaultValueTest() + { + } + + /** + * Test that execution/system properties take precedence over default value of plugin parameters. + */ + public void testitMNG848() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0848" ); + + Verifier verifier = new Verifier( testDir.getAbsolutePath() ); + verifier.setAutoclean( false ); + verifier.deleteDirectory( "target" ); + Properties sysProps = new Properties(); + sysProps.setProperty( "config.aliasDefaultExpressionParam", "PASSED" ); + verifier.setSystemProperties( sysProps ); + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + Properties configProps = verifier.loadProperties( "target/config.properties" ); + assertEquals( "maven-core-it", configProps.getProperty( "defaultParam" ) ); + assertEquals( "PASSED", configProps.getProperty( "aliasDefaultExpressionParam" ) ); + } + +} diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0866EvaluateDefaultValueTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0866EvaluateDefaultValueTest.java new file mode 100644 index 0000000000..38b960e727 --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0866EvaluateDefaultValueTest.java @@ -0,0 +1,63 @@ +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 MNG-866 and + * MNG-160. + * + * @author Benjamin Bentmann + * @version $Id$ + */ +public class MavenITmng0866EvaluateDefaultValueTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng0866EvaluateDefaultValueTest() + { + } + + /** + * Test that expressions inside the default value of plugin parameters are evaluated. + */ + public void testitMNG866() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0866" ); + + Verifier verifier = new Verifier( testDir.getAbsolutePath() ); + verifier.setAutoclean( false ); + verifier.deleteDirectory( "target" ); + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + Properties configProps = verifier.loadProperties( "target/config.properties" ); + assertEquals( "maven-core-it", configProps.getProperty( "defaultParam" ) ); + assertEquals( "org.apache.maven.its.mng0866:test:1.0-SNAPSHOT", configProps.getProperty( "defaultParamWithExpression" ) ); + } + +} diff --git a/its/core-it-suite/src/test/resources/mng-0848/pom.xml b/its/core-it-suite/src/test/resources/mng-0848/pom.xml new file mode 100644 index 0000000000..fcae484778 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-0848/pom.xml @@ -0,0 +1,54 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng0848 + test + 1.0-SNAPSHOT + + Maven Integration Test :: MNG-848 + + Test that execution/system properties take precedence over default value of plugin parameters. + + + + + + org.apache.maven.its.plugins + maven-it-plugin-configuration + 2.1-SNAPSHOT + + + validate + + config + + + target/config.properties + + + + + + + diff --git a/its/core-it-suite/src/test/resources/mng-0866/pom.xml b/its/core-it-suite/src/test/resources/mng-0866/pom.xml new file mode 100644 index 0000000000..61d8bf19b6 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-0866/pom.xml @@ -0,0 +1,54 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng0866 + test + 1.0-SNAPSHOT + + Maven Integration Test :: MNG-866 + + Test that expressions inside the default value of plugin parameters are evaluated. + + + + + + org.apache.maven.its.plugins + maven-it-plugin-configuration + 2.1-SNAPSHOT + + + validate + + config + + + target/config.properties + + + + + + +