Package org.ikasan.testharness.flow.sftp
Class SftpRule
- java.lang.Object
-
- org.junit.rules.ExternalResource
-
- org.ikasan.testharness.flow.sftp.SftpRule
-
- All Implemented Interfaces:
org.junit.rules.TestRule
public class SftpRule extends org.junit.rules.ExternalResourceSftpSystemRule is a helper class to allow SFTP testing.- Author:
- Ikasan Development Team
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidafter()Override to tear down your specific external resource.protected voidbefore()Override to set up your specific external resource.java.lang.StringgetBaseDir()java.io.InputStreamgetFile(java.lang.String fileName)java.lang.StringgetFileAsString(java.lang.String fileName)intgetPort()voidputFile(java.io.File file)voidputFile(java.lang.String fileName, byte[] bytes)voidputFile(java.lang.String fileName, java.lang.String content)voidstart()Start the sshd.voidstop()Stop the sshd.
-
-
-
Method Detail
-
putFile
public void putFile(java.lang.String fileName, java.lang.String content) throws java.lang.Exception- Throws:
java.lang.Exception
-
putFile
public void putFile(java.io.File file) throws java.lang.Exception- Throws:
java.lang.Exception
-
putFile
public void putFile(java.lang.String fileName, byte[] bytes) throws java.lang.Exception- Throws:
java.lang.Exception
-
getFile
public java.io.InputStream getFile(java.lang.String fileName) throws java.lang.Exception- Throws:
java.lang.Exception
-
getFileAsString
public java.lang.String getFileAsString(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 sshd. 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 sshd. The ssh 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.ThrowableOverride to set up your specific external resource.- Overrides:
beforein classorg.junit.rules.ExternalResource- Throws:
java.lang.Throwable- if setup fails (which will disableafter
-
after
protected void after()
Override to tear down your specific external resource.- Overrides:
afterin classorg.junit.rules.ExternalResource
-
-