Class: JmeterPerf::DSL::HTTPRequestDefaults

Inherits:
Object
  • Object
show all
Includes:
Helpers::XmlDocumentUpdater
Defined in:
lib/jmeter_perf/dsl/http_request_defaults.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ HTTPRequestDefaults

Returns a new instance of HTTPRequestDefaults.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/jmeter_perf/dsl/http_request_defaults.rb', line 17

def initialize(params = {})
  testname = params.is_a?(Array) ? "HTTPRequestDefaults" : (params[:name] || "HTTPRequestDefaults")
  @doc = Nokogiri::XML(JmeterPerf::Helpers::String.strip_heredoc(
    <<~EOS
      <ConfigTestElement guiclass="HttpDefaultsGui" testclass="ConfigTestElement" testname="#{testname}" enabled="true">
        <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="#{testname}" enabled="true">
          <collectionProp name="Arguments.arguments">
            <elementProp name="" elementType="HTTPArgument">
              <boolProp name="HTTPArgument.always_encode">false</boolProp>
              <stringProp name="Argument.value">username=my_name&amp;password=my_password&amp;email="my name &lt;[email protected]&gt;"</stringProp>
              <stringProp name="Argument.metadata">=</stringProp>
            </elementProp>
          </collectionProp>
        </elementProp>
        <stringProp name="HTTPSampler.domain"/>
        <stringProp name="HTTPSampler.port"/>
        <stringProp name="HTTPSampler.proxyHost"/>
        <stringProp name="HTTPSampler.proxyPort"/>
        <stringProp name="HTTPSampler.connect_timeout"/>
        <stringProp name="HTTPSampler.response_timeout"/>
        <stringProp name="HTTPSampler.protocol"/>
        <stringProp name="HTTPSampler.contentEncoding"/>
        <stringProp name="HTTPSampler.path">/</stringProp>
        <stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
        <boolProp name="HTTPSampler.image_parser">true</boolProp>
        <boolProp name="HTTPSampler.concurrentDwn">true</boolProp>
        <stringProp name="HTTPSampler.concurrentPool">4</stringProp>
        <stringProp name="HTTPSampler.embedded_url_re"/>
      </ConfigTestElement>
    EOS
  ))
  update params
  update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
end

Instance Attribute Details

#docObject

Returns the value of attribute doc.



14
15
16
# File 'lib/jmeter_perf/dsl/http_request_defaults.rb', line 14

def doc
  @doc
end