use of com.adaptris.filetransfer.FileTransferClient in project interlok by adaptris.
the class FtpConnectionTest method testConnect_WithAccount.
@Test
public void testConnect_WithAccount() throws Exception {
Assume.assumeTrue(areTestsEnabled());
FtpConnectionImp connection = createConnection();
connection.setDefaultAccount(getName());
try {
start(connection);
FileTransferClient client = connection.connect(getDestinationString());
} finally {
stop(connection);
}
}
use of com.adaptris.filetransfer.FileTransferClient in project interlok by adaptris.
the class FtpCase method tearDown.
@After
public void tearDown() throws Exception {
if (areTestsEnabled()) {
FileTransferClient client = connectRawClient();
cleanup(client, getRemoteDirectory() + DEFAULT_WORK_DIR);
cleanup(client, getRemoteDirectory() + DEFAULT_BUILD_DIR);
client.disconnect();
}
}
use of com.adaptris.filetransfer.FileTransferClient in project interlok by adaptris.
the class FtpConnectionCase method testCachedConnection_ExceedsMaxSize.
@Test
public void testCachedConnection_ExceedsMaxSize() throws Exception {
Assume.assumeTrue(areTestsEnabled());
FileTransferConnection connection = createConnection();
connection.setCacheConnection(true);
connection.setMaxClientCache(1);
try {
start(connection);
FileTransferClient client = connection.connect(getDestinationString());
// Should be cached, and equivalent.
FileTransferClient cached = connection.connect(getDestinationString());
assertEquals(client, cached);
FileTransferClient client2 = connection.connect(getDestinationStringWithOverride());
// This should have emptied the cache (and disconnected client1)...
cached = connection.connect(getDestinationString());
assertNotSame(client, cached);
assertFalse(client.isConnected());
} finally {
stop(connection);
}
}
use of com.adaptris.filetransfer.FileTransferClient in project interlok by adaptris.
the class FtpConnectionCase method testConnection_NoCache_Disconnect.
@Test
public void testConnection_NoCache_Disconnect() throws Exception {
Assume.assumeTrue(areTestsEnabled());
FileTransferConnection connection = createConnection();
connection.setCacheConnection(false);
try {
start(connection);
FileTransferClient client = null;
client = connection.connect(getDestinationString());
connection.disconnect(client);
assertFalse(client.isConnected());
} finally {
stop(connection);
}
}
use of com.adaptris.filetransfer.FileTransferClient in project interlok by adaptris.
the class FileTransferConnection method create.
private FileTransferClient create(String hostUrl) throws FileTransferException, IOException, PasswordException {
String remoteHost = hostUrl;
UserInfo ui = createUserInfo();
int port = defaultControlPort();
try {
URI uri = new URI(hostUrl);
if (acceptProtocol(uri.getScheme())) {
remoteHost = uri.getHost();
port = uri.getPort() != -1 ? uri.getPort() : defaultControlPort();
ui.parse(uri.getRawUserInfo());
}
} catch (URISyntaxException e) {
;
}
FileTransferClient client = create(remoteHost, port, ui);
return client;
}
Aggregations