INT-2465 Fix Temporary File Suffix

<file:outbound-channel-adapter/> temporary suffix (.writing) was
overwritten to null by the factory bean if no suffix provided.
This commit is contained in:
Gary Russell
2012-03-07 10:16:59 -05:00
committed by Oleg Zhurakousky
parent 6b6a463638
commit 7cb75f82ef
2 changed files with 10 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2011 the original author or authors.
* Copyright 2002-2012 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.
@@ -23,9 +23,12 @@ import org.springframework.integration.file.FileNameGenerator;
import org.springframework.integration.file.FileWritingMessageHandler;
/**
* Factory bean used to create {@link FileWritingMessageHandler}s.
*
* @author Mark Fisher
* @author Iwein Fuld
* @author Oleg Zhurakousky
* @author Gary Russell
* @since 1.0.3
*/
public class FileWritingMessageHandlerFactoryBean extends AbstractSimpleMessageHandlerFactoryBean<FileWritingMessageHandler>{
@@ -99,7 +102,9 @@ public class FileWritingMessageHandlerFactoryBean extends AbstractSimpleMessageH
if (this.sendTimeout != null) {
handler.setSendTimeout(this.sendTimeout);
}
handler.setTemporaryFileSuffix(this.temporaryFileSuffix);
if (this.temporaryFileSuffix != null) {
handler.setTemporaryFileSuffix(this.temporaryFileSuffix);
}
return handler;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009 the original author or authors.
* Copyright 2002-2012 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.
@@ -41,6 +41,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
* @author Mark Fisher
* @author Marius Bogoevici
* @author Iwein Fuld
* @author Gary Russell
*/
@ContextConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
@@ -89,6 +90,7 @@ public class FileOutboundChannelAdapterParserTests {
File actual = (File) handlerAccessor.getPropertyValue("destinationDirectory");
assertEquals(expected, actual);
assertTrue(handlerAccessor.getPropertyValue("fileNameGenerator") instanceof CustomFileNameGenerator);
assertEquals(".writing", handlerAccessor.getPropertyValue("temporaryFileSuffix"));
}
@Test