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

	<channel id="pollableInput1">
		<queue/>
	</channel>

	<channel id="pollableInput2">
		<queue/>
	</channel>

	<channel id="output">
		<queue/>
	</channel>

	<channel id="replyOutput">
		<queue/>
	</channel>

	<chain id="filterChain" input-channel="filterInput" output-channel="output">
		<filter id="filterWithinChain" ref="typeSelector"/>
		<service-activator id="serviceActivatorWithinChain" ref="testHandler"/>
	</chain>

	<chain id="headerEnricherChain" input-channel="headerEnricherInput">
		<header-enricher id="headerEnricherWithinChain">
			<reply-channel ref="replyOutput"/>
			<correlation-id value="ABC"/>
			<header name="testValue" value="XYZ"/>
			<header name="testRef" ref="testHeaderValue"/>
		</header-enricher>
		<service-activator ref="testHandler"/>
	</chain>

	<chain input-channel="pollableInput1" output-channel="output">
		<filter ref="typeSelector"/>
		<poller fixed-delay="1000"/>
		<service-activator ref="testHandler"/>
	</chain>

	<chain input-channel="pollableInput2" output-channel="output">
		<service-activator ref="testHandler"/>
		<poller ref="topLevelPoller"/>
	</chain>

	<poller id="topLevelPoller" fixed-delay="1000"/>

	<chain input-channel="beanInput" output-channel="output">
		<beans:bean
				class="org.springframework.integration.config.ChainParserTests$StubHandler"/>
	</chain>

	<chain id="aggregatorChain" input-channel="aggregatorInput" output-channel="output">
		<aggregator id="aggregatorWithinChain" ref="aggregatorBean" method="aggregate"/>
		<chain id="nestedChain">
			<filter id="filterWithinNestedChain" ref="typeSelector"/>
			<service-activator ref="testHandler"/>
			<chain id="doubleNestedChain">
				<filter id="filterWithinDoubleNestedChain" ref="typeSelector"/>
			</chain>
		</chain>
	</chain>

	<chain id="aggregatorChain2" input-channel="aggregator2Input" output-channel="output">
		<aggregator id="aggregatorWithinChain" ref="aggregatorBean" method="aggregate"/>
		<chain id="nestedChain">
			<filter id="filterWithinNestedChain" ref="typeSelector"/>
			<service-activator ref="testHandler"/>
		</chain>
	</chain>

	<chain id="payloadTypeRouterChain" input-channel="payloadTypeRouterInput">
		<payload-type-router id="payloadTypeRouterWithinChain">
			<mapping type="java.lang.String" channel="strings"/>
			<mapping type="java.lang.Number" channel="numbers"/>
		</payload-type-router>
	</chain>

	<chain id="headerValueRouterChain" input-channel="headerValueRouterInput">
		<header-value-router id="headerValueRouterWithinChain" header-name="routingHeader"/>
	</chain>

	<chain input-channel="headerValueRouterWithMappingInput">
		<header-value-router header-name="routingHeader">
			<mapping value="isString" channel="strings"/>
			<mapping value="isNumber" channel="numbers"/>
		</header-value-router>
	</chain>

	<chain id="chainWithClaimChecks" input-channel="claimCheckInput" output-channel="claimCheckOutput">
		<claim-check-in id="claimCheckInWithinChain"/>
		<claim-check-out id="claimCheckOutWithinChain"/>
	</chain>

	<channel id="claimCheckOutput">
		<queue/>
	</channel>

	<chain id="chainWithSendTimeout" input-channel="chainWithSendTimeoutInput" output-channel="output"
		   send-timeout="9876">
		<filter ref="typeSelector"/>
		<service-activator ref="testHandler"/>
	</chain>

	<chain id="outboundChain" input-channel="outboundChannelAdapterChannel">
		<outbound-channel-adapter id="outboundChannelAdapterWithinChain" ref="testConsumer"/>
	</chain>

	<chain id="logChain" input-channel="loggingChannelAdapterChannel">
		<object-to-string-transformer charset="cp1251"/>
		<transformer id="transformerWithinChain" expression="payload.toUpperCase()"/>
		<logging-channel-adapter id="loggingChannelAdapterWithinChain" level="WARN"/>
	</chain>

	<beans:bean id="jsonObjectMapper" class="org.mockito.Mockito" factory-method="mock">
		<beans:constructor-arg value="org.springframework.integration.support.json.JsonObjectMapper"
							   type="java.lang.Class"/>
	</beans:bean>

	<chain id="subComponentsIdSupport1" input-channel="subComponentsIdSupport1Channel">
		<splitter id="splitterWithinChain"/>
		<resequencer id="resequencerWithinChain"/>
		<enricher id="enricherWithinChain" requires-reply="false">
			<property name="foo" value="bar"/>
		</enricher>
		<header-filter id="headerFilterWithinChain" header-names="foo"/>
		<payload-serializing-transformer id="payloadSerializingTransformerWithinChain"/>
		<payload-deserializing-transformer id="payloadDeserializingTransformerWithinChain"/>
		<gateway id="gatewayWithinChain" request-channel="strings" reply-channel="numbers"
				 request-timeout="1000" reply-timeout="100"/>
		<object-to-string-transformer id="objectToStringTransformerWithinChain"/>
		<object-to-map-transformer id="objectToMapTransformerWithinChain"
								   flatten="false"
								   object-mapper="jsonObjectMapper"/>
		<map-to-object-transformer id="mapToObjectTransformerWithinChain"
								   type="org.springframework.integration.config.ChainParserTests$FooPojo"/>
		<object-to-json-transformer id="objectToJsonTransformerWithinChain"/>
		<json-to-object-transformer id="jsonToObjectTransformerWithinChain"
									type="org.springframework.integration.config.ChainParserTests$FooPojo"/>
		<control-bus id="controlBusWithinChain"/>
		<router id="routerWithinChain" expression="foo"/>
	</chain>

	<chain id="exceptionTypeRouterChain" input-channel="subComponentsIdSupport2Channel">
		<exception-type-router id="exceptionTypeRouterWithinChain">
			<mapping channel="numbers" exception-type="org.springframework.integration.MessageRejectedException"/>
		</exception-type-router>
	</chain>

	<chain id="recipientListRouterChain" input-channel="subComponentsIdSupport3Channel">
		<recipient-list-router id="recipientListRouterWithinChain">
			<recipient channel="strings"/>
			<recipient channel="numbers"/>
		</recipient-list-router>
	</chain>

	<chain id="chainReplyRequired" input-channel="chainReplyRequiredChannel">
		<transformer id="transformerReplyRequired" expression="null"/>
	</chain>

	<chain id="chainMessageRejectedException" input-channel="chainMessageRejectedExceptionChannel">
		<filter id="filterMessageRejectedException" expression="false" throw-exception-on-rejection="true"/>
	</chain>

	<beans:bean id="testConsumer" class="org.springframework.integration.config.TestConsumer"/>

	<channel id="strings">
		<queue/>
	</channel>

	<channel id="numbers">
		<queue/>
	</channel>

	<beans:bean id="aggregatorBean"
				class="org.springframework.integration.config.ChainParserTests$StubAggregator"/>

	<beans:bean id="testHeaderValue" class="java.lang.Integer">
		<beans:constructor-arg value="123"/>
	</beans:bean>

	<beans:bean id="typeSelector"
				class="org.springframework.integration.selector.PayloadTypeSelector">
		<beans:constructor-arg value="java.lang.String"/>
	</beans:bean>

	<beans:bean id="testHandler"
				class="org.springframework.integration.config.TestHandler">
		<beans:constructor-arg value="1"/>
		<beans:property name="replyMessageText" value="foo"/>
	</beans:bean>

	<beans:bean id="messageStore" class="org.springframework.integration.store.SimpleMessageStore"/>

	<chain id="chainWithNoOutput" input-channel="chainWithNoOutputChannel">
		<header-enricher>
			<reply-channel expression="headers.myReplyChannel"/>
		</header-enricher>
	</chain>

	<chain id="chainWithTransformNoOutput" input-channel="chainWithTransformNoOutputChannel">
		<transformer expression="headers.myMessage"/>
	</chain>

</beans:beans>
