Exemplo n.º 1
0
 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");
 }
Exemplo n.º 2
0
 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, "");
   }
 }