use of org.springframework.integration.file.transformer.FileToStringTransformer in project spring-integration by spring-projects.
the class Files method toStringTransformer.
/**
* Create a {@link FileToStringTransformer} instance with provided {@code charset} and delete files flag.
* @param charset The charset.
* @param deleteFiles true to delete the file.
* @return the {@link FileToStringTransformer}.
*/
public static FileToStringTransformer toStringTransformer(String charset, boolean deleteFiles) {
FileToStringTransformer transformer = new FileToStringTransformer();
if (charset != null) {
transformer.setCharset(charset);
}
transformer.setDeleteFiles(deleteFiles);
return transformer;
}
use of org.springframework.integration.file.transformer.FileToStringTransformer in project spring-integration by spring-projects.
the class FileToStringTransformerParserTests method checkDeleteFilesValue.
@Test
public void checkDeleteFilesValue() {
DirectFieldAccessor endpointAccessor = new DirectFieldAccessor(endpoint);
MessageTransformingHandler handler = (MessageTransformingHandler) endpointAccessor.getPropertyValue("handler");
DirectFieldAccessor handlerAccessor = new DirectFieldAccessor(handler);
FileToStringTransformer transformer = (FileToStringTransformer) handlerAccessor.getPropertyValue("transformer");
DirectFieldAccessor transformerAccessor = new DirectFieldAccessor(transformer);
assertEquals(Boolean.TRUE, transformerAccessor.getPropertyValue("deleteFiles"));
}
Aggregations