[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
This commit is contained in:
Benjamin Bentmann 2008-12-06 13:33:33 +00:00
parent d044fec8ec
commit be94ddadbe
5 changed files with 238 additions and 0 deletions

View File

@ -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 );

View File

@ -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 <a href="http://jira.codehaus.org/browse/MNG-848">MNG-848</a>.
*
* @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" ) );
}
}

View File

@ -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 <a href="http://jira.codehaus.org/browse/MNG-866">MNG-866</a> and
* <a href="http://jira.codehaus.org/browse/MNG-160">MNG-160</a>.
*
* @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" ) );
}
}

View File

@ -0,0 +1,54 @@
<?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.mng0848</groupId>
<artifactId>test</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Maven Integration Test :: MNG-848</name>
<description>
Test that execution/system properties take precedence over default value of plugin parameters.
</description>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-configuration</artifactId>
<version>2.1-SNAPSHOT</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>config</goal>
</goals>
<configuration>
<propertiesFile>target/config.properties</propertiesFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,54 @@
<?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.mng0866</groupId>
<artifactId>test</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Maven Integration Test :: MNG-866</name>
<description>
Test that expressions inside the default value of plugin parameters are evaluated.
</description>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-configuration</artifactId>
<version>2.1-SNAPSHOT</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>config</goal>
</goals>
<configuration>
<propertiesFile>target/config.properties</propertiesFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>