Author: bentmann
Date: Sat Feb 14 10:48:26 2009
New Revision: 744477

URL: http://svn.apache.org/viewvc?rev=744477&view=rev
Log:
[MNG-3732] [regression] project.getActiveProfiles() has not the same behaviour

o Added IT

Added:
    
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3732ActiveProfilesTest.java
   (with props)
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3732/
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3732/pom.xml
   (with props)
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3732/profiles.xml
   (with props)
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3732/settings.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=744477&r1=744476&r2=744477&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
 Sat Feb 14 10:48:26 2009
@@ -157,6 +157,7 @@
         suite.addTestSuite( MavenITmng3746POMPropertyOverrideTest.class );
         suite.addTestSuite( MavenITmng3743ForkWithPluginManagementTest.class );
         suite.addTestSuite( 
MavenITmng3740SelfReferentialReactorProjectsTest.class );
+        suite.addTestSuite( MavenITmng3732ActiveProfilesTest.class );
         suite.addTestSuite( MavenITmng3729MultiForkAggregatorsTest.class );
         suite.addTestSuite( MavenITmng3724ExecutionProjectSyncTest.class );
         suite.addTestSuite( MavenITmng3723ConcreteParentProjectTest.class );

Added: 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3732ActiveProfilesTest.java
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3732ActiveProfilesTest.java?rev=744477&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3732ActiveProfilesTest.java
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3732ActiveProfilesTest.java
 Sat Feb 14 10:48:26 2009
@@ -0,0 +1,79 @@
+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.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * This is a test set for <a 
href="http://jira.codehaus.org/browse/MNG-3732";>MNG-3732</a>.
+ * 
+ * @author Benjamin Bentmann
+ * @version $Id$
+ */
+public class MavenITmng3732ActiveProfilesTest
+    extends AbstractMavenIntegrationTestCase
+{
+
+    public MavenITmng3732ActiveProfilesTest()
+    {
+        super( "[2.0,)" );
+    }
+
+    /**
+     * Verify that MavenProject.getActiveProfiles() includes profiles from all 
sources.
+     */
+    public void testitMNG3732()
+        throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), 
"/mng-3732" );
+
+        Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+        verifier.setAutoclean( false );
+        verifier.deleteDirectory( "target" );
+        verifier.getCliOptions().add( "--settings" );
+        verifier.getCliOptions().add( "settings.xml" );
+        verifier.getCliOptions().add( "-Ppom,profiles,settings" );
+        verifier.executeGoal( "validate" );
+        verifier.verifyErrorFreeLog();
+        verifier.resetStreams();
+
+        Properties props = verifier.loadProperties( 
"target/profile.properties" );
+        List ids = new ArrayList();
+        ids.add( props.getProperty( "project.activeProfiles.0.id", "" ) );
+        ids.add( props.getProperty( "project.activeProfiles.1.id", "" ) );
+        ids.add( props.getProperty( "project.activeProfiles.2.id", "" ) );
+        Collections.sort( ids );
+        assertEquals( Arrays.asList( new String[] { "pom", "profiles", 
"settings" } ), ids );
+        assertEquals( "3", props.getProperty( "project.activeProfiles" ) );
+
+        assertEquals( "PASSED-1", props.getProperty( 
"project.properties.pomProperty" ) );
+        assertEquals( "PASSED-2", props.getProperty( 
"project.properties.settingsProperty" ) );
+        assertEquals( "PASSED-3", props.getProperty( 
"project.properties.profilesProperty" ) );
+    }
+
+}

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

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

Added: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3732/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3732/pom.xml?rev=744477&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3732/pom.xml
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3732/pom.xml
 Sat Feb 14 10:48:26 2009
@@ -0,0 +1,72 @@
+<?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 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.mng03732</groupId>
+  <artifactId>parent</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <name>Maven Integration Test :: MNG-3732</name>
+  <description>
+    Verify that MavenProject.getActiveProfiles() includes profiles from all 
sources.
+  </description>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.its.plugins</groupId>
+        <artifactId>maven-it-plugin-expression</artifactId>
+        <version>2.1-SNAPSHOT</version>
+        <configuration>
+          <outputFile>target/profile.properties</outputFile>
+          <expressions>
+            <expression>project/activeProfiles</expression>
+            <expression>project/properties</expression>
+          </expressions>
+        </configuration>
+        <executions>
+          <execution>
+            <id>test</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>eval</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+  <profiles>
+    <profile>
+      <id>pom</id>
+      <activation>
+        <activeByDefault>true</activeByDefault>
+      </activation>
+      <properties>
+        <pomProperty>PASSED-1</pomProperty>
+      </properties>
+    </profile>
+  </profiles>
+</project>

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

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

Added: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3732/profiles.xml
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3732/profiles.xml?rev=744477&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3732/profiles.xml
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3732/profiles.xml
 Sat Feb 14 10:48:26 2009
@@ -0,0 +1,34 @@
+<?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.
+-->
+
+<profilesXml>
+  <profiles>
+    <profile>
+      <id>profiles</id>
+      <properties>
+        <profilesProperty>PASSED-3</profilesProperty>
+      </properties>
+    </profile>
+  </profiles>
+  <activeProfiles>
+    <activeProfile>profiles</activeProfile>
+  </activeProfiles>
+</profilesXml>

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

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

Added: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3732/settings.xml
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3732/settings.xml?rev=744477&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3732/settings.xml
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3732/settings.xml
 Sat Feb 14 10:48:26 2009
@@ -0,0 +1,34 @@
+<?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.
+-->
+
+<settings>
+  <profiles>
+    <profile>
+      <id>settings</id>
+      <properties>
+        <settingsProperty>PASSED-2</settingsProperty>
+      </properties>
+    </profile>
+  </profiles>
+  <activeProfiles>
+    <activeProfile>settings</activeProfile>
+  </activeProfiles>
+</settings>

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

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


Reply via email to