Skip to content

Commit 0a03d8e

Browse files
committed
Upgrade to RSocket 0.12.1-RC3 and update tests
1) Tests use a timeout to avoid hanging issues 2) Some tests adjusted to work around potential rsocket-java issue rsocket/rsocket-java#613
1 parent c8609b8 commit 0a03d8e

File tree

4 files changed

+33
-19
lines changed

4 files changed

+33
-19
lines changed

spring-messaging/spring-messaging.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dependencyManagement {
77
}
88
}
99

10-
def rsocketVersion = "0.12.1-RC3-SNAPSHOT"
10+
def rsocketVersion = "0.12.1-RC3"
1111

1212
dependencies {
1313
compile(project(":spring-beans"))

spring-messaging/src/test/java/org/springframework/messaging/rsocket/RSocketBufferLeakTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public void assemblyTimeErrorForHandleAndReply() {
138138
StepVerifier.create(result).expectErrorMatches(ex -> {
139139
String prefix = "Ambiguous handler methods mapped for destination 'A.B':";
140140
return ex.getMessage().startsWith(prefix);
141-
}).verify();
141+
}).verify(Duration.ofSeconds(5));
142142
}
143143

144144
@Test
@@ -147,25 +147,25 @@ public void subscriptionTimeErrorForHandleAndReply() {
147147
StepVerifier.create(result).expectErrorMatches(ex -> {
148148
String prefix = "Cannot decode to [org.springframework.core.io.Resource]";
149149
return ex.getMessage().contains(prefix);
150-
}).verify();
150+
}).verify(Duration.ofSeconds(5));
151151
}
152152

153153
@Test
154154
public void errorSignalWithExceptionHandler() {
155155
Mono<String> result = requester.route("error-signal").data("foo").retrieveMono(String.class);
156-
StepVerifier.create(result).expectNext("Handled 'bad input'").verifyComplete();
156+
StepVerifier.create(result).expectNext("Handled 'bad input'").expectComplete().verify(Duration.ofSeconds(5));
157157
}
158158

159159
@Test
160160
public void ignoreInput() {
161161
Flux<String> result = requester.route("ignore-input").data("a").retrieveFlux(String.class);
162-
StepVerifier.create(result).expectNext("bar").verifyComplete();
162+
StepVerifier.create(result).expectNext("bar").thenCancel().verify(Duration.ofSeconds(5));
163163
}
164164

165165
@Test
166166
public void retrieveMonoFromFluxResponderMethod() {
167167
Mono<String> result = requester.route("request-stream").data("foo").retrieveMono(String.class);
168-
StepVerifier.create(result).expectNext("foo-1").verifyComplete();
168+
StepVerifier.create(result).expectNext("foo-1").expectComplete().verify(Duration.ofSeconds(5));
169169
}
170170

171171

spring-messaging/src/test/java/org/springframework/messaging/rsocket/RSocketClientToServerIntegrationTests.java

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ public void echo() {
121121

122122
StepVerifier.create(result)
123123
.expectNext("Hello 1").expectNext("Hello 2").expectNext("Hello 3")
124-
.verifyComplete();
124+
.expectComplete()
125+
.verify(Duration.ofSeconds(5));
125126
}
126127

127128
@Test
@@ -131,7 +132,8 @@ public void echoAsync() {
131132

132133
StepVerifier.create(result)
133134
.expectNext("Hello 1 async").expectNext("Hello 2 async").expectNext("Hello 3 async")
134-
.verifyComplete();
135+
.expectComplete()
136+
.verify(Duration.ofSeconds(5));
135137
}
136138

137139
@Test
@@ -141,7 +143,7 @@ public void echoStream() {
141143
StepVerifier.create(result)
142144
.expectNext("Hello 0").expectNextCount(6).expectNext("Hello 7")
143145
.thenCancel()
144-
.verify();
146+
.verify(Duration.ofSeconds(5));
145147
}
146148

147149
@Test
@@ -152,37 +154,46 @@ public void echoChannel() {
152154

153155
StepVerifier.create(result)
154156
.expectNext("Hello 1 async").expectNextCount(8).expectNext("Hello 10 async")
155-
.verifyComplete();
157+
.thenCancel() // https://github.com/rsocket/rsocket-java/issues/613
158+
.verify(Duration.ofSeconds(5));
156159
}
157160

158161
@Test
159162
public void voidReturnValue() {
160163
Flux<String> result = requester.route("void-return-value").data("Hello").retrieveFlux(String.class);
161-
StepVerifier.create(result).verifyComplete();
164+
StepVerifier.create(result).expectComplete().verify(Duration.ofSeconds(5));
162165
}
163166

164167
@Test
165168
public void voidReturnValueFromExceptionHandler() {
166169
Flux<String> result = requester.route("void-return-value").data("bad").retrieveFlux(String.class);
167-
StepVerifier.create(result).verifyComplete();
170+
StepVerifier.create(result).expectComplete().verify(Duration.ofSeconds(5));
168171
}
169172

170173
@Test
171174
public void handleWithThrownException() {
172175
Mono<String> result = requester.route("thrown-exception").data("a").retrieveMono(String.class);
173-
StepVerifier.create(result).expectNext("Invalid input error handled").verifyComplete();
176+
StepVerifier.create(result)
177+
.expectNext("Invalid input error handled")
178+
.expectComplete()
179+
.verify(Duration.ofSeconds(5));
174180
}
175181

176182
@Test
177183
public void handleWithErrorSignal() {
178184
Mono<String> result = requester.route("error-signal").data("a").retrieveMono(String.class);
179-
StepVerifier.create(result).expectNext("Invalid input error handled").verifyComplete();
185+
StepVerifier.create(result)
186+
.expectNext("Invalid input error handled")
187+
.expectComplete()
188+
.verify(Duration.ofSeconds(5));
180189
}
181190

182191
@Test
183192
public void noMatchingRoute() {
184193
Mono<String> result = requester.route("invalid").data("anything").retrieveMono(String.class);
185-
StepVerifier.create(result).verifyErrorMessage("No handler for destination 'invalid'");
194+
StepVerifier.create(result)
195+
.expectErrorMessage("No handler for destination 'invalid'")
196+
.verify(Duration.ofSeconds(5));
186197
}
187198

188199

spring-messaging/src/test/java/org/springframework/messaging/rsocket/RSocketServerToClientIntegrationTests.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ void echo(RSocketRequester requester) {
151151
.expectNext("Hello 1")
152152
.expectNext("Hello 2")
153153
.expectNext("Hello 3")
154-
.verifyComplete();
154+
.expectComplete()
155+
.verify(Duration.ofSeconds(5));
155156
});
156157
}
157158

@@ -165,7 +166,8 @@ void echoAsync(RSocketRequester requester) {
165166
.expectNext("Hello 1 async")
166167
.expectNext("Hello 2 async")
167168
.expectNext("Hello 3 async")
168-
.verifyComplete();
169+
.expectComplete()
170+
.verify(Duration.ofSeconds(5));
169171
});
170172
}
171173

@@ -180,7 +182,7 @@ void echoStream(RSocketRequester requester) {
180182
.expectNext("Hello 6")
181183
.expectNext("Hello 7")
182184
.thenCancel()
183-
.verify();
185+
.verify(Duration.ofSeconds(5));
184186
});
185187
}
186188

@@ -196,7 +198,8 @@ void echoChannel(RSocketRequester requester) {
196198
.expectNextCount(7)
197199
.expectNext("Hello 9 async")
198200
.expectNext("Hello 10 async")
199-
.verifyComplete();
201+
.thenCancel() // https://github.com/rsocket/rsocket-java/issues/613
202+
.verify(Duration.ofSeconds(5));
200203
});
201204
}
202205

0 commit comments

Comments
 (0)