Skip to content

Commit d61cd79

Browse files
garyrussellartembilan
authored andcommitted
Upgrade to Gradle 4.9; fix RotatingServersTests
Stop the flow before examining the stream to avoid `ConcurrentModificationException`. **cherry-pick to 5.0.x**
1 parent bebde26 commit d61cd79

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

gradle/wrapper/gradle-wrapper.jar

0 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import org.springframework.integration.dsl.IntegrationFlows;
4242
import org.springframework.integration.dsl.MessageChannels;
4343
import org.springframework.integration.dsl.Pollers;
44+
import org.springframework.integration.dsl.StandardIntegrationFlow;
4445
import org.springframework.integration.file.remote.aop.RotatingServerAdvice;
4546
import org.springframework.integration.file.remote.aop.RotatingServerAdvice.KeyDirectory;
4647
import org.springframework.integration.file.remote.session.CachingSessionFactory;
@@ -96,6 +97,7 @@ public void testStandard() throws Exception {
9697
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(StandardConfig.class);
9798
StandardConfig config = ctx.getBean(StandardConfig.class);
9899
assertThat(config.latch.await(10, TimeUnit.SECONDS)).isTrue();
100+
ctx.getBean(StandardIntegrationFlow.class).stop();
99101
List<Integer> sfCalls = config.sessionSources.stream().limit(17).collect(Collectors.toList());
100102
assertThat(sfCalls).containsExactly(1, 1, 1, 2, 2, 2, 3, 3, 3, 1, 1, 2, 2, 3, 3, 1, 1);
101103
File f1 = new File(tmpDir + File.separator + "standard" + File.separator + "f1");
@@ -113,6 +115,7 @@ public void testFair() throws Exception {
113115
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(FairConfig.class);
114116
StandardConfig config = ctx.getBean(StandardConfig.class);
115117
assertThat(config.latch.await(10, TimeUnit.SECONDS)).isTrue();
118+
ctx.getBean(StandardIntegrationFlow.class).stop();
116119
List<Integer> sfCalls = config.sessionSources.stream().limit(17).collect(Collectors.toList());
117120
assertThat(sfCalls).containsExactly(1, 1, 2, 2, 3, 3, 1, 1, 2, 2, 3, 3, 1, 1, 2, 2, 3);
118121
File f1 = new File(tmpDir + File.separator + "fair" + File.separator + "f1");
@@ -130,6 +133,7 @@ public void testVariableLocalDir() throws Exception {
130133
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(VariableLocalConfig.class);
131134
StandardConfig config = ctx.getBean(StandardConfig.class);
132135
assertThat(config.latch.await(10, TimeUnit.SECONDS)).isTrue();
136+
ctx.getBean(StandardIntegrationFlow.class).stop();
133137
List<Integer> sfCalls = config.sessionSources.stream().limit(17).collect(Collectors.toList());
134138
assertThat(sfCalls).containsExactly(1, 1, 1, 2, 2, 2, 3, 3, 3, 1, 1, 2, 2, 3, 3, 1, 1);
135139
File f1 = new File(tmpDir + File.separator + "variable" + File.separator + "foo" + File.separator + "f1");
@@ -146,6 +150,7 @@ public void testVariableLocalDir() throws Exception {
146150
public void testStreaming() throws Exception {
147151
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(StreamingConfig.class);
148152
StandardConfig config = ctx.getBean(StandardConfig.class);
153+
ctx.getBean(StandardIntegrationFlow.class).stop();
149154
assertThat(config.latch.await(10, TimeUnit.SECONDS)).isTrue();
150155
List<Integer> sfCalls = config.sessionSources.stream().limit(17).collect(Collectors.toList());
151156
// there's an extra getSession() with this adapter in listFiles

0 commit comments

Comments
 (0)