Skip to content

Commit 7c924d2

Browse files
authored
Update deps and cleanup (#836)
* Cleanup in ServiceAuthRemoteTest * Dependencies update * Fixed unstable ErrorFlowTest
1 parent 1af8169 commit 7c924d2

File tree

3 files changed

+33
-37
lines changed

3 files changed

+33
-37
lines changed

pom.xml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<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">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
35
<modelVersion>4.0.0</modelVersion>
46

57
<parent>
@@ -57,12 +59,13 @@
5759
</scm>
5860

5961
<properties>
60-
<scalecube-cluster.version>2.6.13</scalecube-cluster.version>
61-
<scalecube-commons.version>1.0.21</scalecube-commons.version>
62-
<scalecube-security.version>1.0.28</scalecube-security.version>
62+
<scalecube-cluster.version>2.6.15</scalecube-cluster.version>
63+
<scalecube-commons.version>1.0.22</scalecube-commons.version>
64+
<scalecube-security.version>1.0.29</scalecube-security.version>
6365

64-
<reactor.version>2020.0.23</reactor.version>
65-
<jackson.version>2.13.3</jackson.version>
66+
<reactor.version>2022.0.7</reactor.version>
67+
<jackson.version>2.15.1</jackson.version>
68+
<netty.version>4.1.92.Final</netty.version>
6669
<rsocket.version>1.1.3</rsocket.version>
6770
<protostuff.version>1.6.0</protostuff.version>
6871
<slf4j.version>1.7.36</slf4j.version>
@@ -71,7 +74,7 @@
7174
<jsr305.version>3.0.2</jsr305.version>
7275
<jctools.version>2.1.2</jctools.version>
7376

74-
<mockito-junit-jupiter.version>4.6.1</mockito-junit-jupiter.version>
77+
<mockito-junit.version>4.6.1</mockito-junit.version>
7578
<junit-jupiter.version>5.8.2</junit-jupiter.version>
7679
<hamcrest.version>1.3</hamcrest.version>
7780

@@ -132,6 +135,15 @@
132135
<scope>import</scope>
133136
</dependency>
134137

138+
<!-- Reactor -->
139+
<dependency>
140+
<groupId>io.netty</groupId>
141+
<artifactId>netty-bom</artifactId>
142+
<version>${netty.version}</version>
143+
<type>pom</type>
144+
<scope>import</scope>
145+
</dependency>
146+
135147
<!-- Logging -->
136148
<dependency>
137149
<groupId>org.slf4j</groupId>
@@ -219,7 +231,7 @@
219231
<dependency>
220232
<groupId>org.mockito</groupId>
221233
<artifactId>mockito-junit-jupiter</artifactId>
222-
<version>${mockito-junit-jupiter.version}</version>
234+
<version>${mockito-junit.version}</version>
223235
<scope>test</scope>
224236
</dependency>
225237
<dependency>

services/src/test/java/io/scalecube/services/ErrorFlowTest.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import static org.junit.jupiter.api.Assertions.assertThrows;
44
import static reactor.core.publisher.Mono.from;
55

6-
import io.scalecube.net.Address;
76
import io.scalecube.services.api.ServiceMessage;
87
import io.scalecube.services.discovery.ScalecubeServiceDiscovery;
98
import io.scalecube.services.exceptions.BadRequestException;
@@ -29,7 +28,7 @@ public class ErrorFlowTest extends BaseTest {
2928
private static Microservices consumer;
3029

3130
@BeforeAll
32-
public static void initNodes() {
31+
public static void initNodes() throws InterruptedException {
3332
provider =
3433
Microservices.builder()
3534
.discovery(
@@ -42,19 +41,22 @@ public static void initNodes() {
4241
.services(new GreetingServiceImpl())
4342
.startAwait();
4443

45-
final Address seedAddress = provider.discoveryAddress();
46-
4744
consumer =
4845
Microservices.builder()
4946
.discovery(
5047
endpoint ->
5148
new ScalecubeServiceDiscovery()
52-
.membership(cfg -> cfg.seedMembers(seedAddress))
49+
.membership(cfg -> cfg.seedMembers(provider.discoveryAddress()))
5350
.transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory()))
5451
.transport(cfg -> cfg.port(PORT.incrementAndGet()))
5552
.options(opts -> opts.metadata(endpoint)))
5653
.transport(RSocketServiceTransport::new)
5754
.startAwait();
55+
56+
while (consumer.serviceEndpoints().size() != 1) {
57+
//noinspection BusyWait
58+
Thread.sleep(1);
59+
}
5860
}
5961

6062
@AfterAll

services/src/test/java/io/scalecube/services/ServiceAuthRemoteTest.java

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,7 @@ static void afterAll() {
135135
@Test
136136
@DisplayName("Successful authentication")
137137
void successfulAuthentication() {
138-
Microservices caller = newCaller();
139-
try {
138+
try (Microservices caller = newCaller()) {
140139
SecuredService securedService = caller.call().api(SecuredService.class);
141140

142141
StepVerifier.create(securedService.helloWithRequest("Bob"))
@@ -150,16 +149,13 @@ void successfulAuthentication() {
150149
StepVerifier.create(securedService.helloWithRequestAndPrincipal("Bob"))
151150
.assertNext(response -> assertEquals("Hello, Bob and Alice", response))
152151
.verifyComplete();
153-
} finally {
154-
caller.shutdown().block(TIMEOUT);
155152
}
156153
}
157154

158155
@Test
159156
@DisplayName("Authentication failed if authenticator not provided")
160157
void failedAuthenticationWhenAuthenticatorNotProvided() {
161-
Microservices caller = newCaller();
162-
try {
158+
try (Microservices caller = newCaller()) {
163159
AnotherSecuredService securedService = caller.call().api(AnotherSecuredService.class);
164160

165161
Consumer<Throwable> verifyError =
@@ -179,16 +175,13 @@ void failedAuthenticationWhenAuthenticatorNotProvided() {
179175
StepVerifier.create(securedService.helloWithRequestAndPrincipal("Bob"))
180176
.expectErrorSatisfies(verifyError)
181177
.verify();
182-
} finally {
183-
caller.shutdown().block(TIMEOUT);
184178
}
185179
}
186180

187181
@Test
188182
@DisplayName("Authentication failed with empty credentials")
189183
void failedAuthenticationWithEmptyCredentials() {
190-
Microservices caller = newEmptyCredentialsCaller();
191-
try {
184+
try (Microservices caller = newEmptyCredentialsCaller()) {
192185
SecuredService securedService = caller.call().api(SecuredService.class);
193186

194187
Consumer<Throwable> verifyError =
@@ -208,16 +201,13 @@ void failedAuthenticationWithEmptyCredentials() {
208201
StepVerifier.create(securedService.helloWithRequestAndPrincipal("Bob"))
209202
.expectErrorSatisfies(verifyError)
210203
.verify();
211-
} finally {
212-
caller.shutdown().block(TIMEOUT);
213204
}
214205
}
215206

216207
@Test
217208
@DisplayName("Authentication failed with invalid credentials")
218209
void failedAuthenticationWithInvalidCredentials() {
219-
Microservices caller = newInvalidCredentialsCaller();
220-
try {
210+
try (Microservices caller = newInvalidCredentialsCaller()) {
221211
SecuredService securedService = caller.call().api(SecuredService.class);
222212

223213
Consumer<Throwable> verifyError =
@@ -237,32 +227,26 @@ void failedAuthenticationWithInvalidCredentials() {
237227
StepVerifier.create(securedService.helloWithRequestAndPrincipal("Bob"))
238228
.expectErrorSatisfies(verifyError)
239229
.verify();
240-
} finally {
241-
caller.shutdown().block(TIMEOUT);
242230
}
243231
}
244232

245233
@Test
246234
@DisplayName("Successful authentication of partially secured service")
247235
void successfulAuthenticationOnPartiallySecuredService() {
248-
Microservices caller = newCaller();
249-
try {
236+
try (Microservices caller = newCaller()) {
250237
StepVerifier.create(caller.call().api(PartiallySecuredService.class).securedMethod("Alice"))
251238
.assertNext(response -> assertEquals("Hello, Alice", response))
252239
.verifyComplete();
253240
StepVerifier.create(caller.call().api(PartiallySecuredService.class).publicMethod("Alice"))
254241
.assertNext(response -> assertEquals("Hello, Alice", response))
255242
.verifyComplete();
256-
} finally {
257-
caller.shutdown().block(TIMEOUT);
258243
}
259244
}
260245

261246
@Test
262247
@DisplayName("Successful call public method of partially secured service without authentication")
263248
void successfulCallOfPublicMethodWithoutAuthentication() {
264-
Microservices caller = newCaller();
265-
try {
249+
try (Microservices caller = newCaller()) {
266250
StepVerifier.create(caller.call().api(PartiallySecuredService.class).publicMethod("Alice"))
267251
.assertNext(response -> assertEquals("Hello, Alice", response))
268252
.verifyComplete();
@@ -275,8 +259,6 @@ void successfulCallOfPublicMethodWithoutAuthentication() {
275259

276260
StepVerifier.create(caller.call().api(PartiallySecuredService.class).securedMethod("Alice"))
277261
.verifyErrorSatisfies(verifyError);
278-
} finally {
279-
caller.shutdown().block(TIMEOUT);
280262
}
281263
}
282264

0 commit comments

Comments
 (0)