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

slachiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git


The following commit(s) were added to refs/heads/master by this push:
     new c0f7fda55 Shade only the logging package of maven-shared-utils
c0f7fda55 is described below

commit c0f7fda55c4a247dd30ddcd0e3edc2d3a97053db
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Mon Nov 9 08:38:34 2026 +0000

    Shade only the logging package of maven-shared-utils
    
    Surefire's own code uses nothing else from it any more; logging needs
    only JAnsi, which Maven provides. The four tests that still reached
    other shaded classes use the shaded commons-lang3 and commons-io
    instead (shared-utils isEmpty trims, so it becomes isBlank).
    
    Part of #3574.
---
 .../ModularClasspathForkConfigurationTest.java       |  2 +-
 .../surefire/report/StatelessXmlReporterTest.java    | 10 +++++-----
 .../report/ConsoleOutputFileReporterTest.java        | 20 +++++++++++++-------
 .../surefire/booter/IsolatedClassLoaderTest.java     |  4 ++--
 surefire-shared-utils/pom.xml                        |  8 ++++++++
 5 files changed, 29 insertions(+), 15 deletions(-)

diff --git 
a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfigurationTest.java
 
b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfigurationTest.java
index d3fe5d32a..27cc46878 100644
--- 
a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfigurationTest.java
+++ 
b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfigurationTest.java
@@ -44,7 +44,7 @@
 import static java.util.Arrays.asList;
 import static java.util.Collections.singleton;
 import static org.apache.maven.surefire.booter.Classpath.emptyClasspath;
-import static org.apache.maven.surefire.shared.utils.StringUtils.replace;
+import static org.apache.maven.surefire.shared.lang3.StringUtils.replace;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.mockito.Mockito.mock;
 
diff --git 
a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporterTest.java
 
b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporterTest.java
index 7b0d99701..846ae7510 100644
--- 
a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporterTest.java
+++ 
b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporterTest.java
@@ -54,7 +54,7 @@
 import static 
org.apache.maven.surefire.api.report.RunMode.RERUN_TEST_AFTER_FAILURE;
 import static 
org.apache.maven.surefire.api.util.internal.ObjectUtils.systemProps;
 import static org.apache.maven.surefire.api.util.internal.StringUtils.NL;
-import static org.apache.maven.surefire.shared.utils.StringUtils.isEmpty;
+import static org.apache.maven.surefire.shared.lang3.StringUtils.isBlank;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -250,8 +250,8 @@ public void testAllFieldsSerialized() throws Exception {
         Xpp3Dom properties = testSuite.getChild("properties");
         assertEquals(System.getProperties().size(), 
properties.getChildCount());
         Xpp3Dom child = properties.getChild(1);
-        assertFalse(isEmpty(child.getAttribute("value")));
-        assertFalse(isEmpty(child.getAttribute("name")));
+        assertFalse(isBlank(child.getAttribute("value")));
+        assertFalse(isBlank(child.getAttribute("name")));
 
         Xpp3Dom[] testcase = testSuite.getChildren("testcase");
         Xpp3Dom tca = testcase[0];
@@ -366,8 +366,8 @@ public void testOutputRerunFlakyFailure() throws Exception {
         Xpp3Dom properties = testSuite.getChild("properties");
         assertEquals(System.getProperties().size(), 
properties.getChildCount());
         Xpp3Dom child = properties.getChild(1);
-        assertFalse(isEmpty(child.getAttribute("value")));
-        assertFalse(isEmpty(child.getAttribute("name")));
+        assertFalse(isBlank(child.getAttribute("value")));
+        assertFalse(isBlank(child.getAttribute("name")));
 
         Xpp3Dom[] testcase = testSuite.getChildren("testcase");
         Xpp3Dom testCaseOne = testcase[0];
diff --git 
a/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/ConsoleOutputFileReporterTest.java
 
b/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/ConsoleOutputFileReporterTest.java
index f0eb5e191..da60d44f9 100644
--- 
a/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/ConsoleOutputFileReporterTest.java
+++ 
b/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/ConsoleOutputFileReporterTest.java
@@ -31,7 +31,7 @@
 import org.apache.maven.surefire.api.report.SimpleReportEntry;
 import org.apache.maven.surefire.api.report.TestOutputReportEntry;
 import org.apache.maven.surefire.api.report.TestSetReportEntry;
-import org.apache.maven.surefire.shared.utils.io.FileUtils;
+import org.apache.maven.surefire.shared.io.FileUtils;
 import org.junit.jupiter.api.Test;
 
 import static java.nio.charset.StandardCharsets.US_ASCII;
@@ -69,7 +69,8 @@ public void testFileNameWithoutSuffix() throws IOException {
                 expectedReportFile.exists(),
                 "Report file (" + expectedReportFile.getAbsolutePath() + ") 
doesn't exist");
 
-        assertThat(FileUtils.fileRead(expectedReportFile, 
US_ASCII.name())).contains("some ");
+        assertThat(FileUtils.readFileToString(expectedReportFile, 
US_ASCII.name()))
+                .contains("some ");
 
         //noinspection ResultOfMethodCallIgnored
         expectedReportFile.delete();
@@ -101,7 +102,8 @@ public void testFileNameWithSuffix() throws IOException {
                 expectedReportFile.exists(),
                 "Report file (" + expectedReportFile.getAbsolutePath() + ") 
doesn't exist");
 
-        assertThat(FileUtils.fileRead(expectedReportFile, 
US_ASCII.name())).contains("some ");
+        assertThat(FileUtils.readFileToString(expectedReportFile, 
US_ASCII.name()))
+                .contains("some ");
 
         assertThat(expectedReportFile).hasSize(9 + 2 * 
System.lineSeparator().length());
 
@@ -128,7 +130,8 @@ public void testNullReportFile() throws IOException {
                 expectedReportFile.exists(),
                 "Report file (" + expectedReportFile.getAbsolutePath() + ") 
doesn't exist");
 
-        assertThat(FileUtils.fileRead(expectedReportFile, 
US_ASCII.name())).contains("some ");
+        assertThat(FileUtils.readFileToString(expectedReportFile, 
US_ASCII.name()))
+                .contains("some ");
 
         //noinspection ResultOfMethodCallIgnored
         expectedReportFile.delete();
@@ -152,7 +155,8 @@ public void 
testOutputWithoutStackTraceUsesCurrentReportFile() throws IOExceptio
         File nullReportFile = new File(reportDir, "null-output.txt");
 
         assertThat(expectedReportFile).exists();
-        assertThat(FileUtils.fileRead(expectedReportFile, 
US_ASCII.name())).contains("some text");
+        assertThat(FileUtils.readFileToString(expectedReportFile, 
US_ASCII.name()))
+                .contains("some text");
         assertThat(nullReportFile).doesNotExist();
 
         //noinspection ResultOfMethodCallIgnored
@@ -187,14 +191,16 @@ public void testConcurrentAccessReportFile() throws 
Exception {
                 expectedReportFile.exists(),
                 "Report file (" + expectedReportFile.getAbsolutePath() + ") 
doesn't exist");
 
-        assertThat(FileUtils.fileRead(expectedReportFile, 
US_ASCII.name())).contains("some text");
+        assertThat(FileUtils.readFileToString(expectedReportFile, 
US_ASCII.name()))
+                .contains("some text");
 
         StringBuilder expectedText = new StringBuilder();
         for (int i = 0; i < 10; i++) {
             expectedText.append("some text\n");
         }
 
-        assertThat(FileUtils.fileRead(expectedReportFile, 
US_ASCII.name())).isEqualTo(expectedText.toString());
+        assertThat(FileUtils.readFileToString(expectedReportFile, 
US_ASCII.name()))
+                .isEqualTo(expectedText.toString());
 
         //noinspection ResultOfMethodCallIgnored
         expectedReportFile.delete();
diff --git 
a/surefire-booter/src/test/java/org/apache/maven/surefire/booter/IsolatedClassLoaderTest.java
 
b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/IsolatedClassLoaderTest.java
index 026cad6ce..06ee02743 100644
--- 
a/surefire-booter/src/test/java/org/apache/maven/surefire/booter/IsolatedClassLoaderTest.java
+++ 
b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/IsolatedClassLoaderTest.java
@@ -22,7 +22,7 @@
 import java.net.URL;
 
 import org.apache.maven.surefire.api.provider.AbstractProvider;
-import org.apache.maven.surefire.shared.utils.io.FileUtils;
+import org.apache.maven.surefire.shared.io.FileUtils;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
@@ -39,7 +39,7 @@ public class IsolatedClassLoaderTest {
     public void prepareClassLoader() throws Exception {
         classLoader = new IsolatedClassLoader(null, false, "role");
 
-        String[] files = FileUtils.fileRead(new 
File("target/test-classpath/cp.txt"), "UTF-8")
+        String[] files = FileUtils.readFileToString(new 
File("target/test-classpath/cp.txt"), "UTF-8")
                 .split(pathSeparator);
 
         for (String file : files) {
diff --git a/surefire-shared-utils/pom.xml b/surefire-shared-utils/pom.xml
index 922092742..793f69c9a 100644
--- a/surefire-shared-utils/pom.xml
+++ b/surefire-shared-utils/pom.xml
@@ -91,6 +91,14 @@
                 </excludes>
               </artifactSet>
               <filters>
+                <filter>
+                  <!-- Surefire uses only the logging package; the rest has 
Surefire's own or commons replacements -->
+                  
<artifact>org.apache.maven.shared:maven-shared-utils</artifact>
+                  <includes>
+                    <include>org/apache/maven/shared/utils/logging/**</include>
+                    <include>META-INF/**</include>
+                  </includes>
+                </filter>
                 <filter>
                   <artifact>*:*</artifact>
                   <excludes>

Reply via email to