From 1731bfb3b4198d112ce972980c900e26a2c50f05 Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Thu, 5 May 2011 18:45:03 -0400 Subject: [PATCH] INT-1885 added support for empty remote-file-separator to the FTP Inbound Channel Adapter --- .../AbstractRemoteFileInboundChannelAdapterParser.java | 5 ++++- .../remote/synchronizer/AbstractInboundFileSynchronizer.java | 2 +- .../integration/ftp/config/spring-integration-ftp-2.0.xsd | 2 +- .../config/FtpInboundChannelAdapterParserTests-context.xml | 2 +- .../ftp/config/FtpInboundChannelAdapterParserTests.java | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/config/AbstractRemoteFileInboundChannelAdapterParser.java b/spring-integration-file/src/main/java/org/springframework/integration/file/config/AbstractRemoteFileInboundChannelAdapterParser.java index 3487b1a03e..0e27f7b5f3 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/config/AbstractRemoteFileInboundChannelAdapterParser.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/config/AbstractRemoteFileInboundChannelAdapterParser.java @@ -54,7 +54,10 @@ public abstract class AbstractRemoteFileInboundChannelAdapterParser extends Abst // configure the InboundFileSynchronizer properties IntegrationNamespaceUtils.setValueIfAttributeDefined(synchronizerBuilder, element, "remote-directory"); IntegrationNamespaceUtils.setValueIfAttributeDefined(synchronizerBuilder, element, "delete-remote-files"); - IntegrationNamespaceUtils.setValueIfAttributeDefined(synchronizerBuilder, element, "remote-file-separator"); + String remoteFileSeparator = element.getAttribute("remote-file-separator"); + if (remoteFileSeparator != null){ + synchronizerBuilder.addPropertyValue("remoteFileSeparator", remoteFileSeparator); + } IntegrationNamespaceUtils.setValueIfAttributeDefined(synchronizerBuilder, element, "temporary-file-suffix"); this.configureFilter(synchronizerBuilder, element, parserContext); diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizer.java b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizer.java index be988598eb..4dc95175ed 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizer.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizer.java @@ -90,7 +90,7 @@ public abstract class AbstractInboundFileSynchronizer implements InboundFileS public void setRemoteFileSeparator(String remoteFileSeparator) { - Assert.hasText(remoteFileSeparator, "'remoteFileSeparator' must not be empty"); + Assert.notNull(remoteFileSeparator, "'remoteFileSeparator' must not be null"); this.remoteFileSeparator = remoteFileSeparator; } diff --git a/spring-integration-ftp/src/main/resources/org/springframework/integration/ftp/config/spring-integration-ftp-2.0.xsd b/spring-integration-ftp/src/main/resources/org/springframework/integration/ftp/config/spring-integration-ftp-2.0.xsd index fe2f075c10..668db1a4f5 100644 --- a/spring-integration-ftp/src/main/resources/org/springframework/integration/ftp/config/spring-integration-ftp-2.0.xsd +++ b/spring-integration-ftp/src/main/resources/org/springframework/integration/ftp/config/spring-integration-ftp-2.0.xsd @@ -143,7 +143,7 @@ endpoint itself is a Polling Consumer for a channel with a queue. - + Allows you to provide remote file/directory separator character. DEFAULT: '/' 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 797a3d30f0..05aeddee0b 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 @@ -19,7 +19,7 @@ delete-remote-files="true" filename-pattern="*.txt" local-directory="." - remote-file-separator="." + remote-file-separator="" temporary-file-suffix=".foo" remote-directory="foo/bar"> diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterParserTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterParserTests.java index af75d22324..89c328e262 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterParserTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterParserTests.java @@ -61,7 +61,7 @@ public class FtpInboundChannelAdapterParserTests { assertEquals(".foo", fisync.getTemporaryFileSuffix()); String remoteFileSeparator = (String) TestUtils.getPropertyValue(fisync, "remoteFileSeparator"); assertNotNull(remoteFileSeparator); - assertEquals(".", remoteFileSeparator); + assertEquals("", remoteFileSeparator); FtpSimplePatternFileListFilter filter = (FtpSimplePatternFileListFilter) TestUtils.getPropertyValue(fisync, "filter"); assertNotNull(filter); Object sessionFactory = TestUtils.getPropertyValue(fisync, "sessionFactory");