Search in sources :

Example 1 with FtpServerFactory

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

the class FtpAndHttpRecipientListInterceptSendToEndpointIssueTest 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 2 with FtpServerFactory

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

the class FtpXQueryTest 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 3 with FtpServerFactory

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

the class SpringFileAntPathMatcherRemoteFileFilterTest 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 4 with FtpServerFactory

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

the class FtpCronScheduledRoutePolicyTest 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(20128);
    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 5 with FtpServerFactory

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

the class FtpServerTestSupport method setUp.

@Override
@Before
public void setUp() throws Exception {
    deleteDirectory(FTP_ROOT_DIR);
    canTest = false;
    FtpServerFactory factory = createFtpServerFactory();
    if (factory != null) {
        ftpServer = factory.createServer();
        if (ftpServer != null) {
            ftpServer.start();
            canTest = true;
        }
    }
    try {
        super.setUp();
    } catch (Exception e) {
        // ignore if algorithm is not on the OS
        NoSuchAlgorithmException nsae = ObjectHelper.getException(NoSuchAlgorithmException.class, e);
        if (nsae != null) {
            canTest = false;
            String name = System.getProperty("os.name");
            String message = nsae.getMessage();
            log.warn("SunX509 is not avail on this platform [{}] Testing is skipped! Real cause: {}", name, message);
        } else {
            // some other error then throw it so the test can fail
            throw e;
        }
    }
}
Also used : FtpServerFactory(org.apache.ftpserver.FtpServerFactory) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) Before(org.junit.Before)

Aggregations

FtpServerFactory (org.apache.ftpserver.FtpServerFactory)22 ListenerFactory (org.apache.ftpserver.listener.ListenerFactory)20 UserManager (org.apache.ftpserver.ftplet.UserManager)13 File (java.io.File)11 NativeFileSystemFactory (org.apache.ftpserver.filesystem.nativefs.NativeFileSystemFactory)8 ClearTextPasswordEncryptor (org.apache.ftpserver.usermanager.ClearTextPasswordEncryptor)8 BaseUser (org.apache.ftpserver.usermanager.impl.BaseUser)7 PropertiesUserManagerFactory (org.apache.ftpserver.usermanager.PropertiesUserManagerFactory)6 ConnectionConfigFactory (org.apache.ftpserver.ConnectionConfigFactory)5 PropertiesUserManager (org.apache.ftpserver.usermanager.impl.PropertiesUserManager)5 WritePermission (org.apache.ftpserver.usermanager.impl.WritePermission)5 ArrayList (java.util.ArrayList)4 Authority (org.apache.ftpserver.ftplet.Authority)4 SslConfigurationFactory (org.apache.ftpserver.ssl.SslConfigurationFactory)4 IOException (java.io.IOException)3 FtpException (org.apache.ftpserver.ftplet.FtpException)3 Listener (org.apache.ftpserver.listener.Listener)3 Before (org.junit.Before)3 BeforeClass (org.junit.BeforeClass)3 FtpServer (org.apache.ftpserver.FtpServer)2