[MNG-2363] <profile><activation><file><exists/> 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
This commit is contained in:
Benjamin Bentmann 2009-06-25 12:07:16 +00:00
parent 3c7b487ca9
commit 1b3b083744
9 changed files with 320 additions and 2 deletions

View File

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

View File

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

View File

@ -0,0 +1 @@
Dummy file used to trigger profile activation.

View File

@ -0,0 +1 @@
Dummy file used to trigger profile activation.

View File

@ -0,0 +1,159 @@
<?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.mng2363</groupId>
<artifactId>parent</artifactId>
<version>0.1</version>
<packaging>pom</packaging>
<name>Maven Integration Test :: MNG-2363</name>
<description>
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.
</description>
<modules>
<module>sub-a</module>
<module>sub-b</module>
</modules>
<profiles>
<profile>
<id>relative-path-1</id>
<activation>
<file>
<exists>file1.txt</exists>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-log-file</artifactId>
<version>2.1-SNAPSHOT</version>
<executions>
<execution>
<id>test-1</id>
<phase>validate</phase>
<configuration>
<logFile>target/file1.txt</logFile>
</configuration>
<goals>
<goal>reset</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>relative-path-2</id>
<activation>
<file>
<exists>parent1.txt</exists>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-log-file</artifactId>
<version>2.1-SNAPSHOT</version>
<executions>
<execution>
<id>test-2</id>
<phase>validate</phase>
<configuration>
<logFile>target/parent1.txt</logFile>
</configuration>
<goals>
<goal>reset</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>basedir-path-1</id>
<activation>
<file>
<exists>${basedir}/file2.txt</exists>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-log-file</artifactId>
<version>2.1-SNAPSHOT</version>
<executions>
<execution>
<id>test-3</id>
<phase>validate</phase>
<configuration>
<logFile>target/file2.txt</logFile>
</configuration>
<goals>
<goal>reset</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>basedir-path-2</id>
<activation>
<file>
<exists>${basedir}/parent2.txt</exists>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-log-file</artifactId>
<version>2.1-SNAPSHOT</version>
<executions>
<execution>
<id>test-4</id>
<phase>validate</phase>
<configuration>
<logFile>target/parent2.txt</logFile>
</configuration>
<goals>
<goal>reset</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -0,0 +1 @@
Dummy file used to trigger profile activation.

View File

@ -0,0 +1,38 @@
<?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>
<parent>
<groupId>org.apache.maven.its.mng2363</groupId>
<artifactId>parent</artifactId>
<version>0.1</version>
</parent>
<artifactId>sub-a</artifactId>
<name>Maven Integration Test :: MNG-2363 :: Sub-A</name>
<description>
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.
</description>
</project>

View File

@ -0,0 +1 @@
Dummy file used to trigger profile activation.

View File

@ -0,0 +1,38 @@
<?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>
<parent>
<groupId>org.apache.maven.its.mng2363</groupId>
<artifactId>parent</artifactId>
<version>0.1</version>
</parent>
<artifactId>sub-b</artifactId>
<name>Maven Integration Test :: MNG-2363 :: Sub-B</name>
<description>
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.
</description>
</project>