use of org.springframework.integration.core.MessagingTemplate in project spring-integration by spring-projects.
the class RouterParserTests method timeoutValueConfigured.
@Test
public void timeoutValueConfigured() {
assertTrue(this.routerWithTimeout instanceof MethodInvokingRouter);
MessagingTemplate template = TestUtils.getPropertyValue(this.routerWithTimeout, "messagingTemplate", MessagingTemplate.class);
Long timeout = TestUtils.getPropertyValue(template, "sendTimeout", Long.class);
assertEquals(new Long(1234), timeout);
}
use of org.springframework.integration.core.MessagingTemplate in project spring-integration by spring-projects.
the class HttpInboundGatewayParserTests method checkConfig.
@Test
public void checkConfig() {
assertNotNull(this.gateway);
assertTrue(getPropertyValue(this.gateway, "expectReply", Boolean.class));
assertTrue(getPropertyValue(this.gateway, "convertExceptions", Boolean.class));
assertSame(this.responses, getPropertyValue(this.gateway, "replyChannel"));
assertNotNull(TestUtils.getPropertyValue(this.gateway, "errorChannel"));
MessagingTemplate messagingTemplate = TestUtils.getPropertyValue(this.gateway, "messagingTemplate", MessagingTemplate.class);
assertEquals(1234L, TestUtils.getPropertyValue(messagingTemplate, "sendTimeout"));
assertEquals(4567L, TestUtils.getPropertyValue(messagingTemplate, "receiveTimeout"));
boolean registerDefaultConverters = TestUtils.getPropertyValue(this.gateway, "mergeWithDefaultConverters", Boolean.class);
assertFalse("By default the register-default-converters flag should be false", registerDefaultConverters);
@SuppressWarnings("unchecked") List<HttpMessageConverter<?>> messageConverters = TestUtils.getPropertyValue(this.gateway, "messageConverters", List.class);
assertTrue("The default converters should have been registered, given there are no custom converters", messageConverters.size() > 0);
assertFalse(TestUtils.getPropertyValue(this.gateway, "autoStartup", Boolean.class));
assertEquals(1001, TestUtils.getPropertyValue(this.gateway, "phase"));
}
use of org.springframework.integration.core.MessagingTemplate in project spring-integration by spring-projects.
the class JmsDynamicDestinationTests method gateway.
@Test
public void gateway() throws Exception {
Message<?> message1 = MessageBuilder.withPayload("test-1").setHeader("destinationNumber", 1).build();
Message<?> message2 = MessageBuilder.withPayload("test-2").setHeader("destinationNumber", 2).build();
MessagingTemplate template = new MessagingTemplate();
Message<?> result1 = template.sendAndReceive(gatewayChannel, message1);
Message<?> result2 = template.sendAndReceive(gatewayChannel, message2);
assertNotNull(result1);
assertNotNull(result2);
assertEquals("test-1!", result1.getPayload());
assertEquals("test-2!!", result2.getPayload());
}
use of org.springframework.integration.core.MessagingTemplate in project spring-integration by spring-projects.
the class UpdateMappingsTests method testChangeRouterMappings.
@Test
public void testChangeRouterMappings() {
MessagingTemplate messagingTemplate = new MessagingTemplate();
messagingTemplate.setReceiveTimeout(1000);
messagingTemplate.convertAndSend(control, "@'router.handler'.replaceChannelMappings('foo=bar \n baz=qux')");
Map<?, ?> mappings = messagingTemplate.convertSendAndReceive(control, "@'router.handler'.getChannelMappings()", Map.class);
assertNotNull(mappings);
assertEquals(2, mappings.size());
assertEquals("bar", mappings.get("foo"));
assertEquals("qux", mappings.get("baz"));
messagingTemplate.convertAndSend(control, "@'router.handler'.replaceChannelMappings('foo=qux \n baz=bar')");
mappings = messagingTemplate.convertSendAndReceive(control, "@'router.handler'.getChannelMappings()", Map.class);
assertEquals(2, mappings.size());
assertEquals("bar", mappings.get("baz"));
assertEquals("qux", mappings.get("foo"));
}
use of org.springframework.integration.core.MessagingTemplate in project spring-integration by spring-projects.
the class WebServiceHeaderEnricherTests method expression.
@Test
public void expression() {
MessagingTemplate template = new MessagingTemplate();
template.setDefaultDestination(expressionInput);
Message<?> result = template.sendAndReceive(new GenericMessage<String>("foo"));
Map<String, Object> headers = result.getHeaders();
assertEquals("http://foo", headers.get(WebServiceHeaders.SOAP_ACTION));
}
Aggregations