Commit 7aaef1e
* GH-3554: Eval remote dir on each synchToLocal
Fixes #3554
The `remoteDirectoryExpression` was introduced into an
`AbstractInboundFileSynchronizer` to let end-user to evaluate a remote directory
on each poll (essentially on each `synchronizeToLocalDirectory()` call).
The fix for the https://jira.spring.io/browse/INT-4491 introduced a regression
when such an expression was evaluated only once when we call a `setRemoteDirectory()`.
So, an original purpose of this option was lost and we don't get an actual
remote dir on each poll
* Remove `evaluateRemoteDirectory()` method and its usage since it doesn't
reflect expectation of the remote dir expression property
* Reinstate the `remoteDirectoryExpression` evaluation in the
`synchronizeToLocalDirectory()`
* Propagate the result of that expression into further methods for copying
files
* Remove setting of the `remoteDirectory` variable into a global `EvaluationContext`
of the `AbstractInboundFileSynchronizer` instance since it is not thread-safe
* Instead create an `EvaluationContext` locally for each `synchronizeToLocalDirectory()`
call and set the `remoteDirectory` variable into this scoped instances
* Generate a local file name from the `localFilenameGeneratorExpression`
against locally created `EvaluationContext` with the mentioned `remoteDirectory` variable
* Cover the expected functionality with a unit-test
**Cherry-pick to `5.4.x` & `5.3.x`**
* * Fix `testRemoteDirectoryRefreshedOnEachSynchronization` according PR review
1 parent 7da58b3 commit 7aaef1e
File tree
3 files changed
+102
-44
lines changed- spring-integration-file/src
- main/java/org/springframework/integration/file/remote/synchronizer
- test/java/org/springframework/integration/file/remote/synchronizer
- spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config
3 files changed
+102
-44
lines changedLines changed: 33 additions & 34 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | 105 | | |
111 | 106 | | |
112 | 107 | | |
| |||
203 | 198 | | |
204 | 199 | | |
205 | 200 | | |
206 | | - | |
207 | 201 | | |
208 | 202 | | |
209 | 203 | | |
| |||
229 | 223 | | |
230 | 224 | | |
231 | 225 | | |
232 | | - | |
233 | 226 | | |
234 | 227 | | |
235 | 228 | | |
| |||
298 | 291 | | |
299 | 292 | | |
300 | 293 | | |
301 | | - | |
302 | 294 | | |
303 | 295 | | |
304 | 296 | | |
| |||
341 | 333 | | |
342 | 334 | | |
343 | 335 | | |
| 336 | + | |
344 | 337 | | |
345 | | - | |
| 338 | + | |
346 | 339 | | |
347 | 340 | | |
348 | 341 | | |
349 | | - | |
| 342 | + | |
350 | 343 | | |
351 | | - | |
| 344 | + | |
352 | 345 | | |
353 | 346 | | |
354 | 347 | | |
355 | 348 | | |
356 | | - | |
| 349 | + | |
357 | 350 | | |
358 | 351 | | |
359 | 352 | | |
360 | | - | |
361 | | - | |
| 353 | + | |
| 354 | + | |
362 | 355 | | |
363 | | - | |
| 356 | + | |
364 | 357 | | |
365 | 358 | | |
366 | 359 | | |
| |||
372 | 365 | | |
373 | 366 | | |
374 | 367 | | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
375 | 374 | | |
376 | 375 | | |
377 | 376 | | |
| |||
383 | 382 | | |
384 | 383 | | |
385 | 384 | | |
386 | | - | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
387 | 388 | | |
388 | 389 | | |
389 | 390 | | |
| |||
392 | 393 | | |
393 | 394 | | |
394 | 395 | | |
395 | | - | |
396 | | - | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
397 | 399 | | |
398 | 400 | | |
399 | 401 | | |
400 | | - | |
401 | | - | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
402 | 406 | | |
403 | 407 | | |
404 | 408 | | |
| |||
440 | 444 | | |
441 | 445 | | |
442 | 446 | | |
443 | | - | |
444 | | - | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
445 | 450 | | |
446 | 451 | | |
447 | | - | |
| 452 | + | |
448 | 453 | | |
449 | 454 | | |
450 | 455 | | |
| |||
567 | 572 | | |
568 | 573 | | |
569 | 574 | | |
570 | | - | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
571 | 578 | | |
572 | | - | |
| 579 | + | |
573 | 580 | | |
574 | 581 | | |
575 | 582 | | |
576 | 583 | | |
577 | 584 | | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | | - | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | 585 | | |
587 | 586 | | |
588 | 587 | | |
| |||
Lines changed: 65 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| 28 | + | |
| 29 | + | |
27 | 30 | | |
28 | 31 | | |
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
33 | | - | |
| 36 | + | |
| 37 | + | |
34 | 38 | | |
35 | 39 | | |
| 40 | + | |
| 41 | + | |
36 | 42 | | |
37 | 43 | | |
38 | 44 | | |
| |||
78 | 84 | | |
79 | 85 | | |
80 | 86 | | |
81 | | - | |
| 87 | + | |
| 88 | + | |
82 | 89 | | |
| 90 | + | |
83 | 91 | | |
84 | 92 | | |
85 | 93 | | |
| |||
209 | 217 | | |
210 | 218 | | |
211 | 219 | | |
212 | | - | |
| 220 | + | |
213 | 221 | | |
214 | 222 | | |
215 | 223 | | |
216 | 224 | | |
217 | 225 | | |
218 | | - | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
219 | 274 | | |
220 | 275 | | |
221 | 276 | | |
| |||
267 | 322 | | |
268 | 323 | | |
269 | 324 | | |
270 | | - | |
| 325 | + | |
| 326 | + | |
271 | 327 | | |
| 328 | + | |
272 | 329 | | |
273 | 330 | | |
274 | 331 | | |
| |||
301 | 358 | | |
302 | 359 | | |
303 | 360 | | |
304 | | - | |
| 361 | + | |
305 | 362 | | |
306 | 363 | | |
307 | 364 | | |
| |||
366 | 423 | | |
367 | 424 | | |
368 | 425 | | |
369 | | - | |
| 426 | + | |
370 | 427 | | |
371 | 428 | | |
372 | 429 | | |
| |||
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
136 | 137 | | |
137 | 138 | | |
138 | 139 | | |
139 | | - | |
| 140 | + | |
| 141 | + | |
140 | 142 | | |
141 | 143 | | |
142 | 144 | | |
| |||
0 commit comments