use of org.springframework.integration.endpoint.AbstractEndpoint in project spring-integration by spring-projects.
the class WebServiceOutboundGatewayParserTests method jmsUri.
@Test
@SuppressWarnings("unchecked")
public void jmsUri() {
AbstractEndpoint endpoint = this.context.getBean("gatewayWithJmsUri", AbstractEndpoint.class);
assertEquals(EventDrivenConsumer.class, endpoint.getClass());
MessageHandler handler = TestUtils.getPropertyValue(endpoint, "handler", MessageHandler.class);
assertNull(TestUtils.getPropertyValue(handler, "destinationProvider"));
assertFalse(TestUtils.getPropertyValue(handler, "encodeUri", Boolean.class));
WebServiceTemplate webServiceTemplate = TestUtils.getPropertyValue(handler, "webServiceTemplate", WebServiceTemplate.class);
webServiceTemplate = spy(webServiceTemplate);
doReturn(null).when(webServiceTemplate).sendAndReceive(anyString(), any(WebServiceMessageCallback.class), ArgumentMatchers.<WebServiceMessageExtractor<Object>>any());
new DirectFieldAccessor(handler).setPropertyValue("webServiceTemplate", webServiceTemplate);
handler.handleMessage(new GenericMessage<String>("foo"));
verify(webServiceTemplate).sendAndReceive(eq("jms:wsQueue"), any(WebServiceMessageCallback.class), ArgumentMatchers.<WebServiceMessageExtractor<Object>>any());
}
use of org.springframework.integration.endpoint.AbstractEndpoint in project spring-integration by spring-projects.
the class WebServiceOutboundGatewayParserTests method simpleGatewayWithStartupFalse.
@Test
public void simpleGatewayWithStartupFalse() {
AbstractEndpoint endpoint = this.context.getBean("gatewayWithOrderAndAutoStartupFalse", AbstractEndpoint.class);
assertEquals(Boolean.FALSE, new DirectFieldAccessor(endpoint).getPropertyValue("autoStartup"));
}
use of org.springframework.integration.endpoint.AbstractEndpoint in project spring-integration by spring-projects.
the class WebServiceOutboundGatewayParserTests method simpleGatewayWithPoller.
@Test
public void simpleGatewayWithPoller() {
AbstractEndpoint endpoint = this.context.getBean("gatewayWithPoller", AbstractEndpoint.class);
assertEquals(PollingConsumer.class, endpoint.getClass());
Object triggerObject = new DirectFieldAccessor(endpoint).getPropertyValue("trigger");
assertEquals(PeriodicTrigger.class, triggerObject.getClass());
PeriodicTrigger trigger = (PeriodicTrigger) triggerObject;
DirectFieldAccessor accessor = new DirectFieldAccessor(trigger);
assertEquals("PeriodicTrigger had wrong period", 5000, ((Long) accessor.getPropertyValue("period")).longValue());
}
use of org.springframework.integration.endpoint.AbstractEndpoint in project spring-integration by spring-projects.
the class WebServiceOutboundGatewayParserTests method simpleGatewayWithCustomMessageSender.
@Test
public void simpleGatewayWithCustomMessageSender() {
AbstractEndpoint endpoint = this.context.getBean("gatewayWithCustomMessageSender", AbstractEndpoint.class);
assertEquals(EventDrivenConsumer.class, endpoint.getClass());
Object gateway = new DirectFieldAccessor(endpoint).getPropertyValue("handler");
assertEquals(SimpleWebServiceOutboundGateway.class, gateway.getClass());
DirectFieldAccessor accessor = new DirectFieldAccessor(gateway);
accessor = new DirectFieldAccessor(accessor.getPropertyValue("webServiceTemplate"));
WebServiceMessageSender messageSender = (WebServiceMessageSender) context.getBean("messageSender");
assertEquals(messageSender, ((WebServiceMessageSender[]) accessor.getPropertyValue("messageSenders"))[0]);
}
use of org.springframework.integration.endpoint.AbstractEndpoint in project spring-integration by spring-projects.
the class WebServiceOutboundGatewayParserTests method simpleGatewayWithReplyChannel.
@Test
public void simpleGatewayWithReplyChannel() {
AbstractEndpoint endpoint = this.context.getBean("gatewayWithReplyChannel", AbstractEndpoint.class);
assertEquals(EventDrivenConsumer.class, endpoint.getClass());
Object gateway = new DirectFieldAccessor(endpoint).getPropertyValue("handler");
assertEquals(SimpleWebServiceOutboundGateway.class, gateway.getClass());
DirectFieldAccessor accessor = new DirectFieldAccessor(gateway);
Object expected = this.context.getBean("outputChannel");
assertEquals(expected, accessor.getPropertyValue("outputChannel"));
Assert.assertEquals(Boolean.FALSE, accessor.getPropertyValue("requiresReply"));
AbstractHeaderMapper.HeaderMatcher requestHeaderMatcher = TestUtils.getPropertyValue(endpoint, "handler.headerMapper.requestHeaderMatcher", AbstractHeaderMapper.HeaderMatcher.class);
assertTrue(requestHeaderMatcher.matchHeader("testRequest"));
assertFalse(requestHeaderMatcher.matchHeader("testReply"));
AbstractHeaderMapper.HeaderMatcher replyHeaderMatcher = TestUtils.getPropertyValue(endpoint, "handler.headerMapper.replyHeaderMatcher", AbstractHeaderMapper.HeaderMatcher.class);
assertFalse(replyHeaderMatcher.matchHeader("testRequest"));
assertTrue(replyHeaderMatcher.matchHeader("testReply"));
Long sendTimeout = TestUtils.getPropertyValue(gateway, "messagingTemplate.sendTimeout", Long.class);
assertEquals(Long.valueOf(777), sendTimeout);
assertSame(this.context.getBean("webServiceTemplate"), TestUtils.getPropertyValue(gateway, "webServiceTemplate"));
}
Aggregations