You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2026/03/01 01:29:07 UTC

(maven-surefire) branch surefire-3.5.x updated: [SUREFIRE-2049] Fix SHUTDOWN type lost during command serialization. (#3270) (#3289)

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

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


The following commit(s) were added to refs/heads/surefire-3.5.x by this push:
     new a8d42a181 [SUREFIRE-2049] Fix SHUTDOWN type lost during command serialization. (#3270) (#3289)
a8d42a181 is described below

commit a8d42a1811381b4350e71614bace1fb0ab19fc29
Author: Olivier Lamy <ol...@apache.org>
AuthorDate: Sun Mar 1 11:29:02 2026 +1000

    [SUREFIRE-2049] Fix SHUTDOWN type lost during command serialization. (#3270) (#3289)
    
    Co-authored-by: Amine Ghoussaini <54...@users.noreply.github.com>
---
 .../lazytestprovider/TestLessInputStreamBuilderTest.java            | 4 ++--
 .../src/main/java/org/apache/maven/surefire/api/booter/Command.java | 5 ++---
 .../apache/maven/surefire/booter/spi/CommandChannelDecoderTest.java | 6 +++---
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/TestLessInputStreamBuilderTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/TestLessInputStreamBuilderTest.java
index fc3287efb..d7ac8e1d2 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/TestLessInputStreamBuilderTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/TestLessInputStreamBuilderTest.java
@@ -72,7 +72,7 @@ public void cachableCommandsShouldBeIterableWithStillOpenIterator() {
 
         builder.getCachableCommands().shutdown(KILL);
         assertTrue(iterator.hasNext());
-        assertThat(iterator.next(), is(new Command(SHUTDOWN, "KILL")));
+        assertThat(iterator.next(), is(new Command(SHUTDOWN, KILL.getParam())));
 
         builder.removeStream(is);
     }
@@ -178,7 +178,7 @@ public int read() throws IOException {
         Command bye = decoder.decode();
         assertThat(bye, is(notNullValue()));
         assertThat(bye.getCommandType(), is(SHUTDOWN));
-        assertThat(bye.getData(), is(KILL.name()));
+        assertThat(bye.getData(), is(KILL.getParam()));
         Command noop = decoder.decode();
         assertThat(noop, is(notNullValue()));
         assertThat(noop.getCommandType(), is(NOOP));
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/api/booter/Command.java b/surefire-api/src/main/java/org/apache/maven/surefire/api/booter/Command.java
index df86fee54..d3d669eb8 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/api/booter/Command.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/api/booter/Command.java
@@ -48,7 +48,7 @@ public Command(MasterProcessCommand command) {
     }
 
     public static Command toShutdown(Shutdown shutdownType) {
-        return new Command(MasterProcessCommand.SHUTDOWN, shutdownType.name());
+        return new Command(MasterProcessCommand.SHUTDOWN, shutdownType.getParam());
     }
 
     public static Command toRunClass(String runClass) {
@@ -65,13 +65,12 @@ public String getData() {
 
     /**
      * @return {@link Shutdown} or {@link Shutdown#DEFAULT} if {@link #getData()} is null or blank string
-     * @throws IllegalArgumentException if string data {@link #getData()} is not applicable to enum {@link Shutdown}
      */
     public Shutdown toShutdownData() {
         if (command != MasterProcessCommand.SHUTDOWN) {
             throw new IllegalStateException("expected MasterProcessCommand.SHUTDOWN");
         }
-        return isBlank(data) ? Shutdown.DEFAULT : Shutdown.valueOf(data);
+        return isBlank(data) ? Shutdown.DEFAULT : Shutdown.parameterOf(data);
     }
 
     @Override
diff --git a/surefire-booter/src/test/java/org/apache/maven/surefire/booter/spi/CommandChannelDecoderTest.java b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/spi/CommandChannelDecoderTest.java
index b75d68a42..9e9a8bae9 100644
--- a/surefire-booter/src/test/java/org/apache/maven/surefire/booter/spi/CommandChannelDecoderTest.java
+++ b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/spi/CommandChannelDecoderTest.java
@@ -144,7 +144,7 @@ public void testDecoderShutdownWithExit() throws IOException {
         CommandChannelDecoder decoder = new CommandChannelDecoder(newChannel(is), args);
         Command command = decoder.decode();
         assertThat(command.getCommandType()).isSameAs(SHUTDOWN);
-        assertThat(command.getData()).isEqualTo(shutdownType.name());
+        assertThat(command.getData()).isEqualTo(shutdownType.getParam());
     }
 
     @Test
@@ -159,7 +159,7 @@ public void testDecoderShutdownWithKill() throws IOException {
         CommandChannelDecoder decoder = new CommandChannelDecoder(newChannel(is), args);
         Command command = decoder.decode();
         assertThat(command.getCommandType()).isSameAs(SHUTDOWN);
-        assertThat(command.getData()).isEqualTo(shutdownType.name());
+        assertThat(command.getData()).isEqualTo(shutdownType.getParam());
     }
 
     @Test
@@ -174,7 +174,7 @@ public void testDecoderShutdownWithDefault() throws IOException {
         CommandChannelDecoder decoder = new CommandChannelDecoder(newChannel(is), args);
         Command command = decoder.decode();
         assertThat(command.getCommandType()).isSameAs(SHUTDOWN);
-        assertThat(command.getData()).isEqualTo(shutdownType.name());
+        assertThat(command.getData()).isEqualTo(shutdownType.getParam());
     }
 
     @Test