Search in sources :

Example 6 with RSocketStrategies

use of org.springframework.messaging.rsocket.RSocketStrategies in project spring-framework by spring-projects.

the class RSocketMessageHandlerTests method setRSocketStrategies.

@Test
public void setRSocketStrategies() {
    RSocketStrategies strategies = RSocketStrategies.builder().encoder(new ByteArrayEncoder()).decoder(new ByteArrayDecoder()).routeMatcher(new SimpleRouteMatcher(new AntPathMatcher())).metadataExtractor(new DefaultMetadataExtractor()).reactiveAdapterStrategy(new ReactiveAdapterRegistry()).build();
    RSocketMessageHandler handler = new RSocketMessageHandler();
    handler.setRSocketStrategies(strategies);
    assertThat(handler.getEncoders()).isEqualTo(strategies.encoders());
    assertThat(handler.getDecoders()).isEqualTo(strategies.decoders());
    assertThat(handler.getRouteMatcher()).isSameAs(strategies.routeMatcher());
    assertThat(handler.getMetadataExtractor()).isSameAs(strategies.metadataExtractor());
    assertThat(handler.getReactiveAdapterRegistry()).isSameAs(strategies.reactiveAdapterRegistry());
}
Also used : ByteArrayEncoder(org.springframework.core.codec.ByteArrayEncoder) ReactiveAdapterRegistry(org.springframework.core.ReactiveAdapterRegistry) RSocketStrategies(org.springframework.messaging.rsocket.RSocketStrategies) DefaultMetadataExtractor(org.springframework.messaging.rsocket.DefaultMetadataExtractor) SimpleRouteMatcher(org.springframework.util.SimpleRouteMatcher) AntPathMatcher(org.springframework.util.AntPathMatcher) ByteArrayDecoder(org.springframework.core.codec.ByteArrayDecoder) Test(org.junit.jupiter.api.Test)

Aggregations

RSocketStrategies (org.springframework.messaging.rsocket.RSocketStrategies)6 Test (org.junit.jupiter.api.Test)5 ReactiveAdapterRegistry (org.springframework.core.ReactiveAdapterRegistry)3 ByteArrayDecoder (org.springframework.core.codec.ByteArrayDecoder)3 ByteArrayEncoder (org.springframework.core.codec.ByteArrayEncoder)3 DefaultMetadataExtractor (org.springframework.messaging.rsocket.DefaultMetadataExtractor)3 AntPathMatcher (org.springframework.util.AntPathMatcher)3 SimpleRouteMatcher (org.springframework.util.SimpleRouteMatcher)3 ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 RSocketStrategiesCustomizer (org.springframework.boot.rsocket.messaging.RSocketStrategiesCustomizer)1 Bean (org.springframework.context.annotation.Bean)1 Jackson2CborDecoder (org.springframework.http.codec.cbor.Jackson2CborDecoder)1 Jackson2CborEncoder (org.springframework.http.codec.cbor.Jackson2CborEncoder)1 PathPatternRouteMatcher (org.springframework.web.util.pattern.PathPatternRouteMatcher)1