Package dev.aherscu.qa.jgiven.ssh.steps
Class SshActions<SELF extends SshActions<SELF>>
- java.lang.Object
-
- com.tngtech.jgiven.base.StageBase<SELF>
-
- com.tngtech.jgiven.Stage<SELF>
-
- dev.aherscu.qa.jgiven.commons.utils.StageEx<SELF>
-
- dev.aherscu.qa.jgiven.commons.steps.GenericActions<SshScenarioType,SELF>
-
- dev.aherscu.qa.jgiven.ssh.steps.SshActions<SELF>
-
- Type Parameters:
SELF
- the type of the subclass
- All Implemented Interfaces:
dev.aherscu.qa.jgiven.commons.model.ScenarioType<SshScenarioType>
@ThreadSafe public class SshActions<SELF extends SshActions<SELF>> extends dev.aherscu.qa.jgiven.commons.steps.GenericActions<SshScenarioType,SELF>
Generic SSH configuration actions. Act on previously set configuration. Each action closes the connection.- Author:
- aherscu
-
-
Field Summary
Fields Modifier and Type Field Description protected ThreadLocal<net.schmizz.sshj.Config>
configuration
The given SSH client configuration.protected ThreadLocal<Integer>
connectionTimeout
The given SSH client connection timeout.protected ThreadLocal<OutputStream>
executionOutput
The given SSH remote stream redirection target.protected ThreadLocal<Integer>
executionTimeout
The given SSH remote execution timeout.protected ThreadLocal<Integer>
exitStatus
The exit status of last SSH batch command.protected ThreadLocal<Integer>
readTimeout
The given SSH client read timeout.static String
TARGET_DOWNLOADS
The area into which to download remote files.
-
Constructor Summary
Constructors Constructor Description SshActions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SELF
deleting_downloaded_files()
Deletes the entire directory of downloaded files.SELF
downloading(URI url, File file)
Downloads a file from target SSH machine to local machine.SELF
executing(URI url, String command)
Executes a batch command on target SSH machine, using the timeout set bySshFixtures.execution_timeout(int)
and the target output stream set bySshFixtures.execution_output_to(OutputStream)
.SELF
executing(URI url, String command, long timeout, TimeUnit timeUnit, OutputStream outputStream)
Executes a batch command on target SSH machine.-
Methods inherited from class dev.aherscu.qa.jgiven.commons.steps.GenericActions
comment, concatenate_$_files_from_$_into, deleting_directory, doing_nothing, doing_nothing, doing_nothing, failing_on_purpose_with, retrying, retrying, safely, safely
-
-
-
-
Field Detail
-
TARGET_DOWNLOADS
public static final String TARGET_DOWNLOADS
The area into which to download remote files. Initialized fromtarget.downloads
system property and defaults totarget/downloads
.
-
exitStatus
@ProvidedScenarioState protected final ThreadLocal<Integer> exitStatus
The exit status of last SSH batch command.
-
configuration
@ExpectedScenarioState protected ThreadLocal<net.schmizz.sshj.Config> configuration
The given SSH client configuration.
-
connectionTimeout
@ExpectedScenarioState protected ThreadLocal<Integer> connectionTimeout
The given SSH client connection timeout.
-
executionOutput
@ExpectedScenarioState protected ThreadLocal<OutputStream> executionOutput
The given SSH remote stream redirection target.
-
executionTimeout
@ExpectedScenarioState protected ThreadLocal<Integer> executionTimeout
The given SSH remote execution timeout.
-
readTimeout
@ExpectedScenarioState protected ThreadLocal<Integer> readTimeout
The given SSH client read timeout.
-
-
Method Detail
-
deleting_downloaded_files
@NestedSteps public SELF deleting_downloaded_files()
Deletes the entire directory of downloaded files.- Returns:
StageBase.self()
-
downloading
public SELF downloading(URI url, File file)
Downloads a file from target SSH machine to local machine.- Parameters:
url
- the machine from which to downloadfile
- the file path to download- Returns:
StageBase.self()
- See Also:
TARGET_DOWNLOADS
-
executing
public SELF executing(URI url, String command)
Executes a batch command on target SSH machine, using the timeout set bySshFixtures.execution_timeout(int)
and the target output stream set bySshFixtures.execution_output_to(OutputStream)
.- Parameters:
url
- the machine on which to executecommand
- the batch command to execute on SSH target machine- Returns:
StageBase.self()
-
executing
public SELF executing(URI url, String command, long timeout, TimeUnit timeUnit, OutputStream outputStream)
Executes a batch command on target SSH machine.- Parameters:
url
- the machine on which to executecommand
- the batch command to execute on SSH target machinetimeout
- how long to wait for the command execution to complete; set to 0 to wait indefinitelytimeUnit
- timeout unitsoutputStream
- output stream to receive what the remote SSH process generate; be warned that this can be very big- Returns:
StageBase.self()
-
-