This is an automated email from the ASF dual-hosted git repository. cstamas pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-mvnd.git
The following commit(s) were added to refs/heads/master by this push: new 952a6745 mixup in case of DISPLAY messages type (#1038) 952a6745 is described below commit 952a67450b42126e345a2e1454afc3cae445c7a9 Author: Tamas Cservenak <ta...@cservenak.net> AuthorDate: Thu Jun 20 08:01:29 2024 +0100 mixup in case of DISPLAY messages type (#1038) ProjectEvent message mixup fixed. Fixes #1036 --- .../main/java-mvnd/org/mvndaemon/mvnd/client/DefaultClient.java | 2 +- common/src/main/java/org/mvndaemon/mvnd/common/Message.java | 8 ++------ .../java/org/mvndaemon/mvnd/common/logging/TerminalOutput.java | 4 ++-- .../test/java/org/mvndaemon/mvnd/assertj/TestClientOutput.java | 2 +- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/client/src/main/java-mvnd/org/mvndaemon/mvnd/client/DefaultClient.java b/client/src/main/java-mvnd/org/mvndaemon/mvnd/client/DefaultClient.java index 24cc49fe..c76cc9ac 100644 --- a/client/src/main/java-mvnd/org/mvndaemon/mvnd/client/DefaultClient.java +++ b/client/src/main/java-mvnd/org/mvndaemon/mvnd/client/DefaultClient.java @@ -165,7 +165,7 @@ public class DefaultClient implements Client { } catch (DaemonException.InterruptedException e) { final AttributedStyle s = new AttributedStyle().bold().foreground(AttributedStyle.RED); String str = new AttributedString(System.lineSeparator() + "Canceled by user", s).toAnsi(); - output.accept(Message.display(str)); + output.accept(Message.err(str)); exitCode = 130; } } diff --git a/common/src/main/java/org/mvndaemon/mvnd/common/Message.java b/common/src/main/java/org/mvndaemon/mvnd/common/Message.java index f274f940..8b4897bf 100644 --- a/common/src/main/java/org/mvndaemon/mvnd/common/Message.java +++ b/common/src/main/java/org/mvndaemon/mvnd/common/Message.java @@ -499,6 +499,8 @@ public abstract class Message { private String mnemonic() { switch (type) { + case DISPLAY: + return "Display"; case PROJECT_LOG_MESSAGE: return "ProjectLogMessage"; default: @@ -730,8 +732,6 @@ public abstract class Message { return "KeyboardInput"; case BUILD_LOG_MESSAGE: return "BuildLogMessage"; - case DISPLAY: - return "Display"; case PRINT_OUT: return "PrintOut"; case PRINT_ERR: @@ -1112,10 +1112,6 @@ public abstract class Message { return new StringMessage(BUILD_STATUS, payload); } - public static StringMessage display(String message) { - return new StringMessage(DISPLAY, message); - } - public static RequestInput requestInput(String projectId) { return new RequestInput(projectId); } diff --git a/common/src/main/java/org/mvndaemon/mvnd/common/logging/TerminalOutput.java b/common/src/main/java/org/mvndaemon/mvnd/common/logging/TerminalOutput.java index 4dcd9b5a..89708f00 100644 --- a/common/src/main/java/org/mvndaemon/mvnd/common/logging/TerminalOutput.java +++ b/common/src/main/java/org/mvndaemon/mvnd/common/logging/TerminalOutput.java @@ -312,9 +312,9 @@ public class TerminalOutput implements ClientOutput { break; } case Message.DISPLAY: { - Message.StringMessage d = (Message.StringMessage) entry; clearDisplay(); - terminal.writer().printf("%s%n", d.getMessage()); + Message.ProjectEvent d = (Message.ProjectEvent) entry; + terminal.writer().printf("[%s] %s%n", d.getProjectId(), d.getMessage()); break; } case Message.PRINT_OUT: { diff --git a/integration-tests/src/test/java/org/mvndaemon/mvnd/assertj/TestClientOutput.java b/integration-tests/src/test/java/org/mvndaemon/mvnd/assertj/TestClientOutput.java index 1daa9c31..524a6ae7 100644 --- a/integration-tests/src/test/java/org/mvndaemon/mvnd/assertj/TestClientOutput.java +++ b/integration-tests/src/test/java/org/mvndaemon/mvnd/assertj/TestClientOutput.java @@ -59,7 +59,7 @@ public class TestClientOutput implements ClientOutput { @Override public void describeTerminal() { - accept(Message.display("Test terminal")); + accept(Message.display("test", "Test terminal")); } @Override