diff --git a/spring-integration-core/src/main/java/org/springframework/integration/endpoint/SourcePollingChannelAdapter.java b/spring-integration-core/src/main/java/org/springframework/integration/endpoint/SourcePollingChannelAdapter.java
index 8cc4e6d06b..89c5edf6b7 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/endpoint/SourcePollingChannelAdapter.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/endpoint/SourcePollingChannelAdapter.java
@@ -24,6 +24,7 @@ import org.springframework.aop.framework.Advised;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.aop.support.AopUtils;
import org.springframework.aop.support.NameMatchMethodPointcutAdvisor;
+import org.springframework.beans.factory.BeanCreationException;
import org.springframework.context.Lifecycle;
import org.springframework.integration.aop.AbstractMessageSourceAdvice;
import org.springframework.integration.core.MessageSource;
@@ -49,6 +50,8 @@ import org.springframework.util.Assert;
public class SourcePollingChannelAdapter extends AbstractPollingEndpoint
implements TrackableComponent {
+ private volatile MessageSource> originalSource;
+
private volatile MessageSource> source;
private volatile MessageChannel outputChannel;
@@ -64,6 +67,9 @@ public class SourcePollingChannelAdapter extends AbstractPollingEndpoint
*/
public void setSource(MessageSource> source) {
this.source = source;
+
+ Object target = extractProxyTarget(source);
+ this.originalSource = target != null ? (MessageSource>) target : source;
}
/**
@@ -177,7 +183,7 @@ public class SourcePollingChannelAdapter extends AbstractPollingEndpoint
@Override
protected Object getResourceToBind() {
- return this.source;
+ return this.originalSource;
}
@Override
@@ -185,4 +191,21 @@ public class SourcePollingChannelAdapter extends AbstractPollingEndpoint
return IntegrationResourceHolder.MESSAGE_SOURCE;
}
+ private static Object extractProxyTarget(Object target) {
+ if (!(target instanceof Advised)) {
+ return target;
+ }
+ Advised advised = (Advised) target;
+ if (advised.getTargetSource() == null) {
+ return null;
+ }
+ try {
+ return extractProxyTarget(advised.getTargetSource().getTarget());
+ }
+ catch (Exception e) {
+ throw new BeanCreationException("Could not extract target", e);
+ }
+ }
+
+
}
diff --git a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbInboundChannelAdapterIntegrationTests-context.xml b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbInboundChannelAdapterIntegrationTests-context.xml
new file mode 100644
index 0000000000..7c8b331424
--- /dev/null
+++ b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbInboundChannelAdapterIntegrationTests-context.xml
@@ -0,0 +1,114 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbInboundChannelAdapterIntegrationTests.java b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbInboundChannelAdapterIntegrationTests.java
index 8fd2e4ce07..b75fb86c31 100644
--- a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbInboundChannelAdapterIntegrationTests.java
+++ b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbInboundChannelAdapterIntegrationTests.java
@@ -21,174 +21,181 @@ import static org.junit.Assert.assertNull;
import java.util.List;
-import com.mongodb.DBObject;
-import com.mongodb.util.JSON;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
-import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
-import org.springframework.data.mongodb.MongoDbFactory;
import org.springframework.data.mongodb.core.MongoOperations;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.BasicQuery;
-import org.springframework.integration.channel.QueueChannel;
+import org.springframework.data.mongodb.core.query.Criteria;
+import org.springframework.data.mongodb.core.query.Query;
+import org.springframework.integration.aop.AbstractMessageSourceAdvice;
+import org.springframework.integration.core.MessageSource;
import org.springframework.integration.endpoint.SourcePollingChannelAdapter;
import org.springframework.integration.mongodb.rules.MongoDbAvailable;
import org.springframework.integration.mongodb.rules.MongoDbAvailableTests;
import org.springframework.messaging.Message;
+import org.springframework.messaging.PollableChannel;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import com.mongodb.DBObject;
+import com.mongodb.util.JSON;
/**
* @author Oleg Zhurakousky
+ * @author Artem Bilan
* @since 2.2
*/
+@ContextConfiguration
+@RunWith(SpringJUnit4ClassRunner.class)
+@DirtiesContext
public class MongoDbInboundChannelAdapterIntegrationTests extends MongoDbAvailableTests {
+ @Autowired
+ private MongoTemplate mongoTemplate;
+
+ @Autowired
+ private PollableChannel replyChannel;
+
+ @Autowired
+ @Qualifier("mongoInboundAdapter")
+ private SourcePollingChannelAdapter mongoInboundAdapter;
+
+ @Autowired
+ @Qualifier("mongoInboundAdapterNamedFactory")
+ private SourcePollingChannelAdapter mongoInboundAdapterNamedFactory;
+
+ @Autowired
+ @Qualifier("mongoInboundAdapterWithTemplate")
+ private SourcePollingChannelAdapter mongoInboundAdapterWithTemplate;
+
+ @Autowired
+ @Qualifier("mongoInboundAdapterWithNamedCollection")
+ private SourcePollingChannelAdapter mongoInboundAdapterWithNamedCollection;
+
+ @Autowired
+ @Qualifier("mongoInboundAdapterWithNamedCollectionExpression")
+ private SourcePollingChannelAdapter mongoInboundAdapterWithNamedCollectionExpression;
+
+ @Autowired
+ @Qualifier("inboundAdapterWithOnSuccessDisposition")
+ private SourcePollingChannelAdapter inboundAdapterWithOnSuccessDisposition;
+
+ @Autowired
+ @Qualifier("mongoInboundAdapterWithConverter")
+ private SourcePollingChannelAdapter mongoInboundAdapterWithConverter;
+
@Test
@MongoDbAvailable
public void testWithDefaultMongoFactory() throws Exception {
- MongoDbFactory mongoDbFactory = this.prepareMongoFactory();
- MongoTemplate template = new MongoTemplate(mongoDbFactory);
- template.save(this.createPerson("Bob"), "data");
+ this.mongoTemplate.save(createPerson("Bob"), "data");
- ConfigurableApplicationContext context =
- new ClassPathXmlApplicationContext("inbound-adapter-config.xml", this.getClass());
- SourcePollingChannelAdapter spca = context.getBean("mongoInboundAdapter", SourcePollingChannelAdapter.class);
- QueueChannel replyChannel = context.getBean("replyChannel", QueueChannel.class);
- spca.start();
+ this.mongoInboundAdapter.start();
@SuppressWarnings("unchecked")
Message> message = (Message>) replyChannel.receive(10000);
assertNotNull(message);
assertEquals("Bob", message.getPayload().get(0).getName());
- assertNotNull(replyChannel.receive(10000));
- context.close();
+ assertNotNull(this.replyChannel.receive(10000));
+
+ this.mongoInboundAdapter.stop();
}
@Test
@MongoDbAvailable
public void testWithNamedMongoFactory() throws Exception {
- MongoDbFactory mongoDbFactory = this.prepareMongoFactory();
- MongoTemplate template = new MongoTemplate(mongoDbFactory);
- template.save(this.createPerson("Bob"), "data");
+ this.mongoTemplate.save(this.createPerson("Bob"), "data");
- ConfigurableApplicationContext context =
- new ClassPathXmlApplicationContext("inbound-adapter-config.xml", this.getClass());
- SourcePollingChannelAdapter spca = context.getBean("mongoInboundAdapterNamedFactory",
- SourcePollingChannelAdapter.class);
- QueueChannel replyChannel = context.getBean("replyChannel", QueueChannel.class);
- spca.start();
+ this.mongoInboundAdapterNamedFactory.start();
@SuppressWarnings("unchecked")
Message> message = (Message>) replyChannel.receive(10000);
assertNotNull(message);
assertEquals("Bob", message.getPayload().get(0).get("name"));
- context.close();
+
+ this.mongoInboundAdapterNamedFactory.stop();
}
@Test
@MongoDbAvailable
public void testWithMongoTemplate() throws Exception {
- MongoDbFactory mongoDbFactory = this.prepareMongoFactory();
- MongoTemplate template = new MongoTemplate(mongoDbFactory);
- template.save(this.createPerson("Bob"), "data");
+ this.mongoTemplate.save(this.createPerson("Bob"), "data");
- ConfigurableApplicationContext context =
- new ClassPathXmlApplicationContext("inbound-adapter-config.xml", this.getClass());
- SourcePollingChannelAdapter spca = context.getBean("mongoInboundAdapterWithTemplate",
- SourcePollingChannelAdapter.class);
- QueueChannel replyChannel = context.getBean("replyChannel", QueueChannel.class);
- spca.start();
+ this.mongoInboundAdapterWithTemplate.start();
@SuppressWarnings("unchecked")
Message message = (Message) replyChannel.receive(10000);
assertNotNull(message);
assertEquals("Bob", message.getPayload().getName());
- context.close();
+
+ this.mongoInboundAdapterWithTemplate.stop();
}
@Test
@MongoDbAvailable
public void testWithNamedCollection() throws Exception {
- MongoDbFactory mongoDbFactory = this.prepareMongoFactory();
- MongoTemplate template = new MongoTemplate(mongoDbFactory);
- template.save(this.createPerson("Bob"), "foo");
+ this.mongoTemplate.save(this.createPerson("Bob"), "foo");
- ConfigurableApplicationContext context =
- new ClassPathXmlApplicationContext("inbound-adapter-config.xml", this.getClass());
- SourcePollingChannelAdapter spca = context.getBean("mongoInboundAdapterWithNamedCollection",
- SourcePollingChannelAdapter.class);
- QueueChannel replyChannel = context.getBean("replyChannel", QueueChannel.class);
- spca.start();
+ this.mongoInboundAdapterWithNamedCollection.start();
@SuppressWarnings("unchecked")
Message> message = (Message>) replyChannel.receive(10000);
assertNotNull(message);
assertEquals("Bob", message.getPayload().get(0).getName());
- context.close();
+
+ this.mongoInboundAdapterWithNamedCollection.stop();
}
@Test
@MongoDbAvailable
public void testWithNamedCollectionExpression() throws Exception {
- MongoDbFactory mongoDbFactory = this.prepareMongoFactory();
- MongoTemplate template = new MongoTemplate(mongoDbFactory);
- template.save(this.createPerson("Bob"), "foo");
+ this.mongoTemplate.save(this.createPerson("Bob"), "foo");
- ConfigurableApplicationContext context =
- new ClassPathXmlApplicationContext("inbound-adapter-config.xml", this.getClass());
- SourcePollingChannelAdapter spca = context.getBean("mongoInboundAdapterWithNamedCollectionExpression",
- SourcePollingChannelAdapter.class);
- QueueChannel replyChannel = context.getBean("replyChannel", QueueChannel.class);
- spca.start();
+ this.mongoInboundAdapterWithNamedCollectionExpression.start();
@SuppressWarnings("unchecked")
Message> message = (Message>) replyChannel.receive(10000);
assertNotNull(message);
assertEquals("Bob", message.getPayload().get(0).getName());
- context.close();
+
+ this.mongoInboundAdapterWithNamedCollectionExpression.stop();
}
@Test
@MongoDbAvailable
public void testWithOnSuccessDisposition() throws Exception {
- MongoDbFactory mongoDbFactory = this.prepareMongoFactory();
- MongoTemplate template = new MongoTemplate(mongoDbFactory);
- template.save(this.createPerson("Bob"), "data");
+ this.mongoTemplate.save(createPerson("Bob"), "data");
- ConfigurableApplicationContext context =
- new ClassPathXmlApplicationContext("inbound-adapter-config.xml", this.getClass());
- SourcePollingChannelAdapter spca = context.getBean("inboundAdapterWithOnSuccessDisposition",
- SourcePollingChannelAdapter.class);
- QueueChannel replyChannel = context.getBean("replyChannel", QueueChannel.class);
- spca.start();
+ this.inboundAdapterWithOnSuccessDisposition.start();
assertNotNull(replyChannel.receive(10000));
- Thread.sleep(300);
assertNull(replyChannel.receive(100));
- context.close();
+
+ this.inboundAdapterWithOnSuccessDisposition.stop();
+
+ assertNull(this.mongoTemplate.findOne(new Query(Criteria.where("name").is("Bob")), Person.class, "data"));
}
@Test
@MongoDbAvailable
public void testWithMongoConverter() throws Exception {
- MongoDbFactory mongoDbFactory = this.prepareMongoFactory();
- MongoTemplate template = new MongoTemplate(mongoDbFactory);
- template.save(this.createPerson("Bob"), "data");
+ this.mongoTemplate.save(this.createPerson("Bob"), "data");
- ConfigurableApplicationContext context =
- new ClassPathXmlApplicationContext("inbound-adapter-config.xml", this.getClass());
- SourcePollingChannelAdapter spca = context.getBean("mongoInboundAdapterWithConverter",
- SourcePollingChannelAdapter.class);
- QueueChannel replyChannel = context.getBean("replyChannel", QueueChannel.class);
- spca.start();
+ this.mongoInboundAdapterWithConverter.start();
@SuppressWarnings("unchecked")
Message> message = (Message>) replyChannel.receive(10000);
assertNotNull(message);
assertEquals("Bob", message.getPayload().get(0).getName());
assertNotNull(replyChannel.receive(10000));
- context.close();
+
+ this.mongoInboundAdapterWithConverter.stop();
}
@Test(expected = BeanDefinitionParsingException.class)
@@ -205,7 +212,7 @@ public class MongoDbInboundChannelAdapterIntegrationTests extends MongoDbAvailab
@Test(expected = BeanDefinitionParsingException.class)
@MongoDbAvailable
- public void testFailureWithCollectionAndCollectioinExpression() throws Exception {
+ public void testFailureWithCollectionAndCollectionExpression() throws Exception {
new ClassPathXmlApplicationContext("inbound-fail-c-cex.xml", this.getClass()).close();
}
@@ -228,4 +235,18 @@ public class MongoDbInboundChannelAdapterIntegrationTests extends MongoDbAvailab
}
+ public static final class TestMessageSourceAdvice extends AbstractMessageSourceAdvice {
+
+ @Override
+ public boolean beforeReceive(MessageSource> source) {
+ return true;
+ }
+
+ @Override
+ public Message> afterReceive(Message> result, MessageSource> source) {
+ return result;
+ }
+
+ }
+
}
diff --git a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/inbound-adapter-parser-config.xml b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbInboundChannelAdapterParserTests-context.xml
similarity index 100%
rename from spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/inbound-adapter-parser-config.xml
rename to spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbInboundChannelAdapterParserTests-context.xml
diff --git a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbInboundChannelAdapterParserTests.java b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbInboundChannelAdapterParserTests.java
index 7e31fd8939..c9dbc9a9d5 100644
--- a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbInboundChannelAdapterParserTests.java
+++ b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbInboundChannelAdapterParserTests.java
@@ -17,32 +17,70 @@ package org.springframework.integration.mongodb.config;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.data.mongodb.MongoDbFactory;
+import org.springframework.data.mongodb.core.MongoTemplate;
+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.SourcePollingChannelAdapter;
import org.springframework.integration.mongodb.inbound.MongoDbMessageSource;
import org.springframework.integration.test.util.TestUtils;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
/**
* @author Oleg Zhurakousky
+ * @author Artem Bilan
*/
+@ContextConfiguration
+@RunWith(SpringJUnit4ClassRunner.class)
+@DirtiesContext
public class MongoDbInboundChannelAdapterParserTests {
+ @Autowired
+ private MongoDbFactory mongoDbFactory;
+
+ @Autowired
+ private MongoConverter mongoConverter;
+
+ @Autowired
+ private MongoTemplate mongoDbTemplate;
+
+ @Autowired
+ @Qualifier("minimalConfig.adapter")
+ private SourcePollingChannelAdapter minimalConfigAdapter;
+
+ @Autowired
+ @Qualifier("fullConfigWithCollectionExpression.adapter")
+ private SourcePollingChannelAdapter fullConfigWithCollectionExpressionAdapter;
+
+ @Autowired
+ @Qualifier("fullConfigWithCollectionName.adapter")
+ private SourcePollingChannelAdapter fullConfigWithCollectionNameAdapter;
+
+ @Autowired
+ @Qualifier("fullConfigWithMongoTemplate.adapter")
+ private SourcePollingChannelAdapter fullConfigWithMongoTemplateAdapter;
+
@Test
public void minimalConfig(){
- ClassPathXmlApplicationContext context =
- new ClassPathXmlApplicationContext("inbound-adapter-parser-config.xml", this.getClass());
- SourcePollingChannelAdapter spca = context.getBean("minimalConfig.adapter", SourcePollingChannelAdapter.class);
- MongoDbMessageSource source = TestUtils.getPropertyValue(spca, "source", MongoDbMessageSource.class);
+ MongoDbMessageSource source = TestUtils.getPropertyValue(this.minimalConfigAdapter, "source",
+ MongoDbMessageSource.class);
- assertEquals(false, TestUtils.getPropertyValue(spca, "shouldTrack"));
+ assertEquals(false, TestUtils.getPropertyValue(this.minimalConfigAdapter, "shouldTrack"));
assertNotNull(TestUtils.getPropertyValue(source, "mongoTemplate"));
- assertEquals(context.getBean("mongoDbFactory"), TestUtils.getPropertyValue(source, "mongoDbFactory"));
+ assertEquals(this.mongoDbFactory, TestUtils.getPropertyValue(source, "mongoDbFactory"));
assertNotNull(TestUtils.getPropertyValue(source, "evaluationContext"));
assertTrue(TestUtils.getPropertyValue(source, "collectionNameExpression") instanceof LiteralExpression);
assertEquals("data", TestUtils.getPropertyValue(source, "collectionNameExpression.literalValue"));
@@ -50,15 +88,13 @@ public class MongoDbInboundChannelAdapterParserTests {
@Test
public void fullConfigWithCollectionExpression(){
- ClassPathXmlApplicationContext context =
- new ClassPathXmlApplicationContext("inbound-adapter-parser-config.xml", this.getClass());
- SourcePollingChannelAdapter spca = context.getBean("fullConfigWithCollectionExpression.adapter", SourcePollingChannelAdapter.class);
- MongoDbMessageSource source = TestUtils.getPropertyValue(spca, "source", MongoDbMessageSource.class);
+ MongoDbMessageSource source = TestUtils.getPropertyValue(this.fullConfigWithCollectionExpressionAdapter,
+ "source", MongoDbMessageSource.class);
- assertEquals(false, TestUtils.getPropertyValue(spca, "shouldTrack"));
+ assertEquals(false, TestUtils.getPropertyValue(this.fullConfigWithCollectionExpressionAdapter, "shouldTrack"));
assertNotNull(TestUtils.getPropertyValue(source, "mongoTemplate"));
- assertEquals(context.getBean("mongoDbFactory"), TestUtils.getPropertyValue(source, "mongoDbFactory"));
- assertEquals(context.getBean("mongoConverter"), TestUtils.getPropertyValue(source, "mongoConverter"));
+ assertEquals(this.mongoDbFactory, TestUtils.getPropertyValue(source, "mongoDbFactory"));
+ assertEquals(this.mongoConverter, TestUtils.getPropertyValue(source, "mongoConverter"));
assertNotNull(TestUtils.getPropertyValue(source, "evaluationContext"));
assertTrue(TestUtils.getPropertyValue(source, "collectionNameExpression") instanceof SpelExpression);
assertEquals("'foo'", TestUtils.getPropertyValue(source, "collectionNameExpression.expression"));
@@ -66,15 +102,13 @@ public class MongoDbInboundChannelAdapterParserTests {
@Test
public void fullConfigWithCollectionName(){
- ClassPathXmlApplicationContext context =
- new ClassPathXmlApplicationContext("inbound-adapter-parser-config.xml", this.getClass());
- SourcePollingChannelAdapter spca = context.getBean("fullConfigWithCollectionName.adapter", SourcePollingChannelAdapter.class);
- MongoDbMessageSource source = TestUtils.getPropertyValue(spca, "source", MongoDbMessageSource.class);
+ MongoDbMessageSource source = TestUtils.getPropertyValue(this.fullConfigWithCollectionNameAdapter, "source",
+ MongoDbMessageSource.class);
- assertEquals(false, TestUtils.getPropertyValue(spca, "shouldTrack"));
+ assertEquals(false, TestUtils.getPropertyValue(this.fullConfigWithCollectionNameAdapter, "shouldTrack"));
assertNotNull(TestUtils.getPropertyValue(source, "mongoTemplate"));
- assertEquals(context.getBean("mongoDbFactory"), TestUtils.getPropertyValue(source, "mongoDbFactory"));
- assertEquals(context.getBean("mongoConverter"), TestUtils.getPropertyValue(source, "mongoConverter"));
+ assertEquals(this.mongoDbFactory, TestUtils.getPropertyValue(source, "mongoDbFactory"));
+ assertEquals(this.mongoConverter, TestUtils.getPropertyValue(source, "mongoConverter"));
assertNotNull(TestUtils.getPropertyValue(source, "evaluationContext"));
assertTrue(TestUtils.getPropertyValue(source, "collectionNameExpression") instanceof LiteralExpression);
assertEquals("foo", TestUtils.getPropertyValue(source, "collectionNameExpression.literalValue"));
@@ -82,14 +116,12 @@ public class MongoDbInboundChannelAdapterParserTests {
@Test
public void fullConfigWithMongoTemplate(){
- ClassPathXmlApplicationContext context =
- new ClassPathXmlApplicationContext("inbound-adapter-parser-config.xml", this.getClass());
- SourcePollingChannelAdapter spca = context.getBean("fullConfigWithMongoTemplate.adapter", SourcePollingChannelAdapter.class);
- MongoDbMessageSource source = TestUtils.getPropertyValue(spca, "source", MongoDbMessageSource.class);
+ MongoDbMessageSource source = TestUtils.getPropertyValue(this.fullConfigWithMongoTemplateAdapter, "source",
+ MongoDbMessageSource.class);
- assertEquals(false, TestUtils.getPropertyValue(spca, "shouldTrack"));
+ assertEquals(false, TestUtils.getPropertyValue(this.fullConfigWithMongoTemplateAdapter, "shouldTrack"));
assertNotNull(TestUtils.getPropertyValue(source, "mongoTemplate"));
- assertEquals(context.getBean("mongoDbTemplate"), TestUtils.getPropertyValue(source, "mongoTemplate"));
+ assertSame(this.mongoDbTemplate, TestUtils.getPropertyValue(source, "mongoTemplate"));
assertNotNull(TestUtils.getPropertyValue(source, "evaluationContext"));
assertTrue(TestUtils.getPropertyValue(source, "collectionNameExpression") instanceof LiteralExpression);
assertEquals("foo", TestUtils.getPropertyValue(source, "collectionNameExpression.literalValue"));
@@ -104,4 +136,5 @@ public class MongoDbInboundChannelAdapterParserTests {
public void templateAndConverterFail(){
new ClassPathXmlApplicationContext("inbound-adapter-parser-fail-template-converter-config.xml", this.getClass());
}
+
}
diff --git a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/inbound-adapter-config.xml b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/inbound-adapter-config.xml
deleted file mode 100644
index 1f21852b36..0000000000
--- a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/inbound-adapter-config.xml
+++ /dev/null
@@ -1,102 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-