use of org.springframework.integration.gateway.GatewayProxyFactoryBean in project spring-integration by spring-projects.
the class AsyncHandlerTests method testGatewayWithException.
@Test
public void testGatewayWithException() throws Exception {
this.whichTest = 0;
GatewayProxyFactoryBean gpfb = new GatewayProxyFactoryBean(Foo.class);
gpfb.setBeanFactory(mock(BeanFactory.class));
DirectChannel input = new DirectChannel();
gpfb.setDefaultRequestChannel(input);
gpfb.setDefaultReplyTimeout(10000L);
gpfb.afterPropertiesSet();
Foo foo = (Foo) gpfb.getObject();
this.handler.setOutputChannel(null);
EventDrivenConsumer consumer = new EventDrivenConsumer(input, this.handler);
consumer.afterPropertiesSet();
consumer.start();
this.latch.countDown();
try {
foo.exchange("foo");
} catch (MessagingException e) {
assertThat(e.getClass().getSimpleName(), equalTo("RuntimeException"));
assertThat(e.getMessage(), equalTo("foo"));
}
}
use of org.springframework.integration.gateway.GatewayProxyFactoryBean in project spring-integration by spring-projects.
the class AsyncHandlerTests method testGateway.
@Test
public void testGateway() throws Exception {
this.whichTest = 0;
GatewayProxyFactoryBean gpfb = new GatewayProxyFactoryBean(Foo.class);
gpfb.setBeanFactory(mock(BeanFactory.class));
DirectChannel input = new DirectChannel();
gpfb.setDefaultRequestChannel(input);
gpfb.setDefaultReplyTimeout(10000L);
gpfb.afterPropertiesSet();
Foo foo = (Foo) gpfb.getObject();
this.handler.setOutputChannel(null);
EventDrivenConsumer consumer = new EventDrivenConsumer(input, this.handler);
consumer.afterPropertiesSet();
consumer.start();
this.latch.countDown();
String result = foo.exchange("foo");
assertEquals("reply", result);
}
Aggregations