Search in sources :

Example 6 with FileTransferClient

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

the class FtpCase method testCachedConnection_DisconnectedClient.

@Test
public void testCachedConnection_DisconnectedClient() throws Exception {
    Assume.assumeTrue(areTestsEnabled());
    FileTransferConnection connection = createConnection();
    connection.setCacheConnection(true);
    try {
        start(connection);
        FileTransferClient client = connection.connect(getDestinationString());
        // Should be cached, and equivalent.
        FileTransferClient cached = connection.connect(getDestinationString());
        assertEquals(client, cached);
        client.disconnect();
        // Now it should be a new entry.
        cached = connection.connect(getDestinationString());
        assertNotSame(client, cached);
    } finally {
        stop(connection);
    }
}
Also used : FileTransferClient(com.adaptris.filetransfer.FileTransferClient) Test(org.junit.Test)

Example 7 with FileTransferClient

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

the class FtpCase method testCachedConnection.

@Test
public void testCachedConnection() throws Exception {
    Assume.assumeTrue(areTestsEnabled());
    FileTransferConnection connection = createConnection();
    connection.setCacheConnection(true);
    try {
        start(connection);
        FileTransferClient client = null;
        client = connection.connect(getDestinationString());
        // Should be cached, and equivalent.
        FileTransferClient cached = connection.connect(getDestinationString());
        assertEquals(client, cached);
        FileTransferClient client2 = connection.connect(getDestinationStringWithOverride());
        // Even though it's effectively the same "host", they become different keys.
        assertNotSame(client, client2);
        cached = connection.connect(getDestinationStringWithOverride());
        assertEquals(client2, cached);
    } finally {
        stop(connection);
    }
}
Also used : FileTransferClient(com.adaptris.filetransfer.FileTransferClient) Test(org.junit.Test)

Example 8 with FileTransferClient

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

the class FtpConnectionCase method testCachedConnection_DisconnectedClient.

@Test
public void testCachedConnection_DisconnectedClient() throws Exception {
    Assume.assumeTrue(areTestsEnabled());
    FileTransferConnection connection = createConnection();
    connection.setCacheConnection(true);
    try {
        start(connection);
        FileTransferClient client = connection.connect(getDestinationString());
        // Should be cached, and equivalent.
        FileTransferClient cached = connection.connect(getDestinationString());
        assertEquals(client, cached);
        client.disconnect();
        // Now it should be a new entry.
        cached = connection.connect(getDestinationString());
        assertNotSame(client, cached);
    } finally {
        stop(connection);
    }
}
Also used : FileTransferClient(com.adaptris.filetransfer.FileTransferClient) Test(org.junit.Test)

Example 9 with FileTransferClient

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

the class FtpConnectionCase method testCachedConnection.

@Test
public void testCachedConnection() throws Exception {
    Assume.assumeTrue(areTestsEnabled());
    FileTransferConnection connection = createConnection();
    connection.setCacheConnection(true);
    try {
        start(connection);
        FileTransferClient client = null;
        client = connection.connect(getDestinationString());
        // Should be cached, and equivalent.
        FileTransferClient cached = connection.connect(getDestinationString());
        assertEquals(client, cached);
        FileTransferClient client2 = connection.connect(getDestinationStringWithOverride());
        // Even though it's effectively the same "host", they become different keys.
        assertNotSame(client, client2);
        cached = connection.connect(getDestinationStringWithOverride());
        assertEquals(client2, cached);
    } finally {
        stop(connection);
    }
}
Also used : FileTransferClient(com.adaptris.filetransfer.FileTransferClient) Test(org.junit.Test)

Example 10 with FileTransferClient

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

the class FtpConnectionCase method testConnection_Cached_Disconnect.

@Test
public void testConnection_Cached_Disconnect() throws Exception {
    Assume.assumeTrue(areTestsEnabled());
    FileTransferConnection connection = createConnection();
    connection.setCacheConnection(true);
    try {
        start(connection);
        FileTransferClient client = null;
        client = connection.connect(getDestinationString());
        connection.disconnect(client);
        assertTrue(client.isConnected());
    } 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