Search in sources :

Example 11 with SimpleRouteMatcher

use of org.springframework.util.SimpleRouteMatcher in project spring-framework by spring-projects.

the class DefaultRSocketStrategiesTests method explicitValues.

@Test
void explicitValues() {
    SimpleRouteMatcher matcher = new SimpleRouteMatcher(new AntPathMatcher());
    DefaultMetadataExtractor extractor = new DefaultMetadataExtractor();
    ReactiveAdapterRegistry registry = new ReactiveAdapterRegistry();
    RSocketStrategies strategies = RSocketStrategies.builder().encoders(encoders -> {
        encoders.clear();
        encoders.add(new ByteArrayEncoder());
    }).decoders(decoders -> {
        decoders.clear();
        decoders.add(new ByteArrayDecoder());
    }).routeMatcher(matcher).metadataExtractor(extractor).reactiveAdapterStrategy(registry).build();
    assertThat(strategies.encoders()).hasSize(1);
    assertThat(strategies.decoders()).hasSize(1);
    assertThat(strategies.routeMatcher()).isSameAs(matcher);
    assertThat(strategies.metadataExtractor()).isSameAs(extractor);
    assertThat(strategies.reactiveAdapterRegistry()).isSameAs(registry);
}
Also used : CharSequenceEncoder(org.springframework.core.codec.CharSequenceEncoder) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) ByteBufferEncoder(org.springframework.core.codec.ByteBufferEncoder) StringDecoder(org.springframework.core.codec.StringDecoder) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Mockito.times(org.mockito.Mockito.times) ByteArrayEncoder(org.springframework.core.codec.ByteArrayEncoder) ByteBufferDecoder(org.springframework.core.codec.ByteBufferDecoder) ByteArrayDecoder(org.springframework.core.codec.ByteArrayDecoder) Mockito.verify(org.mockito.Mockito.verify) Consumer(java.util.function.Consumer) Test(org.junit.jupiter.api.Test) DataBufferEncoder(org.springframework.core.codec.DataBufferEncoder) SimpleRouteMatcher(org.springframework.util.SimpleRouteMatcher) DataBufferDecoder(org.springframework.core.codec.DataBufferDecoder) AntPathMatcher(org.springframework.util.AntPathMatcher) ReactiveAdapterRegistry(org.springframework.core.ReactiveAdapterRegistry) Mockito.mock(org.mockito.Mockito.mock) ByteArrayEncoder(org.springframework.core.codec.ByteArrayEncoder) ReactiveAdapterRegistry(org.springframework.core.ReactiveAdapterRegistry) SimpleRouteMatcher(org.springframework.util.SimpleRouteMatcher) AntPathMatcher(org.springframework.util.AntPathMatcher) ByteArrayDecoder(org.springframework.core.codec.ByteArrayDecoder) Test(org.junit.jupiter.api.Test)

Aggregations

AntPathMatcher (org.springframework.util.AntPathMatcher)11 SimpleRouteMatcher (org.springframework.util.SimpleRouteMatcher)11 Test (org.junit.jupiter.api.Test)8 ReactiveAdapterRegistry (org.springframework.core.ReactiveAdapterRegistry)5 ByteArrayDecoder (org.springframework.core.codec.ByteArrayDecoder)4 ByteArrayEncoder (org.springframework.core.codec.ByteArrayEncoder)4 GenericMessage (org.springframework.messaging.support.GenericMessage)4 DefaultMetadataExtractor (org.springframework.messaging.rsocket.DefaultMetadataExtractor)3 RSocketStrategies (org.springframework.messaging.rsocket.RSocketStrategies)3 MessageHeaderAccessor (org.springframework.messaging.support.MessageHeaderAccessor)3 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)2 CharSequenceEncoder (org.springframework.core.codec.CharSequenceEncoder)2 StringDecoder (org.springframework.core.codec.StringDecoder)2 DataBuffer (org.springframework.core.io.buffer.DataBuffer)2 UTF_8 (java.nio.charset.StandardCharsets.UTF_8)1 Duration (java.time.Duration)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 List (java.util.List)1 Consumer (java.util.function.Consumer)1