INT-1961 added tests to validate that Sftp Inbound Adapter is NOT running when 'auto-startup' is set to 'false'

This commit is contained in:
Oleg Zhurakousky
2011-07-06 17:56:27 -04:00
parent 4281a6af74
commit 661fbb6898
3 changed files with 49 additions and 1 deletions

View File

@@ -1,13 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<beansProjectDescription>
<version>1</version>
<pluginVersion><![CDATA[2.5.2.201101121000-SR1]]></pluginVersion>
<pluginVersion><![CDATA[2.6.0.201104111100-PATCH]]></pluginVersion>
<configSuffixes>
<configSuffix><![CDATA[xml]]></configSuffix>
</configSuffixes>
<enableImports><![CDATA[false]]></enableImports>
<configs>
<config>src/test/java/org/springframework/integration/sftp/config/OutboundChannelAdapterParserTests-context.xml</config>
<config>src/test/java/org/springframework/integration/sftp/config/SftpInboundAutostartup-context.xml</config>
</configs>
<configSets>
</configSets>

View File

@@ -48,6 +48,15 @@ public class InboundChannelAdapterParserTests {
public void prepare(){
new File("foo").delete();
}
@Test
public void testAutoStartup() throws Exception{
ApplicationContext context =
new ClassPathXmlApplicationContext("SftpInboundAutostartup-context.xml", this.getClass());
SourcePollingChannelAdapter adapter = context.getBean("sftpAutoStartup", SourcePollingChannelAdapter.class);
assertFalse(adapter.isRunning());
}
@SuppressWarnings("unchecked")
@Test

View File

@@ -0,0 +1,38 @@
<?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 http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/sftp http://www.springframework.org/schema/integration/sftp/spring-integration-sftp-2.0.xsd">
<bean id="sftpSessionFactory" class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
<property name="host" value="loclahost"/>
<property name="knownHosts" value="local, foo.com, bar.foo"/>
<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>
<int:channel id="requestChannel">
<int:queue/>
</int:channel>
<int-sftp:inbound-channel-adapter id="sftpAutoStartup"
session-factory="sftpSessionFactory"
channel="requestChannel"
filename-regex="f[o]+\.txt"
remote-directory="/foo"
local-directory="file:local-test-dir"
auto-create-local-directory="false"
remote-file-separator="."
temporary-file-suffix=".bar"
delete-remote-files="false"
auto-startup="false">
<int:poller fixed-rate="1000"/>
</int-sftp:inbound-channel-adapter>
</beans>