Sha256: 97abc311f5823937580d572c1894da55127015fde4fadb332e6c3443d9aaf595

Contents?: true

Size: 1.41 KB

Versions: 2

Compression:

Stored size: 1.41 KB

Contents

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

  class OSProcessSampler
    attr_accessor :doc
    include Helper

    def initialize(params = {})
      testname = params.is_a?(Array) ? "OSProcessSampler" : (params[:name] || "OSProcessSampler")
      @doc = Nokogiri::XML(<<~EOS.strip_heredoc)
        <SystemSampler guiclass="SystemSamplerGui" testclass="SystemSampler" testname="#{testname}" enabled="true">
          <boolProp name="SystemSampler.checkReturnCode">false</boolProp>
          <stringProp name="SystemSampler.expectedReturnCode">0</stringProp>
          <stringProp name="SystemSampler.command"/>
          <elementProp name="SystemSampler.arguments" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="#{testname}" enabled="true">
            <collectionProp name="Arguments.arguments"/>
          </elementProp>
          <elementProp name="SystemSampler.environment" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="#{testname}" enabled="true">
            <collectionProp name="Arguments.arguments"/>
          </elementProp>
          <stringProp name="SystemSampler.directory"/>
        </SystemSampler>
      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/os_process_sampler.rb
jmeter_perf-0.0.2 lib/jmeter_perf/dsl/os_process_sampler.rb