Example usage for org.springframework.integration.sftp.session SftpRemoteFileTemplate SftpRemoteFileTemplate

List of usage examples for org.springframework.integration.sftp.session SftpRemoteFileTemplate SftpRemoteFileTemplate

Introduction

In this page you can find the example usage for org.springframework.integration.sftp.session SftpRemoteFileTemplate SftpRemoteFileTemplate.

Prototype

public SftpRemoteFileTemplate(SessionFactory<LsEntry> sessionFactory) 

Source Link

Usage

From source file:org.springframework.integration.sftp.outbound.SftpServerOutboundTests.java

@Test
public void testInt3412FileMode() {
    Message<String> m = MessageBuilder.withPayload("foo").setHeader(FileHeaders.FILENAME, "appending.txt")
            .build();// w w  w.  j  a v a2  s. c  o  m
    appending.send(m);
    appending.send(m);

    SftpRemoteFileTemplate template = new SftpRemoteFileTemplate(sessionFactory);
    assertLength6(template);

    ignoring.send(m);
    assertLength6(template);
    try {
        failing.send(m);
        fail("Expected exception");
    } catch (MessagingException e) {
        assertThat(e.getCause().getCause().getMessage(), containsString("The destination file already exists"));
    }

}