You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by pg...@apache.org on 2008/05/15 22:27:52 UTC

svn commit: r656817 - in /maven/core-integration-testing/trunk/core-integration-tests/src/test: java/org/apache/maven/integrationtests/ resources/mng-3106-ProfileMultipleActivators/

Author: pgier
Date: Thu May 15 13:27:52 2008
New Revision: 656817

URL: http://svn.apache.org/viewvc?rev=656817&view=rev
Log:
[MNG-3106] Adding unit test for multiple profile activators.

Added:
    maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3106ProfileMultipleActivators.java   (with props)
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3106-ProfileMultipleActivators/
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3106-ProfileMultipleActivators/pom.xml   (with props)
Modified:
    maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java

Modified: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java?rev=656817&r1=656816&r2=656817&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java (original)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java Thu May 15 13:27:52 2008
@@ -85,6 +85,7 @@
         suite.addTestSuite( MavenITmng3221InfiniteForking.class );
         suite.addTestSuite( MavenITmng3268MultipleDashPCommandLine.class );
         suite.addTestSuite( MavenITmng3220ImportScopeTest.class );
+        suite.addTestSuite( MavenITmng3106ProfileMultipleActivators.class );
         suite.addTestSuite( MavenITmng3099SettingsProfilesWithNoPOM.class );
         suite.addTestSuite( MavenITmng2972OverridePluginDependency.class );
         suite.addTestSuite( MavenITmng2861RelocationsAndRanges.class );

Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3106ProfileMultipleActivators.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3106ProfileMultipleActivators.java?rev=656817&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3106ProfileMultipleActivators.java (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3106ProfileMultipleActivators.java Thu May 15 13:27:52 2008
@@ -0,0 +1,53 @@
+package org.apache.maven.integrationtests;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
+import org.apache.maven.it.Verifier;
+import org.apache.maven.it.util.ResourceExtractor;
+
+/**
+ * Test that profiles with multiple activators are activated 
+ * when any of the activators are on.
+ * 
+ */
+public class MavenITmng3106ProfileMultipleActivators
+    extends AbstractMavenIntegrationTestCase
+{
+    public MavenITmng3106ProfileMultipleActivators()
+        throws InvalidVersionSpecificationException
+    {
+        super( "(2.0.9,)" );
+    }
+
+    /**
+     * Test build with two profiles, each with more than one activator.
+     * The profiles should be activated even though only one of the activators 
+     * returns true.
+     * 
+     */
+    public void testProfilesWithMultipleActivators()
+        throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3106-ProfileMultipleActivators" );
+
+        Verifier verifier;
+
+        verifier = new Verifier( testDir.getAbsolutePath() );
+
+        List cliOptions = new ArrayList();
+        cliOptions.add( "-Dprofile1.on=true" );
+
+        verifier.setCliOptions( cliOptions );
+        verifier.executeGoal( "package" );
+
+        verifier.verifyErrorFreeLog();
+        verifier.assertFilePresent( "target/profile1/touch.txt" );
+        verifier.assertFilePresent( "target/profile2/touch.txt" );
+        verifier.resetStreams();
+
+    }
+
+}

Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3106ProfileMultipleActivators.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3106ProfileMultipleActivators.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3106-ProfileMultipleActivators/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3106-ProfileMultipleActivators/pom.xml?rev=656817&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3106-ProfileMultipleActivators/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3106-ProfileMultipleActivators/pom.xml Thu May 15 13:27:52 2008
@@ -0,0 +1,92 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.its.mng3106</groupId>
+  <artifactId>test-artifact</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.its.plugins</groupId>
+          <artifactId>maven-it-plugin-touch</artifactId>
+          <version>2.1-SNAPSHOT</version>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+  <profiles>
+    <profile>
+      <id>profile1</id>
+      <activation>
+        <property>
+          <name>profile1.on</name>
+          <value>true</value>
+        </property>
+        <jdk>none</jdk>
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.its.plugins</groupId>
+            <artifactId>maven-it-plugin-touch</artifactId>
+            <executions>
+              <execution>
+                <id>profile1-touch</id>
+                <goals>
+                  <goal>touch</goal>
+                </goals>
+                <configuration>
+                  <outputDirectory>${project.build.directory}/profile1</outputDirectory>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+    <profile>
+      <id>profile2</id>
+      <activation>
+        <property>
+          <name>profile2.on</name>
+          <value>true</value>
+        </property>
+        <file>
+          <exists>pom.xml</exists>
+        </file>
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.its.plugins</groupId>
+            <artifactId>maven-it-plugin-touch</artifactId>
+            <executions>
+              <execution>
+                <id>profile2-touch</id>
+                <goals>
+                  <goal>touch</goal>
+                </goals>
+                <configuration>
+                  <outputDirectory>${project.build.directory}/profile2</outputDirectory>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+  <!--remove when the IT plugins are actually release-->
+    <pluginRepositories>
+        <pluginRepository>
+            <id>apache.snapshots</id>
+            <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+            <snapshots>
+                <enabled>true</enabled>
+            </snapshots>
+            <releases>
+                <enabled>false</enabled>
+            </releases>
+        </pluginRepository>
+    </pluginRepositories>
+</project>

Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3106-ProfileMultipleActivators/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3106-ProfileMultipleActivators/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision