Search in sources :

Example 36 with FileTransferClient

use of com.adaptris.filetransfer.FileTransferClient in project interlok by adaptris.

the class StandardSftpConnectionTest method testConnectOnly_Composite.

@Test
public void testConnectOnly_Composite() throws Exception {
    Assume.assumeTrue(areTestsEnabled());
    StandardSftpConnection conn = createConnection();
    try {
        SftpAuthenticationWrapper auth = new SftpAuthenticationWrapper(new SftpKeyAuthentication(PROPERTIES.getProperty(CFG_PRIVATE_KEY_FILE), "PW:abde"), new SftpKeyAuthentication(PROPERTIES.getProperty(CFG_PRIVATE_KEY_FILE), PROPERTIES.getProperty(CFG_PRIVATE_KEY_PW)));
        conn.setAuthentication(auth);
        start(conn);
        FileTransferClient c = conn.connect(getDestinationString());
        assertTrue(c.isConnected());
        c.disconnect();
    } finally {
        stop(conn);
    }
}
Also used : FileTransferClient(com.adaptris.filetransfer.FileTransferClient) Test(org.junit.Test)

Example 37 with FileTransferClient

use of com.adaptris.filetransfer.FileTransferClient in project interlok by adaptris.

the class StandardSftpConnectionTest method testConnectOnly_PasswordAuth.

@Test
public void testConnectOnly_PasswordAuth() throws Exception {
    Assume.assumeTrue(areTestsEnabled());
    StandardSftpConnection conn = createConnection();
    try {
        conn.setAuthentication(new SftpPasswordAuthentication(PROPERTIES.getProperty(CFG_PASSWORD)));
        start(conn);
        FileTransferClient c = conn.connect(getDestinationString());
        assertTrue(c.isConnected());
        c.disconnect();
    } finally {
        stop(conn);
    }
}
Also used : FileTransferClient(com.adaptris.filetransfer.FileTransferClient) Test(org.junit.Test)

Example 38 with FileTransferClient

use of com.adaptris.filetransfer.FileTransferClient in project interlok by adaptris.

the class StandardSftpConnectionTest method testConnectOnly_KeyAuth.

@Test
public void testConnectOnly_KeyAuth() throws Exception {
    Assume.assumeTrue(areTestsEnabled());
    StandardSftpConnection conn = createConnection();
    try {
        start(conn);
        FileTransferClient c = conn.connect(getDestinationString());
        assertTrue(c.isConnected());
        c.disconnect();
    } finally {
        stop(conn);
    }
}
Also used : FileTransferClient(com.adaptris.filetransfer.FileTransferClient) Test(org.junit.Test)

Example 39 with FileTransferClient

use of com.adaptris.filetransfer.FileTransferClient in project interlok by adaptris.

the class FtpPasswordConnectionCase method testConnect_EncodedPassword.

@Test
public void testConnect_EncodedPassword() throws Exception {
    Assume.assumeTrue(areTestsEnabled());
    FileTransferConnectionUsingPassword connection = (FileTransferConnectionUsingPassword) createConnection();
    String ensureEncodedPassword = Password.encode(Password.decode(connection.getDefaultPassword()), Password.PORTABLE_PASSWORD);
    connection.setDefaultPassword(ensureEncodedPassword);
    try {
        start(connection);
        FileTransferClient client = connection.connect(getDestinationString());
    } finally {
        stop(connection);
    }
}
Also used : FileTransferClient(com.adaptris.filetransfer.FileTransferClient) Test(org.junit.Test)

Aggregations

FileTransferClient (com.adaptris.filetransfer.FileTransferClient)39 Test (org.junit.Test)30 File (java.io.File)4 IOException (java.io.IOException)4 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)3 PasswordException (com.adaptris.security.exc.PasswordException)3 CoreException (com.adaptris.core.CoreException)2 ProduceException (com.adaptris.core.ProduceException)2 CommonsNetFtpClient (com.adaptris.ftp.CommonsNetFtpClient)2 InputStream (java.io.InputStream)2 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 After (org.junit.After)2 InputFieldHint (com.adaptris.annotation.InputFieldHint)1 FileNameCreator (com.adaptris.core.FileNameCreator)1 ServiceException (com.adaptris.core.ServiceException)1 FileTransferException (com.adaptris.filetransfer.FileTransferException)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 Random (java.util.Random)1