use of org.springframework.integration.jdbc.JdbcOutboundGateway in project spring-integration by spring-projects.
the class JdbcOutboundGatewayParserTests method testOutboundGatewayInsideChain.
// INT-1029
@Test
public void testOutboundGatewayInsideChain() {
setUp("handlingMapPayloadJdbcOutboundGatewayTest.xml", getClass());
String beanName = "org.springframework.integration.handler.MessageHandlerChain#" + "0$child.jdbc-outbound-gateway-within-chain.handler";
JdbcOutboundGateway jdbcMessageHandler = this.context.getBean(beanName, JdbcOutboundGateway.class);
MessageChannel channel = this.context.getBean("jdbcOutboundGatewayInsideChain", MessageChannel.class);
assertFalse(TestUtils.getPropertyValue(jdbcMessageHandler, "requiresReply", Boolean.class));
channel.send(MessageBuilder.withPayload(Collections.singletonMap("foo", "bar")).build());
PollableChannel outbound = this.context.getBean("replyChannel", PollableChannel.class);
Message<?> reply = outbound.receive(10000);
assertNotNull(reply);
@SuppressWarnings("unchecked") Map<String, ?> payload = (Map<String, ?>) reply.getPayload();
assertEquals("bar", payload.get("name"));
}
use of org.springframework.integration.jdbc.JdbcOutboundGateway in project spring-integration by spring-projects.
the class JdbcOutboundGatewayParserTests method testMapPayloadMapReply.
@Test
public void testMapPayloadMapReply() {
setUp("handlingMapPayloadJdbcOutboundGatewayTest.xml", getClass());
assertTrue(this.context.containsBean("jdbcGateway"));
Message<?> message = MessageBuilder.withPayload(Collections.singletonMap("foo", "bar")).build();
this.channel.send(message);
Message<?> reply = this.messagingTemplate.receive();
assertNotNull(reply);
@SuppressWarnings("unchecked") Map<String, ?> payload = (Map<String, ?>) reply.getPayload();
assertEquals("bar", payload.get("name"));
Map<String, Object> map = this.jdbcTemplate.queryForMap("SELECT * from FOOS");
assertEquals("Wrong id", message.getHeaders().getId().toString(), map.get("ID"));
assertEquals("Wrong name", "bar", map.get("name"));
JdbcOutboundGateway gateway = context.getBean("jdbcGateway.handler", JdbcOutboundGateway.class);
assertEquals(23, TestUtils.getPropertyValue(gateway, "order"));
Assert.assertTrue(TestUtils.getPropertyValue(gateway, "requiresReply", Boolean.class));
assertEquals(1, adviceCalled);
}
Aggregations