Search in sources :

Example 6 with RSocketMessageHandler

use of org.springframework.messaging.rsocket.annotation.support.RSocketMessageHandler in project spring-boot by spring-projects.

the class RSocketSecurityAutoConfigurationTests method autoConfigurationAddsCustomizerForAuthenticationPrincipalArgumentResolver.

@Test
void autoConfigurationAddsCustomizerForAuthenticationPrincipalArgumentResolver() {
    this.contextRunner.run((context) -> {
        assertThat(context).hasSingleBean(RSocketMessageHandler.class);
        RSocketMessageHandler handler = context.getBean(RSocketMessageHandler.class);
        assertThat(handler.getArgumentResolverConfigurer().getCustomResolvers()).isNotEmpty().anyMatch((customResolver) -> customResolver instanceof AuthenticationPrincipalArgumentResolver);
    });
}
Also used : RSocketMessageHandler(org.springframework.messaging.rsocket.annotation.support.RSocketMessageHandler) AuthenticationPrincipalArgumentResolver(org.springframework.security.messaging.handler.invocation.reactive.AuthenticationPrincipalArgumentResolver) Test(org.junit.jupiter.api.Test)

Example 7 with RSocketMessageHandler

use of org.springframework.messaging.rsocket.annotation.support.RSocketMessageHandler in project spring-framework by spring-projects.

the class RSocketClientToServerIntegrationTests method setupOnce.

@BeforeAll
@SuppressWarnings("ConstantConditions")
public static void setupOnce() {
    MimeType metadataMimeType = MimeTypeUtils.parseMimeType(WellKnownMimeType.MESSAGE_RSOCKET_COMPOSITE_METADATA.getString());
    context = new AnnotationConfigApplicationContext(ServerConfig.class);
    RSocketMessageHandler messageHandler = context.getBean(RSocketMessageHandler.class);
    SocketAcceptor responder = messageHandler.responder();
    server = RSocketServer.create(responder).interceptors(registry -> registry.forResponder(interceptor)).payloadDecoder(PayloadDecoder.ZERO_COPY).bind(TcpServerTransport.create("localhost", 7000)).block();
    requester = RSocketRequester.builder().metadataMimeType(metadataMimeType).rsocketStrategies(context.getBean(RSocketStrategies.class)).tcp("localhost", 7000);
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) SocketAcceptor(io.rsocket.SocketAcceptor) RSocketMessageHandler(org.springframework.messaging.rsocket.annotation.support.RSocketMessageHandler) MimeType(org.springframework.util.MimeType) WellKnownMimeType(io.rsocket.metadata.WellKnownMimeType) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

RSocketMessageHandler (org.springframework.messaging.rsocket.annotation.support.RSocketMessageHandler)7 SocketAcceptor (io.rsocket.SocketAcceptor)3 BeforeAll (org.junit.jupiter.api.BeforeAll)3 Test (org.junit.jupiter.api.Test)3 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)3 Bean (org.springframework.context.annotation.Bean)2 PooledByteBufAllocator (io.netty.buffer.PooledByteBufAllocator)1 ReferenceCounted (io.netty.util.ReferenceCounted)1 RSocket (io.rsocket.RSocket)1 RSocketServer (io.rsocket.core.RSocketServer)1 ApplicationErrorException (io.rsocket.exceptions.ApplicationErrorException)1 PayloadDecoder (io.rsocket.frame.decoder.PayloadDecoder)1 WellKnownMimeType (io.rsocket.metadata.WellKnownMimeType)1 RSocketInterceptor (io.rsocket.plugins.RSocketInterceptor)1 CloseableChannel (io.rsocket.transport.netty.server.CloseableChannel)1 TcpServerTransport (io.rsocket.transport.netty.server.TcpServerTransport)1 Duration (java.time.Duration)1 Instant (java.time.Instant)1 List (java.util.List)1 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1