1616
1717package org .springframework .integration .rsocket .dsl ;
1818
19- import static org .assertj .core .api .Assertions .assertThat ;
20-
2119import java .util .function .Function ;
2220
2321import org .junit .jupiter .api .Test ;
3634import org .springframework .test .context .junit .jupiter .SpringJUnitConfig ;
3735
3836import reactor .core .publisher .Flux ;
39- import reactor .core . publisher . Mono ;
37+ import reactor .test . StepVerifier ;
4038
4139/**
4240 * @author Artem Bilan
@@ -49,11 +47,15 @@ public class RSocketDslTests {
4947
5048 @ Autowired
5149 @ Qualifier ("rsocketUpperCaseRequestFlow.gateway" )
52- private Function <String , String > rsocketUpperCaseFlowFunction ;
50+ private Function <Flux < String >, Flux < String > > rsocketUpperCaseFlowFunction ;
5351
5452 @ Test
5553 void testRsocketUpperCaseFlows () {
56- assertThat (this .rsocketUpperCaseFlowFunction .apply ("hello world" )).isEqualTo ("HELLO WORLD" );
54+ Flux <String > result = this .rsocketUpperCaseFlowFunction .apply (Flux .just ("a\n " , "b\n " , "c\n " ));
55+
56+ StepVerifier .create (result )
57+ .expectNext ("A" , "B" , "C" )
58+ .verifyComplete ();
5759 }
5860
5961 @ Configuration
@@ -78,7 +80,7 @@ public IntegrationFlow rsocketUpperCaseRequestFlow(ClientRSocketConnector client
7880 return IntegrationFlows
7981 .from (Function .class )
8082 .handle (RSockets .outboundGateway ("/uppercase" )
81- .command ((message ) -> RSocketOutboundGateway .Command .requestResponse )
83+ .command ((message ) -> RSocketOutboundGateway .Command .requestStreamOrChannel )
8284 .expectedResponseType ("T(java.lang.String)" )
8385 .clientRSocketConnector (clientRSocketConnector ))
8486 .get ();
@@ -88,7 +90,7 @@ public IntegrationFlow rsocketUpperCaseRequestFlow(ClientRSocketConnector client
8890 public IntegrationFlow rsocketUpperCaseFlow () {
8991 return IntegrationFlows
9092 .from (RSockets .inboundGateway ("/uppercase" ))
91- .<Flux <String >, Mono <String >>transform ((flux ) -> flux . next () .map (String ::toUpperCase ))
93+ .<Flux <String >, Flux <String >>transform ((flux ) -> flux .map (String ::toUpperCase ))
9294 .get ();
9395 }
9496
0 commit comments