From d0e83ce3ecae61eb0a74ac3c3c7eb49dd69f65d8 Mon Sep 17 00:00:00 2001 From: Andy Damevin Date: Mon, 27 Sep 2021 16:47:46 +0200 Subject: [PATCH] Remove undecided sendMessage code --- .../src/main/java/org/acme/StartWebSocket.java | 18 +----------------- .../src/main/kotlin/org/acme/StartWebSocket.kt | 15 +-------------- ...ain_java_ilove_quark_us_StartWebSocket.java | 18 +----------------- ...ain_kotlin_ilove_quark_us_StartWebSocket.kt | 15 +-------------- 4 files changed, 4 insertions(+), 62 deletions(-) diff --git a/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/websockets-codestart/java/src/main/java/org/acme/StartWebSocket.java b/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/websockets-codestart/java/src/main/java/org/acme/StartWebSocket.java index 6b3b9c9ef49a0..f01294b0465de 100644 --- a/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/websockets-codestart/java/src/main/java/org/acme/StartWebSocket.java +++ b/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/websockets-codestart/java/src/main/java/org/acme/StartWebSocket.java @@ -33,23 +33,7 @@ public void onError(Session session, @PathParam("name") String name, Throwable t } @OnMessage - public void onMessage(String message, @PathParam("username") String name) { + public void onMessage(String message, @PathParam("name") String name) { System.out.println("onMessage> " + name + ": " + message); } - - /** - * Send a message to a remote websocket session - * - * @param session the websocket session - * @param message the message to send - * @throws IOException if there is a communication error sending the message object. - * @throws EncodeException if there was a problem encoding the message. - * @throws IllegalArgumentException if the message parameter is {@code null} - */ - public void sendMessage(Session session, String message) throws EncodeException, IOException { - requireNonNull(session, "session is required"); - - session.getBasicRemote().sendObject(message); - } - } diff --git a/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/websockets-codestart/kotlin/src/main/kotlin/org/acme/StartWebSocket.kt b/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/websockets-codestart/kotlin/src/main/kotlin/org/acme/StartWebSocket.kt index c498e11faf9f9..cddb502b90d3a 100644 --- a/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/websockets-codestart/kotlin/src/main/kotlin/org/acme/StartWebSocket.kt +++ b/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/websockets-codestart/kotlin/src/main/kotlin/org/acme/StartWebSocket.kt @@ -26,20 +26,7 @@ class StartWebSocket { } @OnMessage - fun onMessage(message: String, @PathParam("username") name: String) { + fun onMessage(message: String, @PathParam("name") name: String) { println("onMessage> $name: $message") } - - /** - * Send a message to a remote websocket session - * - * @param session the websocket session - * @param message the message to send - * @throws IOException if there is a communication error sending the message object. - * @throws EncodeException if there was a problem encoding the message. - */ - @Throws(EncodeException::class, IOException::class) - fun sendMessage(session: Session, message: String) { - session.basicRemote.sendObject(message) - } } diff --git a/integration-tests/devtools/src/test/resources/__snapshots__/WebSocketsCodestartTest/testContent/src_main_java_ilove_quark_us_StartWebSocket.java b/integration-tests/devtools/src/test/resources/__snapshots__/WebSocketsCodestartTest/testContent/src_main_java_ilove_quark_us_StartWebSocket.java index 6b3b9c9ef49a0..f01294b0465de 100644 --- a/integration-tests/devtools/src/test/resources/__snapshots__/WebSocketsCodestartTest/testContent/src_main_java_ilove_quark_us_StartWebSocket.java +++ b/integration-tests/devtools/src/test/resources/__snapshots__/WebSocketsCodestartTest/testContent/src_main_java_ilove_quark_us_StartWebSocket.java @@ -33,23 +33,7 @@ public void onError(Session session, @PathParam("name") String name, Throwable t } @OnMessage - public void onMessage(String message, @PathParam("username") String name) { + public void onMessage(String message, @PathParam("name") String name) { System.out.println("onMessage> " + name + ": " + message); } - - /** - * Send a message to a remote websocket session - * - * @param session the websocket session - * @param message the message to send - * @throws IOException if there is a communication error sending the message object. - * @throws EncodeException if there was a problem encoding the message. - * @throws IllegalArgumentException if the message parameter is {@code null} - */ - public void sendMessage(Session session, String message) throws EncodeException, IOException { - requireNonNull(session, "session is required"); - - session.getBasicRemote().sendObject(message); - } - } diff --git a/integration-tests/devtools/src/test/resources/__snapshots__/WebSocketsCodestartTest/testContent/src_main_kotlin_ilove_quark_us_StartWebSocket.kt b/integration-tests/devtools/src/test/resources/__snapshots__/WebSocketsCodestartTest/testContent/src_main_kotlin_ilove_quark_us_StartWebSocket.kt index c498e11faf9f9..cddb502b90d3a 100644 --- a/integration-tests/devtools/src/test/resources/__snapshots__/WebSocketsCodestartTest/testContent/src_main_kotlin_ilove_quark_us_StartWebSocket.kt +++ b/integration-tests/devtools/src/test/resources/__snapshots__/WebSocketsCodestartTest/testContent/src_main_kotlin_ilove_quark_us_StartWebSocket.kt @@ -26,20 +26,7 @@ class StartWebSocket { } @OnMessage - fun onMessage(message: String, @PathParam("username") name: String) { + fun onMessage(message: String, @PathParam("name") name: String) { println("onMessage> $name: $message") } - - /** - * Send a message to a remote websocket session - * - * @param session the websocket session - * @param message the message to send - * @throws IOException if there is a communication error sending the message object. - * @throws EncodeException if there was a problem encoding the message. - */ - @Throws(EncodeException::class, IOException::class) - fun sendMessage(session: Session, message: String) { - session.basicRemote.sendObject(message) - } }