Class: JmeterPerf::Plugins::ThroughputShapingTimer

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ ThroughputShapingTimer

Returns a new instance of ThroughputShapingTimer.



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

def initialize(params = {})
  testname = params.is_a?(Array) ? "ThroughputShapingTimer" : (params[:name] || "ThroughputShapingTimer")
  @doc = Nokogiri::XML(
    JmeterPerf::Helpers::String.strip_heredoc(
      "        <kg.apc.jmeter.timers.VariableThroughputTimer guiclass=\"kg.apc.jmeter.timers.VariableThroughputTimerGui\" testclass=\"kg.apc.jmeter.timers.VariableThroughputTimer\" testname=\"\#{testname}\" enabled=\"true\">\n          <collectionProp name=\"load_profile\"/>\n        </kg.apc.jmeter.timers.VariableThroughputTimer>\n      EOF\n    )\n  )\n\n  (params.is_a?(Array) ? params : params[:steps]).each_with_index do |step, index|\n    @doc.at_xpath(\"//collectionProp\") << Nokogiri::XML(\n      JmeterPerf::Helpers::String.strip_heredoc(\n        <<-EOF\n            <collectionProp name=\"step_\#{index}\">\n              <stringProp name=\"start_rps_\#{index}\">\#{step[:start_rps]}</stringProp>\n              <stringProp name=\"end_rps_\#{index}\">\#{step[:end_rps]}</stringProp>\n              <stringProp name=\"duration_sec_\#{index}\">\#{step[:duration]}</stringProp>\n            </collectionProp>\n        EOF\n      )\n    ).children\n  end\n  update params\nend\n"

Instance Attribute Details

#docObject

Returns the value of attribute doc.



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

def doc
  @doc
end