From c346e996ede42c6850efb5e50a6de9c76e017d0a Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 29 Jan 2015 13:32:01 +0000 Subject: [PATCH] Ignore temporary .writing files when finding output files Spring Integration's FileWritingMessageHandler uses a .writing file while it's in the process of writing a message to disk and then performs a rename (depending on the OS and filesystem this may or may not be atommic) to create the .msg file. Prior to this commit the test was finding the temporary .writing files and examining them. This could lead to a FileNotFoundException being thrown as the temporary file was deleted while the test was trying to read its contents. This commit updates the test to only look for files with a .msg suffix Fixes gh-2428 --- .../consumer/SampleIntegrationParentApplicationTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-samples/spring-boot-sample-parent-context/src/test/java/sample/parent/consumer/SampleIntegrationParentApplicationTests.java b/spring-boot-samples/spring-boot-sample-parent-context/src/test/java/sample/parent/consumer/SampleIntegrationParentApplicationTests.java index 23b9a8fdc74..61a8a546e3c 100644 --- a/spring-boot-samples/spring-boot-sample-parent-context/src/test/java/sample/parent/consumer/SampleIntegrationParentApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-parent-context/src/test/java/sample/parent/consumer/SampleIntegrationParentApplicationTests.java @@ -87,7 +87,7 @@ public class SampleIntegrationParentApplicationTests { private Resource[] findResources() throws IOException { return ResourcePatternUtils.getResourcePatternResolver( - new DefaultResourceLoader()).getResources("file:target/output/**"); + new DefaultResourceLoader()).getResources("file:target/output/**/*.msg"); } private String readResources(Resource[] resources) throws IOException {