general poslihing in tests for FTP/SFTP and javadocs polishing in DefaultHttpHeaderMapper

This commit is contained in:
Oleg Zhurakousky
2011-01-17 15:07:57 -05:00
parent a0735fd67a
commit 893d749907
10 changed files with 23 additions and 7 deletions

View File

@@ -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;

View File

@@ -18,7 +18,7 @@
delete-remote-files="true"
filename-pattern="*.txt"
local-directory="."
remote-file-separator="/"
remote-file-separator="."
remote-directory="foo/bar">
<int:poller fixed-rate="1000"/>
</int-ftp:inbound-channel-adapter>

View File

@@ -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);
}

View File

@@ -21,7 +21,7 @@
session-factory="ftpSessionFactory"
remote-directory="foo/bar"
charset="UTF-8"
remote-file-separator="/"
remote-file-separator="."
remote-filename-generator="fileNameGenerator"/>
<int:channel id="ftpChannel"/>

View File

@@ -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"));

View File

@@ -236,7 +236,8 @@ public class DefaultHttpHeaderMapper implements HeaderMapper<HttpHeaders> {
* 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.
* <p>
* 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<HttpHeaders> {
* The values can also contain simple wildcard patterns (e.g. "foo*" or "*foo") to be matched.
* <p>
* 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];

View File

@@ -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">
<poller fixed-rate="1000"/>
</sftp:inbound-channel-adapter>

View File

@@ -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));
}

View File

@@ -25,7 +25,7 @@
channel="inputChannel"
charset="UTF-8"
remote-filename-generator="fileNameGenerator"
remote-file-separator="/"
remote-file-separator="."
remote-directory="foo/bar"/>
<int-sftp:outbound-channel-adapter id="sftpOutboundAdapterWithExpression"

View File

@@ -50,6 +50,9 @@ public class OutboundChannelAdapaterParserTests {
assertEquals(context.getBean("inputChannel"), TestUtils.getPropertyValue(consumer, "inputChannel"));
assertEquals("sftpOutboundAdapter", ((EventDrivenConsumer)consumer).getComponentName());
FileTransferringMessageHandler handler = (FileTransferringMessageHandler) TestUtils.getPropertyValue(consumer, "handler");
String remoteFileSeparator = (String) TestUtils.getPropertyValue(handler, "remoteFileSeparator");
assertNotNull(remoteFileSeparator);
assertEquals(".", remoteFileSeparator);
Expression remoteDirectoryExpression = (Expression) TestUtils.getPropertyValue(handler, "directoryExpressionProcessor.expression");
assertNotNull(remoteDirectoryExpression);
assertTrue(remoteDirectoryExpression instanceof LiteralExpression);