org.apache.jmeter.protocol.system

## Class SystemSampler

- java.lang.Object
- - org.apache.jmeter.testelement.AbstractTestElement
  - - org.apache.jmeter.samplers.AbstractSampler
    - - org.apache.jmeter.protocol.system.SystemSampler

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, ConfigMergabilityIndicator, Searchable, Sampler, TestElement

      public class SystemSampler
      extends AbstractSampler

  A sampler for executing a System function.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `ARGUMENTS`
    `static java.lang.String` | `CHECK_RETURN_CODE`
    `static java.lang.String` | `COMMAND`
    `static int` | `DEFAULT_RETURN_CODE`
    `static java.lang.String` | `DIRECTORY`
    `static java.lang.String` | `ENVIRONMENT`
    `static java.lang.String` | `EXPECTED_RETURN_CODE`

    - ### Fields inherited from interface org.apache.jmeter.testelement.TestElement

      `COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SystemSampler()` Create a SystemSampler.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `applies(ConfigTestElement configElement)` Does configElement apply to Sampler
    `Arguments` | `getArguments()` Get the arguments (parameters) for the JavaSamplerClient to be executed with.
    `boolean` | `getCheckReturnCode()`
    `java.lang.String` | `getCommand()` Gets the Command attribute of the JavaConfig object
    `java.lang.String` | `getDirectory()`
    `Arguments` | `getEnvironmentVariables()` Get the env variables
    `int` | `getExpectedReturnCode()`
    `java.lang.String` | `getStderr()`
    `java.lang.String` | `getStdin()`
    `java.lang.String` | `getStdout()`
    `long` | `getTimeout()`
    `SampleResult` | `sample(Entry entry)` Performs a test sample.
    `void` | `setArguments(Arguments args)` Set the arguments (parameters) for the JavaSamplerClient to be executed with.
    `void` | `setCheckReturnCode(boolean checkit)`
    `void` | `setCommand(java.lang.String command)` Sets the Command attribute of the JavaConfig object
    `void` | `setDirectory(java.lang.String directory)` Set the working directory to use for system commands
    `void` | `setEnvironmentVariables(Arguments arguments)`
    `void` | `setExpectedReturnCode(int code)`
    `void` | `setStderr(java.lang.String filename)`
    `void` | `setStdin(java.lang.String filename)`
    `void` | `setStdout(java.lang.String filename)`
    `void` | `setTimout(long timeoutMs)`

    - ### Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement

      `addPropertiesValues, addProperty, addProperty, addTestElement, canRemove, clear, clearTemporary, clearTestElementChildren, clone, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getSearchableTokens, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, recoverRunningVersion, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse, traverseCollection, traverseMap, traverseProperty`

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.jmeter.testelement.TestElement

      `addTestElement, canRemove, clear, clearTestElementChildren, clone, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getThreadContext, getThreadName, isEnabled, isRunningVersion, isTemporary, propertyIterator, recoverRunningVersion, removed, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse`

- - ### Field Detail

    - #### COMMAND

          public static final java.lang.String COMMAND

      See Also:
        Constant Field Values

    - #### DIRECTORY

          public static final java.lang.String DIRECTORY

      See Also:
        Constant Field Values

    - #### ARGUMENTS

          public static final java.lang.String ARGUMENTS

      See Also:
        Constant Field Values

    - #### ENVIRONMENT

          public static final java.lang.String ENVIRONMENT

      See Also:
        Constant Field Values

    - #### CHECK_RETURN_CODE

          public static final java.lang.String CHECK_RETURN_CODE

      See Also:
        Constant Field Values

    - #### EXPECTED_RETURN_CODE

          public static final java.lang.String EXPECTED_RETURN_CODE

      See Also:
        Constant Field Values

    - #### DEFAULT_RETURN_CODE

          public static final int DEFAULT_RETURN_CODE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### SystemSampler

          public SystemSampler()

      Create a SystemSampler.

  - ### Method Detail

    - #### sample

          public SampleResult sample(Entry entry)

      Performs a test sample.
      Parameters:
        `entry` - the Entry for this sample
      Returns:
        test SampleResult

    - #### applies

          public boolean applies(ConfigTestElement configElement)

      Description copied from class: `AbstractSampler`
      Does configElement apply to Sampler
      Specified by:
        `applies` in interface `ConfigMergabilityIndicator`
      Overrides:
        `applies` in class `AbstractSampler`
      Parameters:
        `configElement` - `ConfigTestElement`
      Returns:
        boolean
      See Also:
        `AbstractSampler.applies(org.apache.jmeter.config.ConfigTestElement)`

    - #### getDirectory

          public java.lang.String getDirectory()

      Returns:
        working directory to use for system commands

    - #### setDirectory

          public void setDirectory(java.lang.String directory)

      Set the working directory to use for system commands
      Parameters:
        `directory` - working directory to use for system commands

    - #### setCommand

          public void setCommand(java.lang.String command)

      Sets the Command attribute of the JavaConfig object
      Parameters:
        `command` - the new Command value

    - #### getCommand

          public java.lang.String getCommand()

      Gets the Command attribute of the JavaConfig object
      Returns:
        the Command value

    - #### setArguments

          public void setArguments(Arguments args)

      Set the arguments (parameters) for the JavaSamplerClient to be executed with.
      Parameters:
        `args` - the new arguments. These replace any existing arguments.

    - #### getArguments

          public Arguments getArguments()

      Get the arguments (parameters) for the JavaSamplerClient to be executed with.
      Returns:
        the arguments

    - #### setCheckReturnCode

          public void setCheckReturnCode(boolean checkit)

      Parameters:
        `checkit` - boolean indicates if we check or not return code

    - #### getCheckReturnCode

          public boolean getCheckReturnCode()

      Returns:
        boolean indicating if we check or not return code

    - #### setExpectedReturnCode

          public void setExpectedReturnCode(int code)

      Parameters:
        `code` - expected return code

    - #### getExpectedReturnCode

          public int getExpectedReturnCode()

      Returns:
        expected return code

    - #### setEnvironmentVariables

          public void setEnvironmentVariables(Arguments arguments)

      Parameters:
        `arguments` - Env vars

    - #### getEnvironmentVariables

          public Arguments getEnvironmentVariables()

      Get the env variables
      Returns:
        the arguments

    - #### getStdout

          public java.lang.String getStdout()

    - #### setStdout

          public void setStdout(java.lang.String filename)

    - #### getStderr

          public java.lang.String getStderr()

    - #### setStderr

          public void setStderr(java.lang.String filename)

    - #### getStdin

          public java.lang.String getStdin()

    - #### setStdin

          public void setStdin(java.lang.String filename)

    - #### getTimeout

          public long getTimeout()

    - #### setTimout

          public void setTimout(long timeoutMs)

Copyright © 1998-2018 Apache Software Foundation. All Rights Reserved.