Skip to content

Commit c1dd618

Browse files
committed
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
1 parent bb174d4 commit c1dd618

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/RotatingServersTests.java

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858

5959
/**
6060
* @author Gary Russell
61+
* @author Artem Bilan
6162
*
6263
* @since 5.0.7
6364
*
@@ -104,10 +105,6 @@ public void testStandard() throws Exception {
104105
assertThat(f2.exists()).isTrue();
105106
File f3 = new File(tmpDir + File.separator + "standard" + File.separator + "f3");
106107
assertThat(f3.exists()).isTrue();
107-
assertThat(f1.delete()).isTrue();
108-
assertThat(f2.delete()).isTrue();
109-
assertThat(f3.delete()).isTrue();
110-
ctx.getBean("files", QueueChannel.class);
111108
assertThat(ctx.getBean("files", QueueChannel.class).getQueueSize()).isEqualTo(3);
112109
ctx.close();
113110
}
@@ -125,9 +122,6 @@ public void testFair() throws Exception {
125122
assertThat(f2.exists()).isTrue();
126123
File f3 = new File(tmpDir + File.separator + "fair" + File.separator + "f3");
127124
assertThat(f3.exists()).isTrue();
128-
assertThat(f1.delete()).isTrue();
129-
assertThat(f2.delete()).isTrue();
130-
assertThat(f3.delete()).isTrue();
131125
QueueChannel files = ctx.getBean("files", QueueChannel.class);
132126
assertThat(files.getQueueSize()).isEqualTo(3);
133127
ctx.close();
@@ -146,12 +140,6 @@ public void testVariableLocalDir() throws Exception {
146140
assertThat(f2.exists()).isTrue();
147141
File f3 = new File(tmpDir + File.separator + "variable" + File.separator + "fiz" + File.separator + "f3");
148142
assertThat(f3.exists()).isTrue();
149-
assertThat(f1.delete()).isTrue();
150-
assertThat(f2.delete()).isTrue();
151-
assertThat(f3.delete()).isTrue();
152-
assertThat(f1.getParentFile().delete()).isTrue();
153-
assertThat(f2.getParentFile().delete()).isTrue();
154-
assertThat(f3.getParentFile().delete()).isTrue();
155143
assertThat(ctx.getBean("files", QueueChannel.class).getQueueSize()).isEqualTo(3);
156144
ctx.close();
157145
}
@@ -164,7 +152,6 @@ public void testStreaming() throws Exception {
164152
List<Integer> sfCalls = config.sessionSources.stream().limit(17).collect(Collectors.toList());
165153
// there's an extra getSession() with this adapter in listFiles
166154
assertThat(sfCalls).containsExactly(1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 1, 1, 2, 2, 3);
167-
ctx.getBean("files", QueueChannel.class);
168155
assertThat(ctx.getBean("files", QueueChannel.class).getQueueSize()).isEqualTo(3);
169156
ctx.close();
170157
}

0 commit comments

Comments
 (0)