diff --git a/build.gradle b/build.gradle index d59267bf32..378db0f959 100644 --- a/build.gradle +++ b/build.gradle @@ -343,6 +343,7 @@ project('spring-integration-sftp') { compile "commons-lang:commons-lang:$commonsLangVersion" compile "org.springframework:spring-context-support:$springVersion" compile("javax.activation:activation:$javaxActivationVersion") { optional = true } + testCompile project(":spring-integration-test") } } diff --git a/spring-integration-sftp/src/main/resources/org/springframework/integration/sftp/config/spring-integration-sftp-2.0.xsd b/spring-integration-sftp/src/main/resources/org/springframework/integration/sftp/config/spring-integration-sftp-2.0.xsd index dd950134c7..c1923011a4 100644 --- a/spring-integration-sftp/src/main/resources/org/springframework/integration/sftp/config/spring-integration-sftp-2.0.xsd +++ b/spring-integration-sftp/src/main/resources/org/springframework/integration/sftp/config/spring-integration-sftp-2.0.xsd @@ -22,7 +22,15 @@ - + + + + + + + + + @@ -69,7 +77,15 @@ - + + + + + + + + + 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 1cb67141ed..805cc18356 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 @@ -9,7 +9,7 @@ - + @@ -21,13 +21,19 @@ - + + clientFactory = (FtpClientFactory) TestUtils.getPropertyValue(clientPoll, "factory"); -// assertEquals("localhost", TestUtils.getPropertyValue(clientFactory, "host")); -// assertEquals(22, TestUtils.getPropertyValue(clientFactory, "port")); + assertNotNull(TestUtils.getPropertyValue(handler, "temporaryBufferFolder")); + assertNotNull(TestUtils.getPropertyValue(handler, "temporaryBufferFolderFile")); + QueuedSftpSessionPool clientPoll = (QueuedSftpSessionPool) TestUtils.getPropertyValue(handler, "pool"); + SftpSessionFactory clientFactory = (SftpSessionFactory) TestUtils.getPropertyValue(clientPoll, "sftpSessionFactory"); + assertEquals("localhost", TestUtils.getPropertyValue(clientFactory, "host")); + assertEquals(2222, TestUtils.getPropertyValue(clientFactory, "port")); } @Test - public void testOutboundChannelAdapaterWithNoId(){ + public void testOutboundChannelAdapaterWithWithRemoteDirectoryExopression(){ ApplicationContext context = new ClassPathXmlApplicationContext("OutboundChannelAdapaterParserTests-context.xml", this.getClass()); + Object consumer = context.getBean("sftpOutboundAdapterWithExpression"); + assertTrue(consumer instanceof EventDrivenConsumer); + assertEquals(context.getBean("inputChannel"), TestUtils.getPropertyValue(consumer, "inputChannel")); + assertEquals("sftpOutboundAdapterWithExpression", ((EventDrivenConsumer)consumer).getComponentName()); + SftpSendingMessageHandler handler = (SftpSendingMessageHandler) TestUtils.getPropertyValue(consumer, "handler"); + SpelExpression remoteDirectoryExpression = (SpelExpression) TestUtils.getPropertyValue(handler, "remoteDirectoryExpression"); + assertNotNull(remoteDirectoryExpression); + assertEquals("'foo' + '/' + 'bar'", remoteDirectoryExpression.getExpressionString()); + assertEquals(context.getBean("fileNameGenerator"), TestUtils.getPropertyValue(handler, "fileNameGenerator")); + assertEquals("UTF-8", TestUtils.getPropertyValue(handler, "charset")); + assertNotNull(TestUtils.getPropertyValue(handler, "temporaryBufferFolder")); + assertNotNull(TestUtils.getPropertyValue(handler, "temporaryBufferFolderFile")); + } }