Class FtpRule

  • All Implemented Interfaces:
    org.junit.rules.TestRule

    public class FtpRule
    extends org.junit.rules.ExternalResource
    FtpSystemRule is a helper class to allow FTP testing.
    Author:
    Ikasan Development Team
    • Constructor Summary

      Constructors 
      Constructor Description
      FtpRule()  
      FtpRule​(java.lang.String user, java.lang.String password, java.lang.String baseDir, int port)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void after()
      Override to tear down your specific external resource.
      protected void before()
      Override to set up your specific external resource.
      java.lang.String getBaseDir()  
      org.mockftpserver.fake.filesystem.FileSystemEntry getFile​(java.lang.String fileName)  
      int getPort()  
      void putFile​(java.lang.String fileName, java.lang.String content)  
      void start()
      Start the fakeFtpServer.
      void stop()
      Stop the fakeFtpServer.
      • Methods inherited from class org.junit.rules.ExternalResource

        apply
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FtpRule

        public FtpRule​(java.lang.String user,
                       java.lang.String password,
                       java.lang.String baseDir,
                       int port)
      • FtpRule

        public FtpRule()
    • Method Detail

      • putFile

        public void putFile​(java.lang.String fileName,
                            java.lang.String content)
                     throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getFile

        public org.mockftpserver.fake.filesystem.FileSystemEntry getFile​(java.lang.String fileName)
                                                                  throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getPort

        public int getPort()
      • getBaseDir

        public java.lang.String getBaseDir()
      • start

        public void start()
        Start the fakeFtpServer.

        The ssh will normally be started by JUnit using the before() method. This method allows the sshd to be started manually to support advanced testing scenarios.

      • stop

        public void stop()
        Stop the fakeFtpServer. Remove all temp files from the baseDir

        The fakeFtpServer demon will normally be stopped by JUnit using the after() method. This method allows the sshd to be stopped manually to support advanced testing scenarios.

      • before

        protected void before()
                       throws java.lang.Throwable
        Override to set up your specific external resource.
        Overrides:
        before in class org.junit.rules.ExternalResource
        Throws:
        java.lang.Throwable - if setup fails (which will disable after
      • after

        protected void after()
        Override to tear down your specific external resource.
        Overrides:
        after in class org.junit.rules.ExternalResource