GH-3395: Fix XML expression default for ARFOGateway
Resolves https://github.com/spring-projects/spring-integration/issues/3395 Outbound remote file gateway parser requires `expression` even though some commands don't need or use it. * Propagate the empty string for `expression` attribute * Fix default (`payload`) expression logic in the `AbstractRemoteFileOutboundGateway` **Cherry-pick to `5.3.x`**
This commit is contained in:
@@ -113,4 +113,26 @@
|
||||
|
||||
<int:channel id="outbound"/>
|
||||
|
||||
<int-sftp:outbound-gateway id="noExpressionLS"
|
||||
request-channel="nullChannel"
|
||||
reply-channel="nullChannel"
|
||||
session-factory="sf"
|
||||
remote-directory="."
|
||||
command="ls" />
|
||||
|
||||
<int-sftp:outbound-gateway id="noExpressionPUT"
|
||||
request-channel="nullChannel"
|
||||
reply-channel="nullChannel"
|
||||
session-factory="sf"
|
||||
remote-directory="."
|
||||
command="put" />
|
||||
|
||||
<int-sftp:outbound-gateway id="noExpressionGET"
|
||||
request-channel="nullChannel"
|
||||
reply-channel="nullChannel"
|
||||
session-factory="sf"
|
||||
remote-directory="."
|
||||
local-directory="."
|
||||
command="get" />
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -69,6 +69,15 @@ public class SftpOutboundGatewayParserTests {
|
||||
@Autowired
|
||||
AbstractEndpoint advised;
|
||||
|
||||
@Autowired
|
||||
AbstractEndpoint noExpressionLS;
|
||||
|
||||
@Autowired
|
||||
AbstractEndpoint noExpressionPUT;
|
||||
|
||||
@Autowired
|
||||
AbstractEndpoint noExpressionGET;
|
||||
|
||||
@Autowired
|
||||
FileNameGenerator generator;
|
||||
|
||||
@@ -165,6 +174,14 @@ public class SftpOutboundGatewayParserTests {
|
||||
assertThat(adviceCalled).isEqualTo(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
void noExpression() {
|
||||
assertThat(TestUtils.getPropertyValue(this.noExpressionLS, "handler.fileNameProcessor")).isNull();
|
||||
assertThat(TestUtils.getPropertyValue(this.noExpressionPUT, "handler.fileNameProcessor")).isNull();
|
||||
assertThat(TestUtils.getPropertyValue(this.noExpressionGET,
|
||||
"handler.fileNameProcessor.expression.expression")).isEqualTo("payload");
|
||||
}
|
||||
|
||||
public static class FooAdvice extends AbstractRequestHandlerAdvice {
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user