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 64f56b52fd..54364e5c0a 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 @@ -95,6 +95,7 @@ public class IntegrationTestSuite suite.addTestSuite( MavenITmng3940EnvVarInterpolationTest.class ); suite.addTestSuite( MavenITmng3938MergePluginExecutionsTest.class ); suite.addTestSuite( MavenITmng3937MergedPluginExecutionGoalsTest.class ); + suite.addTestSuite( MavenITmng3933OsTriggeredExternalProfileTest.class ); suite.addTestSuite( MavenITmng3927PluginDefaultExecutionConfigTest.class ); suite.addTestSuite( MavenITmng3925MergedPluginExecutionOrderTest.class ); suite.addTestSuite( MavenITmng3924XmlMarkupInterpolationTest.class ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3933OsTriggeredExternalProfileTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3933OsTriggeredExternalProfileTest.java new file mode 100644 index 0000000000..5386a09659 --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3933OsTriggeredExternalProfileTest.java @@ -0,0 +1,72 @@ +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 org.apache.maven.it.util.Os; + +import java.io.File; +import java.util.Properties; + +/** + * This is a test set for MNG-3933. + * + * @author Benjamin Bentmann + * @version $Id$ + */ +public class MavenITmng3933OsTriggeredExternalProfileTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng3933OsTriggeredExternalProfileTest() + { + super( "(2.0.10,2.1.0-M1),(2.1.0-M1,)" ); + } + + /** + * Test that OS-triggered profiles from an external profiles.xml are activated. + */ + public void testitMNG3933() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3933" ); + + Verifier verifier = new Verifier( testDir.getAbsolutePath() ); + verifier.setAutoclean( false ); + verifier.deleteDirectory( "target" ); + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + Properties props = verifier.loadProperties( "target/profile.properties" ); + if ( Os.isFamily( Os.FAMILY_WINDOWS ) || Os.isFamily( Os.FAMILY_MAC ) || Os.isFamily( Os.FAMILY_UNIX ) ) + { + assertEquals( "PASSED", props.getProperty( "project.properties.profileProperty" ) ); + } + else + { + System.out.println(); + System.out.println( "[WARNING] Skipping test on unrecognized OS: " + Os.OS_NAME ); + System.out.println(); + } + } + +} diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3944BasedirInterpolationTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3944BasedirInterpolationTest.java index 797e9c3134..fca192530e 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3944BasedirInterpolationTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3944BasedirInterpolationTest.java @@ -21,7 +21,6 @@ package org.apache.maven.it; import org.apache.maven.it.Verifier; import org.apache.maven.it.util.ResourceExtractor; -import org.apache.maven.it.util.Os; import java.io.File; import java.util.Properties; diff --git a/its/core-it-suite/src/test/resources/mng-3933/pom.xml b/its/core-it-suite/src/test/resources/mng-3933/pom.xml new file mode 100644 index 0000000000..e6734d5171 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-3933/pom.xml @@ -0,0 +1,57 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng3933 + test1 + 1.0-SNAPSHOT + + Maven Integration Test :: MNG-3933 + + Test that OS-triggered profiles from an external profiles.xml are activated. + + + + + + org.apache.maven.its.plugins + maven-it-plugin-expression + 2.1-SNAPSHOT + + + validate + + eval + + + target/profile.properties + + project/properties + + + + + + + + diff --git a/its/core-it-suite/src/test/resources/mng-3933/profiles.xml b/its/core-it-suite/src/test/resources/mng-3933/profiles.xml new file mode 100644 index 0000000000..796a5f89cf --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-3933/profiles.xml @@ -0,0 +1,56 @@ + + + + + + + PROFILE-A + + + winDOWS + + + + PASSED + + + + PROFILE-B + + + unIX + + + + PASSED + + + + PROFILE-C + + + mAC + + + + PASSED + + +