From b0e0acd544598ad8dd49a98de170699e3992a513 Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Fri, 30 Jan 2009 16:09:55 +0000 Subject: [PATCH] [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 --- .../apache/maven/it/IntegrationTestSuite.java | 1 + ...4016PrefixedPropertyInterpolationTest.java | 66 +++++++++++++++++ .../src/test/resources/mng-4016/pom.xml | 70 +++++++++++++++++++ 3 files changed, 137 insertions(+) create mode 100644 its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4016PrefixedPropertyInterpolationTest.java create mode 100644 its/core-it-suite/src/test/resources/mng-4016/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 f76f939293..db0c85a844 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 @@ -90,6 +90,7 @@ public class IntegrationTestSuite // suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class ); // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137 + suite.addTestSuite( MavenITmng4016PrefixedPropertyInterpolationTest.class ); suite.addTestSuite( MavenITmng4009InheritProfileEffectsTest.class ); suite.addTestSuite( MavenITmng4008MergedFilterOrderTest.class ); suite.addTestSuite( MavenITmng4007PlatformFileSeparatorTest.class ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4016PrefixedPropertyInterpolationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4016PrefixedPropertyInterpolationTest.java new file mode 100644 index 0000000000..cd042cee4d --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4016PrefixedPropertyInterpolationTest.java @@ -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 MNG-4016. + * + * @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" ) ); + } + +} diff --git a/its/core-it-suite/src/test/resources/mng-4016/pom.xml b/its/core-it-suite/src/test/resources/mng-4016/pom.xml new file mode 100644 index 0000000000..28f84d27c3 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4016/pom.xml @@ -0,0 +1,70 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4016 + test + 0.1 + pom + + Maven Integration Test :: MNG-4016 + + Test that expressions with the special prefixes "project.", "pom." and "env." can be interpolated from + properties that include the prefix. + + + + + PASSED-1 + PASSED-2 + PASSED-3 + + ${project.theTestProperty} + ${pom.anotherTestProperty} + ${env.yetAnotherTestProperty} + + + + + + org.apache.maven.its.plugins + maven-it-plugin-expression + 2.1-SNAPSHOT + + + validate + + eval + + + target/model.properties + + project/properties + + + + + + + +