INT-3024: Add <poller> to mongodb:o-c-adapter
In addition add `<request-handler-advice-chain>` JIRA: https://jira.springsource.org/browse/INT-3024
This commit is contained in:
committed by
Gary Russell
parent
4d351ada4c
commit
f42f6eca57
@@ -92,7 +92,12 @@
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="mongodbAdapterType" />
|
||||
<xsd:extension base="mongodbAdapterType">
|
||||
<xsd:choice minOccurs="0" maxOccurs="2">
|
||||
<xsd:element ref="integration:poller" minOccurs="0" maxOccurs="1"/>
|
||||
<xsd:element name="request-handler-advice-chain" type="integration:adviceChainType" minOccurs="0" maxOccurs="1" />
|
||||
</xsd:choice>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,18 +17,30 @@ package org.springframework.integration.mongodb.config;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.hamcrest.Matchers;
|
||||
|
||||
import org.springframework.aop.support.AopUtils;
|
||||
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.expression.common.LiteralExpression;
|
||||
import org.springframework.expression.spel.standard.SpelExpression;
|
||||
import org.springframework.integration.core.MessageHandler;
|
||||
import org.springframework.integration.endpoint.AbstractEndpoint;
|
||||
import org.springframework.integration.endpoint.PollingConsumer;
|
||||
import org.springframework.integration.handler.advice.RequestHandlerRetryAdvice;
|
||||
import org.springframework.integration.mongodb.outbound.MongoDbStoringMessageHandler;
|
||||
import org.springframework.integration.test.util.TestUtils;
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Artem Bilan
|
||||
*/
|
||||
public class MongoDbOutboundChannelAdapterParserTests {
|
||||
|
||||
@@ -100,4 +112,16 @@ public class MongoDbOutboundChannelAdapterParserTests {
|
||||
public void templateAndConverterFail(){
|
||||
new ClassPathXmlApplicationContext("outbound-adapter-parser-fail-template-converter-config.xml", this.getClass());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInt3024PollerAndRequestHandlerAdviceChain(){
|
||||
ApplicationContext 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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,6 +29,21 @@
|
||||
collection-name="foo"
|
||||
mongo-template="mongoDbTemplate"/>
|
||||
|
||||
<int:channel id="input">
|
||||
<int:queue/>
|
||||
</int:channel>
|
||||
|
||||
<int-mongodb:outbound-channel-adapter id="pollableAdapter"
|
||||
channel="input"
|
||||
collection-name="foo"
|
||||
mongo-template="mongoDbTemplate">
|
||||
<int:poller fixed-delay="1000"/>
|
||||
<int-mongodb:request-handler-advice-chain>
|
||||
<bean class="org.springframework.integration.handler.advice.RequestHandlerRetryAdvice"/>
|
||||
</int-mongodb:request-handler-advice-chain>
|
||||
</int-mongodb:outbound-channel-adapter>
|
||||
|
||||
|
||||
<bean id="mongoConverter" class="org.springframework.integration.mongodb.rules.MongoDbAvailableTests.TestMongoConverter">
|
||||
<constructor-arg ref="mongoDbFactory"/>
|
||||
<constructor-arg>
|
||||
|
||||
Reference in New Issue
Block a user