INT-4114: Add missed <poller> to XSDs

JIRA: https://jira.spring.io/browse/INT-4114
This commit is contained in:
Artem Bilan
2018-10-26 12:28:07 -04:00
committed by Gary Russell
parent fef0a4db03
commit 674d5adfc0
21 changed files with 216 additions and 90 deletions

View File

@@ -8,13 +8,23 @@
http://www.springframework.org/schema/integration/mongodb http://www.springframework.org/schema/integration/mongodb/spring-integration-mongodb.xsd">
<int:channel id="in"/>
<int:channel id="inQueue">
<int:queue />
</int:channel>
<int:channel id="out"/>
<int-mongodb:outbound-gateway id="minimalConfig"
query="{'name' : 'foo'}"
collection-name="foo"
request-channel="in"
reply-channel="out"/>
request-channel="inQueue"
reply-channel="out">
<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-gateway>
<int-mongodb:outbound-gateway id="fullConfigWithCollectionExpression"
mongodb-factory="mongoDbFactory"

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2017 the original author or authors.
* Copyright 2016-2018 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.
@@ -23,6 +23,9 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertThat;
import java.util.List;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -35,14 +38,20 @@ import org.springframework.data.mongodb.core.CollectionCallback;
import org.springframework.data.mongodb.core.convert.MongoConverter;
import org.springframework.expression.common.LiteralExpression;
import org.springframework.expression.spel.standard.SpelExpression;
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.MongoDbOutboundGateway;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.messaging.MessageHandler;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
/**
* @author Xavier Padró
* @author Artem Bilan
*
* @since 5.0
*/
@ContextConfiguration
@@ -61,8 +70,9 @@ public class MongoDbOutboundGatewayParserTests {
@Test
public void minimalConfig() {
AbstractEndpoint endpoint = this.context.getBean("minimalConfig", AbstractEndpoint.class);
MongoDbOutboundGateway gateway =
TestUtils.getPropertyValue(context.getBean("minimalConfig"), "handler", MongoDbOutboundGateway.class);
TestUtils.getPropertyValue(endpoint, "handler", MongoDbOutboundGateway.class);
assertNotNull(TestUtils.getPropertyValue(gateway, "mongoTemplate"));
assertSame(this.mongoDbFactory, TestUtils.getPropertyValue(gateway, "mongoDbFactory"));
@@ -70,6 +80,11 @@ public class MongoDbOutboundGatewayParserTests {
assertThat(TestUtils.getPropertyValue(gateway, "collectionNameExpression"),
instanceOf(LiteralExpression.class));
assertEquals("foo", TestUtils.getPropertyValue(gateway, "collectionNameExpression.literalValue"));
assertThat(endpoint, Matchers.instanceOf(PollingConsumer.class));
MessageHandler handler = TestUtils.getPropertyValue(endpoint, "handler", MessageHandler.class);
List<?> advices = TestUtils.getPropertyValue(handler, "adviceChain", List.class);
assertThat(advices.get(0), Matchers.instanceOf(RequestHandlerRetryAdvice.class));
}
@Test