From a09ee058ecde4766b433a939d912b899ee65f4b0 Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Tue, 30 Jun 2009 22:52:01 +0000 Subject: [PATCH] INT-606 Added test for the 'delete-source-files' attribute. --- ...leOutboundChannelAdapterParserTests-context.xml | 7 ++++++- .../FileOutboundChannelAdapterParserTests.java | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileOutboundChannelAdapterParserTests-context.xml b/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileOutboundChannelAdapterParserTests-context.xml index 264784f570..300f6d9318 100644 --- a/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileOutboundChannelAdapterParserTests-context.xml +++ b/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileOutboundChannelAdapterParserTests-context.xml @@ -18,12 +18,17 @@ - + + + diff --git a/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileOutboundChannelAdapterParserTests.java b/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileOutboundChannelAdapterParserTests.java index 65fe10afcb..f510fc80c0 100644 --- a/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileOutboundChannelAdapterParserTests.java +++ b/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileOutboundChannelAdapterParserTests.java @@ -49,6 +49,10 @@ public class FileOutboundChannelAdapterParserTests { @Qualifier("adapterWithCustomNameGenerator") EventDrivenConsumer adapterWithCustomNameGenerator; + @Autowired + @Qualifier("adapterWithDeleteFlag") + EventDrivenConsumer adapterWithDeleteFlag; + @Test public void simpleAdapter() { @@ -60,6 +64,7 @@ public class FileOutboundChannelAdapterParserTests { File actual = (File) handlerAccessor.getPropertyValue("destinationDirectory"); assertEquals(expected, actual); assertTrue(handlerAccessor.getPropertyValue("fileNameGenerator") instanceof DefaultFileNameGenerator); + assertEquals(Boolean.FALSE, handlerAccessor.getPropertyValue("deleteSourceFiles")); } @Test @@ -74,4 +79,13 @@ public class FileOutboundChannelAdapterParserTests { assertTrue(handlerAccessor.getPropertyValue("fileNameGenerator") instanceof CustomFileNameGenerator); } + @Test + public void adapterWithDeleteFlag() { + DirectFieldAccessor adapterAccessor = new DirectFieldAccessor(adapterWithDeleteFlag); + FileWritingMessageHandler handler = (FileWritingMessageHandler) + adapterAccessor.getPropertyValue("handler"); + DirectFieldAccessor handlerAccessor = new DirectFieldAccessor(handler); + assertEquals(Boolean.TRUE, handlerAccessor.getPropertyValue("deleteSourceFiles")); + } + }