Skip to content

Commit 4ddf423

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** # Conflicts: # gradle/wrapper/gradle-wrapper.jar # gradle/wrapper/gradle-wrapper.properties
1 parent c216f97 commit 4ddf423

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

gradle/wrapper/gradle-wrapper.jar

84 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.6-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.channel.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;
@@ -97,6 +98,7 @@ public void testStandard() throws Exception {
9798
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(StandardConfig.class);
9899
StandardConfig config = ctx.getBean(StandardConfig.class);
99100
assertThat(config.latch.await(10, TimeUnit.SECONDS)).isTrue();
101+
ctx.getBean(StandardIntegrationFlow.class).stop();
100102
List<Integer> sfCalls = config.sessionSources.stream().limit(17).collect(Collectors.toList());
101103
assertThat(sfCalls).containsExactly(1, 1, 1, 2, 2, 2, 3, 3, 3, 1, 1, 2, 2, 3, 3, 1, 1);
102104
File f1 = new File(tmpDir + File.separator + "standard" + File.separator + "f1");
@@ -114,6 +116,7 @@ public void testFair() throws Exception {
114116
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(FairConfig.class);
115117
StandardConfig config = ctx.getBean(StandardConfig.class);
116118
assertThat(config.latch.await(10, TimeUnit.SECONDS)).isTrue();
119+
ctx.getBean(StandardIntegrationFlow.class).stop();
117120
List<Integer> sfCalls = config.sessionSources.stream().limit(17).collect(Collectors.toList());
118121
assertThat(sfCalls).containsExactly(1, 1, 2, 2, 3, 3, 1, 1, 2, 2, 3, 3, 1, 1, 2, 2, 3);
119122
File f1 = new File(tmpDir + File.separator + "fair" + File.separator + "f1");
@@ -132,6 +135,7 @@ public void testVariableLocalDir() throws Exception {
132135
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(VariableLocalConfig.class);
133136
StandardConfig config = ctx.getBean(StandardConfig.class);
134137
assertThat(config.latch.await(10, TimeUnit.SECONDS)).isTrue();
138+
ctx.getBean(StandardIntegrationFlow.class).stop();
135139
List<Integer> sfCalls = config.sessionSources.stream().limit(17).collect(Collectors.toList());
136140
assertThat(sfCalls).containsExactly(1, 1, 1, 2, 2, 2, 3, 3, 3, 1, 1, 2, 2, 3, 3, 1, 1);
137141
File f1 = new File(tmpDir + File.separator + "variable" + File.separator + "foo" + File.separator + "f1");
@@ -148,6 +152,7 @@ public void testVariableLocalDir() throws Exception {
148152
public void testStreaming() throws Exception {
149153
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(StreamingConfig.class);
150154
StandardConfig config = ctx.getBean(StandardConfig.class);
155+
ctx.getBean(StandardIntegrationFlow.class).stop();
151156
assertThat(config.latch.await(10, TimeUnit.SECONDS)).isTrue();
152157
List<Integer> sfCalls = config.sessionSources.stream().limit(17).collect(Collectors.toList());
153158
// there's an extra getSession() with this adapter in listFiles

0 commit comments

Comments
 (0)