From 74176ac1737a471f80af584d5021cd6d81e48604 Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Fri, 26 Dec 2008 17:34:31 +0000 Subject: [PATCH] [MNG-3944] [regression] POMs with unusual file names don't get ${basedir} interpolated o Added IT git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@729515 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/maven/it/IntegrationTestSuite.java | 1 + ...avenITmng3944BasedirInterpolationTest.java | 66 +++++++++++++++++++ .../mng-3944/pom-with-unusual-name.xml | 63 ++++++++++++++++++ 3 files changed, 130 insertions(+) create mode 100644 its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3944BasedirInterpolationTest.java create mode 100644 its/core-it-suite/src/test/resources/mng-3944/pom-with-unusual-name.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 65ecc6b0f5..64f56b52fd 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( MavenITmng3944BasedirInterpolationTest.class ); suite.addTestSuite( MavenITmng3943PluginExecutionInheritanceTest.class ); suite.addTestSuite( MavenITmng3940EnvVarInterpolationTest.class ); suite.addTestSuite( MavenITmng3938MergePluginExecutionsTest.class ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3944BasedirInterpolationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3944BasedirInterpolationTest.java new file mode 100644 index 0000000000..797e9c3134 --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3944BasedirInterpolationTest.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 org.apache.maven.it.util.Os; + +import java.io.File; +import java.util.Properties; + +/** + * This is a test set for MNG-3944. + * + * @author Benjamin Bentmann + * @version $Id$ + */ +public class MavenITmng3944BasedirInterpolationTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng3944BasedirInterpolationTest() + { + } + + /** + * Test that interpolation of ${basedir} works for a POM that is not named "pom.xml" + */ + public void testitMNG3944() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3944" ); + + Verifier verifier = new Verifier( testDir.getAbsolutePath() ); + verifier.setAutoclean( false ); + verifier.deleteDirectory( "target" ); + verifier.getCliOptions().add( "-f" ); + verifier.getCliOptions().add( new File( testDir, "pom-with-unusual-name.xml" ).getAbsolutePath() ); + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + verifier.assertFilePresent( "target/basedir.properties" ); + Properties props = verifier.loadProperties( "target/basedir.properties" ); + assertEquals( testDir, new File( props.getProperty( "project.properties.prop0" ) ) ); + assertEquals( testDir, new File( props.getProperty( "project.properties.prop1" ) ) ); + } + +} diff --git a/its/core-it-suite/src/test/resources/mng-3944/pom-with-unusual-name.xml b/its/core-it-suite/src/test/resources/mng-3944/pom-with-unusual-name.xml new file mode 100644 index 0000000000..f03073d3ce --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-3944/pom-with-unusual-name.xml @@ -0,0 +1,63 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng3944 + test1 + 1.0-SNAPSHOT + + Maven Integration Test :: MNG-3944 + + Test that interpolation of ${basedir} works for a POM that is not named "pom.xml" + + + + + ${basedir} + ${project.basedir} + + + + + + org.apache.maven.its.plugins + maven-it-plugin-expression + 2.1-SNAPSHOT + + + validate + + eval + + + target/basedir.properties + + project/properties + + + + + + + +