FTPTest.java 908 Bytes
Newer Older
eddie.woo's avatar
eddie.woo committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
package pwc.taxtech.atms.common;

import org.apache.commons.net.ftp.FTPClient;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import pwc.taxtech.atms.CommonIT;
import pwc.taxtech.atms.common.ftp.FTPClientPool;

import java.io.File;
import java.io.FileInputStream;

public class FTPTest extends CommonIT {
    @Autowired
    FTPClientPool ftpClientPool;

    @Test
    public void test(){
        try {
            FTPClient client = ftpClientPool.getClient();
            client.listFiles("hhhhh/sss/ccc");
            client.makeDirectory("hhhhh/sss/ccc");
            client.changeWorkingDirectory("hhhhh/sss/ccc");
            client.storeFile("./aa/bb/cc/dd/text.txt",new FileInputStream(new File("C:\\temp/Fixed.txt")));
            System.out.println(client.listFiles().length);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}