Package com.consol.citrus.ftp.client
Class SftpClient
- java.lang.Object
-
- com.consol.citrus.endpoint.AbstractEndpoint
-
- com.consol.citrus.ftp.client.FtpClient
-
- com.consol.citrus.ftp.client.SftpClient
-
- All Implemented Interfaces:
com.consol.citrus.common.InitializingPhase,com.consol.citrus.common.Named,com.consol.citrus.common.ShutdownPhase,com.consol.citrus.endpoint.Endpoint,com.consol.citrus.messaging.Consumer,com.consol.citrus.messaging.Producer,com.consol.citrus.messaging.ReplyConsumer,com.consol.citrus.messaging.SelectiveConsumer
- Direct Known Subclasses:
ScpClient
public class SftpClient extends FtpClient
- Since:
- 2.7.5
- Author:
- Christoph Deppisch
-
-
Constructor Summary
Constructors Modifier Constructor Description SftpClient()Default constructor initializing endpoint configuration.protectedSftpClient(SftpEndpointConfiguration endpointConfiguration)Default constructor using endpoint configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidconnectAndLogin()Opens a new connection and performs login with user name and password if set.protected FtpMessagecreateDir(CommandType ftpCommand)Execute mkDir command and create new directory.protected FtpMessagedeleteFile(DeleteCommand delete, com.consol.citrus.context.TestContext context)Performs delete file operation.voiddestroy()protected FtpMessageexecuteCommand(CommandType ftpCommand, com.consol.citrus.context.TestContext context)SftpEndpointConfigurationgetEndpointConfiguration()protected StringgetPrivateKeyPath()com.jcraft.jsch.JSchgetSsh()Gets the ssh.voidinitialize()protected booleanisDirectory(String remoteFilePath)Check file path type directory or file.protected FtpMessagelistFiles(ListCommand list, com.consol.citrus.context.TestContext context)Perform list files operation and provide file information as response.protected FtpMessageretrieveFile(GetCommand command, com.consol.citrus.context.TestContext context)Performs retrieve file operation.voidsetSsh(com.jcraft.jsch.JSch ssh)Sets the ssh.protected FtpMessagestoreFile(PutCommand command, com.consol.citrus.context.TestContext context)Performs store file operation.-
Methods inherited from class com.consol.citrus.ftp.client.FtpClient
addFileNameToTargetPath, createConsumer, createProducer, getFtpClient, getLocalFileInputStream, receive, receive, receive, receive, send, setCorrelationManager, setFtpClient
-
Methods inherited from class com.consol.citrus.endpoint.AbstractEndpoint
getActor, getConsumerName, getName, getProducerName, setActor, setName
-
-
-
-
Constructor Detail
-
SftpClient
public SftpClient()
Default constructor initializing endpoint configuration.
-
SftpClient
protected SftpClient(SftpEndpointConfiguration endpointConfiguration)
Default constructor using endpoint configuration.- Parameters:
endpointConfiguration-
-
-
Method Detail
-
getEndpointConfiguration
public SftpEndpointConfiguration getEndpointConfiguration()
- Specified by:
getEndpointConfigurationin interfacecom.consol.citrus.endpoint.Endpoint- Overrides:
getEndpointConfigurationin classFtpClient
-
executeCommand
protected FtpMessage executeCommand(CommandType ftpCommand, com.consol.citrus.context.TestContext context)
- Overrides:
executeCommandin classFtpClient
-
createDir
protected FtpMessage createDir(CommandType ftpCommand)
Execute mkDir command and create new directory.- Parameters:
ftpCommand-- Returns:
-
listFiles
protected FtpMessage listFiles(ListCommand list, com.consol.citrus.context.TestContext context)
Description copied from class:FtpClientPerform list files operation and provide file information as response.
-
deleteFile
protected FtpMessage deleteFile(DeleteCommand delete, com.consol.citrus.context.TestContext context)
Description copied from class:FtpClientPerforms delete file operation.- Overrides:
deleteFilein classFtpClient
-
isDirectory
protected boolean isDirectory(String remoteFilePath)
Description copied from class:FtpClientCheck file path type directory or file.- Overrides:
isDirectoryin classFtpClient- Returns:
-
storeFile
protected FtpMessage storeFile(PutCommand command, com.consol.citrus.context.TestContext context)
Description copied from class:FtpClientPerforms store file operation.
-
retrieveFile
protected FtpMessage retrieveFile(GetCommand command, com.consol.citrus.context.TestContext context)
Description copied from class:FtpClientPerforms retrieve file operation.- Overrides:
retrieveFilein classFtpClient
-
connectAndLogin
protected void connectAndLogin()
Description copied from class:FtpClientOpens a new connection and performs login with user name and password if set.- Overrides:
connectAndLoginin classFtpClient
-
getPrivateKeyPath
protected String getPrivateKeyPath() throws IOException
- Throws:
IOException
-
initialize
public void initialize()
- Specified by:
initializein interfacecom.consol.citrus.common.InitializingPhase- Overrides:
initializein classFtpClient
-
destroy
public void destroy()
-
getSsh
public com.jcraft.jsch.JSch getSsh()
Gets the ssh.- Returns:
-
setSsh
public void setSsh(com.jcraft.jsch.JSch ssh)
Sets the ssh.- Parameters:
ssh-
-
-