Search in sources :

Example 1 with Reply

use of org.ftp4che.reply.Reply in project pentaho-kettle by pentaho.

the class FTPSConnectionTest method testEnforceProtPOnPut.

@Test
public void testEnforceProtPOnPut() throws Exception {
    FileObject file = KettleVFS.createTempFile("FTPSConnectionTest_testEnforceProtPOnPut", KettleVFS.Suffix.TMP);
    file.createFile();
    try {
        FTPSTestConnection connection = spy(new FTPSTestConnection(FTPSConnection.CONNECTION_TYPE_FTP_IMPLICIT_TLS_WITH_CRYPTED, "the.perfect.host", 2010, "warwickw", "julia", null));
        connection.replies.put("PWD", new Reply(Arrays.asList("257 \"/la\" is current directory")));
        connection.connect();
        connection.uploadFile(file.getPublicURIString(), "uploaded-file");
        assertEquals("buffer not set", "PBSZ 0\r\n", connection.commands.get(0).toString());
        assertEquals("data privacy not set", "PROT P\r\n", connection.commands.get(1).toString());
    } finally {
        file.delete();
    }
}
Also used : Reply(org.ftp4che.reply.Reply) FileObject(org.apache.commons.vfs2.FileObject) Test(org.junit.Test)

Example 2 with Reply

use of org.ftp4che.reply.Reply in project pentaho-kettle by pentaho.

the class FTPSConnectionTest method testEnforceProtP.

@Test
public void testEnforceProtP() throws Exception {
    FTPSTestConnection connection = spy(new FTPSTestConnection(FTPSConnection.CONNECTION_TYPE_FTP_IMPLICIT_TLS_WITH_CRYPTED, "the.perfect.host", 2010, "warwickw", "julia", null));
    connection.replies.put("PWD", new Reply(Arrays.asList("257 \"/la\" is current directory")));
    connection.connect();
    connection.getFileNames();
    assertEquals("buffer not set", "PBSZ 0\r\n", connection.commands.get(1).toString());
    assertEquals("data privacy not set", "PROT P\r\n", connection.commands.get(2).toString());
}
Also used : Reply(org.ftp4che.reply.Reply) Test(org.junit.Test)

Aggregations

Reply (org.ftp4che.reply.Reply)2 Test (org.junit.Test)2 FileObject (org.apache.commons.vfs2.FileObject)1