You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jv...@apache.org on 2014/06/12 03:31:34 UTC

git commit: Integration test for MNG-4565 where we move from multiple activators being AND'd instead of OR'd.

Repository: maven-integration-testing
Updated Branches:
  refs/heads/master ff75308bb -> 159eb5c3c


Integration test for MNG-4565 where we move from multiple activators being AND'd instead of OR'd.


Project: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/commit/159eb5c3
Tree: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/tree/159eb5c3
Diff: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/diff/159eb5c3

Branch: refs/heads/master
Commit: 159eb5c3c3f15fa8cbd474563fae70f7203aea4d
Parents: ff75308
Author: Jason van Zyl <ja...@tesla.io>
Authored: Wed Jun 11 20:35:30 2014 -0400
Committer: Jason van Zyl <ja...@tesla.io>
Committed: Wed Jun 11 20:35:30 2014 -0400

----------------------------------------------------------------------
 ...nITmng3106ProfileMultipleActivatorsTest.java |  2 +-
 ...4565MultiConditionProfileActivationTest.java | 70 +++++++++++++++++
 .../pom.xml                                     | 83 ++++++++++++++++++++
 3 files changed, 154 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/159eb5c3/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3106ProfileMultipleActivatorsTest.java
----------------------------------------------------------------------
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3106ProfileMultipleActivatorsTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3106ProfileMultipleActivatorsTest.java
index 85040c7..0372b1c 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3106ProfileMultipleActivatorsTest.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3106ProfileMultipleActivatorsTest.java
@@ -35,7 +35,7 @@ public class MavenITmng3106ProfileMultipleActivatorsTest
 {
     public MavenITmng3106ProfileMultipleActivatorsTest()
     {
-        super( "(2.0.9,)" );
+        super( "(2.0.9,3.2.2-SNAPSHOT]" );
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/159eb5c3/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4565MultiConditionProfileActivationTest.java
----------------------------------------------------------------------
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4565MultiConditionProfileActivationTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4565MultiConditionProfileActivationTest.java
new file mode 100644
index 0000000..04c984d
--- /dev/null
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4565MultiConditionProfileActivationTest.java
@@ -0,0 +1,70 @@
+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 java.io.File;
+
+import org.apache.maven.it.Verifier;
+import org.apache.maven.it.util.ResourceExtractor;
+
+/**
+ * This is a test set for <a href="http://jira.codehaus.org/browse/MNG-4565">MNG-3106</a>:
+ * 
+ * When multiple activators are present in a profile they should be AND'd. All activator must
+ * conditions must be satisfied in order for the profile to be activated.
+ */
+public class MavenITmng4565MultiConditionProfileActivationTest
+    extends AbstractMavenIntegrationTestCase
+{
+    public MavenITmng4565MultiConditionProfileActivationTest()
+    {
+        super( "(3.2.2-SNAPSHOT,)" );
+    }
+
+    /**
+     * 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-4565-multi-condition-profile-activation" );
+
+        Verifier verifier;
+
+        verifier = newVerifier( testDir.getAbsolutePath() );
+        verifier.setAutoclean( false );
+        verifier.deleteDirectory( "target" );
+        verifier.addCliOption( "-Dprofile1.on=true" );
+        verifier.executeGoal( "validate" );
+
+        //
+        // The property profile1.on = true so only profile1 should be activated. The profile2.on property is not true so profile2 
+        // should not be activated. Only the profile1/touch.txt file should be generated.
+        //
+        verifier.verifyErrorFreeLog();
+        verifier.assertFilePresent( "target/profile1/touch.txt" );
+        verifier.assertFileNotPresent( "target/profile2/touch.txt" );
+        verifier.resetStreams();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/159eb5c3/core-it-suite/src/test/resources/mng-4565-multi-condition-profile-activation/pom.xml
----------------------------------------------------------------------
diff --git a/core-it-suite/src/test/resources/mng-4565-multi-condition-profile-activation/pom.xml b/core-it-suite/src/test/resources/mng-4565-multi-condition-profile-activation/pom.xml
new file mode 100644
index 0000000..15946a5
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-4565-multi-condition-profile-activation/pom.xml
@@ -0,0 +1,83 @@
+<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>
+        <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>profile1-touch</id>
+                <phase>validate</phase>
+                <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>
+                <phase>validate</phase>
+                <goals>
+                  <goal>touch</goal>
+                </goals>
+                <configuration>
+                  <outputDirectory>${project.build.directory}/profile2</outputDirectory>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+</project>