From 669dc6041d6bb69a3763758ddc6c0abd4ed727e4 Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Sun, 22 Mar 2009 14:59:46 +0000 Subject: [PATCH] [MNG-2309] Profile activation order is random o Added IT git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@757195 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/maven/it/IntegrationTestSuite.java | 1 + ...venITmng2309ProfileInjectionOrderTest.java | 73 +++++++++++++++ .../src/test/resources/mng-2309/pom.xml | 92 +++++++++++++++++++ .../src/test/resources/mng-2309/profiles.xml | 56 +++++++++++ .../src/test/resources/mng-2309/settings.xml | 56 +++++++++++ 5 files changed, 278 insertions(+) create mode 100644 its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2309ProfileInjectionOrderTest.java create mode 100644 its/core-it-suite/src/test/resources/mng-2309/pom.xml create mode 100644 its/core-it-suite/src/test/resources/mng-2309/profiles.xml create mode 100644 its/core-it-suite/src/test/resources/mng-2309/settings.xml diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java b/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java index 5ce0e454c5..4a2e3fea1c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java @@ -262,6 +262,7 @@ public class IntegrationTestSuite suite.addTestSuite( MavenITmng2362DeployedPomEncodingTest.class ); suite.addTestSuite( MavenITmng2339BadProjectInterpolationTest.class ); suite.addTestSuite( MavenITmng2318LocalParentResolutionTest.class ); + suite.addTestSuite( MavenITmng2309ProfileInjectionOrderTest.class ); suite.addTestSuite( MavenITmng2293CustomPluginParamImplTest.class ); suite.addTestSuite( MavenITmng2277AggregatorAndResolutionPluginsTest.class ); suite.addTestSuite( MavenITmng2254PomEncodingTest.class ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2309ProfileInjectionOrderTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2309ProfileInjectionOrderTest.java new file mode 100644 index 0000000000..d25cd1ba3a --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2309ProfileInjectionOrderTest.java @@ -0,0 +1,73 @@ +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 java.util.Properties; + +import org.apache.maven.it.Verifier; +import org.apache.maven.it.util.ResourceExtractor; + +/** + * This is a test set for MNG-2309. + * + * @author Benjamin Bentmann + * @version $Id$ + */ +public class MavenITmng2309ProfileInjectionOrderTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng2309ProfileInjectionOrderTest() + { + super( "[2.0.5,)" ); + } + + /** + * Test that profiles are injected in declaration order, with the last profile being the most dominant. + */ + public void testitMNG2309() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2309" ); + + Verifier verifier = new Verifier( testDir.getAbsolutePath() ); + verifier.setAutoclean( false ); + verifier.getCliOptions().add( "--settings" ); + verifier.getCliOptions().add( "settings.xml" ); + verifier.getCliOptions().add( "-P" + + "pom-a,pom-b,pom-e,pom-c,pom-d" + + ",profiles-a,profiles-b,profiles-e,profiles-c,profiles-d" + + ",settings-a,settings-b,settings-e,settings-c,settings-d" ); + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + Properties props = verifier.loadProperties( "target/pom.properties" ); + assertEquals( "e", props.getProperty( "project.properties.pomProperty" ) ); + assertEquals( "e", props.getProperty( "project.properties.settingsProperty" ) ); + if ( matchesVersionRange( "(,3.0-alpha-1)" ) ) + { + // MNG-4060, profiles.xml support dropped + assertEquals( "e", props.getProperty( "project.properties.profilesProperty" ) ); + } + } + +} diff --git a/its/core-it-suite/src/test/resources/mng-2309/pom.xml b/its/core-it-suite/src/test/resources/mng-2309/pom.xml new file mode 100644 index 0000000000..aa83ec4fde --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-2309/pom.xml @@ -0,0 +1,92 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng2309 + test + 1.0-SNAPSHOT + jar + + Maven Integration Test :: MNG-2309 + + Test that profiles are injected in declaration order, with the last profile being the most dominant. + + + + + + pom-a + + a + + + + pom-b + + b + + + + pom-c + + c + + + + pom-d + + d + + + + pom-e + + e + + + + + + + + org.apache.maven.its.plugins + maven-it-plugin-expression + 2.1-SNAPSHOT + + + validate + + eval + + + target/pom.properties + + project/properties + + + + + + + + diff --git a/its/core-it-suite/src/test/resources/mng-2309/profiles.xml b/its/core-it-suite/src/test/resources/mng-2309/profiles.xml new file mode 100644 index 0000000000..e7cc6b3876 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-2309/profiles.xml @@ -0,0 +1,56 @@ + + + + + + + + + profiles-a + + a + + + + profiles-b + + b + + + + profiles-c + + c + + + + profiles-d + + d + + + + profiles-e + + e + + + + diff --git a/its/core-it-suite/src/test/resources/mng-2309/settings.xml b/its/core-it-suite/src/test/resources/mng-2309/settings.xml new file mode 100644 index 0000000000..389dc1b274 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-2309/settings.xml @@ -0,0 +1,56 @@ + + + + + + + + + settings-a + + a + + + + settings-b + + b + + + + settings-c + + c + + + + settings-d + + d + + + + settings-e + + e + + + +