Sha256: 7dbf5794a1f5adee5d1975cf11e55274f2c05decc1e3413b9e593d21d84beb5c

Contents?: true

Size: 1.56 KB

Versions: 1

Compression:

Stored size: 1.56 KB

Contents

module JmeterPerf
  class DSL
    # DSL method synonymous with the JMeter Element FTPRequestDefaults
    # @see https://github.com/jlurena/jmeter_perf/wiki/1.-DSL-Documentation#ftprequestdefaults
    # @param [Hash] params Parameters for the FTPRequestDefaults element (default: `{}`).
    # @yield block to attach to the FTPRequestDefaults element
    # @return [JmeterPerf::FTPRequestDefaults], a subclass of JmeterPerf::DSL that can be chained with other DSL methods.
    def ftp_request_defaults(params = {}, &)
      node = JmeterPerf::FTPRequestDefaults.new(params)
      attach_node(node, &)
    end
  end

  class FTPRequestDefaults
    attr_accessor :doc
    include Helper

    def initialize(params = {})
      testname = params.is_a?(Array) ? "FTPRequestDefaults" : (params[:name] || "FTPRequestDefaults")
      @doc = Nokogiri::XML(<<~EOS.strip_heredoc)
        <ConfigTestElement guiclass="FtpConfigGui" testclass="ConfigTestElement" testname="#{testname}" enabled="true">
          <stringProp name="FTPSampler.server"/>
          <stringProp name="FTPSampler.port"/>
          <stringProp name="FTPSampler.filename"/>
          <stringProp name="FTPSampler.localfilename"/>
          <stringProp name="FTPSampler.inputdata"/>
          <boolProp name="FTPSampler.binarymode">false</boolProp>
          <boolProp name="FTPSampler.saveresponse">false</boolProp>
          <boolProp name="FTPSampler.upload">false</boolProp>
        </ConfigTestElement>
      EOS
      update params
      update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jmeter_perf-0.0.7 lib/jmeter_perf/dsl/ftp_request_defaults.rb