From b3f461e139a2e1c2e856abc0a9a33611358ba35d Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Tue, 7 Mar 2017 18:17:27 -0500 Subject: [PATCH] INT-4018: Resolve some TODOs JIRA: https://jira.spring.io/browse/INT-4018 * Resolve some TODOs as expected * Remove some as logically or physically with useless effort * Leave others for future considerations --- .../aggregator/MethodInvokingReleaseStrategyTests.java | 4 ---- .../remote/gateway/AbstractRemoteFileOutboundGateway.java | 8 +++++--- .../ftp/outbound/FtpServerOutboundTests-context.xml | 2 +- .../integration/jpa/support/JpaParameter.java | 4 +--- .../sftp/outbound/SftpServerOutboundTests-context.xml | 2 +- ...ompInboundChannelAdapterWebSocketIntegrationTests.java | 2 +- .../websocket/client/StompIntegrationTests.java | 2 +- 7 files changed, 10 insertions(+), 14 deletions(-) diff --git a/spring-integration-core/src/test/java/org/springframework/integration/aggregator/MethodInvokingReleaseStrategyTests.java b/spring-integration-core/src/test/java/org/springframework/integration/aggregator/MethodInvokingReleaseStrategyTests.java index 72cdc217c8..bd0bdca570 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/aggregator/MethodInvokingReleaseStrategyTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/aggregator/MethodInvokingReleaseStrategyTests.java @@ -178,7 +178,6 @@ public class MethodInvokingReleaseStrategyTests { return false; } } - // TODO: this is stupid, but maybe it should be illegal? new MethodInvokingReleaseStrategy(new TestReleaseStrategy(), "notEnoughParameters"); } @@ -190,7 +189,6 @@ public class MethodInvokingReleaseStrategyTests { return false; } } - // TODO: this is stupid, but maybe it should be illegal? new MethodInvokingReleaseStrategy(new TestReleaseStrategy(), TestReleaseStrategy.class.getMethod( "notEnoughParameters")); } @@ -208,7 +206,6 @@ public class MethodInvokingReleaseStrategyTests { Assert.assertTrue(adapter.canRelease(messages)); } - // TODO: should this be MessageHandlingException? @Test(expected = ConversionFailedException.class) public void testWrongReturnType() throws SecurityException, NoSuchMethodError { class TestReleaseStrategy { @@ -248,7 +245,6 @@ public class MethodInvokingReleaseStrategyTests { Assert.assertTrue(adapter.canRelease(messages)); } - // TODO: review exception type here @Test(expected = IllegalStateException.class) public void testWrongReturnTypeUsingMethodObject() throws SecurityException, NoSuchMethodException { class TestReleaseStrategy { diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/gateway/AbstractRemoteFileOutboundGateway.java b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/gateway/AbstractRemoteFileOutboundGateway.java index 27395fef72..c69a0b18aa 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/gateway/AbstractRemoteFileOutboundGateway.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/gateway/AbstractRemoteFileOutboundGateway.java @@ -37,6 +37,7 @@ import org.springframework.expression.common.LiteralExpression; import org.springframework.expression.spel.standard.SpelExpressionParser; import org.springframework.integration.IntegrationMessageHeaderAccessor; import org.springframework.integration.expression.ExpressionUtils; +import org.springframework.integration.expression.FunctionExpression; import org.springframework.integration.file.FileHeaders; import org.springframework.integration.file.filters.FileListFilter; import org.springframework.integration.file.remote.AbstractFileInfo; @@ -60,6 +61,7 @@ import org.springframework.util.StringUtils; * * @author Gary Russell * @author Artem Bilan + * * @since 2.1 */ public abstract class AbstractRemoteFileOutboundGateway extends AbstractReplyProducingMessageHandler { @@ -209,7 +211,8 @@ public abstract class AbstractRemoteFileOutboundGateway extends AbstractReply private volatile ExpressionEvaluatingMessageProcessor renameProcessor = new ExpressionEvaluatingMessageProcessor<>( - new SpelExpressionParser().parseExpression("headers." + FileHeaders.RENAME_TO)); + new FunctionExpression>(m -> + m.getHeaders().get(FileHeaders.RENAME_TO))); private volatile Expression localDirectoryExpression; @@ -592,7 +595,6 @@ public abstract class AbstractRemoteFileOutboundGateway extends AbstractReply return getMessageBuilderFactory().withPayload(payload) .setHeader(FileHeaders.REMOTE_DIRECTORY, remoteDir) .setHeader(FileHeaders.REMOTE_FILE, remoteFilename) - .setHeader("file_remoteSession", session) // TODO: remove in 5.0 .setHeader(IntegrationMessageHeaderAccessor.CLOSEABLE_RESOURCE, session) .build(); } @@ -861,7 +863,7 @@ public abstract class AbstractRemoteFileOutboundGateway extends AbstractReply boolean exists = localFile.exists(); boolean replacing = FileExistsMode.REPLACE.equals(fileExistsMode) || (exists && FileExistsMode.REPLACE_IF_MODIFIED.equals(fileExistsMode) - && localFile.lastModified() != getModified(fileInfo)); + && localFile.lastModified() != getModified(fileInfo)); if (!exists || appending || replacing) { OutputStream outputStream; String tempFileName = localFile.getAbsolutePath() + this.remoteFileTemplate.getTemporaryFileSuffix(); diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/outbound/FtpServerOutboundTests-context.xml b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/outbound/FtpServerOutboundTests-context.xml index 8c05f1a78c..c323d191e5 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/outbound/FtpServerOutboundTests-context.xml +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/outbound/FtpServerOutboundTests-context.xml @@ -131,7 +131,7 @@ + expression="headers['file_marker']?.equals('END') ? headers['closeableResource'].close() : null"/> diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/JpaParameter.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/JpaParameter.java index e3b256aca6..e913765df8 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/JpaParameter.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/JpaParameter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,8 +25,6 @@ import org.springframework.util.Assert; * Abstraction of Jpa parameters allowing to provide static parameters * and SpEl Expression based parameters. * - * TODO Should we combine ProcedureParameter class and this class? - * * @author Gunnar Hillert * @author Artem Bilan * @author Gary Russell diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/outbound/SftpServerOutboundTests-context.xml b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/outbound/SftpServerOutboundTests-context.xml index 79b78910d2..8f62d0aa19 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/outbound/SftpServerOutboundTests-context.xml +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/outbound/SftpServerOutboundTests-context.xml @@ -162,7 +162,7 @@ + expression="payload.mark.toString().equals('END') ? headers['closeableResource'].close() : null"/> webSocketEventListener( final AbstractSubscribableChannel clientOutboundChannel) { diff --git a/spring-integration-websocket/src/test/java/org/springframework/integration/websocket/client/StompIntegrationTests.java b/spring-integration-websocket/src/test/java/org/springframework/integration/websocket/client/StompIntegrationTests.java index de43456814..091a50fb5d 100644 --- a/spring-integration-websocket/src/test/java/org/springframework/integration/websocket/client/StompIntegrationTests.java +++ b/spring-integration-websocket/src/test/java/org/springframework/integration/websocket/client/StompIntegrationTests.java @@ -487,7 +487,7 @@ public class StompIntegrationTests extends LogAdjustingTestSupport { configurer.enableSimpleBroker("/topic", "/queue"); } - //TODO SimpleBrokerMessageHandler doesn't support RECEIPT frame, hence we emulate it this way + //SimpleBrokerMessageHandler doesn't support RECEIPT frame, hence we emulate it this way @Bean public ApplicationListener webSocketEventListener( final AbstractSubscribableChannel clientOutboundChannel) {