INT-1614 FTP inbound synchronizer now requires 'sessionFactory' as a constructor argument like the other adapters

This commit is contained in:
Mark Fisher
2010-11-21 14:02:38 -05:00
parent 9e3a039d2b
commit cf7141bc9c
3 changed files with 6 additions and 7 deletions

View File

@@ -45,8 +45,8 @@ public abstract class AbstractFtpInboundChannelAdapterParser extends AbstractPol
BeanDefinitionBuilder synchronizerBuilder =
BeanDefinitionBuilder.genericBeanDefinition("org.springframework.integration.ftp.inbound.FtpInboundFileSynchronizer");
synchronizerBuilder.addConstructorArgValue(poolBuilder.getBeanDefinition());
IntegrationNamespaceUtils.setValueIfAttributeDefined(synchronizerBuilder, element, "remote-directory", "remotePath");
synchronizerBuilder.addPropertyValue("sessionFactory", poolBuilder.getBeanDefinition());
// IntegrationNamespaceUtils.setValueIfAttributeDefined(synchronizerBuilder, element, "auto-delete-remote-files-on-sync", "shouldDeleteSourceFile");
//
//

View File

@@ -48,14 +48,14 @@ public class FtpInboundFileSynchronizer extends AbstractInboundFileSynchronizer<
/**
* The {@link org.springframework.integration.ftp.session.FtpClientPool} that holds references to {@link org.apache.commons.net.ftp.FTPClient} instances
*
* @param clientPool the {@link org.springframework.integration.ftp.session.FtpClientPool}
* Create a synchronizer with the {@link SessionFactory} used to acquire {@link Session} instances.
*/
public void setSessionFactory(SessionFactory sessionFactory) {
public FtpInboundFileSynchronizer(SessionFactory sessionFactory) {
Assert.notNull(sessionFactory, "sessionFactory must not be null");
this.sessionFactory = sessionFactory;
}
public void setRemotePath(String remotePath) {
this.remotePath = remotePath;
}

View File

@@ -76,8 +76,7 @@ public class FtpInboundRemoteFileSystemSynchronizerTest {
FtpInboundFileSynchronizingMessageSource ms =
new FtpInboundFileSynchronizingMessageSource();
FtpInboundFileSynchronizer synchronizer = spy(new FtpInboundFileSynchronizer());
synchronizer.setSessionFactory(ftpSessionFactory);
FtpInboundFileSynchronizer synchronizer = spy(new FtpInboundFileSynchronizer(ftpSessionFactory));
synchronizer.setShouldDeleteSourceFile(true);
synchronizer.setRemotePath("remote-test-dir");
synchronizer.setFilter(new FtpPatternMatchingFileListFilter(".*\\.test$"));