Search in sources :

Example 1 with ConnectionConfigFactory

use of org.apache.ftpserver.ConnectionConfigFactory in project camel by apache.

the class FtpServerTestSupport method createFtpServerFactory.

protected FtpServerFactory createFtpServerFactory() throws Exception {
    assertTrue(USERS_FILE.exists());
    assertTrue("Port number is not initialized in an expected range: " + BaseServerTestSupport.port, BaseServerTestSupport.port >= 21000);
    NativeFileSystemFactory fsf = new NativeFileSystemFactory();
    fsf.setCreateHome(true);
    PropertiesUserManagerFactory pumf = new PropertiesUserManagerFactory();
    pumf.setAdminName("admin");
    pumf.setPasswordEncryptor(new ClearTextPasswordEncryptor());
    pumf.setFile(USERS_FILE);
    UserManager userMgr = pumf.createUserManager();
    ListenerFactory factory = new ListenerFactory();
    factory.setPort(BaseServerTestSupport.port);
    FtpServerFactory serverFactory = new FtpServerFactory();
    serverFactory.setUserManager(userMgr);
    serverFactory.setFileSystem(fsf);
    serverFactory.setConnectionConfig(new ConnectionConfigFactory().createConnectionConfig());
    serverFactory.addListener(DEFAULT_LISTENER, factory.createListener());
    return serverFactory;
}
Also used : UserManager(org.apache.ftpserver.ftplet.UserManager) FtpServerFactory(org.apache.ftpserver.FtpServerFactory) PropertiesUserManagerFactory(org.apache.ftpserver.usermanager.PropertiesUserManagerFactory) NativeFileSystemFactory(org.apache.ftpserver.filesystem.nativefs.NativeFileSystemFactory) ConnectionConfigFactory(org.apache.ftpserver.ConnectionConfigFactory) ClearTextPasswordEncryptor(org.apache.ftpserver.usermanager.ClearTextPasswordEncryptor) ListenerFactory(org.apache.ftpserver.listener.ListenerFactory)

Aggregations

ConnectionConfigFactory (org.apache.ftpserver.ConnectionConfigFactory)1 FtpServerFactory (org.apache.ftpserver.FtpServerFactory)1 NativeFileSystemFactory (org.apache.ftpserver.filesystem.nativefs.NativeFileSystemFactory)1 UserManager (org.apache.ftpserver.ftplet.UserManager)1 ListenerFactory (org.apache.ftpserver.listener.ListenerFactory)1 ClearTextPasswordEncryptor (org.apache.ftpserver.usermanager.ClearTextPasswordEncryptor)1 PropertiesUserManagerFactory (org.apache.ftpserver.usermanager.PropertiesUserManagerFactory)1