ARFOGateway: Directory LiteralExpression->Value...
Using a `LiteralExpression` in the `AbstractRemoteFileOutboundGateway` (when the user provides a `File` for the directory) causes us to create a new `File` object each time, instead of using the user-supplied `File`. Use a `ValueExpression` instead. Move the `FileWritingMessageHandler` logic to `ExpressionUtils` and use it from both places. Also add a String setter variant for convenient Java Configuration.
This commit is contained in:
committed by
Artem Bilan
parent
d5c633d703
commit
f751398cfe
@@ -135,7 +135,8 @@ public class FileOutboundChannelAdapterIntegrationTests {
|
||||
this.inputChannelSaveToSubDirEmptyStringExpression.send(message);
|
||||
}
|
||||
catch (MessageHandlingException e) {
|
||||
Assert.assertEquals("Unable to resolve destination directory name for the provided Expression '' ''.", e.getCause().getMessage());
|
||||
Assert.assertEquals("Unable to resolve Destination Directory for the provided Expression '' ''.",
|
||||
e.getCause().getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -192,8 +193,8 @@ public class FileOutboundChannelAdapterIntegrationTests {
|
||||
this.inputChannelSaveToSubDirWithFile.send(messageWithFileHeader);
|
||||
}
|
||||
catch (MessageHandlingException e) {
|
||||
Assert.assertEquals("The provided destinationDirectoryExpression " +
|
||||
"(headers['subDirectory']) must not resolve to null.",
|
||||
Assert.assertEquals("The provided Destination Directory expression " +
|
||||
"(headers['subDirectory']) must not evaluate to null.",
|
||||
e.getCause().getMessage());
|
||||
|
||||
return;
|
||||
@@ -214,9 +215,9 @@ public class FileOutboundChannelAdapterIntegrationTests {
|
||||
this.inputChannelSaveToSubDirWithFile.send(messageWithFileHeader);
|
||||
}
|
||||
catch (MessageHandlingException e) {
|
||||
Assert.assertEquals("The provided destinationDirectoryExpression" +
|
||||
" (headers['subDirectory']) must be of type " +
|
||||
"java.io.File or be a String.",
|
||||
Assert.assertEquals("The provided Destination Directory expression" +
|
||||
" (headers['subDirectory']) must evaluate to type " +
|
||||
"java.io.File or String, not java.lang.Integer.",
|
||||
e.getCause().getMessage());
|
||||
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user