This is an automated email from the ASF dual-hosted git repository.

cstamas pushed a commit to branch MNG-7228
in repository https://gitbox.apache.org/repos/asf/maven-integration-testing.git

commit 4d4190de2cd6211d72d374b0407838b95b10ad20
Author: Tamas Cservenak <[email protected]>
AuthorDate: Fri Jun 23 21:44:24 2023 +0200

    [MNG-7228] Add IT that ensure nothing "leaks" into installe model
---
 .../maven/it/MavenITmng7228LeakyModelTest.java     |  68 ++++++++++++++
 .../org/apache/maven/it/TestSuiteOrdering.java     |   1 +
 .../src/test/resources-filtered/bootstrap.txt      |   2 +
 .../test/resources/mng-7228-leaky-model/pom.xml    |  76 +++++++++++++++
 .../resources/mng-7228-leaky-model/settings.xml    | 104 +++++++++++++++++++++
 5 files changed, 251 insertions(+)

diff --git 
a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7228LeakyModelTest.java
 
b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7228LeakyModelTest.java
new file mode 100644
index 000000000..50f13f745
--- /dev/null
+++ 
b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7228LeakyModelTest.java
@@ -0,0 +1,68 @@
+/*
+ * 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.commons.io.FileUtils;
+import org.apache.maven.shared.verifier.Verifier;
+import org.apache.maven.shared.verifier.util.ResourceExtractor;
+import org.junit.jupiter.api.Test;
+
+class MavenITmng7228LeakyModelTest extends AbstractMavenIntegrationTestCase {
+
+    protected MavenITmng7228LeakyModelTest() {
+        // broken: 4.0.0-alpha-3 - 4.0.0-alpha-6
+        super("[,4.0.0-alpha-3),(4.0.0-alpha-6,]");
+    }
+
+    @Test
+    void testLeakyModel() throws Exception {
+        File testDir = ResourceExtractor.simpleExtractResources(getClass(), 
"/mng-7228-leaky-model");
+
+        Verifier verifier = newVerifier(testDir.getAbsolutePath());
+        verifier.setForkJvm(true);
+
+        verifier.addCliArgument("-e");
+        verifier.addCliArgument("-s");
+        verifier.addCliArgument(new File(testDir, 
"settings.xml").getAbsolutePath());
+        verifier.addCliArgument("-Pmanual-profile");
+
+        verifier.addCliArgument("install");
+
+        verifier.execute();
+
+        verifier.verifyErrorFreeLog();
+
+        String pom = FileUtils.readFileToString(
+                new 
File(verifier.getArtifactPath("org.apache.maven.its.mng7228", "test", 
"1.0.0-SNAPSHOT", "pom")));
+
+        assertTrue(pom.contains("projectProperty"));
+        assertFalse(pom.contains("activeProperty"));
+        assertFalse(pom.contains("manualProperty"));
+
+        assertTrue(pom.contains("project-repo"));
+        assertFalse(pom.contains("active-repoP"));
+        assertFalse(pom.contains("manual-repo"));
+
+        assertTrue(pom.contains("project-plugin-repo"));
+        assertFalse(pom.contains("active-plugin-repoP"));
+        assertFalse(pom.contains("manual-plugin-repo"));
+    }
+}
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 443492d4c..50a692936 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(MavenITmng7228LeakyModelTest.class);
         suite.addTestSuite(MavenITmng7819FileLockingWithSnapshotsTest.class);
         
suite.addTestSuite(MavenITmng5600DependencyManagementImportExclusionsTest.class);
         
suite.addTestSuite(MavenITmng7740ConsumerBuildShouldCleanUpOldFilesTest.class);
diff --git a/core-it-suite/src/test/resources-filtered/bootstrap.txt 
b/core-it-suite/src/test/resources-filtered/bootstrap.txt
index 8fdae0402..aa936ab34 100644
--- a/core-it-suite/src/test/resources-filtered/bootstrap.txt
+++ b/core-it-suite/src/test/resources-filtered/bootstrap.txt
@@ -104,6 +104,7 @@ org.apache.maven.plugins:maven-resources-plugin:3.2.0
 org.apache.maven.plugins:maven-resources-plugin:3.3.0
 org.apache.maven.plugins:maven-site-plugin:${stubPluginVersion}
 org.apache.maven.plugins:maven-site-plugin:3.9.1
+org.apache.maven.plugins:maven-shade-plugin:3.5.0
 org.apache.maven.plugins:maven-source-plugin:${stubPluginVersion}
 org.apache.maven.plugins:maven-surefire-plugin:${stubPluginVersion}
 org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5
@@ -167,4 +168,5 @@ org.ow2.asm:asm:4.1
 org.ow2.asm:asm:6.2
 org.ow2.asm:asm:7.2
 org.slf4j:slf4j-api:1.6.1
+org.slf4j:slf4j-api:1.7.36
 org.sonatype.sisu:sisu-guice:3.1.0:jar:no_aop
diff --git a/core-it-suite/src/test/resources/mng-7228-leaky-model/pom.xml 
b/core-it-suite/src/test/resources/mng-7228-leaky-model/pom.xml
new file mode 100644
index 000000000..c5527bac5
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-7228-leaky-model/pom.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.mng7228</groupId>
+  <artifactId>test</artifactId>
+  <version>1.0.0-SNAPSHOT</version>
+
+  <properties>
+    <projectProperty>project</projectProperty>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <version>1.7.36</version>
+    </dependency>
+  </dependencies>
+
+  <repositories>
+    <repository>
+      <releases>
+        <enabled>true</enabled>
+        <updatePolicy>never</updatePolicy>
+        <checksumPolicy>ignore</checksumPolicy>
+      </releases>
+      <snapshots>
+        <enabled>true</enabled>
+        <updatePolicy>never</updatePolicy>
+        <checksumPolicy>ignore</checksumPolicy>
+      </snapshots>
+      <id>project-repo</id>
+      <url>http://localhost:1234</url>
+    </repository>
+  </repositories>
+  <pluginRepositories>
+    <pluginRepository>
+      <releases>
+        <enabled>true</enabled>
+        <updatePolicy>never</updatePolicy>
+        <checksumPolicy>ignore</checksumPolicy>
+      </releases>
+      <snapshots>
+        <enabled>true</enabled>
+        <updatePolicy>never</updatePolicy>
+        <checksumPolicy>ignore</checksumPolicy>
+      </snapshots>
+      <id>project-plugin-repo</id>
+      <url>http://localhost:1234</url>
+    </pluginRepository>
+  </pluginRepositories>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-shade-plugin</artifactId>
+        <version>3.5.0</version>
+        <configuration>
+          
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
+          <shadedClassifierName />
+        </configuration>
+        <executions>
+          <execution>
+            <goals>
+              <goal>shade</goal>
+            </goals>
+            <phase>package</phase>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>
diff --git a/core-it-suite/src/test/resources/mng-7228-leaky-model/settings.xml 
b/core-it-suite/src/test/resources/mng-7228-leaky-model/settings.xml
new file mode 100644
index 000000000..ca91f67bd
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-7228-leaky-model/settings.xml
@@ -0,0 +1,104 @@
+<?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>manual-profile</id>
+      <repositories>
+        <repository>
+          <id>manual-repo</id>
+          <url>http://localhost:1234</url>
+          <releases>
+            <enabled>true</enabled>
+            <checksumPolicy>ignore</checksumPolicy>
+            <updatePolicy>never</updatePolicy>
+          </releases>
+          <snapshots>
+            <enabled>true</enabled>
+            <checksumPolicy>ignore</checksumPolicy>
+            <updatePolicy>never</updatePolicy>
+          </snapshots>
+        </repository>
+      </repositories>
+      <pluginRepositories>
+        <pluginRepository>
+          <id>manual-plugin-repo</id>
+          <url>http://localhost:1234</url>
+          <releases>
+            <enabled>true</enabled>
+            <checksumPolicy>ignore</checksumPolicy>
+            <updatePolicy>never</updatePolicy>
+          </releases>
+          <snapshots>
+            <enabled>true</enabled>
+            <checksumPolicy>ignore</checksumPolicy>
+            <updatePolicy>never</updatePolicy>
+          </snapshots>
+        </pluginRepository>
+      </pluginRepositories>
+      <properties>
+        <manualProperty>settings</manualProperty>
+      </properties>
+    </profile>
+    <profile>
+      <id>active-profile</id>
+      <repositories>
+        <repository>
+          <id>active-repo</id>
+          <url>http://localhost:1234</url>
+          <releases>
+            <enabled>true</enabled>
+            <checksumPolicy>ignore</checksumPolicy>
+            <updatePolicy>never</updatePolicy>
+          </releases>
+          <snapshots>
+            <enabled>true</enabled>
+            <checksumPolicy>ignore</checksumPolicy>
+            <updatePolicy>never</updatePolicy>
+          </snapshots>
+        </repository>
+      </repositories>
+      <pluginRepositories>
+        <pluginRepository>
+          <id>active-plugin-repo</id>
+          <url>http://localhost:1234</url>
+          <releases>
+            <enabled>true</enabled>
+            <checksumPolicy>ignore</checksumPolicy>
+            <updatePolicy>never</updatePolicy>
+          </releases>
+          <snapshots>
+            <enabled>true</enabled>
+            <checksumPolicy>ignore</checksumPolicy>
+            <updatePolicy>never</updatePolicy>
+          </snapshots>
+        </pluginRepository>
+      </pluginRepositories>
+      <properties>
+        <activeProperty>settings</activeProperty>
+      </properties>
+    </profile>
+  </profiles>
+  <activeProfiles>
+    <activeProfile>active-profile</activeProfile>
+  </activeProfiles>
+</settings>

Reply via email to