Class FtpdContainer
- java.lang.Object
-
- org.jenkinsci.test.acceptance.docker.DockerContainer
-
- org.jenkinsci.test.acceptance.docker.fixtures.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 fixturevoid
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 serverString
getUsername()
Gets the username of the ftp user on the docker serverBoolean
pathExist(String Path)
Checks if a Path exist on the docker ftp servervoid
uploadBinary(String localPath, String remotePath)
Connects to the ftp server and uploads one File from the localPath to the remote Path.
-
-
-
Method Detail
-
getPassword
public String getPassword()
Gets the ftp password of the ftp user on the docker server- Specified by:
getPassword
in interfaceIPasswordDockerContainer
- Returns:
- ftp password
-
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
-
getUsername
public String getUsername()
Gets the username of the ftp user on the docker server- Specified by:
getUsername
in interfaceIPasswordDockerContainer
- Returns:
- ftp username
-
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 transferremotePath
- 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
-
-