RotatingSTests: Don't delete files between polls

On Windows `File.delete()` causes to file to be modified first of all.
with the high polling interval (`fixedDelay(1)`) there is a chance
to pick the same file from the local directory again, since the
`AbstractPersistentAcceptOnceFileListFilter` is based on the `lastModified`

* Do not delete files manually at all - just rely on the `clean()`
with the `@Before`

**Cherry-pick to 5.0.x**

# Conflicts:
#	spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/RotatingServersTests.java
This commit is contained in:
Artem Bilan
2018-06-27 16:32:55 -04:00
parent bb174d44ab
commit c1dd6187e3

View File

@@ -58,6 +58,7 @@ import org.springframework.integration.metadata.SimpleMetadataStore;
/**
* @author Gary Russell
* @author Artem Bilan
*
* @since 5.0.7
*
@@ -104,10 +105,6 @@ public class RotatingServersTests extends FtpTestSupport {
assertThat(f2.exists()).isTrue();
File f3 = new File(tmpDir + File.separator + "standard" + File.separator + "f3");
assertThat(f3.exists()).isTrue();
assertThat(f1.delete()).isTrue();
assertThat(f2.delete()).isTrue();
assertThat(f3.delete()).isTrue();
ctx.getBean("files", QueueChannel.class);
assertThat(ctx.getBean("files", QueueChannel.class).getQueueSize()).isEqualTo(3);
ctx.close();
}
@@ -125,9 +122,6 @@ public class RotatingServersTests extends FtpTestSupport {
assertThat(f2.exists()).isTrue();
File f3 = new File(tmpDir + File.separator + "fair" + File.separator + "f3");
assertThat(f3.exists()).isTrue();
assertThat(f1.delete()).isTrue();
assertThat(f2.delete()).isTrue();
assertThat(f3.delete()).isTrue();
QueueChannel files = ctx.getBean("files", QueueChannel.class);
assertThat(files.getQueueSize()).isEqualTo(3);
ctx.close();
@@ -146,12 +140,6 @@ public class RotatingServersTests extends FtpTestSupport {
assertThat(f2.exists()).isTrue();
File f3 = new File(tmpDir + File.separator + "variable" + File.separator + "fiz" + File.separator + "f3");
assertThat(f3.exists()).isTrue();
assertThat(f1.delete()).isTrue();
assertThat(f2.delete()).isTrue();
assertThat(f3.delete()).isTrue();
assertThat(f1.getParentFile().delete()).isTrue();
assertThat(f2.getParentFile().delete()).isTrue();
assertThat(f3.getParentFile().delete()).isTrue();
assertThat(ctx.getBean("files", QueueChannel.class).getQueueSize()).isEqualTo(3);
ctx.close();
}
@@ -164,7 +152,6 @@ public class RotatingServersTests extends FtpTestSupport {
List<Integer> sfCalls = config.sessionSources.stream().limit(17).collect(Collectors.toList());
// there's an extra getSession() with this adapter in listFiles
assertThat(sfCalls).containsExactly(1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 1, 1, 2, 2, 3);
ctx.getBean("files", QueueChannel.class);
assertThat(ctx.getBean("files", QueueChannel.class).getQueueSize()).isEqualTo(3);
ctx.close();
}