use of org.springframework.integration.file.FileWritingMessageHandler in project spring-integration by spring-projects.
the class FileOutboundChannelAdapterParserTests method adapterWithOrder.
@Test
public void adapterWithOrder() {
DirectFieldAccessor adapterAccessor = new DirectFieldAccessor(adapterWithOrder);
FileWritingMessageHandler handler = (FileWritingMessageHandler) adapterAccessor.getPropertyValue("handler");
DirectFieldAccessor handlerAccessor = new DirectFieldAccessor(handler);
assertEquals(555, handlerAccessor.getPropertyValue("order"));
}
use of org.springframework.integration.file.FileWritingMessageHandler in project spring-integration by spring-projects.
the class FileOutboundChannelAdapterParserTests method adapterWithDirectoryExpression.
@Test
public void adapterWithDirectoryExpression() {
FileWritingMessageHandler handler = TestUtils.getPropertyValue(adapterWithDirectoryExpression, "handler", FileWritingMessageHandler.class);
Method m = ReflectionUtils.findMethod(FileWritingMessageHandler.class, "getTemporaryFileSuffix");
ReflectionUtils.makeAccessible(m);
assertEquals(".writing", ReflectionUtils.invokeMethod(m, handler));
String expectedExpressionString = "'foo/bar'";
String actualExpressionString = TestUtils.getPropertyValue(handler, "destinationDirectoryExpression", Expression.class).getExpressionString();
assertEquals(expectedExpressionString, actualExpressionString);
}
use of org.springframework.integration.file.FileWritingMessageHandler in project spring-integration by spring-projects.
the class FileOutboundChannelAdapterParserTests method adapterWithCustomFileNameGenerator.
@Test
public void adapterWithCustomFileNameGenerator() {
DirectFieldAccessor adapterAccessor = new DirectFieldAccessor(adapterWithCustomNameGenerator);
FileWritingMessageHandler handler = (FileWritingMessageHandler) adapterAccessor.getPropertyValue("handler");
DirectFieldAccessor handlerAccessor = new DirectFieldAccessor(handler);
File expected = new File(System.getProperty("java.io.tmpdir"));
Expression destinationDirectoryExpression = (Expression) handlerAccessor.getPropertyValue("destinationDirectoryExpression");
File actual = new File(destinationDirectoryExpression.getExpressionString());
assertEquals(expected, actual);
assertTrue(handlerAccessor.getPropertyValue("fileNameGenerator") instanceof CustomFileNameGenerator);
assertEquals(".writing", handlerAccessor.getPropertyValue("temporaryFileSuffix"));
assertEquals(Boolean.FALSE, handlerAccessor.getPropertyValue("flushWhenIdle"));
}
use of org.springframework.integration.file.FileWritingMessageHandler in project spring-integration by spring-projects.
the class FileOutboundChannelAdapterParserTests method adapterWithDeleteFlag.
@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"));
}
use of org.springframework.integration.file.FileWritingMessageHandler in project spring-integration by spring-projects.
the class FileOutboundChannelAdapterParserTests method adapterWithFlushing.
@Test
public void adapterWithFlushing() {
DirectFieldAccessor adapterAccessor = new DirectFieldAccessor(adapterWithFlushing);
FileWritingMessageHandler handler = (FileWritingMessageHandler) adapterAccessor.getPropertyValue("handler");
DirectFieldAccessor handlerAccessor = new DirectFieldAccessor(handler);
assertEquals(4096, handlerAccessor.getPropertyValue("bufferSize"));
assertEquals(12345L, handlerAccessor.getPropertyValue("flushInterval"));
assertEquals(FileExistsMode.APPEND_NO_FLUSH, handlerAccessor.getPropertyValue("fileExistsMode"));
assertSame(this.predicate, handlerAccessor.getPropertyValue("flushPredicate"));
}
Aggregations