Sha256: 2c752849d496a4b03ef4d0905a964b1016ae5d13930acf3b3e39340484b45da1

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

module JmeterPerf
  class DSL
    def counter(params = {}, &)
      node = JmeterPerf::Counter.new(params)
      attach_node(node, &)
    end
  end

  class Counter
    attr_accessor :doc
    include Helper

    def initialize(params = {})
      testname = params.is_a?(Array) ? "Counter" : (params[:name] || "Counter")
      @doc = Nokogiri::XML(<<~EOS.strip_heredoc)
        <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="#{testname}" enabled="true">
          <stringProp name="CounterConfig.start"/>
          <stringProp name="CounterConfig.end"/>
          <stringProp name="CounterConfig.incr"/>
          <stringProp name="CounterConfig.name"/>
          <stringProp name="CounterConfig.format"/>
          <boolProp name="CounterConfig.per_user">true</boolProp>
          <boolProp name="CounterConfig.reset_on_tg_iteration">true</boolProp>
        </CounterConfig>
      EOS
      update params
      update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jmeter_perf-0.0.6 lib/jmeter_perf/dsl/counter.rb
jmeter_perf-0.0.2 lib/jmeter_perf/dsl/counter.rb