Skip to content

Commit c677722

Browse files
artembilangaryrussell
authored andcommitted
INT-3591: Upgrade to commons-net-3.4
JIRA: https://jira.spring.io/browse/INT-3591 Modify `TestFtpServer` and `FtpServerOutboundTests` for file with leading whitespace to confirm the `FtpServerFactory` has been fixed in the `commons-net-3.4`
1 parent b5745af commit c677722

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ subprojects { subproject ->
9999
chronicleVersion = '3.5.3'
100100
commonsDbcpVersion = '1.4'
101101
commonsIoVersion = '2.4'
102-
commonsNetVersion = '3.3'
102+
commonsNetVersion = '3.4'
103103
curatorVersion = '2.8.0'
104104
derbyVersion = '10.11.1.1'
105105
eclipseLinkVersion = '2.4.2'

spring-integration-ftp/src/test/java/org/springframework/integration/ftp/TestFtpServer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public void create() throws IOException {
8484
ftpRootFolder = this.newFolder(root);
8585
sourceFtpDirectory = new File(ftpRootFolder, "ftpSource");
8686
sourceFtpDirectory.mkdir();
87-
File file = new File(sourceFtpDirectory, "ftpSource1.txt");
87+
File file = new File(sourceFtpDirectory, " ftpSource1.txt");
8888
file.createNewFile();
8989
FileOutputStream fos = new FileOutputStream(file);
9090
fos.write("source1".getBytes());

spring-integration-ftp/src/test/java/org/springframework/integration/ftp/outbound/FtpServerOutboundTests.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public void setup() {
160160
@Test
161161
public void testInt2866LocalDirectoryExpressionGET() {
162162
String dir = "ftpSource/";
163-
this.inboundGet.send(new GenericMessage<Object>(dir + "ftpSource1.txt"));
163+
this.inboundGet.send(new GenericMessage<Object>(dir + " ftpSource1.txt"));
164164
Message<?> result = this.output.receive(1000);
165165
assertNotNull(result);
166166
File localFile = (File) result.getPayload();
@@ -179,7 +179,7 @@ public void testInt2866LocalDirectoryExpressionGET() {
179179
@Test
180180
public void testInt2866InvalidLocalDirectoryExpression() {
181181
try {
182-
this.invalidDirExpression.send(new GenericMessage<Object>("/ftpSource/ftpSource1.txt"));
182+
this.invalidDirExpression.send(new GenericMessage<Object>("/ftpSource/ ftpSource1.txt"));
183183
fail("Exception expected.");
184184
}
185185
catch (Exception e) {
@@ -236,7 +236,7 @@ public void testMGETOnNullDir() throws IOException {
236236
assertThat(localFiles.size(), Matchers.greaterThan(0));
237237

238238
for (File file : localFiles) {
239-
assertThat(file.getName(), isOneOf("localTarget1.txt", "localTarget2.txt"));
239+
assertThat(file.getName(), isOneOf(" localTarget1.txt", "localTarget2.txt"));
240240
assertThat(file.getName(), not(containsString("null")));
241241
}
242242
}
@@ -284,7 +284,7 @@ public void testInt3172LocalDirectoryExpressionMGETRecursiveFiltered() {
284284
public void testInt3100RawGET() throws Exception {
285285
Session<?> session = this.ftpSessionFactory.getSession();
286286
ByteArrayOutputStream baos = new ByteArrayOutputStream();
287-
FileCopyUtils.copy(session.readRaw("ftpSource/ftpSource1.txt"), baos);
287+
FileCopyUtils.copy(session.readRaw("ftpSource/ ftpSource1.txt"), baos);
288288
assertTrue(session.finalizeRaw());
289289
assertEquals("source1", new String(baos.toByteArray()));
290290

@@ -303,7 +303,7 @@ public void testRawGETWithTemplate() throws Exception {
303303
template.setBeanFactory(mock(BeanFactory.class));
304304
template.afterPropertiesSet();
305305
final ByteArrayOutputStream baos1 = new ByteArrayOutputStream();
306-
assertTrue(template.get(new GenericMessage<String>("ftpSource/ftpSource1.txt"), new InputStreamCallback() {
306+
assertTrue(template.get(new GenericMessage<String>("ftpSource/ ftpSource1.txt"), new InputStreamCallback() {
307307

308308
@Override
309309
public void doWithInputStream(InputStream stream) throws IOException {
@@ -408,12 +408,12 @@ public void testInt3412FileMode() {
408408
@Test
409409
public void testStream() {
410410
String dir = "ftpSource/";
411-
this.inboundGetStream.send(new GenericMessage<Object>(dir + "ftpSource1.txt"));
411+
this.inboundGetStream.send(new GenericMessage<Object>(dir + " ftpSource1.txt"));
412412
Message<?> result = this.output.receive(1000);
413413
assertNotNull(result);
414414
assertEquals("source1", result.getPayload());
415415
assertEquals("ftpSource/", result.getHeaders().get(FileHeaders.REMOTE_DIRECTORY));
416-
assertEquals("ftpSource1.txt", result.getHeaders().get(FileHeaders.REMOTE_FILE));
416+
assertEquals(" ftpSource1.txt", result.getHeaders().get(FileHeaders.REMOTE_FILE));
417417

418418
Session<?> session = (Session<?>) result.getHeaders().get(FileHeaders.REMOTE_SESSION);
419419
// Returned to cache
@@ -598,7 +598,7 @@ public void testLsForNullDir() throws IOException {
598598
assertThat(receive.getPayload(), instanceOf(List.class));
599599
List<String> files = (List<String>) receive.getPayload();
600600
assertEquals(2, files.size());
601-
assertThat(files, containsInAnyOrder("ftpSource1.txt", "ftpSource2.txt"));
601+
assertThat(files, containsInAnyOrder(" ftpSource1.txt", "ftpSource2.txt"));
602602

603603
FTPFile[] ftpFiles = ftpSessionFactory.getSession().list(null);
604604
for (FTPFile ftpFile : ftpFiles) {
@@ -618,7 +618,7 @@ public void testInboundChannelAdapterWithNullDir() throws IOException {
618618
Message<?> message = this.output.receive(10000);
619619
assertNotNull(message);
620620
assertThat(message.getPayload(), instanceOf(File.class));
621-
assertEquals("ftpSource1.txt", ((File) message.getPayload()).getName());
621+
assertEquals(" ftpSource1.txt", ((File) message.getPayload()).getName());
622622

623623
message = this.output.receive(10000);
624624
assertNotNull(message);

0 commit comments

Comments
 (0)