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

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

Introduction

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

Prototype

Future<Message<?>> async(String s);

Source Link

Usage

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

@Test
public void testAsyncGateway() throws Exception {
    PollableChannel requestChannel = (PollableChannel) context.getBean("requestChannel");
    MessageChannel replyChannel = (MessageChannel) context.getBean("replyChannel");
    this.startResponder(requestChannel, replyChannel);
    TestService service = context.getBean("async", TestService.class);
    Future<Message<?>> result = service.async("foo");
    Message<?> reply = result.get(1, TimeUnit.SECONDS);
    assertEquals("foo", reply.getPayload());
    assertEquals("testExecutor", reply.getHeaders().get("executor"));
    assertNotNull(TestUtils.getPropertyValue(context.getBean("&async"), "asyncExecutor"));
}

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

@Test
public void testAsyncDisabledGateway() throws Exception {
    PollableChannel requestChannel = (PollableChannel) context.getBean("requestChannel");
    MessageChannel replyChannel = (MessageChannel) context.getBean("replyChannel");
    this.startResponder(requestChannel, replyChannel);
    TestService service = context.getBean("asyncOff", TestService.class);
    Future<Message<?>> result = service.async("futureSync");
    Message<?> reply = result.get(1, TimeUnit.SECONDS);
    assertEquals("futureSync", reply.getPayload());
    Object serviceBean = context.getBean("&asyncOff");
    assertNull(TestUtils.getPropertyValue(serviceBean, "asyncExecutor"));
}