Class: JmeterPerf::Plugins::DummySampler

Inherits:
Object
  • Object
show all
Includes:
Helpers::XmlDocumentUpdater
Defined in:
lib/jmeter_perf/plugins/dummy_sampler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ DummySampler

Returns a new instance of DummySampler.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/jmeter_perf/plugins/dummy_sampler.rb', line 6

def initialize(params = {})
  testname = params.is_a?(Array) ? "DummySampler" : (params[:name] || "DummySampler")
  @doc = Nokogiri::XML(
    JmeterPerf::Helpers::String.strip_heredoc(
      <<-EOF
        <kg.apc.jmeter.samplers.DummySampler guiclass="kg.apc.jmeter.samplers.DummySamplerGui" testclass="kg.apc.jmeter.samplers.DummySampler" testname="#{testname}" enabled="true">
          <boolProp name="WAITING">true</boolProp>
          <boolProp name="SUCCESFULL">true</boolProp>
          <stringProp name="RESPONSE_CODE">200</stringProp>
          <stringProp name="RESPONSE_MESSAGE">OK</stringProp>
          <stringProp name="REQUEST_DATA"></stringProp>
          <stringProp name="RESPONSE_DATA"></stringProp>
          <stringProp name="RESPONSE_TIME">0</stringProp>
          <stringProp name="LATENCY">0</stringProp>
        </kg.apc.jmeter.samplers.DummySampler>
      EOF
    )
  )
  upcased_params = {}
  params.each { |k, v| upcased_params[k.to_s.upcase] = v }
  update upcased_params
end

Instance Attribute Details

#docObject

Returns the value of attribute doc.



4
5
6
# File 'lib/jmeter_perf/plugins/dummy_sampler.rb', line 4

def doc
  @doc
end