@ -16,8 +16,6 @@
package smoketest.rsocket ;
package smoketest.rsocket ;
import java.time.Duration ;
import io.rsocket.metadata.WellKnownMimeType ;
import io.rsocket.metadata.WellKnownMimeType ;
import org.assertj.core.api.Assertions ;
import org.assertj.core.api.Assertions ;
import org.junit.jupiter.api.Test ;
import org.junit.jupiter.api.Test ;
@ -43,7 +41,7 @@ public class SampleRSocketApplicationTests {
@Test
@Test
void unauthenticatedAccessToRSocketEndpoint ( ) {
void unauthenticatedAccessToRSocketEndpoint ( ) {
RSocketRequester requester = this . builder . connec tT cp( "localhost" , this . port ) . block ( Duration . ofSeconds ( 5 ) ) ;
RSocketRequester requester = this . builder . tcp( "localhost" , this . port ) ;
Mono < Project > result = requester . route ( "find.project.spring-boot" ) . retrieveMono ( Project . class ) ;
Mono < Project > result = requester . route ( "find.project.spring-boot" ) . retrieveMono ( Project . class ) ;
StepVerifier . create ( result ) . expectErrorMessage ( "Access Denied" ) . verify ( ) ;
StepVerifier . create ( result ) . expectErrorMessage ( "Access Denied" ) . verify ( ) ;
}
}
@ -54,7 +52,7 @@ public class SampleRSocketApplicationTests {
. rsocketStrategies ( ( builder ) - > builder . encoder ( new SimpleAuthenticationEncoder ( ) ) )
. rsocketStrategies ( ( builder ) - > builder . encoder ( new SimpleAuthenticationEncoder ( ) ) )
. setupMetadata ( new UsernamePasswordMetadata ( "user" , "password" ) ,
. setupMetadata ( new UsernamePasswordMetadata ( "user" , "password" ) ,
MimeTypeUtils . parseMimeType ( WellKnownMimeType . MESSAGE_RSOCKET_AUTHENTICATION . getString ( ) ) )
MimeTypeUtils . parseMimeType ( WellKnownMimeType . MESSAGE_RSOCKET_AUTHENTICATION . getString ( ) ) )
. connec tT cp( "localhost" , this . port ) . block ( Duration . ofSeconds ( 5 ) ) ;
. tcp( "localhost" , this . port ) ;
Mono < Project > result = requester . route ( "find.project.spring-boot" ) . retrieveMono ( Project . class ) ;
Mono < Project > result = requester . route ( "find.project.spring-boot" ) . retrieveMono ( Project . class ) ;
StepVerifier . create ( result )
StepVerifier . create ( result )
. assertNext ( ( project ) - > Assertions . assertThat ( project . getName ( ) ) . isEqualTo ( "spring-boot" ) )
. assertNext ( ( project ) - > Assertions . assertThat ( project . getName ( ) ) . isEqualTo ( "spring-boot" ) )