This is an automated email from the ASF dual-hosted git repository.
olamy 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 5687822f9 [SUREFIRE-2049] Fix SHUTDOWN type lost during command
serialization. (#3270)
5687822f9 is described below
commit 5687822f915ecc837a7f6a4580f60afc03e60b1d
Author: Amine Ghoussaini <[email protected]>
AuthorDate: Sat Feb 28 11:46:21 2026 +0200
[SUREFIRE-2049] Fix SHUTDOWN type lost during command serialization. (#3270)
---
.../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