You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2009/06/25 14:07:16 UTC

svn commit: r788336 - in /maven/core-integration-testing/trunk/core-it-suite/src/test: java/org/apache/maven/it/ resources/mng-2363/ resources/mng-2363/sub-a/ resources/mng-2363/sub-b/

Author: bentmann
Date: Thu Jun 25 12:07:16 2009
New Revision: 788336

URL: http://svn.apache.org/viewvc?rev=788336&view=rev
Log:
[MNG-2363] <profile><activation><file><exists/> does not work in a multi-project build

o Added IT

Added:
    maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2363BasedirAwareFileActivatorTest.java   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/parent1.txt   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/parent2.txt   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/pom.xml   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/sub-a/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/sub-a/file1.txt   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/sub-a/pom.xml   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/sub-b/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/sub-b/file2.txt   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/sub-b/pom.xml   (with props)
Modified:
    maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java

Modified: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java?rev=788336&r1=788335&r2=788336&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java (original)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java Thu Jun 25 12:07:16 2009
@@ -228,7 +228,7 @@
         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 @@
         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 @@
         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 );

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2363BasedirAwareFileActivatorTest.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2363BasedirAwareFileActivatorTest.java?rev=788336&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2363BasedirAwareFileActivatorTest.java (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2363BasedirAwareFileActivatorTest.java Thu Jun 25 12:07:16 2009
@@ -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" );
+    }
+
+}

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2363BasedirAwareFileActivatorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2363BasedirAwareFileActivatorTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/parent1.txt
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/parent1.txt?rev=788336&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/parent1.txt (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/parent1.txt Thu Jun 25 12:07:16 2009
@@ -0,0 +1 @@
+Dummy file used to trigger profile activation.
\ No newline at end of file

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/parent1.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/parent1.txt
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/parent2.txt
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/parent2.txt?rev=788336&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/parent2.txt (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/parent2.txt Thu Jun 25 12:07:16 2009
@@ -0,0 +1 @@
+Dummy file used to trigger profile activation.
\ No newline at end of file

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/parent2.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/parent2.txt
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/pom.xml?rev=788336&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/pom.xml Thu Jun 25 12:07:16 2009
@@ -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>

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/sub-a/file1.txt
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/sub-a/file1.txt?rev=788336&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/sub-a/file1.txt (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/sub-a/file1.txt Thu Jun 25 12:07:16 2009
@@ -0,0 +1 @@
+Dummy file used to trigger profile activation.
\ No newline at end of file

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/sub-a/file1.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/sub-a/file1.txt
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/sub-a/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/sub-a/pom.xml?rev=788336&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/sub-a/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/sub-a/pom.xml Thu Jun 25 12:07:16 2009
@@ -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>

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/sub-a/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/sub-a/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/sub-b/file2.txt
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/sub-b/file2.txt?rev=788336&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/sub-b/file2.txt (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/sub-b/file2.txt Thu Jun 25 12:07:16 2009
@@ -0,0 +1 @@
+Dummy file used to trigger profile activation.
\ No newline at end of file

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/sub-b/file2.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/sub-b/file2.txt
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/sub-b/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/sub-b/pom.xml?rev=788336&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/sub-b/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/sub-b/pom.xml Thu Jun 25 12:07:16 2009
@@ -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>

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/sub-b/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2363/sub-b/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision