Class PublisherSampler

All Implemented Interfaces:
Serializable, Cloneable, ConfigMergabilityIndicator, Searchable, Sampler, org.apache.jmeter.testelement.TestElement, TestStateListener

public class PublisherSampler extends BaseJMSSampler implements TestStateListener
This class implements the JMS Publisher sampler.
See Also:
  • Field Details

    • RAW_DATA

      public static final String RAW_DATA
      Encoding value to sent data as is (no variabilisation)
      See Also:
    • DEFAULT_ENCODING

      public static final String DEFAULT_ENCODING
      Encoding value to sent parsed data but read with default system encoding
      See Also:
    • NO_ENCODING

      public static final Set<String> NO_ENCODING
      Constant for system default encodings
  • Constructor Details

    • PublisherSampler

      public PublisherSampler()
  • Method Details

    • getSupportedEncodings

      public static String[] getSupportedEncodings()
      Init available encoding using constants, then JVM standard ones
      Returns:
      Array of String containing supported encodings
    • testStarted

      public void testStarted(String test)
      the implementation calls testStarted() without any parameters.
      Specified by:
      testStarted in interface TestStateListener
      Parameters:
      test - name of host
      See Also:
    • testEnded

      public void testEnded(String host)
      the implementation calls testEnded() without any parameters.
      Specified by:
      testEnded in interface TestStateListener
      Parameters:
      host - name of host
      See Also:
    • testEnded

      public void testEnded()
      endTest cleans up the client
      Specified by:
      testEnded in interface TestStateListener
      See Also:
    • testStarted

      public void testStarted()
      Description copied from interface: TestStateListener

      Called just before the start of the test from the main engine thread. This is before the test elements are cloned. Note that not all the test variables will have been set up at this point.

      N.B. testStarted() and testEnded() are called from different threads.

      Specified by:
      testStarted in interface TestStateListener
      See Also:
    • sample

      public SampleResult sample()
      The implementation will publish n messages within a for loop. Once n messages are published, it sets the attributes of SampleResult.
      Specified by:
      sample in class BaseJMSSampler
      Returns:
      the populated sample result
    • buildCache

      protected static com.github.benmanes.caffeine.cache.Cache<Object,Object> buildCache(String configChoice)
    • setConfigChoice

      public void setConfigChoice(String choice)
      set the source of the message
      Parameters:
      choice - source of the messages. One of JMSPublisherGui.USE_FILE_RSC, JMSPublisherGui.USE_RANDOM_RSC or JMSPublisherGui#USE_TEXT_RSC
    • getConfigChoice

      public String getConfigChoice()
      return the source of the message Converts from old JMX files which used the local language string
      Returns:
      source of the messages
    • setMessageChoice

      public void setMessageChoice(String choice)
      set the type of the message
      Parameters:
      choice - type of the message (Text, Object, Map)
    • getMessageChoice

      public String getMessageChoice()
      Returns:
      the type of the message (Text, Object, Map)
    • setInputFile

      public void setInputFile(String file)
      set the input file for the publisher
      Parameters:
      file - input file for the publisher
    • getInputFile

      public String getInputFile()
      Returns:
      the path of the input file
    • setRandomPath

      public void setRandomPath(String path)
      set the random path for the messages
      Parameters:
      path - random path for the messages
    • getRandomPath

      public String getRandomPath()
      Returns:
      the random path for messages
    • setTextMessage

      public void setTextMessage(String message)
      set the text for the message
      Parameters:
      message - text for the message
    • getTextMessage

      public String getTextMessage()
      Returns:
      the text for the message
    • getExpiration

      public String getExpiration()
    • getPriority

      public String getPriority()
    • setPriority

      public void setPriority(String s)
    • setExpiration

      public void setExpiration(String s)
    • setUseNonPersistentDelivery

      public void setUseNonPersistentDelivery(boolean value)
      Parameters:
      value - boolean use NON_PERSISTENT
    • getUseNonPersistentDelivery

      public boolean getUseNonPersistentDelivery()
      Returns:
      true if NON_PERSISTENT delivery must be used
    • getJMSProperties

      public JMSProperties getJMSProperties()
      Returns:
      JMSProperties JMS Properties
    • setJMSProperties

      public void setJMSProperties(JMSProperties jmsProperties)
      Parameters:
      jmsProperties - JMS Properties
    • getFileEncoding

      public String getFileEncoding()
      Gets file encoding to use. If RAW_DATA, content isn't parsed.
      Returns:
      File encoding.
      See Also:
    • setFileEncoding

      public void setFileEncoding(String fileEncoding)
      Sets file encoding to use. If RAW_DATA, content isn't parsed.
      Parameters:
      fileEncoding - File encoding.
      See Also: