Sha256: 211d8f3a8f1fa15665d3f0a22197e04f1169b96cd99d44418b767205260ceccc

Contents?: true

Size: 1.44 KB

Versions: 12

Compression:

Stored size: 1.44 KB

Contents

module JmeterPerf
  module Plugins
    class ThroughputShapingTimer
      attr_accessor :doc
      include JmeterPerf::Helpers::XmlDocumentUpdater
      def initialize(params = {})
        testname = params.is_a?(Array) ? "ThroughputShapingTimer" : (params[:name] || "ThroughputShapingTimer")
        @doc = Nokogiri::XML(
          JmeterPerf::Helpers::String.strip_heredoc(
            <<-EOF
              <kg.apc.jmeter.timers.VariableThroughputTimer guiclass="kg.apc.jmeter.timers.VariableThroughputTimerGui" testclass="kg.apc.jmeter.timers.VariableThroughputTimer" testname="#{testname}" enabled="true">
                <collectionProp name="load_profile"/>
              </kg.apc.jmeter.timers.VariableThroughputTimer>
            EOF
          )
        )

        (params.is_a?(Array) ? params : params[:steps]).each_with_index do |step, index|
          @doc.at_xpath("//collectionProp") << Nokogiri::XML(
            JmeterPerf::Helpers::String.strip_heredoc(
              <<-EOF
                  <collectionProp name="step_#{index}">
                    <stringProp name="start_rps_#{index}">#{step[:start_rps]}</stringProp>
                    <stringProp name="end_rps_#{index}">#{step[:end_rps]}</stringProp>
                    <stringProp name="duration_sec_#{index}">#{step[:duration]}</stringProp>
                  </collectionProp>
              EOF
            )
          ).children
        end
        update params
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
jmeter_perf-1.1.1 lib/jmeter_perf/plugins/variable_throughput_timer.rb
jmeter_perf-1.1.0 lib/jmeter_perf/plugins/variable_throughput_timer.rb
jmeter_perf-1.0.10 lib/jmeter_perf/plugins/variable_throughput_timer.rb
jmeter_perf-1.0.9 lib/jmeter_perf/plugins/variable_throughput_timer.rb
jmeter_perf-1.0.8 lib/jmeter_perf/plugins/variable_throughput_timer.rb
jmeter_perf-1.0.7 lib/jmeter_perf/plugins/variable_throughput_timer.rb
jmeter_perf-1.0.6 lib/jmeter_perf/plugins/variable_throughput_timer.rb
jmeter_perf-1.0.5 lib/jmeter_perf/plugins/variable_throughput_timer.rb
jmeter_perf-1.0.4 lib/jmeter_perf/plugins/variable_throughput_timer.rb
jmeter_perf-1.0.2 lib/jmeter_perf/plugins/variable_throughput_timer.rb
jmeter_perf-1.0.1 lib/jmeter_perf/plugins/variable_throughput_timer.rb
jmeter_perf-1.0.0 lib/jmeter_perf/plugins/variable_throughput_timer.rb