Class FtpClient

    • Constructor Detail

      • FtpClient

        public FtpClient()
        Default constructor initializing endpoint configuration.
      • FtpClient

        protected FtpClient​(FtpEndpointConfiguration endpointConfiguration)
        Default constructor using endpoint configuration.
        Parameters:
        endpointConfiguration -
    • Method Detail

      • send

        public void send​(Message message,
                         TestContext context)
        Specified by:
        send in interface com.consol.citrus.messaging.Producer
      • listFiles

        protected FtpMessage listFiles​(ListCommand list,
                                       TestContext context)
        Perform list files operation and provide file information as response.
        Parameters:
        list -
        context -
        Returns:
      • isDirectory

        protected boolean isDirectory​(String remoteFilePath)
                               throws IOException
        Check file path type directory or file.
        Parameters:
        remoteFilePath -
        Returns:
        Throws:
        IOException
      • getLocalFileInputStream

        protected InputStream getLocalFileInputStream​(String path,
                                                      String dataType,
                                                      TestContext context)
                                               throws IOException
        Constructs local file input stream. When using ASCII data type the test variable replacement is activated otherwise plain byte stream is used.
        Parameters:
        path -
        dataType -
        context -
        Returns:
        Throws:
        IOException
      • addFileNameToTargetPath

        protected static String addFileNameToTargetPath​(String sourcePath,
                                                        String targetPath)
        If the target path is a directory (ends with "/"), add the file name from the source path to the target path. Otherwise, don't do anything Example:

        sourcePath="/some/dir/file.pdf"
        targetPath="/other/dir/"
        returns: "/other/dir/file.pdf"

      • connectAndLogin

        protected void connectAndLogin()
                                throws IOException
        Opens a new connection and performs login with user name and password if set.
        Throws:
        IOException
      • receive

        public Message receive​(TestContext context)
        Specified by:
        receive in interface com.consol.citrus.messaging.Consumer
      • receive

        public Message receive​(String selector,
                               TestContext context)
        Specified by:
        receive in interface com.consol.citrus.messaging.SelectiveConsumer
      • receive

        public Message receive​(TestContext context,
                               long timeout)
        Specified by:
        receive in interface com.consol.citrus.messaging.Consumer
      • receive

        public Message receive​(String selector,
                               TestContext context,
                               long timeout)
        Specified by:
        receive in interface com.consol.citrus.messaging.SelectiveConsumer
      • createProducer

        public com.consol.citrus.messaging.Producer createProducer()
        Creates a message producer for this endpoint for sending messages to this endpoint.
        Specified by:
        createProducer in interface Endpoint
      • createConsumer

        public com.consol.citrus.messaging.SelectiveConsumer createConsumer()
        Creates a message consumer for this endpoint. Consumer receives messages on this endpoint.
        Specified by:
        createConsumer in interface Endpoint
        Returns:
      • setFtpClient

        public void setFtpClient​(org.apache.commons.net.ftp.FTPClient ftpClient)
        Sets the apache ftp client.
        Parameters:
        ftpClient -
      • getFtpClient

        public org.apache.commons.net.ftp.FTPClient getFtpClient()
        Gets the apache ftp client.
        Returns:
      • setCorrelationManager

        public void setCorrelationManager​(CorrelationManager<Message> correlationManager)
        Sets the correlation manager.
        Parameters:
        correlationManager -