use of org.springframework.integration.core.MessagingTemplate in project spring-integration by spring-projects.
the class WebServiceHeaderEnricherTests method literalValue.
@Test
public void literalValue() {
MessagingTemplate template = new MessagingTemplate();
template.setDefaultDestination(literalValueInput);
Message<?> result = template.sendAndReceive(new GenericMessage<String>("foo"));
Map<String, Object> headers = result.getHeaders();
assertEquals("http://test", headers.get(WebServiceHeaders.SOAP_ACTION));
}
use of org.springframework.integration.core.MessagingTemplate in project spring-integration by spring-projects.
the class ParserUnitTests method testOutGateway.
@Test
public void testOutGateway() {
DirectFieldAccessor dfa = new DirectFieldAccessor(tcpOutboundGateway);
assertSame(cfC2, dfa.getPropertyValue("connectionFactory"));
assertEquals(234L, dfa.getPropertyValue("requestTimeout"));
MessagingTemplate messagingTemplate = TestUtils.getPropertyValue(tcpOutboundGateway, "messagingTemplate", MessagingTemplate.class);
assertEquals(Long.valueOf(567), TestUtils.getPropertyValue(messagingTemplate, "sendTimeout", Long.class));
assertEquals("789", TestUtils.getPropertyValue(tcpOutboundGateway, "remoteTimeoutExpression.literalValue"));
assertEquals("outGateway", tcpOutboundGateway.getComponentName());
assertEquals("ip:tcp-outbound-gateway", tcpOutboundGateway.getComponentType());
assertTrue(cfC2.isLookupHost());
assertEquals(24, dfa.getPropertyValue("order"));
assertEquals("4000", TestUtils.getPropertyValue(outAdviceGateway, "remoteTimeoutExpression.expression"));
}
use of org.springframework.integration.core.MessagingTemplate in project spring-integration by spring-projects.
the class StopStartTests method test.
@Test
public void test() {
MessagingTemplate template = new MessagingTemplate(this.test);
this.outGateway.start();
assertEquals("FOO", template.convertSendAndReceive("foo", String.class));
this.outGateway.stop();
this.outGateway.start();
assertEquals("BAR", template.convertSendAndReceive("bar", String.class));
this.outGateway.stop();
}
use of org.springframework.integration.core.MessagingTemplate in project spring-integration by spring-projects.
the class UpdateMappingsTests method testJmx.
@Test
public void testJmx() throws Exception {
MessagingTemplate messagingTemplate = new MessagingTemplate();
messagingTemplate.setReceiveTimeout(1000);
Set<ObjectName> names = this.server.queryNames(ObjectName.getInstance("update.mapping.domain:type=MessageHandler,name=router,bean=endpoint"), null);
assertEquals(1, names.size());
Map<String, String> map = new HashMap<String, String>();
map.put("foo", "bar");
map.put("baz", "qux");
Object[] params = new Object[] { map };
this.server.invoke(names.iterator().next(), "setChannelMappings", params, new String[] { "java.util.Map" });
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"));
}
use of org.springframework.integration.core.MessagingTemplate in project spring-integration by spring-projects.
the class ControlBusParserTests method testControlMessageToChannelMetrics.
@Test
public void testControlMessageToChannelMetrics() throws InterruptedException {
MessageChannel control = this.context.getBean("controlChannel", MessageChannel.class);
MessagingTemplate messagingTemplate = new MessagingTemplate();
Object value = messagingTemplate.convertSendAndReceive(control, "@integrationMbeanExporter.getChannelSendRate('testChannel').count", Object.class);
assertEquals(0, value);
MBeanExporter exporter = this.context.getBean(MBeanExporter.class);
exporter.destroy();
}
Aggregations