Fix FTP Tests

Incorrect directory and the test didn't verify that files were retrieved.
This commit is contained in:
Gary Russell
2016-03-11 16:34:21 -05:00
parent c9ef27ae87
commit a2c97ca23b
2 changed files with 11 additions and 1 deletions

View File

@@ -195,11 +195,13 @@ public class FtpServerOutboundTests {
@SuppressWarnings("unchecked")
public void testInt2866LocalDirectoryExpressionMGET() {
String dir = "ftpSource/";
this.inboundMGet.send(new GenericMessage<Object>("*.txt"));
this.inboundMGet.send(new GenericMessage<Object>(dir + "*.txt"));
Message<?> result = this.output.receive(1000);
assertNotNull(result);
List<File> localFiles = (List<File>) 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<File>) 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<File> localFiles = (List<File>) 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")));

View File

@@ -188,6 +188,8 @@ public class SftpServerOutboundTests {
assertNotNull(result);
List<File> localFiles = (List<File>) 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<File>) 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));