Search in sources :

Example 6 with NativeFileSystemFactory

use of org.apache.ftpserver.filesystem.nativefs.NativeFileSystemFactory in project camel by apache.

the class SpringFtpEndpointTest method initFtpServer.

protected void initFtpServer() throws Exception {
    FtpServerFactory serverFactory = new FtpServerFactory();
    // setup user management to read our users.properties and use clear text passwords
    File file = new File("src/test/resources/users.properties");
    UserManager uman = new PropertiesUserManager(new ClearTextPasswordEncryptor(), file, "admin");
    serverFactory.setUserManager(uman);
    NativeFileSystemFactory fsf = new NativeFileSystemFactory();
    fsf.setCreateHome(true);
    serverFactory.setFileSystem(fsf);
    ListenerFactory factory = new ListenerFactory();
    factory.setPort(ftpPort);
    serverFactory.addListener("default", factory.createListener());
    ftpServer = serverFactory.createServer();
}
Also used : FtpServerFactory(org.apache.ftpserver.FtpServerFactory) PropertiesUserManager(org.apache.ftpserver.usermanager.impl.PropertiesUserManager) UserManager(org.apache.ftpserver.ftplet.UserManager) NativeFileSystemFactory(org.apache.ftpserver.filesystem.nativefs.NativeFileSystemFactory) File(java.io.File) PropertiesUserManager(org.apache.ftpserver.usermanager.impl.PropertiesUserManager) ClearTextPasswordEncryptor(org.apache.ftpserver.usermanager.ClearTextPasswordEncryptor) ListenerFactory(org.apache.ftpserver.listener.ListenerFactory)

Example 7 with NativeFileSystemFactory

use of org.apache.ftpserver.filesystem.nativefs.NativeFileSystemFactory 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

FtpServerFactory (org.apache.ftpserver.FtpServerFactory)7 NativeFileSystemFactory (org.apache.ftpserver.filesystem.nativefs.NativeFileSystemFactory)7 UserManager (org.apache.ftpserver.ftplet.UserManager)7 ListenerFactory (org.apache.ftpserver.listener.ListenerFactory)7 ClearTextPasswordEncryptor (org.apache.ftpserver.usermanager.ClearTextPasswordEncryptor)7 File (java.io.File)6 PropertiesUserManager (org.apache.ftpserver.usermanager.impl.PropertiesUserManager)5 PropertiesUserManagerFactory (org.apache.ftpserver.usermanager.PropertiesUserManagerFactory)2 ChannelSftp (com.jcraft.jsch.ChannelSftp)1 JSch (com.jcraft.jsch.JSch)1 Session (com.jcraft.jsch.Session)1 ConnectionConfigFactory (org.apache.ftpserver.ConnectionConfigFactory)1 SslConfigurationFactory (org.apache.ftpserver.ssl.SslConfigurationFactory)1 SshServer (org.apache.sshd.SshServer)1 NamedFactory (org.apache.sshd.common.NamedFactory)1 Command (org.apache.sshd.server.Command)1 ScpCommandFactory (org.apache.sshd.server.command.ScpCommandFactory)1 ServerSession (org.apache.sshd.server.session.ServerSession)1 BeforeClass (org.junit.BeforeClass)1