use of org.springframework.integration.endpoint.AbstractEndpoint in project spring-integration by spring-projects.
the class AbstractMethodAnnotationPostProcessor method createEndpoint.
protected AbstractEndpoint createEndpoint(MessageHandler handler, Method method, List<Annotation> annotations) {
AbstractEndpoint endpoint = null;
String inputChannelName = MessagingAnnotationUtils.resolveAttribute(annotations, getInputChannelAttribute(), String.class);
if (StringUtils.hasText(inputChannelName)) {
MessageChannel inputChannel;
try {
inputChannel = this.channelResolver.resolveDestination(inputChannelName);
} catch (DestinationResolutionException e) {
if (e.getCause() instanceof NoSuchBeanDefinitionException) {
inputChannel = new DirectChannel();
this.beanFactory.registerSingleton(inputChannelName, inputChannel);
inputChannel = (MessageChannel) this.beanFactory.initializeBean(inputChannel, inputChannelName);
} else {
throw e;
}
}
Assert.notNull(inputChannel, "failed to resolve inputChannel '" + inputChannelName + "'");
endpoint = doCreateEndpoint(handler, inputChannel, annotations);
}
return endpoint;
}
use of org.springframework.integration.endpoint.AbstractEndpoint in project spring-integration by spring-projects.
the class WebServiceOutboundGatewayParserTests method simpleGatewayWithCustomRequestCallback.
@Test
public void simpleGatewayWithCustomRequestCallback() {
AbstractEndpoint endpoint = this.context.getBean("gatewayWithCustomRequestCallback", AbstractEndpoint.class);
assertEquals(EventDrivenConsumer.class, endpoint.getClass());
Object gateway = new DirectFieldAccessor(endpoint).getPropertyValue("handler");
assertEquals(SimpleWebServiceOutboundGateway.class, gateway.getClass());
DirectFieldAccessor accessor = new DirectFieldAccessor(gateway);
WebServiceMessageCallback callback = (WebServiceMessageCallback) context.getBean("requestCallback");
assertEquals(callback, accessor.getPropertyValue("requestCallback"));
}
use of org.springframework.integration.endpoint.AbstractEndpoint in project spring-integration by spring-projects.
the class WebServiceOutboundGatewayParserTests method simpleGatewayWithCustomFaultMessageResolver.
@Test
public void simpleGatewayWithCustomFaultMessageResolver() {
AbstractEndpoint endpoint = this.context.getBean("gatewayWithCustomFaultMessageResolver", 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"));
FaultMessageResolver resolver = (FaultMessageResolver) context.getBean("faultMessageResolver");
assertEquals(resolver, accessor.getPropertyValue("faultMessageResolver"));
}
use of org.springframework.integration.endpoint.AbstractEndpoint in project spring-integration by spring-projects.
the class WebServiceOutboundGatewayParserTests method simpleGatewayWithDestinationProvider.
@Test
public void simpleGatewayWithDestinationProvider() {
AbstractEndpoint endpoint = this.context.getBean("gatewayWithDestinationProvider", AbstractEndpoint.class);
assertEquals(EventDrivenConsumer.class, endpoint.getClass());
Object gateway = new DirectFieldAccessor(endpoint).getPropertyValue("handler");
StubDestinationProvider stubProvider = (StubDestinationProvider) context.getBean("destinationProvider");
assertEquals(SimpleWebServiceOutboundGateway.class, gateway.getClass());
DirectFieldAccessor accessor = new DirectFieldAccessor(gateway);
assertEquals("Wrong DestinationProvider", stubProvider, accessor.getPropertyValue("destinationProvider"));
assertNull(accessor.getPropertyValue("uri"));
Object destinationProviderObject = new DirectFieldAccessor(accessor.getPropertyValue("webServiceTemplate")).getPropertyValue("destinationProvider");
assertEquals("Wrong DestinationProvider", stubProvider, destinationProviderObject);
}
use of org.springframework.integration.endpoint.AbstractEndpoint in project spring-integration by spring-projects.
the class WebServiceOutboundGatewayParserTests method simpleGatewayWithIgnoreEmptyResponses.
@Test
public void simpleGatewayWithIgnoreEmptyResponses() {
AbstractEndpoint endpoint = this.context.getBean("gatewayWithIgnoreEmptyResponsesFalseAndRequiresReplyTrue", 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(Boolean.FALSE, accessor.getPropertyValue("ignoreEmptyResponses"));
assertEquals(Boolean.TRUE, accessor.getPropertyValue("requiresReply"));
assertEquals(Boolean.FALSE, accessor.getPropertyValue("extractPayload"));
}
Aggregations