use of org.springframework.integration.endpoint.AbstractEndpoint in project spring-integration by spring-projects.
the class WebServiceOutboundGatewayParserTests method simpleGatewayWithCustomMessageFactory.
@Test
public void simpleGatewayWithCustomMessageFactory() {
AbstractEndpoint endpoint = this.context.getBean("gatewayWithCustomMessageFactory", 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"));
WebServiceMessageFactory factory = (WebServiceMessageFactory) context.getBean("messageFactory");
assertEquals(factory, accessor.getPropertyValue("messageFactory"));
}
use of org.springframework.integration.endpoint.AbstractEndpoint in project spring-integration by spring-projects.
the class WebServiceOutboundGatewayParserTests method simpleGatewayWithDefaultSourceExtractor.
@Test
public void simpleGatewayWithDefaultSourceExtractor() {
AbstractEndpoint endpoint = this.context.getBean("gatewayWithDefaultSourceExtractor", AbstractEndpoint.class);
assertEquals(EventDrivenConsumer.class, endpoint.getClass());
Object gateway = new DirectFieldAccessor(endpoint).getPropertyValue("handler");
assertEquals(SimpleWebServiceOutboundGateway.class, gateway.getClass());
DirectFieldAccessor accessor = new DirectFieldAccessor(gateway);
assertEquals("DefaultSourceExtractor", accessor.getPropertyValue("sourceExtractor").getClass().getSimpleName());
}
use of org.springframework.integration.endpoint.AbstractEndpoint in project spring-integration by spring-projects.
the class WebServiceOutboundGatewayParserTests method simpleGatewayWithCustomMessageSenderList.
@Test
public void simpleGatewayWithCustomMessageSenderList() {
AbstractEndpoint endpoint = this.context.getBean("gatewayWithCustomMessageSenderList", 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]);
assertEquals("Wrong number of message senders ", 2, ((WebServiceMessageSender[]) accessor.getPropertyValue("messageSenders")).length);
}
use of org.springframework.integration.endpoint.AbstractEndpoint in project spring-integration by spring-projects.
the class WebServiceOutboundGatewayParserTests method marshallingGatewayWithAllInOneMarshallerAndMessageFactory.
@Test
public void marshallingGatewayWithAllInOneMarshallerAndMessageFactory() {
ConfigurableApplicationContext context = new ClassPathXmlApplicationContext("marshallingWebServiceOutboundGatewayParserTests.xml", this.getClass());
AbstractEndpoint endpoint = (AbstractEndpoint) context.getBean("gatewayWithAllInOneMarshallerAndMessageFactory");
assertEquals(EventDrivenConsumer.class, endpoint.getClass());
Object gateway = TestUtils.getPropertyValue(endpoint, "handler");
Marshaller marshaller = context.getBean("marshallerAndUnmarshaller", Marshaller.class);
assertSame(marshaller, TestUtils.getPropertyValue(gateway, "webServiceTemplate.marshaller", Marshaller.class));
assertSame(marshaller, TestUtils.getPropertyValue(gateway, "webServiceTemplate.unmarshaller", Unmarshaller.class));
WebServiceMessageFactory messageFactory = (WebServiceMessageFactory) context.getBean("messageFactory");
assertEquals(messageFactory, TestUtils.getPropertyValue(gateway, "webServiceTemplate.messageFactory"));
context.close();
}
use of org.springframework.integration.endpoint.AbstractEndpoint in project spring-integration by spring-projects.
the class WebServiceOutboundGatewayParserTests method advised.
@Test
public void advised() {
adviceCalled = 0;
AbstractEndpoint endpoint = this.context.getBean("gatewayWithAdvice", AbstractEndpoint.class);
assertEquals(EventDrivenConsumer.class, endpoint.getClass());
MessageHandler handler = TestUtils.getPropertyValue(endpoint, "handler", MessageHandler.class);
handler.handleMessage(new GenericMessage<String>("foo"));
assertEquals(1, adviceCalled);
}
Aggregations