module JmeterPerf
module Plugins
class PerfmonCollector
attr_accessor :doc
include Helper
def initialize(params = {})
@doc = Nokogiri::XML(<<-XML.strip_heredoc)
falsesaveConfigtruetruetruetruefalsetruefalsefalsefalsefalsefalsefalse#{params[:xml] || false}falsefalsefalsefalsefalse0truetruetrue#{params[:filename] || "perfmon.jtl"}1000falsefalsefalse
#{metric_connections(params).root}
XML
update params
end
private
def metric_connections(params)
Nokogiri::XML(<<-XML.strip_heredoc)
#{metric_nodes(params[:nodes]).join "\n"}
XML
end
def metric_nodes(nodes)
nodes.collect do |node|
%(
#{node[:server]}#{node[:port]}#{node[:metric]}#{node[:parameters]}
)
end
end
end
end
end