From a2c97ca23b072402b6d73bfeaf65ee69cb71012c Mon Sep 17 00:00:00 2001 From: Gary Russell Date: Fri, 11 Mar 2016 16:34:21 -0500 Subject: [PATCH] Fix FTP Tests Incorrect directory and the test didn't verify that files were retrieved. --- .../integration/ftp/outbound/FtpServerOutboundTests.java | 8 +++++++- .../sftp/outbound/SftpServerOutboundTests.java | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/outbound/FtpServerOutboundTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/outbound/FtpServerOutboundTests.java index 799c2601b0..1e88976a00 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/outbound/FtpServerOutboundTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/outbound/FtpServerOutboundTests.java @@ -195,11 +195,13 @@ public class FtpServerOutboundTests { @SuppressWarnings("unchecked") public void testInt2866LocalDirectoryExpressionMGET() { String dir = "ftpSource/"; - this.inboundMGet.send(new GenericMessage("*.txt")); + this.inboundMGet.send(new GenericMessage(dir + "*.txt")); Message result = this.output.receive(1000); assertNotNull(result); List localFiles = (List) result.getPayload(); + assertThat(localFiles.size(), Matchers.greaterThan(0)); + for (File file : localFiles) { assertThat(file.getPath().replaceAll(java.util.regex.Matcher.quoteReplacement(File.separator), "/"), Matchers.containsString(dir)); @@ -211,6 +213,8 @@ public class FtpServerOutboundTests { assertNotNull(result); localFiles = (List) result.getPayload(); + assertThat(localFiles.size(), Matchers.greaterThan(0)); + for (File file : localFiles) { assertThat(file.getPath().replaceAll(java.util.regex.Matcher.quoteReplacement(File.separator), "/"), Matchers.containsString(dir)); @@ -229,6 +233,8 @@ public class FtpServerOutboundTests { assertNotNull(result); List localFiles = (List) result.getPayload(); + assertThat(localFiles.size(), Matchers.greaterThan(0)); + for (File file : localFiles) { assertThat(file.getName(), isOneOf("localTarget1.txt", "localTarget2.txt")); assertThat(file.getName(), not(containsString("null"))); diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/outbound/SftpServerOutboundTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/outbound/SftpServerOutboundTests.java index c8b89711e1..e8f521b65a 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/outbound/SftpServerOutboundTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/outbound/SftpServerOutboundTests.java @@ -188,6 +188,8 @@ public class SftpServerOutboundTests { assertNotNull(result); List localFiles = (List) result.getPayload(); + assertThat(localFiles.size(), Matchers.greaterThan(0)); + for (File file : localFiles) { assertThat(file.getPath().replaceAll(java.util.regex.Matcher.quoteReplacement(File.separator), "/"), Matchers.containsString(dir)); @@ -199,6 +201,8 @@ public class SftpServerOutboundTests { assertNotNull(result); localFiles = (List) result.getPayload(); + assertThat(localFiles.size(), Matchers.greaterThan(0)); + for (File file : localFiles) { assertThat(file.getPath().replaceAll(java.util.regex.Matcher.quoteReplacement(File.separator), "/"), Matchers.containsString(dir));