use of org.springframework.integration.file.FileWritingMessageHandler in project spring-integration by spring-projects.
the class AutoCreateDirectoryIntegrationTests method customOutboundGateway.
@Test
public void customOutboundGateway() throws Exception {
Object gateway = context.getBean("customOutboundGateway");
DirectFieldAccessor gatewayAccessor = new DirectFieldAccessor(gateway);
FileWritingMessageHandler handler = (FileWritingMessageHandler) gatewayAccessor.getPropertyValue("handler");
assertTrue(new File(BASE_PATH + File.separator + "customOutboundGateway").exists());
assertEquals(Boolean.FALSE, new DirectFieldAccessor(handler).getPropertyValue("autoCreateDirectory"));
}
use of org.springframework.integration.file.FileWritingMessageHandler in project spring-integration by spring-projects.
the class AutoCreateDirectoryIntegrationTests method customOutbound.
@Test
public void customOutbound() throws Exception {
Object adapter = context.getBean("customOutbound");
DirectFieldAccessor adapterAccessor = new DirectFieldAccessor(adapter);
FileWritingMessageHandler handler = (FileWritingMessageHandler) adapterAccessor.getPropertyValue("handler");
assertTrue(new File(BASE_PATH + File.separator + "customOutbound").exists());
assertEquals(Boolean.FALSE, new DirectFieldAccessor(handler).getPropertyValue("autoCreateDirectory"));
}
use of org.springframework.integration.file.FileWritingMessageHandler in project spring-integration by spring-projects.
the class AutoCreateDirectoryIntegrationTests method defaultOutbound.
@Test
public void defaultOutbound() throws Exception {
Object adapter = context.getBean("defaultOutbound");
DirectFieldAccessor adapterAccessor = new DirectFieldAccessor(adapter);
FileWritingMessageHandler handler = (FileWritingMessageHandler) adapterAccessor.getPropertyValue("handler");
assertEquals(Boolean.TRUE, new DirectFieldAccessor(handler).getPropertyValue("autoCreateDirectory"));
assertTrue(new File(BASE_PATH + File.separator + "defaultOutbound").exists());
}
use of org.springframework.integration.file.FileWritingMessageHandler in project spring-integration by spring-projects.
the class FileOutboundChannelAdapterParserTests method adapterWithCharset.
@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"));
}
use of org.springframework.integration.file.FileWritingMessageHandler in project spring-integration by spring-projects.
the class FileOutboundChannelAdapterParserTests method simpleAdapter.
@Test
public void simpleAdapter() {
DirectFieldAccessor adapterAccessor = new DirectFieldAccessor(simpleAdapter);
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(".foo", TestUtils.getPropertyValue(handler, "temporaryFileSuffix", String.class));
assertThat(actual, is(expected));
DefaultFileNameGenerator fileNameGenerator = (DefaultFileNameGenerator) handlerAccessor.getPropertyValue("fileNameGenerator");
assertNotNull(fileNameGenerator);
Expression expression = TestUtils.getPropertyValue(fileNameGenerator, "expression", Expression.class);
assertNotNull(expression);
assertEquals("'foo.txt'", expression.getExpressionString());
assertEquals(Boolean.FALSE, handlerAccessor.getPropertyValue("deleteSourceFiles"));
assertEquals(Boolean.TRUE, handlerAccessor.getPropertyValue("flushWhenIdle"));
if (FileUtils.IS_POSIX) {
assertThat(TestUtils.getPropertyValue(handler, "permissions", Set.class).size(), equalTo(9));
}
assertEquals(Boolean.TRUE, handlerAccessor.getPropertyValue("preserveTimestamp"));
}
Aggregations