From 4e048f7072e06836530262392a9adde812be7881 Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Mon, 15 Nov 2010 18:26:55 -0500 Subject: [PATCH] INT-1614 added more inbound tests for FTP/FTPS --- ...boundChannelAdapterParserTests-context.xml | 20 ++++++- .../FtpInboundChannelAdapterParserTests.java | 57 +++++++++++++++++- ...boundChannelAdapterParserTests-context.xml | 20 ++++++- .../FtpsInboundChannelAdapterParserTests.java | 60 ++++++++++++++++++- 4 files changed, 152 insertions(+), 5 deletions(-) diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterParserTests-context.xml b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterParserTests-context.xml index 1f7e0e032f..264de666a6 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterParserTests-context.xml +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterParserTests-context.xml @@ -9,7 +9,25 @@ + + + + filter = (CompositeFileListFilter) TestUtils.getPropertyValue(fisync, "filter"); + Set filters = (Set) TestUtils.getPropertyValue(filter, "fileFilters"); + assertEquals(2, filters.size()); + assertTrue(filters.contains(ac.getBean("entryListFilter"))); + + FtpClientPool clientPoll = (FtpClientPool) TestUtils.getPropertyValue(inbound, "clientPool"); + + FtpClientFactory clientFactory = (FtpClientFactory) TestUtils.getPropertyValue(clientPoll, "factory"); + assertEquals("localhost", TestUtils.getPropertyValue(clientFactory, "host")); + assertEquals(22, TestUtils.getPropertyValue(clientFactory, "port")); + assertEquals("user", TestUtils.getPropertyValue(clientFactory, "username")); + assertEquals("password", TestUtils.getPropertyValue(clientFactory, "password")); + assertEquals("foo/bar", TestUtils.getPropertyValue(clientFactory, "remoteWorkingDirectory")); + System.out.println(); + } + + @Test + public void testFtpInboundChannelAdapterCompleteNoId() throws Exception{ + + ApplicationContext ac = + new ClassPathXmlApplicationContext("FtpInboundChannelAdapterParserTests-context.xml", this.getClass()); + Map spcas = ac.getBeansOfType(SourcePollingChannelAdapter.class); + SourcePollingChannelAdapter adapter = null; + for (String key : spcas.keySet()) { + if (!key.equals("ftpInbound")){ + adapter = spcas.get(key); + } + } + assertNotNull(adapter); } } diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpsInboundChannelAdapterParserTests-context.xml b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpsInboundChannelAdapterParserTests-context.xml index 3f1486fe08..15b6824297 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpsInboundChannelAdapterParserTests-context.xml +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpsInboundChannelAdapterParserTests-context.xml @@ -9,7 +9,25 @@ + + + + filter = (CompositeFileListFilter) TestUtils.getPropertyValue(fisync, "filter"); + Set filters = (Set) TestUtils.getPropertyValue(filter, "fileFilters"); + assertEquals(2, filters.size()); + assertTrue(filters.contains(ac.getBean("entryListFilter"))); + + FtpClientPool clientPoll = (FtpClientPool) TestUtils.getPropertyValue(inbound, "clientPool"); + + FtpClientFactory clientFactory = (FtpClientFactory) TestUtils.getPropertyValue(clientPoll, "factory"); + assertEquals("localhost", TestUtils.getPropertyValue(clientFactory, "host")); + assertEquals(22, TestUtils.getPropertyValue(clientFactory, "port")); + assertEquals("user", TestUtils.getPropertyValue(clientFactory, "username")); + assertEquals("password", TestUtils.getPropertyValue(clientFactory, "password")); + assertEquals("foo/bar", TestUtils.getPropertyValue(clientFactory, "remoteWorkingDirectory")); + System.out.println(); + } + + @Test + public void testFtpsInboundChannelAdapterCompleteNoId() throws Exception{ + + ApplicationContext ac = + new ClassPathXmlApplicationContext("FtpsInboundChannelAdapterParserTests-context.xml", this.getClass()); + Map spcas = ac.getBeansOfType(SourcePollingChannelAdapter.class); + SourcePollingChannelAdapter adapter = null; + for (String key : spcas.keySet()) { + if (!key.equals("ftpInbound")){ + adapter = spcas.get(key); + } + } + assertNotNull(adapter); } }