<?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-sftp="http://www.springframework.org/schema/integration/sftp"
	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
		http://www.springframework.org/schema/integration/sftp https://www.springframework.org/schema/integration/sftp/spring-integration-sftp.xsd">

	<bean id="sftpSessionFactory" class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
		<property name="host" value="localhost"/>
		<property name="knownHostsResource"
						value="#{ new org.springframework.core.io.ByteArrayResource('local, foo.com, bar.foo'.bytes)}"/>
		<property name="privateKey" value="classpath:org/springframework/integration/sftp/config/sftpTest"/>
		<property name="privateKeyPassphrase" value="ghj"/>
		<property name="password" value="hello"/>
		<property name="port" value="2222"/>
		<property name="user" value="oleg"/>
	</bean>

	<bean id="csf" class="org.springframework.integration.file.remote.session.CachingSessionFactory">
		<constructor-arg ref="sftpSessionFactory"/>
	</bean>

	<int:publish-subscribe-channel id="inputChannel"/>

	<int-sftp:outbound-channel-adapter id="sftpOutboundAdapter"
				session-factory="csf"
				channel="inputChannel"
				charset="UTF-8"
				remote-filename-generator="fileNameGenerator"
				remote-file-separator="."
				temporary-file-suffix=".bar"
				remote-directory="foo/bar"
				temporary-remote-directory="foo/baz"
				chmod="600"
				order="23"/>

	<int-sftp:outbound-channel-adapter id="sftpOutboundAdapterWithExpression"
				session-factory="sftpSessionFactory"
				channel="inputChannel"
				charset="UTF-8"
				remote-directory-expression="'foo' + '/' + 'bar'"
				remote-filename-generator-expression="payload.getName() + '-foo'"
				order="12"/>

	<int-sftp:outbound-channel-adapter
				session-factory="sftpSessionFactory"
				channel="inputChannel"
				charset="UTF-8"
				remote-directory="foo/bar"/>

	<int-sftp:outbound-channel-adapter id="sftpOutboundAdapterWithNoTemporaryFileName"
				session-factory="sftpSessionFactory"
				channel="inputChannel"
				charset="UTF-8"
				use-temporary-file-name="false"
				remote-directory="foo/bar"/>

	<int:channel id="queueChannel">
		<int:queue/>
	</int:channel>

	<int-sftp:outbound-channel-adapter id="advised"
				session-factory="sftpSessionFactory"
				channel="queueChannel"
				charset="UTF-8"
				use-temporary-file-name="false"
				remote-directory="foo/bar">
		<int:poller fixed-delay="1000"/>
		<int-sftp:request-handler-advice-chain>
			<bean class="org.springframework.integration.sftp.config.OutboundChannelAdapterParserTests$FooAdvice" />
		</int-sftp:request-handler-advice-chain>
	</int-sftp:outbound-channel-adapter>

	<bean id="fileNameGenerator" class="org.mockito.Mockito" factory-method="mock">
		<constructor-arg value="org.springframework.integration.file.FileNameGenerator" type="java.lang.Class"/>
	</bean>
</beans>
