diff --git a/pom.xml b/pom.xml index c9eef4f2..70cab5cc 100644 --- a/pom.xml +++ b/pom.xml @@ -57,12 +57,13 @@ - 2.10.18 + 2.10.20 1.0.17 + 2.6.10 - 2020.0.6 - 1.0.4 - 4.1.63.Final + 2020.0.10 + 1.0.5 + 4.1.66.Final 2.11.0 3.1.2 1.7.30 @@ -116,6 +117,11 @@ scalecube-commons ${scalecube-commons.version} + + io.scalecube + scalecube-transport-netty + ${scalecube-cluster.version} + diff --git a/services-gateway-tests/pom.xml b/services-gateway-tests/pom.xml index 10059e7e..8f3c8751 100644 --- a/services-gateway-tests/pom.xml +++ b/services-gateway-tests/pom.xml @@ -42,6 +42,10 @@ io.scalecube scalecube-services-transport-jackson + + io.scalecube + scalecube-transport-netty + org.slf4j diff --git a/services-gateway-tests/src/test/java/io/scalecube/services/gateway/AbstractGatewayExtension.java b/services-gateway-tests/src/test/java/io/scalecube/services/gateway/AbstractGatewayExtension.java index 882150c3..99d8264d 100644 --- a/services-gateway-tests/src/test/java/io/scalecube/services/gateway/AbstractGatewayExtension.java +++ b/services-gateway-tests/src/test/java/io/scalecube/services/gateway/AbstractGatewayExtension.java @@ -11,6 +11,7 @@ import io.scalecube.services.gateway.transport.StaticAddressRouter; import io.scalecube.services.transport.api.ClientTransport; import io.scalecube.services.transport.rsocket.RSocketServiceTransport; +import io.scalecube.transport.netty.websocket.WebsocketTransportFactory; import java.util.function.Function; import org.junit.jupiter.api.extension.AfterAllCallback; import org.junit.jupiter.api.extension.AfterEachCallback; @@ -47,7 +48,12 @@ protected AbstractGatewayExtension( public final void beforeAll(ExtensionContext context) { gateway = Microservices.builder() - .discovery("gateway", ScalecubeServiceDiscovery::new) + .discovery( + "gateway", + serviceEndpoint -> + new ScalecubeServiceDiscovery() + .transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory())) + .options(opts -> opts.metadata(serviceEndpoint))) .transport(RSocketServiceTransport::new) .gateway( options -> { @@ -100,7 +106,9 @@ public void startServices() { } private ServiceDiscovery serviceDiscovery(ServiceEndpoint serviceEndpoint) { - return new ScalecubeServiceDiscovery(serviceEndpoint) + return new ScalecubeServiceDiscovery() + .transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory())) + .options(opts -> opts.metadata(serviceEndpoint)) .membership(opts -> opts.seedMembers(gateway.discovery("gateway").address())); } diff --git a/services-gateway-tests/src/test/java/io/scalecube/services/gateway/http/CorsTest.java b/services-gateway-tests/src/test/java/io/scalecube/services/gateway/http/CorsTest.java index 41ff827a..c59d0e74 100644 --- a/services-gateway-tests/src/test/java/io/scalecube/services/gateway/http/CorsTest.java +++ b/services-gateway-tests/src/test/java/io/scalecube/services/gateway/http/CorsTest.java @@ -13,6 +13,7 @@ import io.scalecube.services.examples.GreetingServiceImpl; import io.scalecube.services.gateway.BaseTest; import io.scalecube.services.transport.rsocket.RSocketServiceTransport; +import io.scalecube.transport.netty.websocket.WebsocketTransportFactory; import java.time.Duration; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -32,7 +33,12 @@ public class CorsTest extends BaseTest { private final Microservices.Builder gatewayBuilder = Microservices.builder() - .discovery("gateway", ScalecubeServiceDiscovery::new) + .discovery( + "gateway", + serviceEndpoint -> + new ScalecubeServiceDiscovery() + .transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory())) + .options(opts -> opts.metadata(serviceEndpoint))) .transport(RSocketServiceTransport::new) .services(new GreetingServiceImpl()); private HttpClient client; diff --git a/services-gateway-tests/src/test/java/io/scalecube/services/gateway/http/HttpClientConnectionTest.java b/services-gateway-tests/src/test/java/io/scalecube/services/gateway/http/HttpClientConnectionTest.java index c9fb2f1e..76cbae33 100644 --- a/services-gateway-tests/src/test/java/io/scalecube/services/gateway/http/HttpClientConnectionTest.java +++ b/services-gateway-tests/src/test/java/io/scalecube/services/gateway/http/HttpClientConnectionTest.java @@ -16,6 +16,7 @@ import io.scalecube.services.gateway.transport.StaticAddressRouter; import io.scalecube.services.gateway.transport.http.HttpGatewayClient; import io.scalecube.services.transport.rsocket.RSocketServiceTransport; +import io.scalecube.transport.netty.websocket.WebsocketTransportFactory; import java.io.IOException; import java.time.Duration; import java.util.concurrent.atomic.AtomicInteger; @@ -42,7 +43,12 @@ class HttpClientConnectionTest extends BaseTest { void beforEach() { gateway = Microservices.builder() - .discovery("gateway", ScalecubeServiceDiscovery::new) + .discovery( + "gateway", + serviceEndpoint -> + new ScalecubeServiceDiscovery() + .transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory())) + .options(opts -> opts.metadata(serviceEndpoint))) .transport(RSocketServiceTransport::new) .gateway(options -> new HttpGateway(options.id("HTTP"))) .startAwait(); @@ -54,7 +60,9 @@ void beforEach() { .discovery( "service", serviceEndpoint -> - new ScalecubeServiceDiscovery(serviceEndpoint) + new ScalecubeServiceDiscovery() + .transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory())) + .options(opts -> opts.metadata(serviceEndpoint)) .membership( opts -> opts.seedMembers(gateway.discovery("gateway").address()))) .transport(RSocketServiceTransport::new) diff --git a/services-gateway-tests/src/test/java/io/scalecube/services/gateway/rsocket/RSocketClientConnectionTest.java b/services-gateway-tests/src/test/java/io/scalecube/services/gateway/rsocket/RSocketClientConnectionTest.java index 4dc5fdf5..3369fa33 100644 --- a/services-gateway-tests/src/test/java/io/scalecube/services/gateway/rsocket/RSocketClientConnectionTest.java +++ b/services-gateway-tests/src/test/java/io/scalecube/services/gateway/rsocket/RSocketClientConnectionTest.java @@ -21,6 +21,7 @@ import io.scalecube.services.gateway.transport.StaticAddressRouter; import io.scalecube.services.gateway.transport.rsocket.RSocketGatewayClient; import io.scalecube.services.transport.rsocket.RSocketServiceTransport; +import io.scalecube.transport.netty.websocket.WebsocketTransportFactory; import java.io.IOException; import java.time.Duration; import java.util.Collections; @@ -51,7 +52,12 @@ void beforEach() { sessionEventHandler = new TestGatewaySessionHandler(); gateway = Microservices.builder() - .discovery("gateway", ScalecubeServiceDiscovery::new) + .discovery( + "gateway", + serviceEndpoint -> + new ScalecubeServiceDiscovery() + .transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory())) + .options(opts -> opts.metadata(serviceEndpoint))) .transport(RSocketServiceTransport::new) .gateway(options -> new RSocketGateway(options.id("RS"), sessionEventHandler)) .startAwait(); @@ -63,7 +69,9 @@ void beforEach() { .discovery( "service", serviceEndpoint -> - new ScalecubeServiceDiscovery(serviceEndpoint) + new ScalecubeServiceDiscovery() + .transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory())) + .options(opts -> opts.metadata(serviceEndpoint)) .membership( opts -> opts.seedMembers(gateway.discovery("gateway").address()))) .transport(RSocketServiceTransport::new) diff --git a/services-gateway-tests/src/test/java/io/scalecube/services/gateway/websocket/WebsocketClientConnectionTest.java b/services-gateway-tests/src/test/java/io/scalecube/services/gateway/websocket/WebsocketClientConnectionTest.java index 6a4662f6..5d1c445a 100644 --- a/services-gateway-tests/src/test/java/io/scalecube/services/gateway/websocket/WebsocketClientConnectionTest.java +++ b/services-gateway-tests/src/test/java/io/scalecube/services/gateway/websocket/WebsocketClientConnectionTest.java @@ -26,6 +26,7 @@ import io.scalecube.services.gateway.transport.websocket.WebsocketGatewayClientSession; import io.scalecube.services.gateway.ws.WebsocketGateway; import io.scalecube.services.transport.rsocket.RSocketServiceTransport; +import io.scalecube.transport.netty.websocket.WebsocketTransportFactory; import java.io.IOException; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; @@ -61,7 +62,12 @@ void beforEach() { this.sessionEventHandler = new TestGatewaySessionHandler(); gateway = Microservices.builder() - .discovery("gateway", ScalecubeServiceDiscovery::new) + .discovery( + "gateway", + serviceEndpoint -> + new ScalecubeServiceDiscovery() + .transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory())) + .options(opts -> opts.metadata(serviceEndpoint))) .transport(RSocketServiceTransport::new) .gateway(options -> new WebsocketGateway(options.id("WS"), sessionEventHandler)) .startAwait(); @@ -73,7 +79,9 @@ void beforEach() { .discovery( "service", serviceEndpoint -> - new ScalecubeServiceDiscovery(serviceEndpoint) + new ScalecubeServiceDiscovery() + .transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory())) + .options(opts -> opts.metadata(serviceEndpoint)) .membership( opts -> opts.seedMembers(gateway.discovery("gateway").address()))) .transport(RSocketServiceTransport::new) diff --git a/services-gateway-tests/src/test/java/io/scalecube/services/gateway/websocket/WebsocketClientTest.java b/services-gateway-tests/src/test/java/io/scalecube/services/gateway/websocket/WebsocketClientTest.java index d85b2bbe..9f97e295 100644 --- a/services-gateway-tests/src/test/java/io/scalecube/services/gateway/websocket/WebsocketClientTest.java +++ b/services-gateway-tests/src/test/java/io/scalecube/services/gateway/websocket/WebsocketClientTest.java @@ -18,6 +18,7 @@ import io.scalecube.services.gateway.transport.websocket.WebsocketGatewayClient; import io.scalecube.services.gateway.ws.WebsocketGateway; import io.scalecube.services.transport.rsocket.RSocketServiceTransport; +import io.scalecube.transport.netty.websocket.WebsocketTransportFactory; import java.time.Duration; import java.util.concurrent.ThreadLocalRandom; import java.util.stream.Collectors; @@ -45,7 +46,12 @@ class WebsocketClientTest extends BaseTest { static void beforeAll() { gateway = Microservices.builder() - .discovery("gateway", ScalecubeServiceDiscovery::new) + .discovery( + "gateway", + serviceEndpoint -> + new ScalecubeServiceDiscovery() + .transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory())) + .options(opts -> opts.metadata(serviceEndpoint))) .transport(RSocketServiceTransport::new) .gateway( options -> new WebsocketGateway(options.id("WS"), new TestGatewaySessionHandler())) @@ -57,7 +63,9 @@ static void beforeAll() { .discovery( "service", serviceEndpoint -> - new ScalecubeServiceDiscovery(serviceEndpoint) + new ScalecubeServiceDiscovery() + .transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory())) + .options(opts -> opts.metadata(serviceEndpoint)) .membership( opts -> opts.seedMembers(gateway.discovery("gateway").address()))) .transport(RSocketServiceTransport::new) diff --git a/services-gateway-tests/src/test/java/io/scalecube/services/gateway/websocket/WebsocketServerTest.java b/services-gateway-tests/src/test/java/io/scalecube/services/gateway/websocket/WebsocketServerTest.java index a53e913a..c14b8dee 100644 --- a/services-gateway-tests/src/test/java/io/scalecube/services/gateway/websocket/WebsocketServerTest.java +++ b/services-gateway-tests/src/test/java/io/scalecube/services/gateway/websocket/WebsocketServerTest.java @@ -18,6 +18,7 @@ import io.scalecube.services.gateway.transport.websocket.WebsocketGatewayClient; import io.scalecube.services.gateway.ws.WebsocketGateway; import io.scalecube.services.transport.rsocket.RSocketServiceTransport; +import io.scalecube.transport.netty.websocket.WebsocketTransportFactory; import java.time.Duration; import java.util.concurrent.ThreadLocalRandom; import java.util.stream.Collectors; @@ -44,7 +45,12 @@ class WebsocketServerTest extends BaseTest { static void beforeAll() { gateway = Microservices.builder() - .discovery("gateway", ScalecubeServiceDiscovery::new) + .discovery( + "gateway", + serviceEndpoint -> + new ScalecubeServiceDiscovery() + .transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory())) + .options(opts -> opts.metadata(serviceEndpoint))) .transport(RSocketServiceTransport::new) .gateway( options -> new WebsocketGateway(options.id("WS"), new TestGatewaySessionHandler()))