diff --git a/spring-integration-ftp/.springBeans b/spring-integration-ftp/.springBeans new file mode 100644 index 0000000000..ad7b5a4b38 --- /dev/null +++ b/spring-integration-ftp/.springBeans @@ -0,0 +1,14 @@ + + + 1 + + + + + + + src/test/java/org/springframework/integration/ftp/config/FtpOutboundChannelAdapterParserTests-context.xml + + + + diff --git a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/config/AbstractFtpOutboundChannelAdapterParser.java b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/config/AbstractFtpOutboundChannelAdapterParser.java index 87a17b0425..d19a0e7b2c 100644 --- a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/config/AbstractFtpOutboundChannelAdapterParser.java +++ b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/config/AbstractFtpOutboundChannelAdapterParser.java @@ -31,8 +31,7 @@ public abstract class AbstractFtpOutboundChannelAdapterParser extends AbstractOu @Override protected AbstractBeanDefinition parseConsumer(Element element, ParserContext parserContext) { - BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition( - FtpSendingMessageHandlerFactoryBean.class.getName()); + BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(this.getClassName()); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder,element,"charset"); IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder,element,"filename-generator", "fileNameGenerator"); FtpNamespaceParserSupport.configureCoreFtpClient(builder, element, parserContext); diff --git a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/config/FtpsInboundRemoteFileSystemSynchronizingMessageSourceFactoryBean.java b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/config/FtpsInboundRemoteFileSystemSynchronizingMessageSourceFactoryBean.java index f39a4d90e4..43458c881b 100644 --- a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/config/FtpsInboundRemoteFileSystemSynchronizingMessageSourceFactoryBean.java +++ b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/config/FtpsInboundRemoteFileSystemSynchronizingMessageSourceFactoryBean.java @@ -125,6 +125,7 @@ class FtpsInboundRemoteFileSystemSynchronizingMessageSourceFactoryBean extends F factory.setRemoteWorkingDirectory(this.remoteDirectory); factory.setFileType(this.fileType); factory.setClientMode(this.clientMode); + factory.setCipherSuites(this.cipherSuites); factory.setAuthValue(this.authValue); factory.setTrustManager(this.trustManager); 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 6afafb1378..a4c646b0f5 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 @@ -84,8 +84,8 @@ - - + + 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 new file mode 100644 index 0000000000..80677aeb7a --- /dev/null +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundChannelAdapterParserTests-context.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + 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 new file mode 100644 index 0000000000..4dbfe0887a --- /dev/null +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundChannelAdapterParserTests.java @@ -0,0 +1,59 @@ +/* + * Copyright 2002-2010 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.integration.ftp.config; + +import static junit.framework.Assert.assertEquals; +import static junit.framework.Assert.assertNotNull; +import static junit.framework.Assert.assertTrue; + +import org.junit.Test; + +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.integration.endpoint.EventDrivenConsumer; +import org.springframework.integration.ftp.client.FtpClientFactory; +import org.springframework.integration.ftp.client.FtpClientPool; +import org.springframework.integration.ftp.outbound.FtpSendingMessageHandler; +import org.springframework.integration.test.util.TestUtils; + +/** + * @author Oleg Zhurakousky + * + */ +public class FtpOutboundChannelAdapterParserTests { + + @Test + public void testFtpOutboundChannelAdapterComplete() throws Exception{ + ApplicationContext ac = + new ClassPathXmlApplicationContext("FtpOutboundChannelAdapterParserTests-context.xml", this.getClass()); + Object consumer = ac.getBean("ftpOutbound"); + assertTrue(consumer instanceof EventDrivenConsumer); + assertEquals(ac.getBean("ftpChannel"), TestUtils.getPropertyValue(consumer, "inputChannel")); + assertEquals("ftpOutbound", ((EventDrivenConsumer)consumer).getComponentName()); + FtpSendingMessageHandler handler = (FtpSendingMessageHandler) TestUtils.getPropertyValue(consumer, "handler"); + assertEquals(ac.getBean("fileNameGenerator"), TestUtils.getPropertyValue(handler, "fileNameGenerator")); + assertEquals("UTF-8", TestUtils.getPropertyValue(handler, "charset")); + assertNotNull(TestUtils.getPropertyValue(handler, "temporaryBufferFolder")); + assertNotNull(TestUtils.getPropertyValue(handler, "temporaryBufferFolderFile")); + FtpClientPool clientPoll = (FtpClientPool) TestUtils.getPropertyValue(handler, "ftpClientPool"); + FtpClientFactory clientFactory = (FtpClientFactory) TestUtils.getPropertyValue(clientPoll, "factory"); + assertEquals("localhost", TestUtils.getPropertyValue(clientFactory, "host")); + assertEquals(22, TestUtils.getPropertyValue(clientFactory, "port")); + assertEquals("user", TestUtils.getPropertyValue(clientFactory, "username")); + assertEquals("password", TestUtils.getPropertyValue(clientFactory, "password")); + assertEquals("foo/bar", TestUtils.getPropertyValue(clientFactory, "remoteWorkingDirectory")); + } +} diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpsOutboundChannelAdapterParserTests-context.xml b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpsOutboundChannelAdapterParserTests-context.xml new file mode 100644 index 0000000000..80677aeb7a --- /dev/null +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpsOutboundChannelAdapterParserTests-context.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + +