From 87c0563c22db29ca13ed6a6831585d27aacc4a02 Mon Sep 17 00:00:00 2001 From: Nakiguli Grace Date: Thu, 21 Oct 2021 13:22:40 +0300 Subject: [PATCH 1/3] initial-work1:Implement JSONRPC as a wire protocol --- .../bridge/tcp/TcpEventBusClient.java | 40 ++++++++++++++++ .../bridge/tcp/TcpEventBusClientImpl.java | 48 +++++++++++++++++++ .../tcp/impl/TcpEventBusBridgeImpl.java | 2 - 3 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 src/main/java/io/vertx/ext/eventbus/bridge/tcp/TcpEventBusClient.java create mode 100644 src/main/java/io/vertx/ext/eventbus/bridge/tcp/TcpEventBusClientImpl.java diff --git a/src/main/java/io/vertx/ext/eventbus/bridge/tcp/TcpEventBusClient.java b/src/main/java/io/vertx/ext/eventbus/bridge/tcp/TcpEventBusClient.java new file mode 100644 index 0000000..f0228ad --- /dev/null +++ b/src/main/java/io/vertx/ext/eventbus/bridge/tcp/TcpEventBusClient.java @@ -0,0 +1,40 @@ +package io.vertx.ext.eventbus.bridge.tcp; + +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; +import io.vertx.core.Vertx; +import io.vertx.core.eventbus.DeliveryOptions; +import io.vertx.core.eventbus.MessageConsumer; +import io.vertx.ext.bridge.BridgeOptions; + +/** + * TCP EventBus Client for to connect to the event bus bridge + * + * @author Nakiguli Grace + */ + +public interface TcpEventBusClient { + + /**create an event bus client */ + static TcpEventBusClient create(TcpEventBusClient tcpEventBusClient) { + return create(tcpEventBusClient); + } + + /**send message to eventBus address*/ + TcpEventBusClient send(String message); + + /**send message to eventBus address and expect a reply*/ + TcpEventBusClient send(String address, Handler> handler); + + /**publish message to eventBus address*/ + TcpEventBusClient publish(String address, String body, DeliveryOptions deliveryOptions); + + /**Subscribe a consumer*/ + TcpEventBusClient register(Handler>> handler); + + /**un subscribe a consumer if it does not want to listen*/ + TcpEventBusClient unRegister(Handler> handler); + + /**close client*/ + void close(Handler> handler); +} diff --git a/src/main/java/io/vertx/ext/eventbus/bridge/tcp/TcpEventBusClientImpl.java b/src/main/java/io/vertx/ext/eventbus/bridge/tcp/TcpEventBusClientImpl.java new file mode 100644 index 0000000..4bcd5e2 --- /dev/null +++ b/src/main/java/io/vertx/ext/eventbus/bridge/tcp/TcpEventBusClientImpl.java @@ -0,0 +1,48 @@ +package io.vertx.ext.eventbus.bridge.tcp; + +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; +import io.vertx.core.eventbus.DeliveryOptions; +import io.vertx.core.eventbus.MessageConsumer; +import io.vertx.core.json.JsonObject; + +/** + * TCP EventBus Client implementation + * + * @author Nakiguli Grace + */ + +public class TcpEventBusClientImpl implements TcpEventBusClient{ + + @Override + public TcpEventBusClient send(String String) { + return null; + } + + @Override + public TcpEventBusClient send(String address, + Handler> handler) { + return null; + } + + @Override + public TcpEventBusClient publish(String address, String body, DeliveryOptions deliveryOptions) { + return null; + } + + @Override + public TcpEventBusClient register( + Handler>> handler) { + return null; + } + + @Override + public TcpEventBusClient unRegister(Handler> handler) { + return null; + } + + @Override + public void close(Handler> handler) { + + } +} diff --git a/src/main/java/io/vertx/ext/eventbus/bridge/tcp/impl/TcpEventBusBridgeImpl.java b/src/main/java/io/vertx/ext/eventbus/bridge/tcp/impl/TcpEventBusBridgeImpl.java index ff2b111..781d8b0 100644 --- a/src/main/java/io/vertx/ext/eventbus/bridge/tcp/impl/TcpEventBusBridgeImpl.java +++ b/src/main/java/io/vertx/ext/eventbus/bridge/tcp/impl/TcpEventBusBridgeImpl.java @@ -61,7 +61,6 @@ public class TcpEventBusBridgeImpl implements TcpEventBusBridge { private final BridgeOptions options; private final Handler bridgeEventHandler; - public TcpEventBusBridgeImpl(Vertx vertx, BridgeOptions options, NetServerOptions netServerOptions, Handler eventHandler) { this.eb = vertx.eventBus(); this.options = options != null ? options : new BridgeOptions(); @@ -127,7 +126,6 @@ private void doSendOrPub(NetSocket socket, String address, JsonObject msg, Map Date: Fri, 22 Oct 2021 18:23:16 +0300 Subject: [PATCH 2/3] initial-work1 --- pom.xml | 164 ++++++++++++++++++ .../bridge/tcp/TcpEventBusClient.java | 40 ----- .../bridge/tcp/TcpEventBusClientImpl.java | 48 ----- .../bridge/tcp/EventBusBridgeRestIT.java | 19 ++ src/test/resources/my-it-config.json | 5 + 5 files changed, 188 insertions(+), 88 deletions(-) delete mode 100644 src/main/java/io/vertx/ext/eventbus/bridge/tcp/TcpEventBusClient.java delete mode 100644 src/main/java/io/vertx/ext/eventbus/bridge/tcp/TcpEventBusClientImpl.java create mode 100644 src/test/java/io/vertx/ext/eventbus/bridge/tcp/EventBusBridgeRestIT.java create mode 100644 src/test/resources/my-it-config.json diff --git a/pom.xml b/pom.xml index 908e0b6..7c34afb 100644 --- a/pom.xml +++ b/pom.xml @@ -90,5 +90,169 @@ 1.65 test + + + + com.jayway.restassured + rest-assured + 2.8.0 + test + + + + org.assertj + assertj-core + 3.4.1 + test + + + + + + + + src/test/resources + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.0.0 + + + reserve-network-port + + reserve-network-port + + process-sources + + + http.port + + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + 2.18.1 + + + + integration-test + verify + + + + + ${http.port} + + + + + + + + + maven-antrun-plugin + 1.8 + + + start-vertx-app + pre-integration-test + + run + + + + + + + + + + + + + + + stop-vertx-app + post-integration-test + + run + + + + + + + + + + + + + + + + + + + + + + windows + + + windows + + + + + + maven-antrun-plugin + 1.8 + + + stop-vertx-app + post-integration-test + + run + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/io/vertx/ext/eventbus/bridge/tcp/TcpEventBusClient.java b/src/main/java/io/vertx/ext/eventbus/bridge/tcp/TcpEventBusClient.java deleted file mode 100644 index f0228ad..0000000 --- a/src/main/java/io/vertx/ext/eventbus/bridge/tcp/TcpEventBusClient.java +++ /dev/null @@ -1,40 +0,0 @@ -package io.vertx.ext.eventbus.bridge.tcp; - -import io.vertx.core.AsyncResult; -import io.vertx.core.Handler; -import io.vertx.core.Vertx; -import io.vertx.core.eventbus.DeliveryOptions; -import io.vertx.core.eventbus.MessageConsumer; -import io.vertx.ext.bridge.BridgeOptions; - -/** - * TCP EventBus Client for to connect to the event bus bridge - * - * @author Nakiguli Grace - */ - -public interface TcpEventBusClient { - - /**create an event bus client */ - static TcpEventBusClient create(TcpEventBusClient tcpEventBusClient) { - return create(tcpEventBusClient); - } - - /**send message to eventBus address*/ - TcpEventBusClient send(String message); - - /**send message to eventBus address and expect a reply*/ - TcpEventBusClient send(String address, Handler> handler); - - /**publish message to eventBus address*/ - TcpEventBusClient publish(String address, String body, DeliveryOptions deliveryOptions); - - /**Subscribe a consumer*/ - TcpEventBusClient register(Handler>> handler); - - /**un subscribe a consumer if it does not want to listen*/ - TcpEventBusClient unRegister(Handler> handler); - - /**close client*/ - void close(Handler> handler); -} diff --git a/src/main/java/io/vertx/ext/eventbus/bridge/tcp/TcpEventBusClientImpl.java b/src/main/java/io/vertx/ext/eventbus/bridge/tcp/TcpEventBusClientImpl.java deleted file mode 100644 index 4bcd5e2..0000000 --- a/src/main/java/io/vertx/ext/eventbus/bridge/tcp/TcpEventBusClientImpl.java +++ /dev/null @@ -1,48 +0,0 @@ -package io.vertx.ext.eventbus.bridge.tcp; - -import io.vertx.core.AsyncResult; -import io.vertx.core.Handler; -import io.vertx.core.eventbus.DeliveryOptions; -import io.vertx.core.eventbus.MessageConsumer; -import io.vertx.core.json.JsonObject; - -/** - * TCP EventBus Client implementation - * - * @author Nakiguli Grace - */ - -public class TcpEventBusClientImpl implements TcpEventBusClient{ - - @Override - public TcpEventBusClient send(String String) { - return null; - } - - @Override - public TcpEventBusClient send(String address, - Handler> handler) { - return null; - } - - @Override - public TcpEventBusClient publish(String address, String body, DeliveryOptions deliveryOptions) { - return null; - } - - @Override - public TcpEventBusClient register( - Handler>> handler) { - return null; - } - - @Override - public TcpEventBusClient unRegister(Handler> handler) { - return null; - } - - @Override - public void close(Handler> handler) { - - } -} diff --git a/src/test/java/io/vertx/ext/eventbus/bridge/tcp/EventBusBridgeRestIT.java b/src/test/java/io/vertx/ext/eventbus/bridge/tcp/EventBusBridgeRestIT.java new file mode 100644 index 0000000..82f3c3c --- /dev/null +++ b/src/test/java/io/vertx/ext/eventbus/bridge/tcp/EventBusBridgeRestIT.java @@ -0,0 +1,19 @@ +package io.vertx.ext.eventbus.bridge.tcp; + +import org.junit.AfterClass; +import org.junit.BeforeClass; + +public class EventBusBridgeRestIT { + @BeforeClass + public static void configureRestAssured() { + RestAssured.baseURI = "http://localhost"; + RestAssured.port = Integer.getInteger("http.port", 8080); + } + + @AfterClass + public static void unConfigureRestAssured() { + RestAssured.reset(); + } + + +} diff --git a/src/test/resources/my-it-config.json b/src/test/resources/my-it-config.json new file mode 100644 index 0000000..c1ae919 --- /dev/null +++ b/src/test/resources/my-it-config.json @@ -0,0 +1,5 @@ + +{ + "http.port": "${http.port}" +} + From 87adf5049aa8e87e9ba7c19a64ad3bd0bf7bf0e1 Mon Sep 17 00:00:00 2001 From: Nakiguli Grace Date: Wed, 27 Oct 2021 15:13:08 +0300 Subject: [PATCH 3/3] initial-work1:Delete uwanted files --- pom.xml | 164 ------------------ .../bridge/tcp/EventBusBridgeRestIT.java | 19 -- src/test/resources/my-it-config.json | 5 - 3 files changed, 188 deletions(-) delete mode 100644 src/test/java/io/vertx/ext/eventbus/bridge/tcp/EventBusBridgeRestIT.java delete mode 100644 src/test/resources/my-it-config.json diff --git a/pom.xml b/pom.xml index 7c34afb..908e0b6 100644 --- a/pom.xml +++ b/pom.xml @@ -90,169 +90,5 @@ 1.65 test - - - - com.jayway.restassured - rest-assured - 2.8.0 - test - - - - org.assertj - assertj-core - 3.4.1 - test - - - - - - - - src/test/resources - true - - - - - - org.codehaus.mojo - build-helper-maven-plugin - 3.0.0 - - - reserve-network-port - - reserve-network-port - - process-sources - - - http.port - - - - - - - org.apache.maven.plugins - maven-failsafe-plugin - 2.18.1 - - - - integration-test - verify - - - - - ${http.port} - - - - - - - - - maven-antrun-plugin - 1.8 - - - start-vertx-app - pre-integration-test - - run - - - - - - - - - - - - - - - stop-vertx-app - post-integration-test - - run - - - - - - - - - - - - - - - - - - - - - - windows - - - windows - - - - - - maven-antrun-plugin - 1.8 - - - stop-vertx-app - post-integration-test - - run - - - - - - - - - - - - - - - - - - - diff --git a/src/test/java/io/vertx/ext/eventbus/bridge/tcp/EventBusBridgeRestIT.java b/src/test/java/io/vertx/ext/eventbus/bridge/tcp/EventBusBridgeRestIT.java deleted file mode 100644 index 82f3c3c..0000000 --- a/src/test/java/io/vertx/ext/eventbus/bridge/tcp/EventBusBridgeRestIT.java +++ /dev/null @@ -1,19 +0,0 @@ -package io.vertx.ext.eventbus.bridge.tcp; - -import org.junit.AfterClass; -import org.junit.BeforeClass; - -public class EventBusBridgeRestIT { - @BeforeClass - public static void configureRestAssured() { - RestAssured.baseURI = "http://localhost"; - RestAssured.port = Integer.getInteger("http.port", 8080); - } - - @AfterClass - public static void unConfigureRestAssured() { - RestAssured.reset(); - } - - -} diff --git a/src/test/resources/my-it-config.json b/src/test/resources/my-it-config.json deleted file mode 100644 index c1ae919..0000000 --- a/src/test/resources/my-it-config.json +++ /dev/null @@ -1,5 +0,0 @@ - -{ - "http.port": "${http.port}" -} -