Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Commit

Permalink
Updated dependencies (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-v authored Jun 15, 2023
1 parent 7840752 commit 943cb73
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 23 deletions.
24 changes: 18 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
Expand Down Expand Up @@ -33,13 +35,14 @@
</scm>

<properties>
<scalecube-cluster.version>2.6.13</scalecube-cluster.version>
<scalecube-commons.version>1.0.21</scalecube-commons.version>
<scalecube-services.version>2.10.24</scalecube-services.version>
<scalecube-cluster.version>2.6.15</scalecube-cluster.version>
<scalecube-commons.version>1.0.22</scalecube-commons.version>
<scalecube-services.version>2.10.25</scalecube-services.version>

<reactor.version>2020.0.23</reactor.version>
<reactor.version>2022.0.7</reactor.version>
<rsocket.version>1.1.3</rsocket.version>
<jackson.version>2.13.3</jackson.version>
<jackson.version>2.15.1</jackson.version>
<netty.version>4.1.92.Final</netty.version>
<slf4j.version>1.7.36</slf4j.version>
<log4j.version>2.17.2</log4j.version>
<disruptor.version>3.4.2</disruptor.version>
Expand Down Expand Up @@ -104,6 +107,15 @@
<scope>import</scope>
</dependency>

<!-- Netty -->
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-bom</artifactId>
<version>${netty.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>

<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ public abstract class GatewayTemplate implements Gateway {
protected final GatewayOptions options;

protected GatewayTemplate(GatewayOptions options) {
this.options = new GatewayOptions(options);
this.options =
new GatewayOptions()
.id(options.id())
.port(options.port())
.workerPool(options.workerPool())
.call(options.call());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private ServiceDiscovery serviceDiscovery(ServiceEndpoint serviceEndpoint) {
return new ScalecubeServiceDiscovery()
.transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory()))
.options(opts -> opts.metadata(serviceEndpoint))
.membership(opts -> opts.seedMembers(gateway.discovery().address()));
.membership(opts -> opts.seedMembers(gateway.discoveryAddress()));
}

public void shutdownServices() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void beforEach() {
new ScalecubeServiceDiscovery()
.transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory()))
.options(opts -> opts.metadata(serviceEndpoint))
.membership(opts -> opts.seedMembers(gateway.discovery().address())))
.membership(opts -> opts.seedMembers(gateway.discoveryAddress())))
.transport(RSocketServiceTransport::new)
.services(new TestServiceImpl())
.startAwait();
Expand Down Expand Up @@ -91,7 +91,7 @@ void testCloseServiceStreamAfterLostConnection() {
.router(new StaticAddressRouter(gatewayAddress));

StepVerifier.create(serviceCall.api(TestService.class).oneNever("body").log("<<< "))
.thenAwait(Duration.ofSeconds(1))
.thenAwait(Duration.ofSeconds(5))
.then(() -> client.close())
.then(() -> client.onClose().block())
.expectError(IOException.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void beforEach() {
new ScalecubeServiceDiscovery()
.transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory()))
.options(opts -> opts.metadata(serviceEndpoint))
.membership(opts -> opts.seedMembers(gateway.discovery().address())))
.membership(opts -> opts.seedMembers(gateway.discoveryAddress())))
.transport(RSocketServiceTransport::new)
.services(new TestServiceImpl(onCloseCounter::incrementAndGet))
.startAwait();
Expand Down Expand Up @@ -100,7 +100,7 @@ void testCloseServiceStreamAfterLostConnection() {
.router(new StaticAddressRouter(gatewayAddress));

StepVerifier.create(serviceCall.api(TestService.class).manyNever().log("<<< "))
.thenAwait(Duration.ofSeconds(1))
.thenAwait(Duration.ofSeconds(5))
.then(() -> client.close())
.then(() -> client.onClose().block())
.expectError(IOException.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void beforEach() {
new ScalecubeServiceDiscovery()
.transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory()))
.options(opts -> opts.metadata(serviceEndpoint))
.membership(opts -> opts.seedMembers(gateway.discovery().address())))
.membership(opts -> opts.seedMembers(gateway.discoveryAddress())))
.transport(RSocketServiceTransport::new)
.services(new TestServiceImpl(onCloseCounter::incrementAndGet))
.startAwait();
Expand Down Expand Up @@ -110,7 +110,7 @@ void testCloseServiceStreamAfterLostConnection() {
.router(new StaticAddressRouter(gatewayAddress));

StepVerifier.create(serviceCall.api(TestService.class).manyNever().log("<<< "))
.thenAwait(Duration.ofSeconds(1))
.thenAwait(Duration.ofSeconds(5))
.then(() -> client.close())
.then(() -> client.onClose().block())
.expectError(IOException.class)
Expand Down Expand Up @@ -168,8 +168,11 @@ public void testHandlerEvents() throws InterruptedException {

@Test
void testKeepalive()
throws InterruptedException, NoSuchFieldException, IllegalAccessException,
NoSuchMethodException, InvocationTargetException {
throws InterruptedException,
NoSuchFieldException,
IllegalAccessException,
NoSuchMethodException,
InvocationTargetException {

int expectedKeepalives = 3;
Duration keepAliveInterval = Duration.ofSeconds(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.junit.jupiter.api.RepeatedTest;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.netty.resources.LoopResources;
import reactor.test.StepVerifier;

class WebsocketClientTest extends BaseTest {
Expand All @@ -39,9 +40,12 @@ class WebsocketClientTest extends BaseTest {
private static Address gatewayAddress;
private static Microservices service;
private static GatewayClient client;
private static LoopResources loopResources;

@BeforeAll
static void beforeAll() {
loopResources = LoopResources.create("websocket-gateway-client");

gateway =
Microservices.builder()
.discovery(
Expand All @@ -62,7 +66,7 @@ static void beforeAll() {
new ScalecubeServiceDiscovery()
.transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory()))
.options(opts -> opts.metadata(serviceEndpoint))
.membership(opts -> opts.seedMembers(gateway.discovery().address())))
.membership(opts -> opts.seedMembers(gateway.discoveryAddress())))
.transport(RSocketServiceTransport::new)
.services(new TestServiceImpl())
.startAwait();
Expand All @@ -82,26 +86,33 @@ static void afterAll() {
if (client != null) {
client.close();
}

Flux.concat(
Mono.justOrEmpty(gateway).map(Microservices::shutdown),
Mono.justOrEmpty(service).map(Microservices::shutdown))
.then()
.block();

if (loopResources != null) {
loopResources.disposeLater().block();
}
}

@RepeatedTest(300)
@RepeatedTest(100)
void testMessageSequence() {

client =
new WebsocketGatewayClient(
GatewayClientSettings.builder().address(gatewayAddress).build(), CLIENT_CODEC);
GatewayClientSettings.builder().address(gatewayAddress).build(),
CLIENT_CODEC,
loopResources);

ServiceCall serviceCall =
new ServiceCall()
.transport(new GatewayClientTransport(client))
.router(new StaticAddressRouter(gatewayAddress));

int count = (int) 1e3;
int count = 100;

StepVerifier.create(serviceCall.api(TestService.class).many(count) /*.log("<<< ")*/)
.expectNextSequence(IntStream.range(0, count).boxed().collect(Collectors.toList()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.junit.jupiter.api.RepeatedTest;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.netty.resources.LoopResources;
import reactor.test.StepVerifier;

class WebsocketServerTest extends BaseTest {
Expand All @@ -38,9 +39,12 @@ class WebsocketServerTest extends BaseTest {
private static Microservices gateway;
private static Address gatewayAddress;
private static GatewayClient client;
private static LoopResources loopResources;

@BeforeAll
static void beforeAll() {
loopResources = LoopResources.create("websocket-gateway-client");

gateway =
Microservices.builder()
.discovery(
Expand Down Expand Up @@ -71,22 +75,29 @@ static void afterAll() {
if (client != null) {
client.close();
}

Mono.justOrEmpty(gateway).map(Microservices::shutdown).then().block();

if (loopResources != null) {
loopResources.disposeLater().block();
}
}

@RepeatedTest(300)
@RepeatedTest(100)
void testMessageSequence() {

client =
new WebsocketGatewayClient(
GatewayClientSettings.builder().address(gatewayAddress).build(), CLIENT_CODEC);
GatewayClientSettings.builder().address(gatewayAddress).build(),
CLIENT_CODEC,
loopResources);

ServiceCall serviceCall =
new ServiceCall()
.transport(new GatewayClientTransport(client))
.router(new StaticAddressRouter(gatewayAddress));

int count = (int) 1e3;
int count = 100;

StepVerifier.create(serviceCall.api(TestService.class).many(count) /*.log("<<< ")*/)
.expectNextSequence(IntStream.range(0, count).boxed().collect(Collectors.toList()))
Expand Down

0 comments on commit 943cb73

Please sign in to comment.