INT-950: turns out all supporting classes already had this property, so only changes in the namespace and the parser were needed.
This commit is contained in:
@@ -50,6 +50,7 @@ abstract class FileWritingMessageHandlerBeanDefinitionBuilder {
|
|||||||
}
|
}
|
||||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "auto-create-directory");
|
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "auto-create-directory");
|
||||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "delete-source-files");
|
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "delete-source-files");
|
||||||
|
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "charset");
|
||||||
String fileNameGenerator = element.getAttribute("filename-generator");
|
String fileNameGenerator = element.getAttribute("filename-generator");
|
||||||
if (StringUtils.hasText(fileNameGenerator)) {
|
if (StringUtils.hasText(fileNameGenerator)) {
|
||||||
builder.addPropertyReference("fileNameGenerator", fileNameGenerator);
|
builder.addPropertyReference("fileNameGenerator", fileNameGenerator);
|
||||||
|
|||||||
@@ -200,6 +200,7 @@
|
|||||||
</xsd:annotation>
|
</xsd:annotation>
|
||||||
</xsd:attribute>
|
</xsd:attribute>
|
||||||
<xsd:attribute name="auto-startup" type="xsd:string"/>
|
<xsd:attribute name="auto-startup" type="xsd:string"/>
|
||||||
|
<xsd:attribute name="charset" type="xsd:string"/>
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
|
|
||||||
<xsd:element name="file-to-string-transformer">
|
<xsd:element name="file-to-string-transformer">
|
||||||
|
|||||||
@@ -29,6 +29,11 @@
|
|||||||
delete-source-files="true"
|
delete-source-files="true"
|
||||||
directory="${java.io.tmpdir}"/>
|
directory="${java.io.tmpdir}"/>
|
||||||
|
|
||||||
|
<file:outbound-channel-adapter id="adapterWithCharset"
|
||||||
|
channel="testChannel"
|
||||||
|
charset="UTF-8"
|
||||||
|
directory="${java.io.tmpdir}"/>
|
||||||
|
|
||||||
<file:outbound-channel-adapter id="adapterWithOrder"
|
<file:outbound-channel-adapter id="adapterWithOrder"
|
||||||
channel="testChannel"
|
channel="testChannel"
|
||||||
order="555"
|
order="555"
|
||||||
|
|||||||
@@ -16,14 +16,8 @@
|
|||||||
|
|
||||||
package org.springframework.integration.file.config;
|
package org.springframework.integration.file.config;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
import org.springframework.beans.DirectFieldAccessor;
|
import org.springframework.beans.DirectFieldAccessor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
@@ -33,6 +27,12 @@ import org.springframework.integration.file.FileWritingMessageHandler;
|
|||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mark Fisher
|
* @author Mark Fisher
|
||||||
* @author Marius Bogoevici
|
* @author Marius Bogoevici
|
||||||
@@ -57,6 +57,10 @@ public class FileOutboundChannelAdapterParserTests {
|
|||||||
@Qualifier("adapterWithOrder")
|
@Qualifier("adapterWithOrder")
|
||||||
EventDrivenConsumer adapterWithOrder;
|
EventDrivenConsumer adapterWithOrder;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
@Qualifier("adapterWithCharset")
|
||||||
|
EventDrivenConsumer adapterWithCharset;
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void simpleAdapter() {
|
public void simpleAdapter() {
|
||||||
@@ -107,4 +111,13 @@ public class FileOutboundChannelAdapterParserTests {
|
|||||||
assertEquals(Boolean.FALSE, adapterAccessor.getPropertyValue("autoStartup"));
|
assertEquals(Boolean.FALSE, adapterAccessor.getPropertyValue("autoStartup"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void adapterWithCharset() {
|
||||||
|
DirectFieldAccessor adapterAccessor = new DirectFieldAccessor(adapterWithCharset);
|
||||||
|
FileWritingMessageHandler handler = (FileWritingMessageHandler)
|
||||||
|
adapterAccessor.getPropertyValue("handler");
|
||||||
|
DirectFieldAccessor handlerAccessor = new DirectFieldAccessor(handler);
|
||||||
|
assertEquals(Charset.forName("UTF-8"), handlerAccessor.getPropertyValue("charset"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user