From 893d74990765d30f021a73636edd316ba19d8be4 Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Mon, 17 Jan 2011 15:07:57 -0500 Subject: [PATCH] general poslihing in tests for FTP/SFTP and javadocs polishing in DefaultHttpHeaderMapper --- .../springframework/integration/ftp/session/FtpSession.java | 1 - .../config/FtpInboundChannelAdapterParserTests-context.xml | 2 +- .../ftp/config/FtpInboundChannelAdapterParserTests.java | 3 +++ .../config/FtpOutboundChannelAdapterParserTests-context.xml | 2 +- .../ftp/config/FtpOutboundChannelAdapterParserTests.java | 3 +++ .../integration/http/support/DefaultHttpHeaderMapper.java | 6 ++++-- .../config/InboundChannelAdapaterParserTests-context.xml | 2 +- .../sftp/config/InboundChannelAdapaterParserTests.java | 6 ++++++ .../config/OutboundChannelAdapaterParserTests-context.xml | 2 +- .../sftp/config/OutboundChannelAdapaterParserTests.java | 3 +++ 10 files changed, 23 insertions(+), 7 deletions(-) diff --git a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/session/FtpSession.java b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/session/FtpSession.java index 20f4ba0701..55d727e007 100644 --- a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/session/FtpSession.java +++ b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/session/FtpSession.java @@ -25,7 +25,6 @@ import org.apache.commons.logging.LogFactory; import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPFile; -import org.springframework.integration.file.FileWritingMessageHandler; import org.springframework.integration.file.remote.session.Session; import org.springframework.util.Assert; 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 2211ca8b86..b8fc39c74e 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 @@ -18,7 +18,7 @@ delete-remote-files="true" filename-pattern="*.txt" local-directory="." - remote-file-separator="/" + remote-file-separator="." 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 c441118b2e..4927a3f57a 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 @@ -55,6 +55,9 @@ public class FtpInboundChannelAdapterParserTests { FtpInboundFileSynchronizer fisync = (FtpInboundFileSynchronizer) TestUtils.getPropertyValue(inbound, "synchronizer"); + String remoteFileSeparator = (String) TestUtils.getPropertyValue(fisync, "remoteFileSeparator"); + assertNotNull(remoteFileSeparator); + assertEquals(".", remoteFileSeparator); FtpSimplePatternFileListFilter filter = (FtpSimplePatternFileListFilter) TestUtils.getPropertyValue(fisync, "filter"); assertNotNull(filter); } diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundChannelAdapterParserTests-context.xml b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundChannelAdapterParserTests-context.xml index bd843205e7..625aac37fd 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundChannelAdapterParserTests-context.xml +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundChannelAdapterParserTests-context.xml @@ -21,7 +21,7 @@ session-factory="ftpSessionFactory" remote-directory="foo/bar" charset="UTF-8" - remote-file-separator="/" + remote-file-separator="." remote-filename-generator="fileNameGenerator"/> diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundChannelAdapterParserTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundChannelAdapterParserTests.java index ebb9280a0b..aab0fb0057 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundChannelAdapterParserTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundChannelAdapterParserTests.java @@ -45,6 +45,9 @@ public class FtpOutboundChannelAdapterParserTests { assertEquals(ac.getBean("ftpChannel"), TestUtils.getPropertyValue(consumer, "inputChannel")); assertEquals("ftpOutbound", ((EventDrivenConsumer)consumer).getComponentName()); FileTransferringMessageHandler handler = (FileTransferringMessageHandler) TestUtils.getPropertyValue(consumer, "handler"); + String remoteFileSeparator = (String) TestUtils.getPropertyValue(handler, "remoteFileSeparator"); + assertNotNull(remoteFileSeparator); + assertEquals(".", remoteFileSeparator); assertEquals(ac.getBean("fileNameGenerator"), TestUtils.getPropertyValue(handler, "fileNameGenerator")); assertEquals("UTF-8", TestUtils.getPropertyValue(handler, "charset")); assertNotNull(TestUtils.getPropertyValue(handler, "temporaryDirectory")); diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/support/DefaultHttpHeaderMapper.java b/spring-integration-http/src/main/java/org/springframework/integration/http/support/DefaultHttpHeaderMapper.java index 11f9b049e4..b614fd5911 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/support/DefaultHttpHeaderMapper.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/support/DefaultHttpHeaderMapper.java @@ -236,7 +236,8 @@ public class DefaultHttpHeaderMapper implements HeaderMapper { * or HTTP response (for inbound adapters) from a Spring Integration Message's headers. * The values can also contain simple wildcard patterns (e.g. "foo*" or "*foo") to be matched. *

- * Any non-standard headers will be prefixed by {@value #USER_DEFINED_HEADER_PREFIX} if not already. + * Any non-standard headers will be prefixed with the value specified by + * {@value DefaultHttpHeaderMapper#setUserDefinedPrefix(String)}. The default is 'X-'. */ public void setOutboundHeaderNames(String[] outboundHeaderNames) { this.outboundHeaderNames = (outboundHeaderNames != null) ? outboundHeaderNames : new String[0]; @@ -248,7 +249,8 @@ public class DefaultHttpHeaderMapper implements HeaderMapper { * The values can also contain simple wildcard patterns (e.g. "foo*" or "*foo") to be matched. *

* This will match the header name directly or, for non-standard HTTP headers, it will match - * the header name prefixed by {@value #USER_DEFINED_HEADER_PREFIX}. + * the header name prefixed with the value specified by + * {@value DefaultHttpHeaderMapper#setUserDefinedPrefix(String)}. The default is 'X-'. */ public void setInboundHeaderNames(String[] inboundHeaderNames) { this.inboundHeaderNames = (inboundHeaderNames != null) ? inboundHeaderNames : new String[0]; diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapaterParserTests-context.xml b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapaterParserTests-context.xml index d059794af8..d1c7abe358 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapaterParserTests-context.xml +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapaterParserTests-context.xml @@ -42,7 +42,7 @@ remote-directory="/foo" local-directory="file:local-test-dir" auto-create-local-directory="false" - remote-file-separator="/" + remote-file-separator="." delete-remote-files="false"> diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapaterParserTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapaterParserTests.java index 2ba3a7be84..62a56028be 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapaterParserTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapaterParserTests.java @@ -16,6 +16,7 @@ package org.springframework.integration.sftp.config; +import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertFalse; import static junit.framework.Assert.assertNotNull; import static junit.framework.Assert.assertTrue; @@ -33,6 +34,7 @@ import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.integration.core.PollableChannel; import org.springframework.integration.endpoint.SourcePollingChannelAdapter; +import org.springframework.integration.sftp.inbound.SftpInboundFileSynchronizer; import org.springframework.integration.sftp.inbound.SftpInboundFileSynchronizingMessageSource; import org.springframework.integration.test.util.TestUtils; @@ -57,6 +59,10 @@ public class InboundChannelAdapaterParserTests { SftpInboundFileSynchronizingMessageSource source = (SftpInboundFileSynchronizingMessageSource) TestUtils.getPropertyValue(adapter, "source"); assertNotNull(source); + SftpInboundFileSynchronizer synchronizer = (SftpInboundFileSynchronizer) TestUtils.getPropertyValue(source, "synchronizer"); + String remoteFileSeparator = (String) TestUtils.getPropertyValue(synchronizer, "remoteFileSeparator"); + assertNotNull(remoteFileSeparator); + assertEquals(".", remoteFileSeparator); PollableChannel requestChannel = context.getBean("requestChannel", PollableChannel.class); assertNotNull(requestChannel.receive(2000)); } diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/OutboundChannelAdapaterParserTests-context.xml b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/OutboundChannelAdapaterParserTests-context.xml index 152f15ac9b..e1d08b3232 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/OutboundChannelAdapaterParserTests-context.xml +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/OutboundChannelAdapaterParserTests-context.xml @@ -25,7 +25,7 @@ channel="inputChannel" charset="UTF-8" remote-filename-generator="fileNameGenerator" - remote-file-separator="/" + remote-file-separator="." remote-directory="foo/bar"/>