Search in sources :

Example 1 with ClientRSocketConnector

use of org.springframework.integration.rsocket.ClientRSocketConnector in project spring-boot by spring-projects.

the class IntegrationAutoConfigurationTests method rsocketSupportEnabled.

@Test
void rsocketSupportEnabled() {
    this.contextRunner.withUserConfiguration(RSocketServerConfiguration.class).withConfiguration(AutoConfigurations.of(RSocketServerAutoConfiguration.class, RSocketStrategiesAutoConfiguration.class, RSocketMessagingAutoConfiguration.class, RSocketRequesterAutoConfiguration.class, IntegrationAutoConfiguration.class)).withPropertyValues("spring.rsocket.server.port=0", "spring.integration.rsocket.client.port=0", "spring.integration.rsocket.client.host=localhost", "spring.integration.rsocket.server.message-mapping-enabled=true").run((context) -> {
        assertThat(context).hasSingleBean(ClientRSocketConnector.class).hasBean("clientRSocketConnector").hasSingleBean(ServerRSocketConnector.class).hasSingleBean(ServerRSocketMessageHandler.class).hasSingleBean(RSocketMessageHandler.class);
        ServerRSocketMessageHandler serverRSocketMessageHandler = context.getBean(ServerRSocketMessageHandler.class);
        assertThat(context).getBean(RSocketMessageHandler.class).isSameAs(serverRSocketMessageHandler);
        ClientRSocketConnector clientRSocketConnector = context.getBean(ClientRSocketConnector.class);
        ClientTransport clientTransport = (ClientTransport) new DirectFieldAccessor(clientRSocketConnector).getPropertyValue("clientTransport");
        assertThat(clientTransport).isInstanceOf(TcpClientTransport.class);
    });
}
Also used : RSocketStrategiesAutoConfiguration(org.springframework.boot.autoconfigure.rsocket.RSocketStrategiesAutoConfiguration) RSocketServerAutoConfiguration(org.springframework.boot.autoconfigure.rsocket.RSocketServerAutoConfiguration) RSocketRequesterAutoConfiguration(org.springframework.boot.autoconfigure.rsocket.RSocketRequesterAutoConfiguration) ServerRSocketMessageHandler(org.springframework.integration.rsocket.ServerRSocketMessageHandler) DirectFieldAccessor(org.springframework.beans.DirectFieldAccessor) RSocketMessageHandler(org.springframework.messaging.rsocket.annotation.support.RSocketMessageHandler) ServerRSocketMessageHandler(org.springframework.integration.rsocket.ServerRSocketMessageHandler) ClientRSocketConnector(org.springframework.integration.rsocket.ClientRSocketConnector) ClientTransport(io.rsocket.transport.ClientTransport) TcpClientTransport(io.rsocket.transport.netty.client.TcpClientTransport) RSocketMessagingAutoConfiguration(org.springframework.boot.autoconfigure.rsocket.RSocketMessagingAutoConfiguration) Test(org.junit.jupiter.api.Test)

Aggregations

ClientTransport (io.rsocket.transport.ClientTransport)1 TcpClientTransport (io.rsocket.transport.netty.client.TcpClientTransport)1 Test (org.junit.jupiter.api.Test)1 DirectFieldAccessor (org.springframework.beans.DirectFieldAccessor)1 RSocketMessagingAutoConfiguration (org.springframework.boot.autoconfigure.rsocket.RSocketMessagingAutoConfiguration)1 RSocketRequesterAutoConfiguration (org.springframework.boot.autoconfigure.rsocket.RSocketRequesterAutoConfiguration)1 RSocketServerAutoConfiguration (org.springframework.boot.autoconfigure.rsocket.RSocketServerAutoConfiguration)1 RSocketStrategiesAutoConfiguration (org.springframework.boot.autoconfigure.rsocket.RSocketStrategiesAutoConfiguration)1 ClientRSocketConnector (org.springframework.integration.rsocket.ClientRSocketConnector)1 ServerRSocketMessageHandler (org.springframework.integration.rsocket.ServerRSocketMessageHandler)1 RSocketMessageHandler (org.springframework.messaging.rsocket.annotation.support.RSocketMessageHandler)1