GH-3315: Fix (S)FTP Stream with Fair Rotation

Resolves https://github.com/spring-projects/spring-integration/issues/3315

`maxFetchSize` ignored with filters supporting single file filtering (default).
This breaks "fair" rotation with the `RotatingServerAdvice`.

Honor `maxFetchSize`, even with filters that support single file filtering.

**cherry-pick to 5.3.x, 5.2.x**
This commit is contained in:
Gary Russell
2020-07-01 11:18:00 -04:00
committed by Artem Bilan
parent 0ddbfa6e6d
commit f3d61ec44a
3 changed files with 131 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2019 the original author or authors.
* Copyright 2015-2020 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.
@@ -18,6 +18,7 @@ package org.springframework.integration.file.remote;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -70,7 +71,7 @@ public class RemoteFileStreamingMessageSourceTests {
testRemoteFileStreamingMessageSource.setBeanFactory(mock(BeanFactory.class));
testRemoteFileStreamingMessageSource.start();
assertThat(testRemoteFileStreamingMessageSource.doReceive()).isNull();
assertThat(testRemoteFileStreamingMessageSource.doReceive(-1)).isNull();
}
@Test
@@ -94,7 +95,7 @@ public class RemoteFileStreamingMessageSourceTests {
testRemoteFileStreamingMessageSource.start();
assertThatExceptionOfType(UncheckedIOException.class)
.isThrownBy(testRemoteFileStreamingMessageSource::doReceive);
.isThrownBy(() -> testRemoteFileStreamingMessageSource.doReceive(anyInt()));
assertThat(cachingSessionFactory.getSession()).isNotNull();
}