diff --git a/basic/ftp/README.md b/basic/ftp/README.md new file mode 100644 index 00000000..9bfb3a53 --- /dev/null +++ b/basic/ftp/README.md @@ -0,0 +1,47 @@ +FTP Samples +=========== + +## Introduction + +This example demonstrates the following aspects of the FTP support available with Spring Integration: + +1. Transfer local files via the FTP Outbound Channel Adapter to a remote directory +2. Poll for remote files using the FTP Inbound Channel Adapter +3. Execute explicit FTP command (LS, RM) in order to retrieve a remote file listing and to subsequently delete those files. + +## Setup + +The samples work out of the box using an embedded Apache FTP Server. Simply execute: + + $ mvn clean package + +and the samples are build as well as executed. The samples are part of a JUnit test suite: + + org.springframework.integration.samples.ftp.TestSuite.java + +which comprises the following tests that correspond to the scenarios outlined above: + +* org.springframework.integration.samples.ftp.FtpOutboundChannelAdapterSample.class, +* org.springframework.integration.samples.ftp.FtpInboundChannelAdapterSample.class, +* org.springframework.integration.samples.ftp.FtpOutboundGatewaySample.class + +Keep in mind that the tests are meant to be executed in sequence. + +## The Scenarios + +### Outbound Channel Adapter + +This sample will take 2 local files + +1. a.txt +2. b.txt + +and transfer them to a remote directory '/'. + +### Inbound Channel Adapter + +This test will use the 2 files previously uploaded. Using an Inbound Channel Adapter, the test will poll the remote (Root) directory that will contain 2 files. The adapter will attempt to transfer them to a local directory, which will be generated. Once copied, the files will be sent as a payload of the message to a channel. We are using a file filter, transferring only files that end with 'txt'. The remote files are not deleted. + +### Outbound Gateway + +The last test will re-use the 2 files that are still on the remote FTP server. This test will retrieve and removes them through explicit FTP commands (ls and rm). diff --git a/basic/ftp/pom.xml b/basic/ftp/pom.xml index 8708f61d..fddbc558 100644 --- a/basic/ftp/pom.xml +++ b/basic/ftp/pom.xml @@ -7,7 +7,7 @@ jar 2.1.0.RC1 - 1.2.16 + 1.6.4 4.10 @@ -16,23 +16,54 @@ spring-integration-ftp ${spring.integration.version} + - log4j - log4j - ${log4j.version} + commons-io + commons-io + 2.1 + junit junit ${junit.version} + + org.apache.ftpserver + ftpserver-core + 1.0.6 + + + + + + ch.qos.logback + logback-classic + 1.0.0 + + + org.slf4j + slf4j-api + ${slf4j.version} + + + org.slf4j + log4j-over-slf4j + ${slf4j.version} + + + org.slf4j + jcl-over-slf4j + ${slf4j.version} + org.apache.maven.plugins maven-compiler-plugin + 2.3.2 1.5 1.5 @@ -41,6 +72,16 @@ false + + org.apache.maven.plugins + maven-surefire-plugin + 2.11 + + + **/TestSuite.java + + + diff --git a/basic/ftp/readme.txt b/basic/ftp/readme.txt deleted file mode 100644 index 6032f017..00000000 --- a/basic/ftp/readme.txt +++ /dev/null @@ -1,35 +0,0 @@ -This example demonstrates the following aspects of the FTP support available with Spring Integration: -1. FTP Inbound Channel Adapter (transfers files from remote to local directory) -2. FTP Outbound Channel Adapter (transfers files from local to the remote directory) - - #### INBOUND CHANNEL ADAPTER #### - -To run INBOUND CHANNEL ADAPTER sample execute FtpInboundChannelAdapterSample test. You will see that based on configuration it -will access sample remote directory which contains 3 files and will attempt to transfer them to a local directory which -will be generated. Once copied the files will be sent as a payload of the message to a channel. -The output should look like this: -===== -Received first file message: [Payload=local-dir/a.txt][Headers={timestamp=1290066001349, id=9dca686a-cfd4-4d96-a1a7-761feb005e43}] -Received second file message: [Payload=local-dir/b.txt][Headers={timestamp=1290066001650, id=d33a475d-fa71-4c5b-b73e-3147969f1c6f}] -Received nothing else -===== - -As you can see, although the remote directory had 3 files we only received 2 since we were filtering only the files that end with 'txt'. - -#### OUTBOUND CHANNEL ADAPTER #### - -To run OUTBOUND CHANNEL ADAPTER sample execute FtpOutboundChannelAdapterSample test. You will see that based on configuration it -will attempt to transfer this 'readme.txt' file to a remote directory 'remote-target-dir' -The output should look like this: -===== -Successfully transfered 'readme.txt' file to a remote location under the name 'readme.txt' -===== - - -#### OUTBOUND GATEWAY #### - -Run the FtpOutoundGateway sample as a JUnit test; it creates 2 files, retrieves and removes them over ftp. It cleans up -by removing the retrieved files. Test assumes full access to the filesystem via /tmp where the test files are created. -Requires an ftp server running on localhost. - -Requires setting of user and password properties in user.properties. \ No newline at end of file diff --git a/basic/ftp/remote-source-dir/foo.bar b/basic/ftp/remote-source-dir/foo.bar deleted file mode 100644 index e69de29b..00000000 diff --git a/basic/ftp/src/test/java/org/springframework/integration/samples/ftp/FtpInboundChannelAdapterSample.java b/basic/ftp/src/test/java/org/springframework/integration/samples/ftp/FtpInboundChannelAdapterSample.java index a657e445..3bed826d 100644 --- a/basic/ftp/src/test/java/org/springframework/integration/samples/ftp/FtpInboundChannelAdapterSample.java +++ b/basic/ftp/src/test/java/org/springframework/integration/samples/ftp/FtpInboundChannelAdapterSample.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2011 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. @@ -15,25 +15,54 @@ */ package org.springframework.integration.samples.ftp; -import org.junit.Test; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; -import org.springframework.context.ApplicationContext; +import java.io.File; + +import org.apache.commons.io.FileUtils; +import org.junit.After; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.integration.Message; import org.springframework.integration.core.PollableChannel; /** + * * @author Oleg Zhurakousky + * @author Gunnar Hillert * */ public class FtpInboundChannelAdapterSample { + private static final Logger LOGGER = LoggerFactory.getLogger(FtpInboundChannelAdapterSample.class); + @Test public void runDemo() throws Exception{ - ApplicationContext ac = + ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext("META-INF/spring/integration/FtpInboundChannelAdapterSample-context.xml"); - PollableChannel ftpChannel = ac.getBean("ftpChannel", PollableChannel.class); - System.out.println("Received first file message: " + ftpChannel.receive(5000)); - System.out.println("Received scond file message: " + ftpChannel.receive(5000)); - System.out.println("Received nothing else: " + ftpChannel.receive(2000)); + + PollableChannel ftpChannel = ctx.getBean("ftpChannel", PollableChannel.class); + + Message message1 = ftpChannel.receive(2000); + Message message2 = ftpChannel.receive(2000); + Message message3 = ftpChannel.receive(1000); + + LOGGER.info("Received first file message: {}.", message1); + LOGGER.info("Received second file message: {}.", message2); + LOGGER.info("Received nothing else: {}.", message3); + + assertNotNull(message1); + assertNotNull(message2); + assertNull("Was NOT expecting a third message.", message3); + + } + + @After + public void cleanup() { + FileUtils.deleteQuietly(new File(TestSuite.LOCAL_FTP_TEMP_DIR)); } } diff --git a/basic/ftp/src/test/java/org/springframework/integration/samples/ftp/FtpOutboundChannelAdapterSample.java b/basic/ftp/src/test/java/org/springframework/integration/samples/ftp/FtpOutboundChannelAdapterSample.java index 4836f5ca..0dba2369 100644 --- a/basic/ftp/src/test/java/org/springframework/integration/samples/ftp/FtpOutboundChannelAdapterSample.java +++ b/basic/ftp/src/test/java/org/springframework/integration/samples/ftp/FtpOutboundChannelAdapterSample.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2011 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. @@ -15,35 +15,74 @@ */ package org.springframework.integration.samples.ftp; +import static org.junit.Assert.assertTrue; + import java.io.File; +import java.io.InputStream; +import org.apache.commons.io.FileUtils; +import org.junit.After; import org.junit.Test; - -import org.springframework.context.ApplicationContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.integration.Message; import org.springframework.integration.MessageChannel; import org.springframework.integration.support.MessageBuilder; /** + * * @author Oleg Zhurakousky + * @author Gunnar Hillert * */ public class FtpOutboundChannelAdapterSample { + private static final Logger LOGGER = LoggerFactory.getLogger(FtpOutboundChannelAdapterSample.class); + + private final File baseFolder = new File("target" + File.separator + "toSend"); + @Test public void runDemo() throws Exception{ - ApplicationContext ac = + + ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext("META-INF/spring/integration/FtpOutboundChannelAdapterSample-context.xml"); - MessageChannel ftpChannel = ac.getBean("ftpChannel", MessageChannel.class); - File file = new File("readme.txt"); - if (file.exists()){ - Message message = MessageBuilder.withPayload(file).build(); - ftpChannel.send(message); - Thread.sleep(2000); - } - if (new File("remote-target-dir/readme.txt").exists()){ - System.out.println("Successfully transfered 'readme.txt' file to a remote location under the name 'readme.txt'"); - } + + MessageChannel ftpChannel = ctx.getBean("ftpChannel", MessageChannel.class); + + baseFolder.mkdirs(); + + final File fileToSendA = new File(baseFolder, "a.txt"); + final File fileToSendB = new File(baseFolder, "b.txt"); + + final InputStream inputStreamA = FtpOutboundChannelAdapterSample.class.getResourceAsStream("/test-files/a.txt"); + final InputStream inputStreamB = FtpOutboundChannelAdapterSample.class.getResourceAsStream("/test-files/b.txt"); + + FileUtils.copyInputStreamToFile(inputStreamA, fileToSendA); + FileUtils.copyInputStreamToFile(inputStreamB, fileToSendB); + + assertTrue(fileToSendA.exists()); + assertTrue(fileToSendB.exists()); + + final Message messageA = MessageBuilder.withPayload(fileToSendA).build(); + final Message messageB = MessageBuilder.withPayload(fileToSendB).build(); + + ftpChannel.send(messageA); + ftpChannel.send(messageB); + + Thread.sleep(2000); + + assertTrue(new File(TestSuite.FTP_ROOT_DIR + File.separator + "a.txt").exists()); + assertTrue(new File(TestSuite.FTP_ROOT_DIR + File.separator + "b.txt").exists()); + + LOGGER.info("Successfully transfered file 'a.txt' and 'b.txt' to a remote FTP location."); + } + + @After + public void cleanup() { + FileUtils.deleteQuietly(baseFolder); + } + } diff --git a/basic/ftp/src/test/java/org/springframework/integration/samples/ftp/FtpOutboundGatewaySample.java b/basic/ftp/src/test/java/org/springframework/integration/samples/ftp/FtpOutboundGatewaySample.java index 0471a1f0..20865ec8 100644 --- a/basic/ftp/src/test/java/org/springframework/integration/samples/ftp/FtpOutboundGatewaySample.java +++ b/basic/ftp/src/test/java/org/springframework/integration/samples/ftp/FtpOutboundGatewaySample.java @@ -20,57 +20,59 @@ import static org.junit.Assert.assertTrue; import java.io.File; import java.util.List; -import java.util.Random; +import org.apache.commons.io.FileUtils; +import org.junit.After; import org.junit.Test; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; /** * Demonstrates use of the outbound gateway to use ls, get and rm. - * Creates a temporary directory with 2 files; retrieves and removes them. + * + * The previous Test {@link FtpOutboundChannelAdapterSample} was uploading 2 test + * files: + * + *
    + *
  • a.txt
  • + *
  • b.txt
  • + *
+ * + * This test will now retrieves those 2 files and removes them. Instead of just + * polling the file, the files are instead retrieved and deleted using explicit + * FTP commands (LS and RM) + * * @author Gary Russell * @since 2.1 * */ public class FtpOutboundGatewaySample { + @Test public void testLsGetRm() throws Exception { ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext( "classpath:/META-INF/spring/integration/FtpOutboundGatewaySample-context.xml"); - ToFtpFlowGateway toFtpFlow = ctx.getBean(ToFtpFlowGateway.class); - try { - String tmpDir = System.getProperty("java.io.tmpdir"); + + final ToFtpFlowGateway toFtpFlow = ctx.getBean(ToFtpFlowGateway.class); - // remove the previous output files if necessary - new File(new File(tmpDir), "1.ftptest").delete(); - new File(new File(tmpDir), "2.ftptest").delete(); - - // create a couple of files in a temp dir - File dir = new File(tmpDir + "/" + new Random().nextInt()); - dir.mkdir(); - File f1 = new File(dir, "1.ftptest"); - f1.createNewFile(); - File f2 = new File(dir, "2.ftptest"); - f2.createNewFile(); - - - // execute the flow (ls, get, rm, aggregate results) - List rmResults = toFtpFlow.lsGetAndRmFiles(dir.getAbsolutePath()); - - - //Check everything went as expected, and clean up - assertEquals(2, rmResults.size()); - for (Boolean result : rmResults) { - assertTrue(result); - } - assertTrue("Expected remote dir to be empty", dir.delete()); - assertTrue("Could note delete retrieved file", new File(new File(tmpDir), "1.ftptest").delete()); - assertTrue("Could note delete retrieved file", new File(new File(tmpDir), "2.ftptest").delete()); - } finally { - ctx.close(); + // execute the flow (ls, get, rm, aggregate results) + List rmResults = toFtpFlow.lsGetAndRmFiles("/"); + + //Check everything went as expected, and clean up + assertEquals("Was expecting the collection 'rmResults' to contain 2 elements.", 2, rmResults.size()); + + for (Boolean result : rmResults) { + assertTrue(result); } - } + + assertTrue("Expected FTP remote directory to be empty", new File(TestSuite.FTP_ROOT_DIR).delete()); + } + + @After + public void cleanup() { + FileUtils.deleteQuietly(new File(TestSuite.LOCAL_FTP_TEMP_DIR)); + } + } \ No newline at end of file diff --git a/basic/ftp/src/test/java/org/springframework/integration/samples/ftp/TestSuite.java b/basic/ftp/src/test/java/org/springframework/integration/samples/ftp/TestSuite.java new file mode 100644 index 00000000..180f94ad --- /dev/null +++ b/basic/ftp/src/test/java/org/springframework/integration/samples/ftp/TestSuite.java @@ -0,0 +1,87 @@ +/* + * Copyright 2002-2011 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.samples.ftp; + +import java.io.File; +import java.io.IOException; +import java.net.SocketException; + +import org.apache.commons.io.FileUtils; +import org.apache.ftpserver.FtpServer; +import org.apache.ftpserver.FtpServerFactory; +import org.apache.ftpserver.ftplet.FtpException; +import org.apache.ftpserver.listener.ListenerFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.rules.TemporaryFolder; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.springframework.integration.samples.ftp.support.TestUserManager; + +/** + * Test Suite that will bootstrap an embedded Apache FTP Server. Additionally some + * test files will be send to the FTP Server. + * + * + * @author Gunnar Hillert + * + */ +@RunWith(Suite.class) +@Suite.SuiteClasses({ + FtpOutboundChannelAdapterSample.class, + FtpInboundChannelAdapterSample.class, + FtpOutboundGatewaySample.class + }) +public class TestSuite { + + public static final String FTP_ROOT_DIR = "target" + File.separator + "ftproot"; + public static final String LOCAL_FTP_TEMP_DIR = "target" + File.separator + "local-ftp-temp"; + + @ClassRule + public static final TemporaryFolder temporaryFolder = new TemporaryFolder(); + + public static FtpServer server; + + @BeforeClass + public static void setupFtpServer() throws FtpException, SocketException, IOException { + + File ftpRoot = new File (FTP_ROOT_DIR); + ftpRoot.mkdirs(); + + TestUserManager userManager = new TestUserManager(ftpRoot.getAbsolutePath()); + + FtpServerFactory serverFactory = new FtpServerFactory(); + serverFactory.setUserManager(userManager); + ListenerFactory factory = new ListenerFactory(); + + factory.setPort(3333); + + serverFactory.addListener("default", factory.createListener()); + + server = serverFactory.createServer(); + + server.start(); + + } + + @AfterClass + public static void shutDown() { + server.stop(); + FileUtils.deleteQuietly(new File(FTP_ROOT_DIR)); + } + +} diff --git a/basic/ftp/src/test/java/org/springframework/integration/samples/ftp/support/TestUserManager.java b/basic/ftp/src/test/java/org/springframework/integration/samples/ftp/support/TestUserManager.java new file mode 100644 index 00000000..16ef6737 --- /dev/null +++ b/basic/ftp/src/test/java/org/springframework/integration/samples/ftp/support/TestUserManager.java @@ -0,0 +1,103 @@ +/* + * Copyright 2002-2011 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.samples.ftp.support; + +import java.util.Arrays; + +import org.apache.ftpserver.ftplet.Authentication; +import org.apache.ftpserver.ftplet.AuthenticationFailedException; +import org.apache.ftpserver.ftplet.Authority; +import org.apache.ftpserver.ftplet.FtpException; +import org.apache.ftpserver.ftplet.User; +import org.apache.ftpserver.usermanager.AnonymousAuthentication; +import org.apache.ftpserver.usermanager.ClearTextPasswordEncryptor; +import org.apache.ftpserver.usermanager.UsernamePasswordAuthentication; +import org.apache.ftpserver.usermanager.impl.AbstractUserManager; +import org.apache.ftpserver.usermanager.impl.BaseUser; +import org.apache.ftpserver.usermanager.impl.ConcurrentLoginPermission; +import org.apache.ftpserver.usermanager.impl.WritePermission; + +/** + * + * @author Gunnar Hillert + * + */ +public class TestUserManager extends AbstractUserManager { + private BaseUser testUser; + private BaseUser anonUser; + + private static final String TEST_USERNAME = "demo"; + private static final String TEST_PASSWORD = "demo"; + + public TestUserManager(String homeDirectory) { + super("admin", new ClearTextPasswordEncryptor()); + + testUser = new BaseUser(); + testUser.setAuthorities(Arrays.asList(new Authority[] {new ConcurrentLoginPermission(1, 1), new WritePermission()})); + testUser.setEnabled(true); + testUser.setHomeDirectory(homeDirectory); + testUser.setMaxIdleTime(10000); + testUser.setName(TEST_USERNAME); + testUser.setPassword(TEST_PASSWORD); + + anonUser = new BaseUser(testUser); + anonUser.setName("anonymous"); + } + + public User getUserByName(String username) throws FtpException { + if(TEST_USERNAME.equals(username)) { + return testUser; + } else if(anonUser.getName().equals(username)) { + return anonUser; + } + + return null; + } + + public String[] getAllUserNames() throws FtpException { + return new String[] {TEST_USERNAME, anonUser.getName()}; + } + + public void delete(String username) throws FtpException { + throw new UnsupportedOperationException("Deleting of FTP Users is not supported."); + } + + public void save(User user) throws FtpException { + throw new UnsupportedOperationException("Saving of FTP Users is not supported."); + } + + public boolean doesExist(String username) throws FtpException { + return (TEST_USERNAME.equals(username) || anonUser.getName().equals(username)) ? true : false; + } + + public User authenticate(Authentication authentication) throws AuthenticationFailedException { + if(UsernamePasswordAuthentication.class.isAssignableFrom(authentication.getClass())) { + UsernamePasswordAuthentication upAuth = (UsernamePasswordAuthentication) authentication; + + if(TEST_USERNAME.equals(upAuth.getUsername()) && TEST_PASSWORD.equals(upAuth.getPassword())) { + return testUser; + } + + if(anonUser.getName().equals(upAuth.getUsername())) { + return anonUser; + } + } else if(AnonymousAuthentication.class.isAssignableFrom(authentication.getClass())) { + return anonUser; + } + + return null; + } +} \ No newline at end of file diff --git a/basic/ftp/src/test/resources/META-INF/spring/integration/FtpInboundChannelAdapterSample-context.xml b/basic/ftp/src/test/resources/META-INF/spring/integration/FtpInboundChannelAdapterSample-context.xml index 6f9c047f..2f26da0e 100644 --- a/basic/ftp/src/test/resources/META-INF/spring/integration/FtpInboundChannelAdapterSample-context.xml +++ b/basic/ftp/src/test/resources/META-INF/spring/integration/FtpInboundChannelAdapterSample-context.xml @@ -12,19 +12,20 @@ - + + - + remote-directory="/" + local-directory="#{ T(org.springframework.integration.samples.ftp.TestSuite).LOCAL_FTP_TEMP_DIR}/ftpInbound"> diff --git a/basic/ftp/src/test/resources/META-INF/spring/integration/FtpOutboundChannelAdapterSample-context.xml b/basic/ftp/src/test/resources/META-INF/spring/integration/FtpOutboundChannelAdapterSample-context.xml index b5b0c709..5e826178 100644 --- a/basic/ftp/src/test/resources/META-INF/spring/integration/FtpOutboundChannelAdapterSample-context.xml +++ b/basic/ftp/src/test/resources/META-INF/spring/integration/FtpOutboundChannelAdapterSample-context.xml @@ -2,26 +2,27 @@ + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> - + + - + remote-directory="/" + session-factory="ftpClientFactory" /> diff --git a/basic/ftp/src/test/resources/META-INF/spring/integration/FtpOutboundGatewaySample-context.xml b/basic/ftp/src/test/resources/META-INF/spring/integration/FtpOutboundGatewaySample-context.xml index 96654280..50e4c4ff 100644 --- a/basic/ftp/src/test/resources/META-INF/spring/integration/FtpOutboundGatewaySample-context.xml +++ b/basic/ftp/src/test/resources/META-INF/spring/integration/FtpOutboundGatewaySample-context.xml @@ -4,7 +4,7 @@ xmlns:context="http://www.springframework.org/schema/context" xmlns:int="http://www.springframework.org/schema/integration" xmlns:int-ftp="http://www.springframework.org/schema/integration/ftp" - xsi:schemaLocation="http://www.springframework.org/schema/integration/ftp http://www.springframework.org/schema/integration/ftp/spring-integration-ftp.xsd + xsi:schemaLocation="http://www.springframework.org/schema/integration/ftp http://www.springframework.org/schema/integration/ftp/spring-integration-ftp-2.1.xsd http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> @@ -16,36 +16,54 @@ - + + - + + + + + + - + - + + - + + + + + - + + + + + diff --git a/basic/ftp/src/test/resources/log4j.properties b/basic/ftp/src/test/resources/log4j.properties deleted file mode 100644 index c4672eb7..00000000 --- a/basic/ftp/src/test/resources/log4j.properties +++ /dev/null @@ -1,8 +0,0 @@ -log4j.rootCategory=WARN, stdout - -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %t %c{2}:%L - %m%n - -log4j.category.org.springframework=WARN -log4j.category.org.springframework.integration=DEBUG diff --git a/basic/ftp/src/test/resources/logback.xml b/basic/ftp/src/test/resources/logback.xml new file mode 100644 index 00000000..0c5ad886 --- /dev/null +++ b/basic/ftp/src/test/resources/logback.xml @@ -0,0 +1,27 @@ + + + + + + + %d %5p | %t | %-55logger{55} | %m %n + + + + + + + + + + + + + + + + + + + + diff --git a/basic/ftp/remote-source-dir/a.txt b/basic/ftp/src/test/resources/test-files/a.txt similarity index 100% rename from basic/ftp/remote-source-dir/a.txt rename to basic/ftp/src/test/resources/test-files/a.txt diff --git a/basic/ftp/remote-source-dir/b.txt b/basic/ftp/src/test/resources/test-files/b.txt similarity index 100% rename from basic/ftp/remote-source-dir/b.txt rename to basic/ftp/src/test/resources/test-files/b.txt diff --git a/basic/ftp/src/test/resources/user.properties b/basic/ftp/src/test/resources/user.properties index 5c164817..4d5a0693 100644 --- a/basic/ftp/src/test/resources/user.properties +++ b/basic/ftp/src/test/resources/user.properties @@ -1,2 +1,4 @@ -user= -password= \ No newline at end of file +user=demo +password=demo +port=3333 +host=localhost \ No newline at end of file diff --git a/basic/pom.xml b/basic/pom.xml index f232d928..bc8a6fd5 100644 --- a/basic/pom.xml +++ b/basic/pom.xml @@ -15,7 +15,7 @@ enricher feed file - + ftp helloworld http jdbc @@ -32,7 +32,6 @@ ws-outbound-gateway xml xmpp -