use of org.springframework.integration.endpoint.AbstractEndpoint in project spring-integration by spring-projects.
the class WebServiceOutboundGatewayParserTests method simpleGatewayWithCustomSourceExtractorAndMessageFactory.
@Test
public void simpleGatewayWithCustomSourceExtractorAndMessageFactory() {
AbstractEndpoint endpoint = context.getBean("gatewayWithCustomSourceExtractorAndMessageFactory", AbstractEndpoint.class);
SourceExtractor<?> sourceExtractor = (SourceExtractor<?>) context.getBean("sourceExtractor");
assertEquals(EventDrivenConsumer.class, endpoint.getClass());
Object gateway = new DirectFieldAccessor(endpoint).getPropertyValue("handler");
assertEquals(SimpleWebServiceOutboundGateway.class, gateway.getClass());
DirectFieldAccessor accessor = new DirectFieldAccessor(gateway);
assertEquals(sourceExtractor, accessor.getPropertyValue("sourceExtractor"));
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 simpleGatewayWithOrder.
@Test
public void simpleGatewayWithOrder() {
AbstractEndpoint endpoint = this.context.getBean("gatewayWithOrderAndAutoStartupFalse", AbstractEndpoint.class);
Object gateway = new DirectFieldAccessor(endpoint).getPropertyValue("handler");
assertEquals(99, new DirectFieldAccessor(gateway).getPropertyValue("order"));
}
use of org.springframework.integration.endpoint.AbstractEndpoint in project spring-integration by spring-projects.
the class IntegrationMBeanExporter method registerEndpoints.
private void registerEndpoints() {
String[] names = this.applicationContext.getBeanNamesForType(AbstractEndpoint.class);
Set<String> endpointNames = new HashSet<>();
for (String name : names) {
if (!this.beansByEndpointName.values().contains(name)) {
AbstractEndpoint endpoint = this.applicationContext.getBean(name, AbstractEndpoint.class);
String beanKey;
name = endpoint.getComponentName();
String source;
if (name.startsWith("_org.springframework.integration")) {
name = getInternalComponentName(name);
source = "internal";
} else {
name = endpoint.getComponentName();
source = "endpoint";
}
if (!matches(this.componentNamePatterns, name)) {
continue;
}
if (endpointNames.contains(name)) {
int count = 0;
String unique = name + "#" + count;
while (endpointNames.contains(unique)) {
unique = name + "#" + (++count);
}
name = unique;
}
endpointNames.add(name);
beanKey = getEndpointBeanKey(endpoint, name, source);
ObjectName objectName = registerBeanInstance(new ManagedEndpoint(endpoint), beanKey);
if (logger.isInfoEnabled()) {
logger.info("Registered endpoint without MessageSource: " + objectName);
}
}
}
}
use of org.springframework.integration.endpoint.AbstractEndpoint in project spring-integration by spring-projects.
the class MongoDbOutboundChannelAdapterParserTests method testInt3024PollerAndRequestHandlerAdviceChain.
@Test
public void testInt3024PollerAndRequestHandlerAdviceChain() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("outbound-adapter-parser-config.xml", this.getClass());
AbstractEndpoint endpoint = context.getBean("pollableAdapter", AbstractEndpoint.class);
assertThat(endpoint, Matchers.instanceOf(PollingConsumer.class));
MessageHandler handler = TestUtils.getPropertyValue(endpoint, "handler", MessageHandler.class);
assertTrue(AopUtils.isAopProxy(handler));
List<?> advisors = TestUtils.getPropertyValue(handler, "h.advised.advisors", List.class);
assertThat(TestUtils.getPropertyValue(advisors.get(0), "advice"), Matchers.instanceOf(RequestHandlerRetryAdvice.class));
context.close();
}
Aggregations