Example usage for org.apache.commons.net.ftp FTPSClient rename

List of usage examples for org.apache.commons.net.ftp FTPSClient rename

Introduction

In this page you can find the example usage for org.apache.commons.net.ftp FTPSClient rename.

Prototype

public boolean rename(String from, String to) throws IOException 

Source Link

Document

Renames a remote file.

Usage

From source file:ddf.test.itests.catalog.TestFtp.java

/**
 * Test the ftp command sequence of uploading a dot-file (i.e. .foo) and then renaming that file
 * to the final filename (i.e. test.txt). Confirm that the catalog contains only one object and
 * the title of that object is "test.txt".
 *//*  w ww.j  a va  2s . c  o m*/
@Test
public void testFtpsPutDotFile() throws Exception {

    setClientAuthConfiguration(NEED);
    FTPSClient client = createSecureClient(true);

    String dotFilename = ".foo";
    String finalFilename = "test.txt";

    ftpPut(client, SAMPLE_DATA, dotFilename);
    boolean ret = client.rename(dotFilename, finalFilename);
    assertTrue(ret);

    verifyIngest(1, finalFilename);
}