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
This commit is contained in:
Artem Bilan
2017-03-07 18:17:27 -05:00
committed by Gary Russell
parent 55e7752079
commit b3f461e139
7 changed files with 10 additions and 14 deletions

View File

@@ -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 {

View File

@@ -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<F> extends AbstractReplyProducingMessageHandler {
@@ -209,7 +211,8 @@ public abstract class AbstractRemoteFileOutboundGateway<F> extends AbstractReply
private volatile ExpressionEvaluatingMessageProcessor<String> renameProcessor =
new ExpressionEvaluatingMessageProcessor<>(
new SpelExpressionParser().parseExpression("headers." + FileHeaders.RENAME_TO));
new FunctionExpression<Message<?>>(m ->
m.getHeaders().get(FileHeaders.RENAME_TO)));
private volatile Expression localDirectoryExpression;
@@ -592,7 +595,6 @@ public abstract class AbstractRemoteFileOutboundGateway<F> 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<F> 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();

View File

@@ -131,7 +131,7 @@
</int:chain>
<int:service-activator input-channel="markers"
expression="headers['file_marker']?.equals('END') ? headers['file_remoteSession'].close() : null"/>
expression="headers['file_marker']?.equals('END') ? headers['closeableResource'].close() : null"/>
<int:channel id="appending" />

View File

@@ -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

View File

@@ -162,7 +162,7 @@
</int:chain>
<int:service-activator input-channel="markers"
expression="payload.mark.toString().equals('END') ? headers['file_remoteSession'].close() : null"/>
expression="payload.mark.toString().equals('END') ? headers['closeableResource'].close() : null"/>
<int-sftp:outbound-gateway
session-factory="sftpSessionFactory"

View File

@@ -352,7 +352,7 @@ public class StompInboundChannelAdapterWebSocketIntegrationTests extends LogAdju
.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<SessionSubscribeEvent> webSocketEventListener(
final AbstractSubscribableChannel clientOutboundChannel) {

View File

@@ -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<SessionSubscribeEvent> webSocketEventListener(
final AbstractSubscribableChannel clientOutboundChannel) {