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/30 17:05:54 UTC
svn commit: r929162 - in
/maven/core-integration-testing/trunk/core-it-suite/src/test:
java/org/apache/maven/it/ resources/mng-3122/
Author: bentmann
Date: Tue Mar 30 15:05:53 2010
New Revision: 929162
URL: http://svn.apache.org/viewvc?rev=929162&view=rev
Log:
[MNG-3122] MAVENPROJECT: getActiveProfiles() returning duplicate activeByDefault profile defined in LOCAL_HOME/.m2/settings.xml
o Added IT
Added:
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3122ActiveProfilesNoDuplicatesTest.java (with props)
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3122/
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3122/pom.xml (with props)
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3122/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=929162&r1=929161&r2=929162&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 Tue Mar 30 15:05:53 2010
@@ -367,6 +367,7 @@ public class IntegrationTestSuite
suite.addTestSuite( MavenITmng3203DefaultLifecycleExecIdTest.class );
suite.addTestSuite( MavenITmng3183LoggingToFileTest.class );
suite.addTestSuite( MavenITmng3139UseCachedMetadataOfBlacklistedRepoTest.class );
+ suite.addTestSuite( MavenITmng3122ActiveProfilesNoDuplicatesTest.class );
suite.addTestSuite( MavenITmng3118TestClassPathOrderTest.class );
suite.addTestSuite( MavenITmng3106ProfileMultipleActivatorsTest.class );
suite.addTestSuite( MavenITmng3099SettingsProfilesWithNoPomTest.class );
Added: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3122ActiveProfilesNoDuplicatesTest.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3122ActiveProfilesNoDuplicatesTest.java?rev=929162&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3122ActiveProfilesNoDuplicatesTest.java (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3122ActiveProfilesNoDuplicatesTest.java Tue Mar 30 15:05:53 2010
@@ -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.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-3122">MNG-3122</a>.
+ *
+ * @author Benjamin Bentmann
+ * @version $Id$
+ */
+public class MavenITmng3122ActiveProfilesNoDuplicatesTest
+ extends AbstractMavenIntegrationTestCase
+{
+
+ public MavenITmng3122ActiveProfilesNoDuplicatesTest()
+ {
+ super( "[3.0-alpha-3,)" );
+ }
+
+ /**
+ * Verify that MavenProject.getActiveProfiles() reports profiles from the settings.xml with activeByDefault=true
+ * only once.
+ */
+ public void testitMNG3122()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3122" );
+
+ Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+ verifier.setAutoclean( false );
+ verifier.deleteDirectory( "target" );
+ verifier.getCliOptions().add( "--settings" );
+ verifier.getCliOptions().add( "settings.xml" );
+ verifier.executeGoal( "validate" );
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ Properties props = verifier.loadProperties( "target/profile.properties" );
+ int count = 0;
+ int n = Integer.parseInt( props.getProperty( "project.activeProfiles", "0" ) );
+ for ( int i = 0; i < n; i++ )
+ {
+ if ( "mng3122".equals( props.getProperty( "project.activeProfiles." + i + ".id" ) ) )
+ {
+ count++;
+ }
+ }
+ assertEquals( 1, count );
+ }
+
+}
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3122ActiveProfilesNoDuplicatesTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3122ActiveProfilesNoDuplicatesTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3122/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3122/pom.xml?rev=929162&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3122/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3122/pom.xml Tue Mar 30 15:05:53 2010
@@ -0,0 +1,59 @@
+<?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.mng3122</groupId>
+ <artifactId>test</artifactId>
+ <version>0.1</version>
+
+ <name>Maven Integration Test :: MNG-3122</name>
+ <description>
+ Verify that MavenProject.getActiveProfiles() reports profiles from the settings.xml with activeByDefault=true
+ only once.
+ </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>
+ </expressions>
+ </configuration>
+ <executions>
+ <execution>
+ <id>test</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>eval</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3122/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3122/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3122/settings.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3122/settings.xml?rev=929162&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3122/settings.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3122/settings.xml Tue Mar 30 15:05:53 2010
@@ -0,0 +1,31 @@
+<?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>mng3122</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ </profile>
+ </profiles>
+</settings>
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3122/settings.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3122/settings.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision