Example usage for org.springframework.integration.file.remote FileInfo getFilename

List of usage examples for org.springframework.integration.file.remote FileInfo getFilename

Introduction

In this page you can find the example usage for org.springframework.integration.file.remote FileInfo getFilename.

Prototype

String getFilename();

Source Link

Usage

From source file:org.springframework.integration.ftp.outbound.FtpOutboundTests.java

@Test //INT-2275
public void testFtpOutboundGatewayInsideChain() throws Exception {
    ApplicationContext context = new ClassPathXmlApplicationContext("FtpOutboundInsideChainTests-context.xml",
            getClass());//from ww w .  j  ava 2 s  .  co  m

    MessageChannel channel = context.getBean("ftpOutboundGatewayInsideChain", MessageChannel.class);

    channel.send(MessageBuilder.withPayload("remote-test-dir").build());

    PollableChannel output = context.getBean("output", PollableChannel.class);

    Message<?> result = output.receive();
    Object payload = result.getPayload();
    assertTrue(payload instanceof List<?>);
    @SuppressWarnings("unchecked")
    List<? extends FileInfo<?>> remoteFiles = (List<? extends FileInfo<?>>) payload;
    assertEquals(3, remoteFiles.size());
    List<String> files = Arrays.asList(new File("remote-test-dir").list());
    for (FileInfo<?> remoteFile : remoteFiles) {
        assertTrue(files.contains(remoteFile.getFilename()));
    }
}