From 2d6e4909693417ab7193854407311ecaf7379686 Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Mon, 7 Mar 2011 15:33:58 -0500 Subject: [PATCH] INT-1782 added support for configuring temporary suffix --- .../file/FileWritingMessageHandler.java | 14 +++++++++++--- ...tractRemoteFileInboundChannelAdapterParser.java | 1 + ...WritingMessageHandlerBeanDefinitionBuilder.java | 1 + .../FileWritingMessageHandlerFactoryBean.java | 7 +++++++ .../RemoteFileOutboundChannelAdapterParser.java | 1 + .../handler/FileTransferringMessageHandler.java | 14 ++++++++++++-- .../AbstractInboundFileSynchronizer.java | 13 ++++++++++--- ...tractInboundFileSynchronizingMessageSource.java | 2 +- .../file/config/spring-integration-file-2.0.xsd | 7 +++++++ ...leOutboundChannelAdapterParserTests-context.xml | 3 ++- .../FileOutboundChannelAdapterParserTests.java | 1 + .../ftp/config/spring-integration-ftp-2.0.xsd | 14 ++++++++++++++ ...FtpInboundChannelAdapterParserTests-context.xml | 1 + .../FtpInboundChannelAdapterParserTests.java | 1 + .../FtpInboundChannelAdapterSample-context.xml | 1 + ...tpOutboundChannelAdapterParserTests-context.xml | 1 + .../FtpOutboundChannelAdapterParserTests.java | 1 + ...tpsInboundChannelAdapterParserTests-context.xml | 1 + .../sftp/config/spring-integration-sftp-2.0.xsd | 14 ++++++++++++++ .../InboundChannelAdapterParserTests-context.xml | 1 + .../config/InboundChannelAdapterParserTests.java | 2 ++ .../OutboundChannelAdapterParserTests-context.xml | 1 + .../config/OutboundChannelAdapterParserTests.java | 1 + .../config/SftpInboundOutboundSanitySample.java | 12 ++++++------ .../config/SftpInboundReceiveSample-ignored.xml | 7 ++++--- .../config/SftpOutboundTransferSample-ignored.xml | 5 +++-- .../outbound/SftpSendingMessageHandlerTests.java | 5 ++--- 27 files changed, 108 insertions(+), 24 deletions(-) diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/FileWritingMessageHandler.java b/spring-integration-file/src/main/java/org/springframework/integration/file/FileWritingMessageHandler.java index 9362cb9be7..ef28df6be5 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/FileWritingMessageHandler.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/FileWritingMessageHandler.java @@ -53,11 +53,11 @@ import java.nio.charset.Charset; * @author Mark Fisher * @author Iwein Fuld * @author Alex Peters + * @author Oleg Zhurakousky */ public class FileWritingMessageHandler extends AbstractReplyProducingMessageHandler { - public static final String TEMPORARY_FILE_SUFFIX =".writing"; - + public volatile String temporaryFileSuffix =".writing"; private final Log logger = LogFactory.getLog(this.getClass()); @@ -89,6 +89,14 @@ public class FileWritingMessageHandler extends AbstractReplyProducingMessageHand this.autoCreateDirectory = autoCreateDirectory; } + public void setTemporaryFileSuffix(String temporaryFileSuffix) { + this.temporaryFileSuffix = temporaryFileSuffix; + } + + public String getTemporaryFileSuffix() { + return temporaryFileSuffix; + } + /** * Provide the {@link FileNameGenerator} strategy to use when generating * the destination file's name. @@ -139,7 +147,7 @@ public class FileWritingMessageHandler extends AbstractReplyProducingMessageHand Assert.notNull(payload, "message payload must not be null"); String generatedFileName = this.fileNameGenerator.generateFileName(requestMessage); File originalFileFromHeader = this.retrieveOriginalFileFromHeader(requestMessage); - File tempFile = new File(this.destinationDirectory, generatedFileName + TEMPORARY_FILE_SUFFIX); + File tempFile = new File(this.destinationDirectory, generatedFileName + temporaryFileSuffix); File resultFile = new File(this.destinationDirectory, generatedFileName); try { if (payload instanceof File) { diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/config/AbstractRemoteFileInboundChannelAdapterParser.java b/spring-integration-file/src/main/java/org/springframework/integration/file/config/AbstractRemoteFileInboundChannelAdapterParser.java index d5be0dde38..98c16eca45 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/config/AbstractRemoteFileInboundChannelAdapterParser.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/config/AbstractRemoteFileInboundChannelAdapterParser.java @@ -48,6 +48,7 @@ public abstract class AbstractRemoteFileInboundChannelAdapterParser extends Abst IntegrationNamespaceUtils.setValueIfAttributeDefined(synchronizerBuilder, element, "remote-directory"); IntegrationNamespaceUtils.setValueIfAttributeDefined(synchronizerBuilder, element, "delete-remote-files"); IntegrationNamespaceUtils.setValueIfAttributeDefined(synchronizerBuilder, element, "remote-file-separator"); + IntegrationNamespaceUtils.setValueIfAttributeDefined(synchronizerBuilder, element, "temporary-file-suffix"); this.configureFilter(synchronizerBuilder, element, parserContext); // build the MessageSource diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/config/FileWritingMessageHandlerBeanDefinitionBuilder.java b/spring-integration-file/src/main/java/org/springframework/integration/file/config/FileWritingMessageHandlerBeanDefinitionBuilder.java index f473c6c45f..716ea5043e 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/config/FileWritingMessageHandlerBeanDefinitionBuilder.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/config/FileWritingMessageHandlerBeanDefinitionBuilder.java @@ -50,6 +50,7 @@ abstract class FileWritingMessageHandlerBeanDefinitionBuilder { } IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "auto-create-directory"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "delete-source-files"); + IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "temporary-file-suffix"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "charset"); String fileNameGenerator = element.getAttribute("filename-generator"); if (StringUtils.hasText(fileNameGenerator)) { diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/config/FileWritingMessageHandlerFactoryBean.java b/spring-integration-file/src/main/java/org/springframework/integration/file/config/FileWritingMessageHandlerFactoryBean.java index 4256002349..fd7b35bb01 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/config/FileWritingMessageHandlerFactoryBean.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/config/FileWritingMessageHandlerFactoryBean.java @@ -57,6 +57,8 @@ public class FileWritingMessageHandlerFactoryBean implements FactoryBean(remoteDirectoryExpression, String.class); } + + public String getTemporaryFileSuffix() { + return temporaryFileSuffix; + } public void setTemporaryDirectory(File temporaryDirectory) { Assert.notNull(temporaryDirectory, "temporaryDirectory must not be null"); @@ -86,10 +91,15 @@ public class FileTransferringMessageHandler extends AbstractMessageHandler { public void setCharset(String charset) { this.charset = charset; } + + public void setTemporaryFileSuffix(String temporaryFileSuffix) { + this.temporaryFileSuffix = temporaryFileSuffix; + } protected void onInit() throws Exception { Assert.notNull(this.directoryExpressionProcessor, "remoteDirectoryExpression is required"); } + @Override protected void handleMessageInternal(Message message) throws Exception { @@ -174,7 +184,7 @@ public class FileTransferringMessageHandler extends AbstractMessageHandler { } String remoteFilePath = remoteDirectory + fileName; // write remote file first with .writing extension - String tempFilePath = remoteFilePath + FileWritingMessageHandler.TEMPORARY_FILE_SUFFIX; + String tempFilePath = remoteFilePath + this.temporaryFileSuffix; session.write(fileInputStream, tempFilePath); fileInputStream.close(); // then rename it to its final name diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizer.java b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizer.java index 7e241b47e6..c9ca1444d8 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizer.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizer.java @@ -53,8 +53,7 @@ public abstract class AbstractInboundFileSynchronizer implements InboundFileS /** * Extension used when downloading files. We change it right after we know it's downloaded. */ - static final String INCOMPLETE_EXTENSION = ".writing"; - + public volatile String temporaryFileSuffix =".writing"; protected final Log logger = LogFactory.getLog(this.getClass()); @@ -93,6 +92,10 @@ public abstract class AbstractInboundFileSynchronizer implements InboundFileS Assert.hasText(remoteFileSeparator, "'remoteFileSeparator' must not be empty"); this.remoteFileSeparator = remoteFileSeparator; } + + public void setTemporaryFileSuffix(String temporaryFileSuffix) { + this.temporaryFileSuffix = temporaryFileSuffix; + } /** * Specify the full path to the remote directory. @@ -116,6 +119,10 @@ public abstract class AbstractInboundFileSynchronizer implements InboundFileS protected final List filterFiles(F[] files) { return (this.filter != null) ? this.filter.filterFiles(files) : Arrays.asList(files); } + + public String getTemporaryFileSuffix() { + return temporaryFileSuffix; + } public void synchronizeToLocalDirectory(File localDirectory) { Session session = null; @@ -160,7 +167,7 @@ public abstract class AbstractInboundFileSynchronizer implements InboundFileS } File localFile = new File(localDirectory, remoteFileName); if (!localFile.exists()) { - String tempFileName = localFile.getAbsolutePath() + INCOMPLETE_EXTENSION; + String tempFileName = localFile.getAbsolutePath() + this.temporaryFileSuffix; File tempFile = new File(tempFileName); InputStream inputStream = null; FileOutputStream fileOutputStream = new FileOutputStream(tempFile); diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizingMessageSource.java b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizingMessageSource.java index 52ea431d1d..5c098ba5e3 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizingMessageSource.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizingMessageSource.java @@ -137,7 +137,7 @@ public abstract class AbstractInboundFileSynchronizingMessageSource extends M @SuppressWarnings("unchecked") private FileListFilter buildFilter() { - Pattern completePattern = Pattern.compile("^.*(?(Arrays.asList( new AcceptOnceFileListFilter(), new RegexPatternFileListFilter(completePattern))); diff --git a/spring-integration-file/src/main/resources/org/springframework/integration/file/config/spring-integration-file-2.0.xsd b/spring-integration-file/src/main/resources/org/springframework/integration/file/config/spring-integration-file-2.0.xsd index 92927b03ba..fd344387cd 100644 --- a/spring-integration-file/src/main/resources/org/springframework/integration/file/config/spring-integration-file-2.0.xsd +++ b/spring-integration-file/src/main/resources/org/springframework/integration/file/config/spring-integration-file-2.0.xsd @@ -198,6 +198,13 @@ Only files matching this regular expression will be picked up by this adapter. + + + + Extension used when uploading files. We change it right after we know it's uploaded. + + + + directory="${java.io.tmpdir}" + temporary-file-suffix=".foo"/> + + + + Extension used when uploading files. We change it right after we know it's uploaded. + + + @@ -111,6 +118,13 @@ + + + + Extension used when downloading files. We change it right after we know it's downloaded. + + + diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterParserTests-context.xml b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterParserTests-context.xml index b8fc39c74e..804266c9ed 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterParserTests-context.xml +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterParserTests-context.xml @@ -19,6 +19,7 @@ filename-pattern="*.txt" local-directory="." remote-file-separator="." + temporary-file-suffix=".foo" remote-directory="foo/bar"> diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterParserTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterParserTests.java index 4927a3f57a..d631518712 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterParserTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterParserTests.java @@ -55,6 +55,7 @@ public class FtpInboundChannelAdapterParserTests { FtpInboundFileSynchronizer fisync = (FtpInboundFileSynchronizer) TestUtils.getPropertyValue(inbound, "synchronizer"); + assertEquals(".foo", fisync.getTemporaryFileSuffix()); String remoteFileSeparator = (String) TestUtils.getPropertyValue(fisync, "remoteFileSeparator"); assertNotNull(remoteFileSeparator); assertEquals(".", remoteFileSeparator); diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterSample-context.xml b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterSample-context.xml index 1272c3a4f4..6f188a3955 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterSample-context.xml +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterSample-context.xml @@ -21,6 +21,7 @@ delete-remote-files="false" filename-regex=".*\.gz$" remote-directory="/home/ozhurakousky/Downloads" + temporary-file-suffix=".foo" local-directory="file:local-test-dir"> diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundChannelAdapterParserTests-context.xml b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundChannelAdapterParserTests-context.xml index 625aac37fd..6cea25ca97 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundChannelAdapterParserTests-context.xml +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundChannelAdapterParserTests-context.xml @@ -22,6 +22,7 @@ remote-directory="foo/bar" charset="UTF-8" remote-file-separator="." + temporary-file-suffix=".foo" remote-filename-generator="fileNameGenerator"/> diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundChannelAdapterParserTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundChannelAdapterParserTests.java index aab0fb0057..4ba20ae22f 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundChannelAdapterParserTests.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundChannelAdapterParserTests.java @@ -47,6 +47,7 @@ public class FtpOutboundChannelAdapterParserTests { FileTransferringMessageHandler handler = (FileTransferringMessageHandler) TestUtils.getPropertyValue(consumer, "handler"); String remoteFileSeparator = (String) TestUtils.getPropertyValue(handler, "remoteFileSeparator"); assertNotNull(remoteFileSeparator); + assertEquals(".foo", handler.getTemporaryFileSuffix()); assertEquals(".", remoteFileSeparator); assertEquals(ac.getBean("fileNameGenerator"), TestUtils.getPropertyValue(handler, "fileNameGenerator")); assertEquals("UTF-8", TestUtils.getPropertyValue(handler, "charset")); diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpsInboundChannelAdapterParserTests-context.xml b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpsInboundChannelAdapterParserTests-context.xml index 1f48dcda1f..7d1021f78a 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpsInboundChannelAdapterParserTests-context.xml +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpsInboundChannelAdapterParserTests-context.xml @@ -24,6 +24,7 @@ delete-remote-files="true" local-directory="." remote-directory="foo/bar" + temporary-file-suffix=".foo" filter="entryListFilter"> diff --git a/spring-integration-sftp/src/main/resources/org/springframework/integration/sftp/config/spring-integration-sftp-2.0.xsd b/spring-integration-sftp/src/main/resources/org/springframework/integration/sftp/config/spring-integration-sftp-2.0.xsd index cf1ecf5eae..04588bc9cc 100644 --- a/spring-integration-sftp/src/main/resources/org/springframework/integration/sftp/config/spring-integration-sftp-2.0.xsd +++ b/spring-integration-sftp/src/main/resources/org/springframework/integration/sftp/config/spring-integration-sftp-2.0.xsd @@ -70,6 +70,13 @@ + + + + Extension used when uploading files. We change it right after we know it's uploaded. + + + @@ -132,6 +139,13 @@ + + + + Extension used when downloading files. We change it right after we know it's downloaded. + + + diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapterParserTests-context.xml b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapterParserTests-context.xml index d1c7abe358..a8d84884f9 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapterParserTests-context.xml +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapterParserTests-context.xml @@ -43,6 +43,7 @@ local-directory="file:local-test-dir" auto-create-local-directory="false" remote-file-separator="." + temporary-file-suffix=".bar" delete-remote-files="false"> diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapterParserTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapterParserTests.java index 1bfb2ef176..2fd78c01b7 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapterParserTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapterParserTests.java @@ -59,8 +59,10 @@ public class InboundChannelAdapterParserTests { SftpInboundFileSynchronizingMessageSource source = (SftpInboundFileSynchronizingMessageSource) TestUtils.getPropertyValue(adapter, "source"); assertNotNull(source); + SftpInboundFileSynchronizer synchronizer = (SftpInboundFileSynchronizer) TestUtils.getPropertyValue(source, "synchronizer"); String remoteFileSeparator = (String) TestUtils.getPropertyValue(synchronizer, "remoteFileSeparator"); + assertEquals(".bar", synchronizer.getTemporaryFileSuffix()); assertNotNull(remoteFileSeparator); assertEquals(".", remoteFileSeparator); PollableChannel requestChannel = context.getBean("requestChannel", PollableChannel.class); diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/OutboundChannelAdapterParserTests-context.xml b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/OutboundChannelAdapterParserTests-context.xml index e1d08b3232..fc37e11ad7 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/OutboundChannelAdapterParserTests-context.xml +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/OutboundChannelAdapterParserTests-context.xml @@ -26,6 +26,7 @@ charset="UTF-8" remote-filename-generator="fileNameGenerator" remote-file-separator="." + temporary-file-suffix=".bar" remote-directory="foo/bar"/> - + @@ -22,10 +22,11 @@ channel="receiveChannel" session-factory="sftpSessionFactory" local-directory="file:local-test-dir" - remote-directory="/home/ozhurakousky/foo/bar" + remote-directory="/Users/ozhurakousky/workspace-sts-2.3.3.M2/si/spring-integration/spring-integration-sftp/remote-test-dir" auto-startup="true" + temporary-file-suffix=".foo" delete-remote-files="false" - filename-regex=".*\.txt$"> + filename-regex=".*\.test$"> diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpOutboundTransferSample-ignored.xml b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpOutboundTransferSample-ignored.xml index 8e82f164b6..9e68173bc5 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpOutboundTransferSample-ignored.xml +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpOutboundTransferSample-ignored.xml @@ -9,7 +9,7 @@ - + @@ -22,7 +22,8 @@ session-factory="sftpSessionFactory" channel="ftpChannel" charset="UTF-8" + temporary-file-suffix=".foo" remote-filename-generator-expression="payload.getName() + '-foo'" - remote-directory="/home/ozhurakousky"/> + remote-directory="/Users/ozhurakousky/workspace-sts-2.3.3.M2/si/spring-integration/spring-integration-sftp/remote-target-dir"/> diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/outbound/SftpSendingMessageHandlerTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/outbound/SftpSendingMessageHandlerTests.java index 2d4698c198..54020a8055 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/outbound/SftpSendingMessageHandlerTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/outbound/SftpSendingMessageHandlerTests.java @@ -32,7 +32,6 @@ import org.mockito.stubbing.Answer; import org.springframework.expression.common.LiteralExpression; import org.springframework.integration.file.DefaultFileNameGenerator; -import org.springframework.integration.file.FileWritingMessageHandler; import org.springframework.integration.file.remote.handler.FileTransferringMessageHandler; import org.springframework.integration.file.remote.session.Session; import org.springframework.integration.file.remote.session.SessionFactory; @@ -114,7 +113,7 @@ public class SftpSendingMessageHandlerTests { public Object answer(InvocationOnMock invocation) throws Throwable { File file = new File((String)invocation.getArguments()[1]); - assertTrue(file.getName().endsWith(FileWritingMessageHandler.TEMPORARY_FILE_SUFFIX)); + assertTrue(file.getName().endsWith(".writing")); FileCopyUtils.copy((InputStream)invocation.getArguments()[0], new FileOutputStream(file)); return null; } @@ -125,7 +124,7 @@ public class SftpSendingMessageHandlerTests { public Object answer(InvocationOnMock invocation) throws Throwable { File file = new File((String) invocation.getArguments()[0]); - assertTrue(file.getName().endsWith(FileWritingMessageHandler.TEMPORARY_FILE_SUFFIX)); + assertTrue(file.getName().endsWith(".writing")); File renameToFile = new File((String) invocation.getArguments()[1]); file.renameTo(renameToFile); return null;