Example usage for org.springframework.integration.gateway TestService customCompletableReturnsMessage

List of usage examples for org.springframework.integration.gateway TestService customCompletableReturnsMessage

Introduction

In this page you can find the example usage for org.springframework.integration.gateway TestService customCompletableReturnsMessage.

Prototype

MyCompletableMessageFuture customCompletableReturnsMessage(String s);

Source Link

Usage

From source file:org.springframework.integration.config.xml.GatewayParserTests.java

@Test
public void testCustomCompletableNoAsyncMessage() throws Exception {
    QueueChannel requestChannel = (QueueChannel) context.getBean("requestChannel");
    final AtomicReference<Thread> thread = new AtomicReference<>();
    requestChannel.addInterceptor(new ChannelInterceptorAdapter() {

        @Override/*from   www . j av a2  s  .c om*/
        public Message<?> preSend(Message<?> message, MessageChannel channel) {
            thread.set(Thread.currentThread());
            return super.preSend(message, channel);
        }

    });
    MessageChannel replyChannel = (MessageChannel) context.getBean("replyChannel");
    this.startResponder(requestChannel, replyChannel);
    TestService service = context.getBean("completableNoAsync", TestService.class);
    MyCompletableMessageFuture result = service.customCompletableReturnsMessage("flowCustomCompletableM");
    Message<?> reply = result.get(1, TimeUnit.SECONDS);
    assertEquals("flowCustomCompletableM", reply.getPayload());
    assertEquals(Thread.currentThread(), thread.get());
    assertNull(TestUtils.getPropertyValue(context.getBean("&completableNoAsync"), "asyncExecutor"));
}