This is an automated email from the ASF dual-hosted git repository. gnodet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-integration-testing.git
The following commit(s) were added to refs/heads/master by this push: new 556107e04 [MNG-8360] IT for subproject profile activation (#396) 556107e04 is described below commit 556107e04d8995de7836dfcd9cced224001eb636 Author: Guillaume Nodet <gno...@apache.org> AuthorDate: Fri Oct 25 17:33:53 2024 +0200 [MNG-8360] IT for subproject profile activation (#396) --- ...enITmng8360SubprojectProfileActivationTest.java | 55 ++++++++++++++++++++++ .../org/apache/maven/it/TestSuiteOrdering.java | 1 + .../src/test/resources/mng-8360/.mvn/maven.config | 2 + .../src/test/resources/mng-8360/module1/pom.xml | 6 +++ core-it-suite/src/test/resources/mng-8360/pom.xml | 35 ++++++++++++++ .../src/test/resources/mng-8360/settings.xml | 13 +++++ 6 files changed, 112 insertions(+) diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8360SubprojectProfileActivationTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8360SubprojectProfileActivationTest.java new file mode 100644 index 000000000..e7c77f7a7 --- /dev/null +++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8360SubprojectProfileActivationTest.java @@ -0,0 +1,55 @@ +/* + * 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. + */ +package org.apache.maven.it; + +import java.io.File; + +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; +import org.junit.jupiter.api.Test; + +/** + * This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-8341">MNG-8341</a>. + */ +class MavenITmng8360SubprojectProfileActivationTest extends AbstractMavenIntegrationTestCase { + + MavenITmng8360SubprojectProfileActivationTest() { + super("[4.0.0-beta-6,)"); + } + + /** + * Verify that the build succeeds + */ + @Test + void testDeadlock() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-8360"); + + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArguments("-s", "settings.xml"); + verifier.addCliArguments("-f", "module1"); + verifier.addCliArgument("org.apache.maven.plugins:maven-help-plugin:3.3.0:active-profiles"); + verifier.execute(); + verifier.verifyErrorFreeLog(); + + // verify the three profiles have been activated + verifier.verifyTextInLog("settings-xml-activeProfiles"); + verifier.verifyTextInLog("profile_active_from_mvn_config"); + verifier.verifyTextInLog("profile_active_from_condition"); + } +} diff --git a/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java b/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java index 2109042e5..e864606d7 100644 --- a/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java +++ b/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java @@ -120,6 +120,7 @@ public class TestSuiteOrdering implements ClassOrderer { * the tests are to finishing. Newer tests are also more likely to fail, so this is * a fail fast technique as well. */ + suite.addTestSuite(MavenITmng8360SubprojectProfileActivationTest.class); suite.addTestSuite(MavenITmng8347TransitiveDependencyManagerTest.class); suite.addTestSuite(MavenITmng8341DeadlockTest.class); suite.addTestSuite(MavenITmng8331VersionedAndUnversionedDependenciesTest.class); diff --git a/core-it-suite/src/test/resources/mng-8360/.mvn/maven.config b/core-it-suite/src/test/resources/mng-8360/.mvn/maven.config new file mode 100644 index 000000000..6b7fcccb4 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-8360/.mvn/maven.config @@ -0,0 +1,2 @@ +-P profile_active_from_mvn_config +-Dprofile_active_from_condition=true diff --git a/core-it-suite/src/test/resources/mng-8360/module1/pom.xml b/core-it-suite/src/test/resources/mng-8360/module1/pom.xml new file mode 100644 index 000000000..62ab3c3c2 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-8360/module1/pom.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.1.0"> + <parent /> + <artifactId>module1</artifactId> + <packaging>pom</packaging> +</project> diff --git a/core-it-suite/src/test/resources/mng-8360/pom.xml b/core-it-suite/src/test/resources/mng-8360/pom.xml new file mode 100644 index 000000000..29b733291 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-8360/pom.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.1.0" root="true"> + <groupId>com.github.mattnelson</groupId> + <artifactId>profiles</artifactId> + <version>1.0.0-SNAPSHOT</version> + <packaging>pom</packaging> + <profiles> + <profile> + <id>profile_active_by_default</id> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + <properties> + <profile_active_by_default>parent</profile_active_by_default> + </properties> + </profile> + <profile> + <id>profile_active_from_mvn_config</id> + <properties> + <profile_active_from_mvn_config>parent</profile_active_from_mvn_config> + </properties> + </profile> + <profile> + <id>profile_active_from_condition</id> + <activation> + <property> + <name>profile_active_from_condition</name> + </property> + </activation> + <properties> + <profile_active_from_condition>parent</profile_active_from_condition> + </properties> + </profile> + </profiles> +</project> diff --git a/core-it-suite/src/test/resources/mng-8360/settings.xml b/core-it-suite/src/test/resources/mng-8360/settings.xml new file mode 100644 index 000000000..c5e138244 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-8360/settings.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> + <interactiveMode>false</interactiveMode> + <activeProfiles> + <activeProfile>settings-xml-activeProfiles</activeProfile> + </activeProfiles> + <profiles> + <profile> + <id>settings-xml-activeProfiles</id> + </profile> + </profiles> +</settings>