INT-1901 added support for 'comparator' atribute for FTP/SFTP Inbound Channel adapters

This commit is contained in:
Oleg Zhurakousky
2011-05-11 15:03:09 -04:00
parent 21cb39b892
commit 08d601a2ba
10 changed files with 67 additions and 2 deletions

View File

@@ -44,10 +44,15 @@
auto-create-local-directory="false"
remote-file-separator="."
temporary-file-suffix=".bar"
comparator="comparator"
delete-remote-files="false">
<poller fixed-rate="1000"/>
</sftp:inbound-channel-adapter>
<beans:bean id="comparator" class="org.mockito.Mockito" factory-method="mock">
<beans:constructor-arg value="java.util.Comparator"/>
</beans:bean>
<sftp:inbound-channel-adapter id="sftpAdapter"
channel="requestChannel"
session-factory="sftpSessionFactory"

View File

@@ -22,6 +22,7 @@ import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertTrue;
import java.io.File;
import java.util.Comparator;
import org.junit.After;
import org.junit.Before;
@@ -48,6 +49,7 @@ public class InboundChannelAdapterParserTests {
new File("foo").delete();
}
@SuppressWarnings("unchecked")
@Test
public void testWithLocalFiles() throws Exception{
ApplicationContext context =
@@ -59,7 +61,8 @@ public class InboundChannelAdapterParserTests {
SftpInboundFileSynchronizingMessageSource source =
(SftpInboundFileSynchronizingMessageSource) TestUtils.getPropertyValue(adapter, "source");
assertNotNull(source);
Comparator<File> comparator = TestUtils.getPropertyValue(adapter, "source.fileSource.toBeReceived.q.comparator", Comparator.class);
assertNotNull(comparator);
SftpInboundFileSynchronizer synchronizer = (SftpInboundFileSynchronizer) TestUtils.getPropertyValue(source, "synchronizer");
String remoteFileSeparator = (String) TestUtils.getPropertyValue(synchronizer, "remoteFileSeparator");
assertEquals(".bar", TestUtils.getPropertyValue(synchronizer, "temporaryFileSuffix", String.class));