Build: #24 was successful Changes by Artem Bilan

Code commits

Plan Repository (main)

  • Artem Bilan

    Artem Bilan 0d7bbeaa4e1a202e9d12de5faaaea93b08412bb7

    GH-3554: Eval remote dir on each synchToLocal (#3556)
    * GH-3554: Eval remote dir on each synchToLocal

    Fixes https://github.com/spring-projects/spring-integration/issues/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

    • spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizer.java (version 0d7bbeaa4e1a202e9d12de5faaaea93b08412bb7)
    • spring-integration-file/src/test/java/org/springframework/integration/file/remote/synchronizer/AbstractRemoteFileSynchronizerTests.java (version 0d7bbeaa4e1a202e9d12de5faaaea93b08412bb7)
    • spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterParserTests.java (version 0d7bbeaa4e1a202e9d12de5faaaea93b08412bb7)