<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	   xmlns:int="http://www.springframework.org/schema/integration"
	   xmlns:int-mongodb="http://www.springframework.org/schema/integration/mongodb"
	   xsi:schemaLocation="http://www.springframework.org/schema/integration https://www.springframework.org/schema/integration/spring-integration.xsd
		http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/integration/mongodb https://www.springframework.org/schema/integration/mongodb/spring-integration-mongodb.xsd">

	<bean id="mongoDbFactory" class="org.mockito.Mockito" factory-method="mock">
		<constructor-arg value="org.springframework.data.mongodb.MongoDatabaseFactory" type="java.lang.Class"/>
		<constructor-arg value="#{T(org.mockito.Answers).RETURNS_MOCKS}"/>
	</bean>

	<int-mongodb:outbound-channel-adapter id="minimalConfig"/>

	<int-mongodb:outbound-channel-adapter id="fullConfigWithCollectionExpression"
										  collection-name-expression="headers.collectionName"
										  mongo-converter="mongoConverter"
										  mongodb-factory="mongoDbFactory"/>

	<int-mongodb:outbound-channel-adapter id="fullConfigWithCollection"
										  collection-name="foo"
										  mongo-converter="mongoConverter"
										  mongodb-factory="mongoDbFactory"/>

	<int-mongodb:outbound-channel-adapter id="fullConfigWithMongoTemplate"
										  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.MongoDbContainerTest.TestMongoConverter">
		<constructor-arg ref="mongoDbFactory"/>
		<constructor-arg>
			<bean class="org.springframework.data.mongodb.core.mapping.MongoMappingContext"/>
		</constructor-arg>
	</bean>

	<bean id="mongoDbTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
		<constructor-arg ref="mongoDbFactory"/>
	</bean>

</beans>
