Sha256: e4ac52d092743fc9b22572e7444f82580fd75bfd739e738752f4054fda54bc3e

Contents?: true

Size: 915 Bytes

Versions: 2

Compression:

Stored size: 915 Bytes

Contents

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

  class JSONPathPostprocessor
    attr_accessor :doc
    include Helper

    def initialize(params = {})
      testname = params.is_a?(Array) ? "JSONPathPostprocessor" : (params[:name] || "JSONPathPostprocessor")
      @doc = Nokogiri::XML(<<~EOS.strip_heredoc)
        <JSONPostProcessor guiclass="JSONPostProcessorGui" testclass="JSONPostProcessor" testname="#{testname}" enabled="true">
          <stringProp name="JSONPostProcessor.referenceNames"/>
          <stringProp name="JSONPostProcessor.jsonPathExprs"/>
          <stringProp name="JSONPostProcessor.match_numbers"/>
        </JSONPostProcessor>
      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/json_path_postprocessor.rb
jmeter_perf-0.0.2 lib/jmeter_perf/dsl/json_path_postprocessor.rb