Class: JmeterPerf::Plugins::CompositeGraph

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ CompositeGraph

Returns a new instance of CompositeGraph.



6
7
8
9
10
11
12
13
14
15
16
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/jmeter_perf/plugins/composite_graph.rb', line 6

def initialize(params = {})
  testname = params.is_a?(Array) ? "CompositeGraph" : (params[:name] || "CompositeGraph")
  graph_nodes = params.collect { |g| "<stringProp name=\"\">#{g[:graph]}</stringProp>" }
  metric_nodes = params.collect { |m| "<stringProp name=\"\">#{m[:metric]}</stringProp>" }

  composite_collections = Nokogiri::XML(
    JmeterPerf::Helpers::String.strip_heredoc(
      <<-XML
        <collectionProp name="COMPOSITE_CFG">
          <collectionProp name="">
              #{graph_nodes.join "\n"}
          </collectionProp>
          <collectionProp name="">
              #{metric_nodes.join "\n"}
          </collectionProp>
        </collectionProp>
      XML
    )
  )
  @doc = Nokogiri::XML(
    JmeterPerf::Helpers::String.strip_heredoc(
      <<-XML
        <kg.apc.jmeter.vizualizers.CompositeResultCollector guiclass="kg.apc.jmeter.vizualizers.CompositeGraphGui" testclass="kg.apc.jmeter.vizualizers.CompositeResultCollector" testname="#{testname}" enabled="true">
          <boolProp name="ResultCollector.error_logging">false</boolProp>
          <objProp>
            <name>saveConfig</name>
            <value class="SampleSaveConfiguration">
              <time>true</time>
              <latency>true</latency>
              <timestamp>true</timestamp>
              <success>true</success>
              <label>true</label>
              <code>true</code>
              <message>false</message>
              <threadName>true</threadName>
              <dataType>false</dataType>
              <encoding>false</encoding>
              <assertions>false</assertions>
              <subresults>false</subresults>
              <responseData>false</responseData>
              <samplerData>false</samplerData>
              <xml>false</xml>
              <fieldNames>false</fieldNames>
              <responseHeaders>false</responseHeaders>
              <requestHeaders>false</requestHeaders>
              <responseDataOnError>false</responseDataOnError>
              <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
              <assertionsResultsToSave>0</assertionsResultsToSave>
              <bytes>true</bytes>
              <threadCounts>true</threadCounts>
              <sampleCount>true</sampleCount>
            </value>
          </objProp>
          <stringProp name="filename"></stringProp>
          <longProp name="interval_grouping">500</longProp>
          <boolProp name="graph_aggregated">false</boolProp>
          <stringProp name="include_sample_labels"></stringProp>
          <stringProp name="exclude_sample_labels"></stringProp>
          <stringProp name="start_offset"></stringProp>
          <stringProp name="end_offset"></stringProp>
          <boolProp name="include_checkbox_state">false</boolProp>
          <boolProp name="exclude_checkbox_state">false</boolProp>
          #{composite_collections.root}
        </kg.apc.jmeter.vizualizers.CompositeResultCollector>
      XML
    )
  )
  update params
end

Instance Attribute Details

#docObject

Returns the value of attribute doc.



4
5
6
# File 'lib/jmeter_perf/plugins/composite_graph.rb', line 4

def doc
  @doc
end