Sha256: 49c431802a54b9233aa2af0ef678af4bc056a92bf4b56c2beb99fe445e1d02da

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

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

  class HTTPAuthorizationManager
    attr_accessor :doc
    include Helper

    def initialize(params = {})
      testname = params.is_a?(Array) ? "HTTPAuthorizationManager" : (params[:name] || "HTTPAuthorizationManager")
      @doc = Nokogiri::XML(<<~EOS.strip_heredoc)
        <AuthManager guiclass="AuthPanel" testclass="AuthManager" testname="#{testname}" enabled="true">
          <collectionProp name="AuthManager.auth_list">
            <elementProp name="" elementType="Authorization">
              <stringProp name="Authorization.url"/>
              <stringProp name="Authorization.username"/>
              <stringProp name="Authorization.password"/>
              <stringProp name="Authorization.domain"/>
              <stringProp name="Authorization.realm"/>
            </elementProp>
          </collectionProp>
        </AuthManager>
      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/http_authorization_manager.rb
jmeter_perf-0.0.2 lib/jmeter_perf/dsl/http_authorization_manager.rb