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 2010/03/31 12:44:31 UTC

svn commit: r929469 - in /maven/core-integration-testing/trunk/core-it-suite/src/test: java/org/apache/maven/it/ resources/mng-2848/

Author: bentmann
Date: Wed Mar 31 10:44:30 2010
New Revision: 929469

URL: http://svn.apache.org/viewvc?rev=929469&view=rev
Log:
[MNG-2848] Environment variables in profile activation not working

o Added IT

Added:
    maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2848ProfileActivationByEnvironmentVariableTest.java   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2848/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2848/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=929469&r1=929468&r2=929469&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 Wed Mar 31 10:44:30 2010
@@ -388,6 +388,7 @@ public class IntegrationTestSuite
         suite.addTestSuite( MavenITmng2871PrePackageSubartifactResolutionTest.class );
         suite.addTestSuite( MavenITmng2865MirrorWildcardTest.class );
         suite.addTestSuite( MavenITmng2861RelocationsAndRangesTest.class );
+        suite.addTestSuite( MavenITmng2848ProfileActivationByEnvironmentVariableTest.class );
         suite.addTestSuite( MavenITmng2843PluginConfigPropertiesInjectionTest.class );
         suite.addTestSuite( MavenITmng2831CustomArtifactHandlerAndCustomLifecycleTest.class );
         suite.addTestSuite( MavenITmng2820PomCommentsTest.class );

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2848ProfileActivationByEnvironmentVariableTest.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2848ProfileActivationByEnvironmentVariableTest.java?rev=929469&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2848ProfileActivationByEnvironmentVariableTest.java (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2848ProfileActivationByEnvironmentVariableTest.java Wed Mar 31 10:44:30 2010
@@ -0,0 +1,62 @@
+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.Properties;
+
+/**
+ * This is a test set for <a href="http://jira.codehaus.org/browse/MNG-2848">MNG-2848</a>.
+ * 
+ * @author Benjamin Bentmann
+ */
+public class MavenITmng2848ProfileActivationByEnvironmentVariableTest
+    extends AbstractMavenIntegrationTestCase
+{
+
+    public MavenITmng2848ProfileActivationByEnvironmentVariableTest()
+    {
+        super( "[2.0.9,)" );
+    }
+
+    /**
+     * Test activation of a profile via environment variables.
+     */
+    public void testit()
+        throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2848" );
+
+        Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+        verifier.setAutoclean( false );
+        verifier.deleteDirectory( "target" );
+        verifier.setEnvironmentVariable( "MNG2848", "GO" );
+        verifier.executeGoal( "validate" );
+        verifier.verifyErrorFreeLog();
+        verifier.resetStreams();
+
+        Properties props = verifier.loadProperties( "target/profile.properties" );
+        assertEquals( "PASSED", props.getProperty( "project.properties.testProp" ) );
+    }
+
+}

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

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

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2848/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2848/pom.xml?rev=929469&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2848/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2848/pom.xml Wed Mar 31 10:44:30 2010
@@ -0,0 +1,71 @@
+<?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.mng02848</groupId>
+  <artifactId>test</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <name>Maven Integration Test :: MNG-2848</name> 
+  <description>
+    Test activation of a profile via environment variables.
+  </description>
+  
+  <profiles>
+    <profile>
+      <id>test</id>
+      <activation>
+        <property>
+          <name>env.MNG2848</name>
+          <value>GO</value>
+        </property>
+      </activation>
+      <properties>
+        <testProp>PASSED</testProp>
+      </properties>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.its.plugins</groupId>
+            <artifactId>maven-it-plugin-expression</artifactId>
+            <version>2.1-SNAPSHOT</version>
+            <executions>
+              <execution>
+                <phase>validate</phase>
+                <goals>
+                  <goal>eval</goal>
+                </goals>
+                <configuration>
+                  <outputFile>target/profile.properties</outputFile>
+                  <expressions>
+                    <expression>project/properties</expression>
+                  </expressions>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+</project>

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

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