From c1dd6187e37906111e04f5accb7e192a9fb03aee Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Wed, 27 Jun 2018 16:32:55 -0400 Subject: [PATCH] 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 --- .../ftp/inbound/RotatingServersTests.java | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/RotatingServersTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/RotatingServersTests.java index 724bcb9b9f..fa8bac64e3 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/RotatingServersTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/RotatingServersTests.java @@ -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 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(); }