Forum Discussion

nav1's avatar
nav1
New Member
11 years ago

Currently we use Hawtio (JBOSS) to manually test FTP, can this be automated using SoapUI

Hello

 

Currently we use Hawtio (RED HAT JBOSS FUSE Managment Console) & (Active MQ) to manually test FTP, can this be automated using SoapUI

1 Reply

  • MartinSpamer's avatar
    MartinSpamer
    Frequent Contributor

    Yes, this would be quite straight forward.

     

    1) Identify a suitable Java FTP library, such Apache Common's FTPClient.

    2) Add this to the SOAPUI java.library.path, which can be found using the following Groovy snippet

    log.info System.properties["java.library.path"]

    3) Create a Project with a Groovy Test Step

    4) Code a little Groovy to perform the FTP operation you want. e.g.

    import org.apache.commons.net.ftp.FTPClient
    
    new FTPClient().with {
        connect "ftp.example.com"
        enterLocalPassiveMode()
        login "username", "password"
        changeWorkingDirectory "/blah"
        def incomingFile = new File("local-filename")
        incomingFile.withOutputStream { ostream -> retrieveFile "remote-filename", ostream }
        disconnect()
    }