use of org.springframework.integration.sftp.gateway.SftpOutboundGateway in project spring-integration by spring-projects.
the class SftpOutboundGatewayParserTests method advised.
@Test
public void advised() {
SftpOutboundGateway gateway = TestUtils.getPropertyValue(advised, "handler", SftpOutboundGateway.class);
gateway.handleMessage(new GenericMessage<String>("foo"));
assertEquals(1, adviceCalled);
}
use of org.springframework.integration.sftp.gateway.SftpOutboundGateway in project spring-integration by spring-projects.
the class SftpOutboundGatewayParserTests method testGatewayMv.
@Test
public void testGatewayMv() {
SftpOutboundGateway gateway = TestUtils.getPropertyValue(gateway3, "handler", SftpOutboundGateway.class);
assertNotNull(TestUtils.getPropertyValue(gateway, "remoteFileTemplate.sessionFactory"));
assertNotNull(TestUtils.getPropertyValue(gateway, "outputChannel"));
assertEquals(Command.MV, TestUtils.getPropertyValue(gateway, "command"));
assertEquals("'foo'", TestUtils.getPropertyValue(gateway, "renameProcessor.expression.expression"));
}
use of org.springframework.integration.sftp.gateway.SftpOutboundGateway in project spring-integration by spring-projects.
the class SftpOutboundGatewayParserTests method testGateway1.
@Test
public void testGateway1() {
SftpOutboundGateway gateway = TestUtils.getPropertyValue(gateway1, "handler", SftpOutboundGateway.class);
assertEquals("X", TestUtils.getPropertyValue(gateway, "remoteFileTemplate.remoteFileSeparator"));
assertNotNull(TestUtils.getPropertyValue(gateway, "remoteFileTemplate.sessionFactory"));
assertNotNull(TestUtils.getPropertyValue(gateway, "outputChannel"));
assertEquals("local-test-dir", TestUtils.getPropertyValue(gateway, "localDirectoryExpression.literalValue"));
assertFalse((Boolean) TestUtils.getPropertyValue(gateway, "autoCreateLocalDirectory"));
assertTrue(TestUtils.getPropertyValue(gateway, "requiresReply", Boolean.class));
assertNotNull(TestUtils.getPropertyValue(gateway, "filter"));
assertEquals(Command.LS, TestUtils.getPropertyValue(gateway, "command"));
@SuppressWarnings("unchecked") Set<Option> options = TestUtils.getPropertyValue(gateway, "options", Set.class);
assertTrue(options.contains(Option.NAME_ONLY));
assertTrue(options.contains(Option.NOSORT));
Long sendTimeout = TestUtils.getPropertyValue(gateway, "messagingTemplate.sendTimeout", Long.class);
assertEquals(Long.valueOf(777), sendTimeout);
assertThat(TestUtils.getPropertyValue(gateway, "mputFilter"), Matchers.instanceOf(RegexPatternFileListFilter.class));
}
use of org.springframework.integration.sftp.gateway.SftpOutboundGateway in project spring-integration by spring-projects.
the class SftpOutboundGatewayParserTests method testGateway2.
@Test
public void testGateway2() throws Exception {
SftpOutboundGateway gateway = TestUtils.getPropertyValue(gateway2, "handler", SftpOutboundGateway.class);
assertEquals("X", TestUtils.getPropertyValue(gateway, "remoteFileTemplate.remoteFileSeparator"));
assertNotNull(TestUtils.getPropertyValue(gateway, "remoteFileTemplate.sessionFactory"));
assertTrue(TestUtils.getPropertyValue(gateway, "remoteFileTemplate.sessionFactory") instanceof CachingSessionFactory);
assertNotNull(TestUtils.getPropertyValue(gateway, "outputChannel"));
assertEquals("local-test-dir", TestUtils.getPropertyValue(gateway, "localDirectoryExpression.literalValue"));
assertFalse((Boolean) TestUtils.getPropertyValue(gateway, "autoCreateLocalDirectory"));
assertEquals(Command.GET, TestUtils.getPropertyValue(gateway, "command"));
assertFalse(TestUtils.getPropertyValue(gateway, "requiresReply", Boolean.class));
@SuppressWarnings("unchecked") Set<String> options = TestUtils.getPropertyValue(gateway, "options", Set.class);
assertTrue(options.contains(Option.PRESERVE_TIMESTAMP));
// INT-3129
assertNotNull(TestUtils.getPropertyValue(gateway, "localFilenameGeneratorExpression"));
final AtomicReference<Method> genMethod = new AtomicReference<Method>();
ReflectionUtils.doWithMethods(SftpOutboundGateway.class, method -> {
method.setAccessible(true);
genMethod.set(method);
}, method -> "generateLocalFileName".equals(method.getName()));
assertEquals("FOO.afoo", genMethod.get().invoke(gateway, new GenericMessage<String>(""), "foo"));
assertThat(TestUtils.getPropertyValue(gateway, "mputFilter"), Matchers.instanceOf(SimplePatternFileListFilter.class));
}
use of org.springframework.integration.sftp.gateway.SftpOutboundGateway in project spring-integration by spring-projects.
the class SftpOutboundGatewayParserTests method testGatewayMPut.
@Test
public void testGatewayMPut() {
SftpOutboundGateway gateway = TestUtils.getPropertyValue(gateway4, "handler", SftpOutboundGateway.class);
assertNotNull(TestUtils.getPropertyValue(gateway, "remoteFileTemplate.sessionFactory"));
assertNotNull(TestUtils.getPropertyValue(gateway, "outputChannel"));
assertEquals(Command.MPUT, TestUtils.getPropertyValue(gateway, "command"));
assertEquals("'foo'", TestUtils.getPropertyValue(gateway, "renameProcessor.expression.expression"));
assertThat(TestUtils.getPropertyValue(gateway, "mputFilter"), Matchers.instanceOf(RegexPatternFileListFilter.class));
assertSame(generator, TestUtils.getPropertyValue(gateway, "remoteFileTemplate.fileNameGenerator"));
assertEquals("/foo", TestUtils.getPropertyValue(gateway, "remoteFileTemplate.directoryExpressionProcessor.expression", Expression.class).getExpressionString());
assertEquals("/bar", TestUtils.getPropertyValue(gateway, "remoteFileTemplate.temporaryDirectoryExpressionProcessor.expression", Expression.class).getExpressionString());
}
Aggregations