Class AccessLogSampler

All Implemented Interfaces:
Serializable, Cloneable, ConfigMergabilityIndicator, Replaceable, Searchable, HTTPConstantsInterface, Interruptible, Sampler, TestBean, org.apache.jmeter.testelement.TestElement, TestIterationListener, TestStateListener, ThreadListener

public class AccessLogSampler extends HTTPSampler implements TestBean, ThreadListener

AccessLogSampler is responsible for a couple of things:
  • creating instances of Generator
  • creating instances of Parser
  • triggering popup windows
  • calling Generator.generateRequest()
  • checking to make sure the classes are valid
  • making sure a class can be instantiated
The intent of this sampler is it uses the generator and parser to create a HTTPSampler when it is needed. It does not contain logic about how to parse the logs. It also doesn't care how Generator is implemented, as long as it implements the interface. This means a person could simply implement a dummy parser to generate random parameters and the generator consumes the results. This wasn't the original intent of the sampler. I originally wanted to write this sampler, so that I can take production logs to simulate production traffic in a test environment. Doing so is desirable to study odd or unusual behavior. It's also good to compare a new system against an existing system to get near apples-to-apples comparison. I've been asked if benchmarks are really fair comparisons just about every single time, so this helps me accomplish that task.

Some bugs only appear under production traffic, so it is useful to generate traffic using production logs. This way, JMeter can record when problems occur and provide a way to match the server logs.

See Also:
  • Field Details

  • Constructor Details

    • AccessLogSampler

      public AccessLogSampler()
  • Method Details

    • setLogFile

      public void setLogFile(String path)
      Set the path where XML messages are stored for random selection.
      path - path where to store XML messages
    • getLogFile

      public String getLogFile()
      Get the path where XML messages are stored. this is the directory where JMeter will randomly select a file.
      path where XML messages are stored
    • setParserClassName

      public void setParserClassName(String classname)
      it's kinda obvious, but we state it anyways. Set the xml file with a string path.
      classname - - parser class name
    • getParserClassName

      public String getParserClassName()
      Get the file location of the xml file.
      String file path.
    • sampleWithParser

      public SampleResult sampleWithParser()
      sample gets a new HTTPSampler from the generator and calls it's sample() method.
      newly generated and called sample
    • sample

      public SampleResult sample(Entry e)
      sample(Entry e) simply calls sample().
      Specified by:
      sample in interface Sampler
      sample in class HTTPSamplerBase
      e - - ignored
      the new sample
    • instantiateParser

      public void instantiateParser()
      Method will instantiate the log parser based on the class in the text field. This was done to make it easier for people to plugin their own log parser and use different log parser.
    • getFilterClassName

      public String getFilterClassName()
      Returns the filterClassName.
    • setFilterClassName

      public void setFilterClassName(String filterClassName)
      filterClassName - The filterClassName to set.
    • getDomain

      public String getDomain()
      getDomain in class HTTPSamplerBase
      Returns the domain.
    • setDomain

      public void setDomain(String domain)
      setDomain in class HTTPSamplerBase
      domain - The domain to set.
    • isImageParsing

      public boolean isImageParsing()
      Returns the imageParsing.
    • setImageParsing

      public void setImageParsing(boolean imageParsing)
      imageParsing - The imageParsing to set.
    • getPortString

      public String getPortString()
      Returns the port.
    • setPortString

      public void setPortString(String port)
      port - The port to set.
    • setProtocol

      public void setProtocol(String value)
      Sets the scheme, with default
      setProtocol in class HTTPSamplerBase
      value - the protocol
    • getProtocol

      public String getProtocol()
      Gets the protocol, with default.
      getProtocol in class HTTPSamplerBase
      the protocol
    • initFilter

      protected void initFilter()
    • clone

      public Object clone()
      Specified by:
      clone in interface org.apache.jmeter.testelement.TestElement
      clone in class AbstractTestElement
    • testEnded

      public void testEnded()

      Called once for all threads after the end of a test. This will use the same element instances as at the start of the test.

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

      Specified by:
      testEnded in interface TestStateListener
      testEnded in class HTTPSamplerBase
      See Also:
    • testStarted

      public void testStarted()

      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
      testStarted in class HTTPSamplerBase
      See Also:
    • threadFinished

      public void threadFinished()
      Called for each thread after all samples have been processed. See org.apache.jmeter.threads.JMeterThread#threadFinished(org.apache.jmeter.engine.event.LoopIterationListener)
      Specified by:
      threadFinished in interface ThreadListener
      threadFinished in class HTTPSamplerBase