Search in sources :

Example 1 with FtpServer

use of org.h2.dev.ftp.server.FtpServer in project h2database by h2database.

the class TestFtp method test.

private void test(String dir) throws Exception {
    Server server = FtpServer.createFtpServer("-ftpDir", dir, "-ftpPort", "8121").start();
    FtpServer ftp = (FtpServer) server.getService();
    ftp.setEventListener(this);
    FtpClient client = FtpClient.open("localhost:8121");
    client.login("sa", "sa");
    client.makeDirectory("ftp");
    client.changeWorkingDirectory("ftp");
    assertEquals("CWD", lastEvent.getCommand());
    client.makeDirectory("hello");
    client.changeWorkingDirectory("hello");
    client.changeDirectoryUp();
    assertEquals("CDUP", lastEvent.getCommand());
    client.nameList("hello");
    client.removeDirectory("hello");
    client.close();
    server.stop();
}
Also used : Server(org.h2.tools.Server) FtpServer(org.h2.dev.ftp.server.FtpServer) FtpServer(org.h2.dev.ftp.server.FtpServer) FtpClient(org.h2.dev.ftp.FtpClient)

Aggregations

FtpClient (org.h2.dev.ftp.FtpClient)1 FtpServer (org.h2.dev.ftp.server.FtpServer)1 Server (org.h2.tools.Server)1