/** * Verifies that coping file from remote machine to local machine works as expected. Depends on * {@link #testCopyFileFromServerToRemoteClient()} */ public void testCopyFileFromRemoteClientToServer() throws Exception { File f = new File(ftpServer.getDefaultUserHomeDirectory(), "FTPRemoteClientTest3.class"); f.delete(); assertTrue(!f.exists()); ftpRemoteClient.copyFileFromRemoteClientToLocalMachine( ".\\FTPRemoteClientTest2.class", "FTPRemoteClientTest3.class"); assertTrue(f.exists()); assertTrue(f.delete()); ftpRemoteClient.closeFTPSession(); }
public void testCopyFileFromServerToRemoteClient() throws Exception { URL url = getClass().getResource("FTPRemoteClientTest.class"); FileUtils.copyURLToFile( url, new File(ftpServer.getDefaultUserHomeDirectory(), "FTPRemoteClientTest.class")); ftpRemoteClient.copyFileFromLocalMachineToRemoteClient( "FTPRemoteClientTest.class", "./FTPRemoteClientTest2.class"); }
public void testCopyFileFromServerToRemoteClientWithJsystemProperties() throws Exception { URL url = getClass().getResource("FTPRemoteClientTest.class"); FileUtils.copyURLToFile( url, new File(ftpServer.getDefaultUserHomeDirectory(), "FTPRemoteClientTest.class")); String ftpServer = ftpRemoteClient.getFtpServerHostName(); try { JSystemProperties.getInstance() .setPreference(FTPRemoteClient.LOCAL_HOST_ADDRESS_PROPERTY, "128.0.0.1"); ftpRemoteClient.copyFileFromLocalMachineToRemoteClient( "FTPRemoteClientTest.class", "./FTPRemoteClientTest2.class"); assertTrue(false); } catch (Exception e) { // good } finally { ftpRemoteClient.setFtpServerHostName(ftpServer); JSystemProperties.getInstance() .setPreference(FTPRemoteClient.LOCAL_HOST_ADDRESS_PROPERTY, ""); } }
public void tearDown() throws Exception { ftpRemoteClient.closeFTPSession(); }