[MNG-4016] Properties with the prefix project/pom are not interpolated from the properties section

o Added IT

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@739321 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-01-30 16:09:55 +00:00
parent 2f70d84b62
commit b0e0acd544
3 changed files with 137 additions and 0 deletions

View File

@ -90,6 +90,7 @@ public class IntegrationTestSuite
// suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class ); // suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class );
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137 // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
suite.addTestSuite( MavenITmng4016PrefixedPropertyInterpolationTest.class );
suite.addTestSuite( MavenITmng4009InheritProfileEffectsTest.class ); suite.addTestSuite( MavenITmng4009InheritProfileEffectsTest.class );
suite.addTestSuite( MavenITmng4008MergedFilterOrderTest.class ); suite.addTestSuite( MavenITmng4008MergedFilterOrderTest.class );
suite.addTestSuite( MavenITmng4007PlatformFileSeparatorTest.class ); suite.addTestSuite( MavenITmng4007PlatformFileSeparatorTest.class );

View File

@ -0,0 +1,66 @@
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-4016">MNG-4016</a>.
*
* @author Benjamin Bentmann
* @version $Id$
*/
public class MavenITmng4016PrefixedPropertyInterpolationTest
extends AbstractMavenIntegrationTestCase
{
public MavenITmng4016PrefixedPropertyInterpolationTest()
{
super( "(2.1.0-M1,)" );
}
/**
* Test that expressions with the special prefixes "project.", "pom." and "env." can be interpolated from
* properties that include the prefix.
*/
public void testitMNG4016()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4016" );
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
verifier.setAutoclean( false );
verifier.deleteDirectory( "target" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
verifier.assertFilePresent( "target/model.properties" );
Properties props = verifier.loadProperties( "target/model.properties" );
assertEquals( "PASSED-1", props.getProperty( "project.properties.projectProperty" ) );
assertEquals( "PASSED-2", props.getProperty( "project.properties.pomProperty" ) );
assertEquals( "PASSED-3", props.getProperty( "project.properties.envProperty" ) );
}
}

View File

@ -0,0 +1,70 @@
<?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.mng4016</groupId>
<artifactId>test</artifactId>
<version>0.1</version>
<packaging>pom</packaging>
<name>Maven Integration Test :: MNG-4016</name>
<description>
Test that expressions with the special prefixes "project.", "pom." and "env." can be interpolated from
properties that include the prefix.
</description>
<properties>
<!-- source properties for the expressions to evaluate -->
<project.theTestProperty>PASSED-1</project.theTestProperty>
<pom.anotherTestProperty>PASSED-2</pom.anotherTestProperty>
<env.yetAnotherTestProperty>PASSED-3</env.yetAnotherTestProperty>
<!-- interpolation targets -->
<projectProperty>${project.theTestProperty}</projectProperty>
<pomProperty>${pom.anotherTestProperty}</pomProperty>
<envProperty>${env.yetAnotherTestProperty}</envProperty>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-expression</artifactId>
<version>2.1-SNAPSHOT</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>eval</goal>
</goals>
<configuration>
<outputFile>target/model.properties</outputFile>
<expressions>
<expression>project/properties</expression>
</expressions>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>