Re: [PR] [MNG-7772] Test for extensions.xml defined in an ext directory in the… [maven-integration-testing]

2023-10-18 Thread via GitHub


gnodet merged PR #311:
URL: https://github.com/apache/maven-integration-testing/pull/311


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] [MNG-7772] Test for extensions.xml defined in an ext directory in the… [maven-integration-testing]

2023-10-17 Thread via GitHub


juulhobert commented on PR #311:
URL: 
https://github.com/apache/maven-integration-testing/pull/311#issuecomment-1767064068

   > Nice work, thanks for providing these extensive test cases!
   
   Thanks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] [MNG-7772] Test for extensions.xml defined in an ext directory in the… [maven-integration-testing]

2023-10-15 Thread via GitHub


mthmulders commented on PR #311:
URL: 
https://github.com/apache/maven-integration-testing/pull/311#issuecomment-1763424268

   The two extensions are completely identical. Can't we reuse them?
   
   Also, in the testing of 
[MNG-7772](https://github.com/apache/maven/pull/1280), building the Extension 
fails somehow. I'm trying to reproduce locally but don't yet understand why...


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] [MNG-7772] Test for extensions.xml defined in an ext directory in the… [maven-integration-testing]

2023-10-15 Thread via GitHub


mthmulders commented on PR #311:
URL: 
https://github.com/apache/maven-integration-testing/pull/311#issuecomment-1763408996

   I've kicked off the GitHub Action build for the corresponding PR in Maven 
Core. If those changes build correctly, it should trigger these new tests.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] [MNG-7772] Test for extensions.xml defined in an ext directory in the… [maven-integration-testing]

2023-10-15 Thread via GitHub


mthmulders commented on code in PR #311:
URL: 
https://github.com/apache/maven-integration-testing/pull/311#discussion_r1359868326


##
core-it-suite/src/test/resources/mng-7772-core-extensions-lib-ext/extension/.gitignore:
##


Review Comment:
   Nit: this wasn't covered by existing **.gitignore** rules?



##
core-it-suite/src/test/resources/mng-7772-core-extensions-found/extension/.gitignore:
##


Review Comment:
   Nit: this wasn't covered by existing **.gitignore** rules?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] [MNG-7772] Test for extensions.xml defined in an ext directory in the… [maven-integration-testing]

2023-10-14 Thread via GitHub


juulhobert commented on code in PR #311:
URL: 
https://github.com/apache/maven-integration-testing/pull/311#discussion_r1359376079


##
core-it-suite/src/test/java/org/apache/maven/it/ItUtils.java:
##
@@ -56,4 +63,24 @@ public static String calcHash(File file, String algo) throws 
Exception {
 
 return hash.toString();
 }
+
+public static String getLogContent(Verifier verifier) throws IOException {
+ByteArrayOutputStream baos = new ByteArrayOutputStream();
+Files.copy(Paths.get(verifier.getBasedir(), 
verifier.getLogFileName()), baos);
+return baos.toString();
+}
+
+public static void setUserHome(Verifier verifier, File file) {
+setUserHome(verifier, file.toPath());
+}
+
+public static void setUserHome(Verifier verifier, Path home) {
+// NOTE: We set the user.home directory instead of say 
settings.security to reflect Maven's normal behavior
+String path = home.toAbsolutePath().toString();
+if (path.indexOf(' ') < 0) {
+verifier.setEnvironmentVariable("MAVEN_OPTS", "-Duser.home=" + 
path);
+} else {
+verifier.setEnvironmentVariable("MAVEN_OPTS", "\"-Duser.home=" + 
path + "\"");

Review Comment:
   It's not trivial to get the forkJvm value, therefore i've only added a 
comment to warn future developers about it. I hope you're ok with it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] [MNG-7772] Test for extensions.xml defined in an ext directory in the… [maven-integration-testing]

2023-10-14 Thread via GitHub


slawekjaranowski commented on code in PR #311:
URL: 
https://github.com/apache/maven-integration-testing/pull/311#discussion_r1359372962


##
core-it-suite/src/test/java/org/apache/maven/it/ItUtils.java:
##
@@ -56,4 +63,24 @@ public static String calcHash(File file, String algo) throws 
Exception {
 
 return hash.toString();
 }
+
+public static String getLogContent(Verifier verifier) throws IOException {
+ByteArrayOutputStream baos = new ByteArrayOutputStream();
+Files.copy(Paths.get(verifier.getBasedir(), 
verifier.getLogFileName()), baos);
+return baos.toString();
+}
+
+public static void setUserHome(Verifier verifier, File file) {
+setUserHome(verifier, file.toPath());
+}
+
+public static void setUserHome(Verifier verifier, Path home) {
+// NOTE: We set the user.home directory instead of say 
settings.security to reflect Maven's normal behavior
+String path = home.toAbsolutePath().toString();
+if (path.indexOf(' ') < 0) {
+verifier.setEnvironmentVariable("MAVEN_OPTS", "-Duser.home=" + 
path);
+} else {
+verifier.setEnvironmentVariable("MAVEN_OPTS", "\"-Duser.home=" + 
path + "\"");

Review Comment:
   We also need here 
   ```
   verifier.setForkJvm(true);
   ```
   environment variable can be set only in fork mode of verifier



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] [MNG-7772] Test for extensions.xml defined in an ext directory in the… [maven-integration-testing]

2023-10-14 Thread via GitHub


juulhobert commented on code in PR #311:
URL: 
https://github.com/apache/maven-integration-testing/pull/311#discussion_r1359360272


##
core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7772CoreExtensionsNotFoundTest.java:
##
@@ -0,0 +1,81 @@
+/*
+ * 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.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import org.apache.maven.shared.verifier.VerificationException;
+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 https://issues.apache.org/jira/browse/MNG-7772";>MNG-7772:
+ * check that Maven fails if it cannot load core extensions contributed by 
${user.home}/.m2/extensions.xml.
+ */
+public class MavenITmng7772CoreExtensionsNotFoundTest extends 
AbstractMavenIntegrationTestCase {
+
+public MavenITmng7772CoreExtensionsNotFoundTest() {
+super("[3.9.0,)");
+}
+
+@Test
+public void testCoreExtensionsNotFound() throws Exception {
+File testDir = ResourceExtractor.simpleExtractResources(getClass(), 
"/mng-7772-core-extensions-not-found");
+
+Path m2TestDirPath = Paths.get(testDir.toPath().toString(), ".m2");
+Files.createDirectories(Paths.get(System.getProperty("user.home"), 
".m2"));
+Path to = Paths.get(System.getProperty("user.home"), ".m2", 
"extensions.xml");
+
+// Test cannot run when there is already an extensions.xml file 
present in the ${user.home}/.m2 folder
+assertFalse(Files.exists(to));
+
+try {
+Files.copy(m2TestDirPath.resolve("extensions.xml"), to);
+Verifier verifier = newVerifier(testDir.getAbsolutePath());
+
+try {
+verifier.addCliArgument("validate");
+verifier.execute();

Review Comment:
   I see why it's not preferable to use the real user home. Somehow 
`.setSystemProperty("user.home"` was not working but I found that test 
MavenITmng0553SettingsAuthzEncryptionTest already had a method for setting the 
user home. I've reused that code and that's working :)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] [MNG-7772] Test for extensions.xml defined in an ext directory in the… [maven-integration-testing]

2023-10-14 Thread via GitHub


juulhobert commented on code in PR #311:
URL: 
https://github.com/apache/maven-integration-testing/pull/311#discussion_r1359321315


##
core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7772CoreExtensionsNotFoundTest.java:
##
@@ -0,0 +1,81 @@
+/*
+ * 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.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import org.apache.maven.shared.verifier.VerificationException;
+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 https://issues.apache.org/jira/browse/MNG-7772";>MNG-7772:
+ * check that Maven fails if it cannot load core extensions contributed by 
${user.home}/.m2/extensions.xml.
+ */
+public class MavenITmng7772CoreExtensionsNotFoundTest extends 
AbstractMavenIntegrationTestCase {
+
+public MavenITmng7772CoreExtensionsNotFoundTest() {
+super("[3.9.0,)");

Review Comment:
   Changed it to `"(4.0.0-alpha-7,)"`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] [MNG-7772] Test for extensions.xml defined in an ext directory in the… [maven-integration-testing]

2023-10-13 Thread via GitHub


slawekjaranowski commented on code in PR #311:
URL: 
https://github.com/apache/maven-integration-testing/pull/311#discussion_r1358681241


##
core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7772CoreExtensionsNotFoundTest.java:
##
@@ -0,0 +1,81 @@
+/*
+ * 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.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import org.apache.maven.shared.verifier.VerificationException;
+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 https://issues.apache.org/jira/browse/MNG-7772";>MNG-7772:
+ * check that Maven fails if it cannot load core extensions contributed by 
${user.home}/.m2/extensions.xml.
+ */
+public class MavenITmng7772CoreExtensionsNotFoundTest extends 
AbstractMavenIntegrationTestCase {
+
+public MavenITmng7772CoreExtensionsNotFoundTest() {
+super("[3.9.0,)");
+}
+
+@Test
+public void testCoreExtensionsNotFound() throws Exception {
+File testDir = ResourceExtractor.simpleExtractResources(getClass(), 
"/mng-7772-core-extensions-not-found");
+
+Path m2TestDirPath = Paths.get(testDir.toPath().toString(), ".m2");
+Files.createDirectories(Paths.get(System.getProperty("user.home"), 
".m2"));
+Path to = Paths.get(System.getProperty("user.home"), ".m2", 
"extensions.xml");
+
+// Test cannot run when there is already an extensions.xml file 
present in the ${user.home}/.m2 folder
+assertFalse(Files.exists(to));
+
+try {
+Files.copy(m2TestDirPath.resolve("extensions.xml"), to);
+Verifier verifier = newVerifier(testDir.getAbsolutePath());
+
+try {
+verifier.addCliArgument("validate");
+verifier.execute();

Review Comment:
   I would like to try:
   
   ```
   verifier.setSystemProperty("user.home", mocUserHom_with_m2 );
   
   ```



##
core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7772CoreExtensionsNotFoundTest.java:
##
@@ -0,0 +1,81 @@
+/*
+ * 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.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import org.apache.maven.shared.verifier.VerificationException;
+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 https://issues.apache.org/jira/browse/MNG-7772";>MNG-7772:
+ * check that Maven fails if it cannot load core extensions contributed by 
${user.home}/.m2/extensions.xml.
+ */
+public class MavenITmng7772CoreExtensionsNotFoundTest extends 
AbstractMavenIntegrationTestCase {
+
+public MavenITmng7772CoreExtensionsNotFoundTest() {
+super("[3.9.0,)");
+}
+
+@Test
+public void testCoreExtensionsNotFound() throws Exception {
+File testDir = ResourceExtractor.simpleExtractResources(getClass(), 
"/mng-7772-core-extensions-not-found");
+
+Path m2TestDirPath = Paths.get(testDir.toPath().toString(), "

Re: [PR] [MNG-7772] Test for extensions.xml defined in an ext directory in the… [maven-integration-testing]

2023-10-13 Thread via GitHub


mthmulders commented on PR #311:
URL: 
https://github.com/apache/maven-integration-testing/pull/311#issuecomment-1761781889

   I'd love to also see a "positive" test case, e.g., one that demonstrates 
that Maven indeed activates an extension that is installed in the user-level 
Maven directory. I think that test case should fork to a new JVM to prevent the 
extension leaking into other test cases.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] [MNG-7772] Test for extensions.xml defined in an ext directory in the… [maven-integration-testing]

2023-10-13 Thread via GitHub


mthmulders commented on code in PR #311:
URL: 
https://github.com/apache/maven-integration-testing/pull/311#discussion_r1358476213


##
core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7772CoreExtensionsNotFoundTest.java:
##
@@ -0,0 +1,81 @@
+/*
+ * 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.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import org.apache.maven.shared.verifier.VerificationException;
+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 https://issues.apache.org/jira/browse/MNG-7772";>MNG-7772:
+ * check that Maven fails if it cannot load core extensions contributed by 
${user.home}/.m2/extensions.xml.
+ */
+public class MavenITmng7772CoreExtensionsNotFoundTest extends 
AbstractMavenIntegrationTestCase {
+
+public MavenITmng7772CoreExtensionsNotFoundTest() {
+super("[3.9.0,)");
+}
+
+@Test
+public void testCoreExtensionsNotFound() throws Exception {
+File testDir = ResourceExtractor.simpleExtractResources(getClass(), 
"/mng-7772-core-extensions-not-found");
+
+Path m2TestDirPath = Paths.get(testDir.toPath().toString(), ".m2");
+Files.createDirectories(Paths.get(System.getProperty("user.home"), 
".m2"));

Review Comment:
   I'm not 100% sure this is the location of the Maven user directory in the 
Core Integration Suite. I hope someone else knows for sure



##
core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7772CoreExtensionsNotFoundTest.java:
##
@@ -0,0 +1,81 @@
+/*
+ * 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.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import org.apache.maven.shared.verifier.VerificationException;
+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 https://issues.apache.org/jira/browse/MNG-7772";>MNG-7772:
+ * check that Maven fails if it cannot load core extensions contributed by 
${user.home}/.m2/extensions.xml.
+ */
+public class MavenITmng7772CoreExtensionsNotFoundTest extends 
AbstractMavenIntegrationTestCase {
+
+public MavenITmng7772CoreExtensionsNotFoundTest() {
+super("[3.9.0,)");

Review Comment:
   Since your change on Maven itself is on the **master** branch, I'd expect 
the version range to start with "4.0.0-alpha-8".



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[PR] [MNG-7772] Test for extensions.xml defined in an ext directory in the… [maven-integration-testing]

2023-10-13 Thread via GitHub


juulhobert opened a new pull request, #311:
URL: https://github.com/apache/maven-integration-testing/pull/311

   Integration test for [PR](https://github.com/apache/maven/pull/1280) and 
[Jira issue](https://issues.apache.org/jira/browse/MNG-7772)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org