Class FtpdContainer

  • All Implemented Interfaces:
    Closeable, AutoCloseable, IPasswordDockerContainer

    public class FtpdContainer
    extends org.jenkinsci.test.acceptance.docker.DockerContainer
    implements IPasswordDockerContainer
    Represents a server with FTPD. Uses FtpClient to allow easy acces to files. It is assumed that the ftpd server of the docker fixture is configured using passive connection and the ports 21,7050,...,7055
    Author:
    Tobias Meyer
    • Constructor Summary

      Constructors 
      Constructor Description
      FtpdContainer()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Boolean ftpConnect()
      Establish a ftp connection to the ftp server running on the docker fixture
      void ftpDisconnect()
      If the internal ftp client is connected to ftp server on the docker fixture, disconnects.
      String getPassword()
      Gets the ftp password of the ftp user on the docker server
      String getUsername()
      Gets the username of the ftp user on the docker server
      Boolean pathExist​(String Path)
      Checks if a Path exist on the docker ftp server
      void uploadBinary​(String localPath, String remotePath)
      Connects to the ftp server and uploads one File from the localPath to the remote Path.
      • Methods inherited from class org.jenkinsci.test.acceptance.docker.DockerContainer

        assertRunning, close, cp, getCid, getIpAddress, getLogfile, getPid, inspect, ipBound, ipUdpBound, ipv6Enabled, port, resource, sharingHostDockerService, toString, udpPort
    • Constructor Detail

      • FtpdContainer

        public FtpdContainer()
    • Method Detail

      • ftpDisconnect

        public void ftpDisconnect()
        If the internal ftp client is connected to ftp server on the docker fixture, disconnects.
      • ftpConnect

        public Boolean ftpConnect()
        Establish a ftp connection to the ftp server running on the docker fixture
        Returns:
        true if connection is okay, false if failed
      • uploadBinary

        public void uploadBinary​(String localPath,
                                 String remotePath)
                          throws IOException
        Connects to the ftp server and uploads one File from the localPath to the remote Path. The binary Transfer mode is used. After the transfer is finished the client disconnects from the server.
        Parameters:
        localPath - The file to transfer
        remotePath - The remote path
        Throws:
        IOException
      • pathExist

        public Boolean pathExist​(String Path)
                          throws IOException
        Checks if a Path exist on the docker ftp server
        Parameters:
        Path - the Path to check
        Returns:
        true if the Path exist, else false
        Throws:
        IOException