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-mvnd.git

commit 31c765e0d43e72d4ccc3a17608b02619d7aabced
Author: Guillaume Nodet <gno...@gmail.com>
AuthorDate: Thu Nov 7 18:47:11 2024 +0100

    Use Maven 4 model
---
 .../test/java/org/mvndaemon/mvnd/it/MvndTestUtil.java   | 17 +++++++++--------
 .../org/mvndaemon/mvnd/it/SingleModuleNativeIT.java     | 10 +++++-----
 .../java/org/mvndaemon/mvnd/it/SingleModuleTest.java    |  8 ++++----
 3 files changed, 18 insertions(+), 17 deletions(-)

diff --git 
a/integration-tests/src/test/java/org/mvndaemon/mvnd/it/MvndTestUtil.java 
b/integration-tests/src/test/java/org/mvndaemon/mvnd/it/MvndTestUtil.java
index 05e9f537..6e523d5f 100644
--- a/integration-tests/src/test/java/org/mvndaemon/mvnd/it/MvndTestUtil.java
+++ b/integration-tests/src/test/java/org/mvndaemon/mvnd/it/MvndTestUtil.java
@@ -18,34 +18,35 @@
  */
 package org.mvndaemon.mvnd.it;
 
+import javax.xml.stream.XMLStreamException;
+
 import java.io.IOException;
 import java.io.Reader;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.util.Properties;
+import java.util.Map;
 
-import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.apache.maven.model.v4.MavenStaxReader;
 
 public class MvndTestUtil {
 
     private MvndTestUtil() {}
 
-    public static Properties properties(Path pomXmlPath) {
+    public static Map<String, String> properties(Path pomXmlPath) {
         try (Reader runtimeReader = Files.newBufferedReader(pomXmlPath, 
StandardCharsets.UTF_8)) {
-            final MavenXpp3Reader rxppReader = new MavenXpp3Reader();
+            final MavenStaxReader rxppReader = new MavenStaxReader();
             return rxppReader.read(runtimeReader).getProperties();
-        } catch (IOException | XmlPullParserException e) {
+        } catch (IOException | XMLStreamException e) {
             throw new RuntimeException("Could not read or parse " + 
pomXmlPath);
         }
     }
 
     public static String version(Path pomXmlPath) {
         try (Reader runtimeReader = Files.newBufferedReader(pomXmlPath, 
StandardCharsets.UTF_8)) {
-            final MavenXpp3Reader rxppReader = new MavenXpp3Reader();
+            final MavenStaxReader rxppReader = new MavenStaxReader();
             return rxppReader.read(runtimeReader).getVersion();
-        } catch (IOException | XmlPullParserException e) {
+        } catch (IOException | XMLStreamException e) {
             throw new RuntimeException("Could not read or parse " + 
pomXmlPath);
         }
     }
diff --git 
a/integration-tests/src/test/java/org/mvndaemon/mvnd/it/SingleModuleNativeIT.java
 
b/integration-tests/src/test/java/org/mvndaemon/mvnd/it/SingleModuleNativeIT.java
index fa98b88c..c4ddfab4 100644
--- 
a/integration-tests/src/test/java/org/mvndaemon/mvnd/it/SingleModuleNativeIT.java
+++ 
b/integration-tests/src/test/java/org/mvndaemon/mvnd/it/SingleModuleNativeIT.java
@@ -24,7 +24,7 @@ import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.List;
-import java.util.Properties;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 import org.assertj.core.api.Assertions;
@@ -59,7 +59,7 @@ class SingleModuleNativeIT {
 
         final TestClientOutput o = new TestClientOutput();
         client.execute(o, "clean", "install", "-e", "-B").assertSuccess();
-        final Properties props =
+        final Map<String, String> props =
                 
MvndTestUtil.properties(parameters.multiModuleProjectDirectory().resolve("pom.xml"));
 
         final List<String> messages = o.getMessages().stream()
@@ -87,14 +87,14 @@ class SingleModuleNativeIT {
         Assertions.assertThat(installedJar).exists();
     }
 
-    protected void assertJVM(TestClientOutput o, Properties props) {
+    protected void assertJVM(TestClientOutput o, Map<String, String> props) {
         /* implemented in the subclass */
     }
 
-    String mojoStartedLogMessage(Properties props, String pluginArtifactId, 
String mojo, String executionId) {
+    String mojoStartedLogMessage(Map<String, String> props, String 
pluginArtifactId, String mojo, String executionId) {
         return "\\Q--- "
                 + pluginArtifactId.replace("maven-", "").replace("-plugin", "")
-                + ":" + props.getProperty(pluginArtifactId + ".version") + ":" 
+ mojo + " ("
+                + ":" + props.get(pluginArtifactId + ".version") + ":" + mojo 
+ " ("
                 + executionId + ") @ single-module ---\\E";
     }
 }
diff --git 
a/integration-tests/src/test/java/org/mvndaemon/mvnd/it/SingleModuleTest.java 
b/integration-tests/src/test/java/org/mvndaemon/mvnd/it/SingleModuleTest.java
index d2b66cac..a678353c 100644
--- 
a/integration-tests/src/test/java/org/mvndaemon/mvnd/it/SingleModuleTest.java
+++ 
b/integration-tests/src/test/java/org/mvndaemon/mvnd/it/SingleModuleTest.java
@@ -19,7 +19,7 @@
 package org.mvndaemon.mvnd.it;
 
 import java.util.List;
-import java.util.Properties;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 import org.assertj.core.api.Assertions;
@@ -31,7 +31,7 @@ import org.mvndaemon.mvnd.junit.MvndTest;
 @MvndTest(projectDir = "src/test/projects/single-module")
 class SingleModuleTest extends SingleModuleNativeIT {
 
-    protected void assertJVM(TestClientOutput o, Properties props) {
+    protected void assertJVM(TestClientOutput o, Map<String, String> props) {
         final List<String> filteredMessages = o.getMessages().stream()
                 .filter(m -> m.getType() == Message.MOJO_STARTED)
                 .map(Object::toString)
@@ -48,14 +48,14 @@ class SingleModuleTest extends SingleModuleNativeIT {
                         mojoStarted(props, "maven-install-plugin", "install", 
"default-install")));
     }
 
-    String mojoStarted(Properties props, String pluginArtifactId, String mojo, 
String executionId) {
+    String mojoStarted(Map<String, String> props, String pluginArtifactId, 
String mojo, String executionId) {
         return "\\Q"
                 + Message.mojoStarted(
                                 "single-module",
                                 "org.apache.maven.plugins",
                                 pluginArtifactId,
                                 pluginArtifactId.replace("maven-", 
"").replace("-plugin", ""),
-                                props.getProperty(pluginArtifactId + 
".version"),
+                                props.get(pluginArtifactId + ".version"),
                                 mojo,
                                 executionId)
                         .toString()

Reply via email to