Class SshActions<SELF extends 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 Detail

      • TARGET_DOWNLOADS

        public static final String TARGET_DOWNLOADS
        The area into which to download remote files. Initialized from target.downloads system property and defaults to target/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.
    • Constructor Detail

      • SshActions

        public SshActions()
    • 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 download
        file - the file path to download
        Returns:
        StageBase.self()
        See Also:
        TARGET_DOWNLOADS
      • 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 execute
        command - the batch command to execute on SSH target machine
        timeout - how long to wait for the command execution to complete; set to 0 to wait indefinitely
        timeUnit - timeout units
        outputStream - output stream to receive what the remote SSH process generate; be warned that this can be very big
        Returns:
        StageBase.self()