From 1b3b08374448aef4547669abb0c7175cbc873b02 Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Thu, 25 Jun 2009 12:07:16 +0000 Subject: [PATCH] [MNG-2363] does not work in a multi-project build o Added IT git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@788336 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/maven/it/IntegrationTestSuite.java | 5 +- ...Tmng2363BasedirAwareFileActivatorTest.java | 78 +++++++++ .../src/test/resources/mng-2363/parent1.txt | 1 + .../src/test/resources/mng-2363/parent2.txt | 1 + .../src/test/resources/mng-2363/pom.xml | 159 ++++++++++++++++++ .../test/resources/mng-2363/sub-a/file1.txt | 1 + .../src/test/resources/mng-2363/sub-a/pom.xml | 38 +++++ .../test/resources/mng-2363/sub-b/file2.txt | 1 + .../src/test/resources/mng-2363/sub-b/pom.xml | 38 +++++ 9 files changed, 320 insertions(+), 2 deletions(-) create mode 100644 its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2363BasedirAwareFileActivatorTest.java create mode 100644 its/core-it-suite/src/test/resources/mng-2363/parent1.txt create mode 100644 its/core-it-suite/src/test/resources/mng-2363/parent2.txt create mode 100644 its/core-it-suite/src/test/resources/mng-2363/pom.xml create mode 100644 its/core-it-suite/src/test/resources/mng-2363/sub-a/file1.txt create mode 100644 its/core-it-suite/src/test/resources/mng-2363/sub-a/pom.xml create mode 100644 its/core-it-suite/src/test/resources/mng-2363/sub-b/file2.txt create mode 100644 its/core-it-suite/src/test/resources/mng-2363/sub-b/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 b17be28d62..e6383bb44a 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 @@ -228,7 +228,7 @@ public class IntegrationTestSuite suite.addTestSuite( MavenITmng3428PluginDescriptorArtifactsIncompleteTest.class ); suite.addTestSuite( MavenITmng3422ActiveComponentCollectionTest.class ); suite.addTestSuite( MavenITmng3415JunkRepositoryMetadataTest.class ); - suite.addTestSuite( MavenITmng3401CLIDefaultExecIdTest.class ); + suite.addTestSuite( MavenITmng3401CLIDefaultExecIdTest.class ); suite.addTestSuite( MavenITmng3396DependencyManagementForOverConstrainedRangesTest.class ); suite.addTestSuite( MavenITmng3394POMPluginVersionDominanceTest.class ); suite.addTestSuite( MavenITmng3380ManagedRelocatedTransdepsTest.class ); @@ -245,7 +245,7 @@ public class IntegrationTestSuite suite.addTestSuite( MavenITmng3259DepsDroppedInMultiModuleBuildTest.class ); suite.addTestSuite( MavenITmng3220ImportScopeTest.class ); suite.addTestSuite( MavenITmng3217InterPluginDependencyTest.class ); - suite.addTestSuite( MavenITmng3203DefaultLifecycleExecIdTest.class ); + suite.addTestSuite( MavenITmng3203DefaultLifecycleExecIdTest.class ); suite.addTestSuite( MavenITmng3139UseCachedMetadataOfBlacklistedRepoTest.class ); suite.addTestSuite( MavenITmng3118TestClassPathOrderTest.class ); suite.addTestSuite( MavenITmng3106ProfileMultipleActivatorsTest.class ); @@ -280,6 +280,7 @@ public class IntegrationTestSuite suite.addTestSuite( MavenITmng2539PluginDependenciesComeFromPluginReposTest.class ); suite.addTestSuite( MavenITmng2432PluginPrefixOrderTest.class ); suite.addTestSuite( MavenITmng2387InactiveProxyTest.class ); + suite.addTestSuite( MavenITmng2363BasedirAwareFileActivatorTest.class ); suite.addTestSuite( MavenITmng2362DeployedPomEncodingTest.class ); suite.addTestSuite( MavenITmng2339BadProjectInterpolationTest.class ); suite.addTestSuite( MavenITmng2318LocalParentResolutionTest.class ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2363BasedirAwareFileActivatorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2363BasedirAwareFileActivatorTest.java new file mode 100644 index 0000000000..8c8b5bdfc3 --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2363BasedirAwareFileActivatorTest.java @@ -0,0 +1,78 @@ +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.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * This is a test set for MNG-2363. + * + * @author Benjamin Bentmann + */ +public class MavenITmng2363BasedirAwareFileActivatorTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng2363BasedirAwareFileActivatorTest() + { + super( "[3.0-alpha-3,)" ); + } + + /** + * Test that the file-based profile activator resolves relative paths against the current project's base directory + * and also interpolates ${basedir} if explicitly given, just like usual for other parts of the POM. + */ + public void testit() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2363" ); + + Verifier verifier = new Verifier( testDir.getAbsolutePath() ); + verifier.setAutoclean( false ); + verifier.deleteDirectory( "target" ); + verifier.deleteDirectory( "sub-a/target" ); + verifier.deleteDirectory( "sub-b/target" ); + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + verifier.assertFilePresent( "target/parent1.txt" ); + verifier.assertFilePresent( "target/parent2.txt" ); + verifier.assertFileNotPresent( "target/file1.txt" ); + verifier.assertFileNotPresent( "target/file2.txt" ); + + verifier.assertFileNotPresent( "sub-a/target/parent1.txt" ); + verifier.assertFileNotPresent( "sub-a/target/parent2.txt" ); + verifier.assertFilePresent( "sub-a/target/file1.txt" ); + verifier.assertFileNotPresent( "sub-a/target/file2.txt" ); + + verifier.assertFileNotPresent( "sub-b/target/parent1.txt" ); + verifier.assertFileNotPresent( "sub-b/target/parent2.txt" ); + verifier.assertFileNotPresent( "sub-b/target/file1.txt" ); + verifier.assertFilePresent( "sub-b/target/file2.txt" ); + } + +} diff --git a/its/core-it-suite/src/test/resources/mng-2363/parent1.txt b/its/core-it-suite/src/test/resources/mng-2363/parent1.txt new file mode 100644 index 0000000000..fcad7f5e80 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-2363/parent1.txt @@ -0,0 +1 @@ +Dummy file used to trigger profile activation. \ No newline at end of file diff --git a/its/core-it-suite/src/test/resources/mng-2363/parent2.txt b/its/core-it-suite/src/test/resources/mng-2363/parent2.txt new file mode 100644 index 0000000000..fcad7f5e80 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-2363/parent2.txt @@ -0,0 +1 @@ +Dummy file used to trigger profile activation. \ No newline at end of file diff --git a/its/core-it-suite/src/test/resources/mng-2363/pom.xml b/its/core-it-suite/src/test/resources/mng-2363/pom.xml new file mode 100644 index 0000000000..f866c616ae --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-2363/pom.xml @@ -0,0 +1,159 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng2363 + parent + 0.1 + pom + + Maven Integration Test :: MNG-2363 + + Test that the file-based profile activator resolves relative paths against the current project's base directory + and also interpolates ${basedir} if explicitly given, just like usual for other parts of the POM. + + + + sub-a + sub-b + + + + + relative-path-1 + + + file1.txt + + + + + + org.apache.maven.its.plugins + maven-it-plugin-log-file + 2.1-SNAPSHOT + + + test-1 + validate + + target/file1.txt + + + reset + + + + + + + + + relative-path-2 + + + parent1.txt + + + + + + org.apache.maven.its.plugins + maven-it-plugin-log-file + 2.1-SNAPSHOT + + + test-2 + validate + + target/parent1.txt + + + reset + + + + + + + + + basedir-path-1 + + + ${basedir}/file2.txt + + + + + + org.apache.maven.its.plugins + maven-it-plugin-log-file + 2.1-SNAPSHOT + + + test-3 + validate + + target/file2.txt + + + reset + + + + + + + + + basedir-path-2 + + + ${basedir}/parent2.txt + + + + + + org.apache.maven.its.plugins + maven-it-plugin-log-file + 2.1-SNAPSHOT + + + test-4 + validate + + target/parent2.txt + + + reset + + + + + + + + + diff --git a/its/core-it-suite/src/test/resources/mng-2363/sub-a/file1.txt b/its/core-it-suite/src/test/resources/mng-2363/sub-a/file1.txt new file mode 100644 index 0000000000..fcad7f5e80 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-2363/sub-a/file1.txt @@ -0,0 +1 @@ +Dummy file used to trigger profile activation. \ No newline at end of file diff --git a/its/core-it-suite/src/test/resources/mng-2363/sub-a/pom.xml b/its/core-it-suite/src/test/resources/mng-2363/sub-a/pom.xml new file mode 100644 index 0000000000..e1fd6f4026 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-2363/sub-a/pom.xml @@ -0,0 +1,38 @@ + + + + + + 4.0.0 + + + org.apache.maven.its.mng2363 + parent + 0.1 + + + sub-a + + Maven Integration Test :: MNG-2363 :: Sub-A + + Test that the file-based profile activator resolves relative paths against the current project's base directory + and also interpolates ${basedir} if explicitly given, just like usual for other parts of the POM. + + diff --git a/its/core-it-suite/src/test/resources/mng-2363/sub-b/file2.txt b/its/core-it-suite/src/test/resources/mng-2363/sub-b/file2.txt new file mode 100644 index 0000000000..fcad7f5e80 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-2363/sub-b/file2.txt @@ -0,0 +1 @@ +Dummy file used to trigger profile activation. \ No newline at end of file diff --git a/its/core-it-suite/src/test/resources/mng-2363/sub-b/pom.xml b/its/core-it-suite/src/test/resources/mng-2363/sub-b/pom.xml new file mode 100644 index 0000000000..ea62ba12e7 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-2363/sub-b/pom.xml @@ -0,0 +1,38 @@ + + + + + + 4.0.0 + + + org.apache.maven.its.mng2363 + parent + 0.1 + + + sub-b + + Maven Integration Test :: MNG-2363 :: Sub-B + + Test that the file-based profile activator resolves relative paths against the current project's base directory + and also interpolates ${basedir} if explicitly given, just like usual for other parts of the POM. + +