Class MailReaderSampler

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

public class MailReaderSampler extends AbstractSampler implements Interruptible
Sampler that can read from POP3 and IMAP mail servers
See Also:
  • Field Details

  • Constructor Details

    • MailReaderSampler

      public MailReaderSampler()
  • Method Details

    • isUseLocalTrustStore

      public boolean isUseLocalTrustStore()
    • getTrustStoreToUse

      public String getTrustStoreToUse()
    • isUseSSL

      public boolean isUseSSL()
    • isUseStartTLS

      public boolean isUseStartTLS()
    • isTrustAllCerts

      public boolean isTrustAllCerts()
    • isEnforceStartTLS

      public boolean isEnforceStartTLS()
    • sample

      public SampleResult sample(Entry e)
      Obtains statistics about the given Entry, and packages the information into a SampleResult.
      Specified by:
      sample in interface Sampler
      Parameters:
      e - the Entry (TODO seems to be unused)
      Returns:
      information about the sample
    • addCustomProperties

      protected void addCustomProperties(Properties props)
    • setServerType

      public void setServerType(String serverType)
      Sets the type of protocol to use when talking with the remote mail server. Either MailReaderSampler.TYPE_IMAP[S] or MailReaderSampler.TYPE_POP3[S]. Default is MailReaderSampler.TYPE_POP3.
      Parameters:
      serverType - protocol to use
    • getServerType

      public String getServerType()
      Returns the type of the protocol set to use when talking with the remote server. Either MailReaderSampler.TYPE_IMAP[S] or MailReaderSampler.TYPE_POP3[S].
      Returns:
      Server Type
    • setServer

      public void setServer(String server)
      Parameters:
      server - - The name or address of the remote server.
    • getServer

      public String getServer()
      Returns:
      The name or address of the remote server.
    • getPort

      public String getPort()
    • setPort

      public void setPort(String port)
    • setUserName

      public void setUserName(String username)
      Parameters:
      username - - The username of the mail account.
    • getUserName

      public String getUserName()
      Returns:
      The username of the mail account.
    • setPassword

      public void setPassword(String password)
      Parameters:
      password - the password to use
    • getPassword

      public String getPassword()
      Returns:
      password
    • setFolder

      public void setFolder(String folder)
      Parameters:
      folder - - Name of the folder to read emails from. "INBOX" is the only acceptable value if the server type is POP3.
    • getFolder

      public String getFolder()
      Returns:
      folder
    • setNumMessages

      public void setNumMessages(int numMessages)
      Parameters:
      numMessages - - The number of messages to retrieve from the mail server. Set this value to -1 to retrieve all messages.
    • setNumMessages

      public void setNumMessages(String numMessages)
      Parameters:
      numMessages - - The number of messages to retrieve from the mail server. Set this value to -1 to retrieve all messages.
    • getNumMessages

      public int getNumMessages()
      Returns:
      The number of messages to retrieve from the mail server. -1 denotes get all messages.
    • getNumMessagesString

      public String getNumMessagesString()
      Returns:
      The number of messages to retrieve from the mail server. -1 denotes get all messages.
    • setDeleteMessages

      public void setDeleteMessages(boolean delete)
      Parameters:
      delete - - Whether or not to delete the read messages from the folder.
    • getDeleteMessages

      public boolean getDeleteMessages()
      Returns:
      Whether or not to delete the read messages from the folder.
    • isStoreMimeMessage

      public boolean isStoreMimeMessage()
      Returns:
      Whether or not to store the retrieved message as MIME message in the sample result
    • setStoreMimeMessage

      public void setStoreMimeMessage(boolean storeMimeMessage)
      Parameters:
      storeMimeMessage - Whether or not to store the retrieved message as MIME message in the sample result
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • interrupt

      public boolean interrupt()
      Interrupt the current operation if possible.
      Specified by:
      interrupt in interface Interruptible
      Returns:
      true if there was an operation to interrupt.
    • 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:
    • getHeaderOnly

      public boolean getHeaderOnly()
    • setHeaderOnly

      public void setHeaderOnly(boolean selected)