ruby-jmeter 2.0.3 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. data/examples/basic_header.rb +5 -1
  2. data/examples/basic_user_defined_variables.rb +10 -0
  3. data/lib/ruby-jmeter/dsl/access_log_sampler.rb +3 -3
  4. data/lib/ruby-jmeter/dsl/aggregate_graph.rb +3 -3
  5. data/lib/ruby-jmeter/dsl/aggregate_report.rb +3 -3
  6. data/lib/ruby-jmeter/dsl/ajp13_sampler.rb +4 -4
  7. data/lib/ruby-jmeter/dsl/assertion_results.rb +3 -3
  8. data/lib/ruby-jmeter/dsl/beanshell_assertion.rb +3 -3
  9. data/lib/ruby-jmeter/dsl/beanshell_listener.rb +3 -3
  10. data/lib/ruby-jmeter/dsl/beanshell_postprocessor.rb +3 -3
  11. data/lib/ruby-jmeter/dsl/beanshell_preprocessor.rb +3 -3
  12. data/lib/ruby-jmeter/dsl/beanshell_sampler.rb +3 -3
  13. data/lib/ruby-jmeter/dsl/beanshell_timer.rb +3 -3
  14. data/lib/ruby-jmeter/dsl/bsf_assertion.rb +3 -3
  15. data/lib/ruby-jmeter/dsl/bsf_listener.rb +3 -3
  16. data/lib/ruby-jmeter/dsl/bsf_postprocessor.rb +3 -3
  17. data/lib/ruby-jmeter/dsl/bsf_preprocessor.rb +3 -3
  18. data/lib/ruby-jmeter/dsl/bsf_sampler.rb +3 -3
  19. data/lib/ruby-jmeter/dsl/bsf_timer.rb +3 -3
  20. data/lib/ruby-jmeter/dsl/compare_assertion.rb +3 -3
  21. data/lib/ruby-jmeter/dsl/comparison_assertion_visualizer.rb +3 -3
  22. data/lib/ruby-jmeter/dsl/constant_throughput_timer.rb +3 -3
  23. data/lib/ruby-jmeter/dsl/constant_timer.rb +3 -3
  24. data/lib/ruby-jmeter/dsl/counter.rb +3 -3
  25. data/lib/ruby-jmeter/dsl/cssjquery_extractor.rb +3 -3
  26. data/lib/ruby-jmeter/dsl/csv_data_set_config.rb +3 -3
  27. data/lib/ruby-jmeter/dsl/debug_postprocessor.rb +3 -3
  28. data/lib/ruby-jmeter/dsl/debug_sampler.rb +3 -3
  29. data/lib/ruby-jmeter/dsl/distribution_graphalpha.rb +3 -3
  30. data/lib/ruby-jmeter/dsl/duration_assertion.rb +3 -3
  31. data/lib/ruby-jmeter/dsl/foreach_controller.rb +3 -3
  32. data/lib/ruby-jmeter/dsl/ftp_request.rb +3 -3
  33. data/lib/ruby-jmeter/dsl/ftp_request_defaults.rb +3 -3
  34. data/lib/ruby-jmeter/dsl/gaussian_random_timer.rb +3 -3
  35. data/lib/ruby-jmeter/dsl/generate_summary_results.rb +3 -3
  36. data/lib/ruby-jmeter/dsl/graph_results.rb +3 -3
  37. data/lib/ruby-jmeter/dsl/html_assertion.rb +3 -3
  38. data/lib/ruby-jmeter/dsl/html_link_parser.rb +3 -3
  39. data/lib/ruby-jmeter/dsl/html_parameter_mask.rb +3 -3
  40. data/lib/ruby-jmeter/dsl/http_authorization_manager.rb +3 -3
  41. data/lib/ruby-jmeter/dsl/http_cache_manager.rb +3 -3
  42. data/lib/ruby-jmeter/dsl/http_cookie_manager.rb +3 -3
  43. data/lib/ruby-jmeter/dsl/http_header_manager.rb +3 -3
  44. data/lib/ruby-jmeter/dsl/http_request.rb +4 -4
  45. data/lib/ruby-jmeter/dsl/http_request_defaults.rb +4 -4
  46. data/lib/ruby-jmeter/dsl/http_url_rewriting_modifier.rb +3 -3
  47. data/lib/ruby-jmeter/dsl/if_controller.rb +3 -3
  48. data/lib/ruby-jmeter/dsl/include_controller.rb +3 -3
  49. data/lib/ruby-jmeter/dsl/java_request.rb +3 -3
  50. data/lib/ruby-jmeter/dsl/java_request_defaults.rb +3 -3
  51. data/lib/ruby-jmeter/dsl/jdbc_connection_configuration.rb +3 -3
  52. data/lib/ruby-jmeter/dsl/jdbc_postprocessor.rb +3 -3
  53. data/lib/ruby-jmeter/dsl/jdbc_preprocessor.rb +3 -3
  54. data/lib/ruby-jmeter/dsl/jdbc_request.rb +3 -3
  55. data/lib/ruby-jmeter/dsl/jms_pointtopoint.rb +5 -5
  56. data/lib/ruby-jmeter/dsl/jms_publisher.rb +4 -4
  57. data/lib/ruby-jmeter/dsl/jms_subscriber.rb +3 -3
  58. data/lib/ruby-jmeter/dsl/jsr223_assertion.rb +3 -3
  59. data/lib/ruby-jmeter/dsl/jsr223_listener.rb +3 -3
  60. data/lib/ruby-jmeter/dsl/jsr223_postprocessor.rb +3 -3
  61. data/lib/ruby-jmeter/dsl/jsr223_preprocessor.rb +3 -3
  62. data/lib/ruby-jmeter/dsl/jsr223_sampler.rb +3 -3
  63. data/lib/ruby-jmeter/dsl/jsr223_timer.rb +3 -3
  64. data/lib/ruby-jmeter/dsl/junit_request.rb +3 -3
  65. data/lib/ruby-jmeter/dsl/keystore_configuration.rb +3 -3
  66. data/lib/ruby-jmeter/dsl/ldap_extended_request.rb +3 -3
  67. data/lib/ruby-jmeter/dsl/ldap_extended_request_defaults.rb +3 -3
  68. data/lib/ruby-jmeter/dsl/ldap_request.rb +4 -4
  69. data/lib/ruby-jmeter/dsl/ldap_request_defaults.rb +4 -4
  70. data/lib/ruby-jmeter/dsl/login_config_element.rb +3 -3
  71. data/lib/ruby-jmeter/dsl/loop_controller.rb +3 -3
  72. data/lib/ruby-jmeter/dsl/mail_reader_sampler.rb +3 -3
  73. data/lib/ruby-jmeter/dsl/mailer_visualizer.rb +3 -3
  74. data/lib/ruby-jmeter/dsl/md5hex_assertion.rb +3 -3
  75. data/lib/ruby-jmeter/dsl/module_controller.rb +3 -3
  76. data/lib/ruby-jmeter/dsl/monitor_results.rb +3 -3
  77. data/lib/ruby-jmeter/dsl/once_only_controller.rb +3 -3
  78. data/lib/ruby-jmeter/dsl/os_process_sampler.rb +5 -5
  79. data/lib/ruby-jmeter/dsl/poisson_random_timer.rb +3 -3
  80. data/lib/ruby-jmeter/dsl/random_controller.rb +3 -3
  81. data/lib/ruby-jmeter/dsl/random_order_controller.rb +3 -3
  82. data/lib/ruby-jmeter/dsl/random_variable.rb +3 -3
  83. data/lib/ruby-jmeter/dsl/recording_controller.rb +3 -3
  84. data/lib/ruby-jmeter/dsl/regex_user_parameters.rb +3 -3
  85. data/lib/ruby-jmeter/dsl/regular_expression_extractor.rb +3 -3
  86. data/lib/ruby-jmeter/dsl/response_assertion.rb +3 -3
  87. data/lib/ruby-jmeter/dsl/response_time_graph.rb +3 -3
  88. data/lib/ruby-jmeter/dsl/result_status_action_handler.rb +3 -3
  89. data/lib/ruby-jmeter/dsl/runtime_controller.rb +3 -3
  90. data/lib/ruby-jmeter/dsl/save_responses_to_a_file.rb +3 -3
  91. data/lib/ruby-jmeter/dsl/simple_config_element.rb +3 -3
  92. data/lib/ruby-jmeter/dsl/simple_controller.rb +3 -3
  93. data/lib/ruby-jmeter/dsl/simple_data_writer.rb +3 -3
  94. data/lib/ruby-jmeter/dsl/smime_assertion.rb +3 -3
  95. data/lib/ruby-jmeter/dsl/smtp_sampler.rb +3 -3
  96. data/lib/ruby-jmeter/dsl/soapxmlrpc_request.rb +3 -3
  97. data/lib/ruby-jmeter/dsl/spline_visualizer.rb +3 -3
  98. data/lib/ruby-jmeter/dsl/summary_report.rb +3 -3
  99. data/lib/ruby-jmeter/dsl/switch_controller.rb +3 -3
  100. data/lib/ruby-jmeter/dsl/synchronizing_timer.rb +3 -3
  101. data/lib/ruby-jmeter/dsl/tcp_sampler.rb +3 -3
  102. data/lib/ruby-jmeter/dsl/tcp_sampler_config.rb +3 -3
  103. data/lib/ruby-jmeter/dsl/test_action.rb +3 -3
  104. data/lib/ruby-jmeter/dsl/test_plan.rb +4 -4
  105. data/lib/ruby-jmeter/dsl/thread_group.rb +4 -4
  106. data/lib/ruby-jmeter/dsl/throughput_controller.rb +3 -3
  107. data/lib/ruby-jmeter/dsl/transaction_controller.rb +3 -3
  108. data/lib/ruby-jmeter/dsl/uniform_random_timer.rb +3 -3
  109. data/lib/ruby-jmeter/dsl/user_defined_variables.rb +3 -3
  110. data/lib/ruby-jmeter/dsl/user_parameters.rb +3 -3
  111. data/lib/ruby-jmeter/dsl/view_results_in_table.rb +3 -3
  112. data/lib/ruby-jmeter/dsl/view_results_tree.rb +3 -3
  113. data/lib/ruby-jmeter/dsl/while_controller.rb +3 -3
  114. data/lib/ruby-jmeter/dsl/xml_assertion.rb +3 -3
  115. data/lib/ruby-jmeter/dsl/xml_schema_assertion.rb +3 -3
  116. data/lib/ruby-jmeter/dsl/xpath_assertion.rb +3 -3
  117. data/lib/ruby-jmeter/dsl/xpath_extractor.rb +3 -3
  118. data/lib/ruby-jmeter/dsl.rb +6 -2
  119. data/lib/ruby-jmeter/helpers/helper.rb +20 -3
  120. data/lib/ruby-jmeter/idl.rb +3 -3
  121. data/lib/ruby-jmeter/version.rb +1 -1
  122. data/spec/dsl_spec.rb +22 -0
  123. metadata +4 -6
@@ -11,14 +11,14 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'ResultStatusActionHandler'
14
+ testname = params.kind_of?(Array) ? 'ResultStatusActionHandler' : (params[:name] || 'ResultStatusActionHandler')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <ResultAction guiclass="ResultActionGui" testclass="ResultAction" testname="#{params[:name]}" enabled="true">
16
+ <ResultAction guiclass="ResultActionGui" testclass="ResultAction" testname="#{testname}" enabled="true">
17
17
  <intProp name="OnError.action">0</intProp>
18
18
  </ResultAction>)
19
19
  EOS
20
20
  update params
21
- update_at_xpath params if params[:update_at_xpath]
21
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
22
22
  end
23
23
  end
24
24
 
@@ -11,14 +11,14 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'RuntimeController'
14
+ testname = params.kind_of?(Array) ? 'RuntimeController' : (params[:name] || 'RuntimeController')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <RunTime guiclass="RunTimeGui" testclass="RunTime" testname="#{params[:name]}" enabled="true">
16
+ <RunTime guiclass="RunTimeGui" testclass="RunTime" testname="#{testname}" enabled="true">
17
17
  <stringProp name="RunTime.seconds">1</stringProp>
18
18
  </RunTime>)
19
19
  EOS
20
20
  update params
21
- update_at_xpath params if params[:update_at_xpath]
21
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
22
22
  end
23
23
  end
24
24
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'SaveResponsesToAFile'
14
+ testname = params.kind_of?(Array) ? 'SaveResponsesToAFile' : (params[:name] || 'SaveResponsesToAFile')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <ResultSaver guiclass="ResultSaverGui" testclass="ResultSaver" testname="#{params[:name]}" enabled="true">
16
+ <ResultSaver guiclass="ResultSaverGui" testclass="ResultSaver" testname="#{testname}" enabled="true">
17
17
  <stringProp name="FileSaver.filename"/>
18
18
  <boolProp name="FileSaver.errorsonly">false</boolProp>
19
19
  <boolProp name="FileSaver.skipautonumber">false</boolProp>
@@ -22,7 +22,7 @@ module RubyJmeter
22
22
  </ResultSaver>)
23
23
  EOS
24
24
  update params
25
- update_at_xpath params if params[:update_at_xpath]
25
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
26
26
  end
27
27
  end
28
28
 
@@ -11,12 +11,12 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'SimpleConfigElement'
14
+ testname = params.kind_of?(Array) ? 'SimpleConfigElement' : (params[:name] || 'SimpleConfigElement')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <ConfigTestElement guiclass="SimpleConfigGui" testclass="ConfigTestElement" testname="#{params[:name]}" enabled="true"/>)
16
+ <ConfigTestElement guiclass="SimpleConfigGui" testclass="ConfigTestElement" testname="#{testname}" enabled="true"/>)
17
17
  EOS
18
18
  update params
19
- update_at_xpath params if params[:update_at_xpath]
19
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
20
20
  end
21
21
  end
22
22
 
@@ -11,12 +11,12 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'SimpleController'
14
+ testname = params.kind_of?(Array) ? 'SimpleController' : (params[:name] || 'SimpleController')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="#{params[:name]}" enabled="true"/>)
16
+ <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="#{testname}" enabled="true"/>)
17
17
  EOS
18
18
  update params
19
- update_at_xpath params if params[:update_at_xpath]
19
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
20
20
  end
21
21
  end
22
22
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'SimpleDataWriter'
14
+ testname = params.kind_of?(Array) ? 'SimpleDataWriter' : (params[:name] || 'SimpleDataWriter')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <ResultCollector guiclass="SimpleDataWriter" testclass="ResultCollector" testname="#{params[:name]}" enabled="true">
16
+ <ResultCollector guiclass="SimpleDataWriter" testclass="ResultCollector" testname="#{testname}" enabled="true">
17
17
  <boolProp name="ResultCollector.error_logging">false</boolProp>
18
18
  <objProp>
19
19
  <name>saveConfig</name>
@@ -48,7 +48,7 @@ module RubyJmeter
48
48
  </ResultCollector>)
49
49
  EOS
50
50
  update params
51
- update_at_xpath params if params[:update_at_xpath]
51
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
52
52
  end
53
53
  end
54
54
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'SmimeAssertion'
14
+ testname = params.kind_of?(Array) ? 'SmimeAssertion' : (params[:name] || 'SmimeAssertion')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <SMIMEAssertion guiclass="SMIMEAssertionGui" testclass="SMIMEAssertion" testname="#{params[:name]}" enabled="true">
16
+ <SMIMEAssertion guiclass="SMIMEAssertionGui" testclass="SMIMEAssertion" testname="#{testname}" enabled="true">
17
17
  <boolProp name="SMIMEAssert.verifySignature">false</boolProp>
18
18
  <boolProp name="SMIMEAssert.notSigned">false</boolProp>
19
19
  <stringProp name="SMIMEAssert.issuerDn"/>
@@ -28,7 +28,7 @@ module RubyJmeter
28
28
  </SMIMEAssertion>)
29
29
  EOS
30
30
  update params
31
- update_at_xpath params if params[:update_at_xpath]
31
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
32
32
  end
33
33
  end
34
34
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'SmtpSampler'
14
+ testname = params.kind_of?(Array) ? 'SmtpSampler' : (params[:name] || 'SmtpSampler')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <SmtpSampler guiclass="SmtpSamplerGui" testclass="SmtpSampler" testname="#{params[:name]}" enabled="true">
16
+ <SmtpSampler guiclass="SmtpSamplerGui" testclass="SmtpSampler" testname="#{testname}" enabled="true">
17
17
  <stringProp name="SMTPSampler.server"/>
18
18
  <stringProp name="SMTPSampler.serverPort"/>
19
19
  <stringProp name="SMTPSampler.mailFrom"/>
@@ -44,7 +44,7 @@ module RubyJmeter
44
44
  </SmtpSampler>)
45
45
  EOS
46
46
  update params
47
- update_at_xpath params if params[:update_at_xpath]
47
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
48
48
  end
49
49
  end
50
50
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'SoapxmlrpcRequest'
14
+ testname = params.kind_of?(Array) ? 'SoapxmlrpcRequest' : (params[:name] || 'SoapxmlrpcRequest')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <SoapSampler guiclass="SoapSamplerGui" testclass="SoapSampler" testname="#{params[:name]}" enabled="true">
16
+ <SoapSampler guiclass="SoapSamplerGui" testclass="SoapSampler" testname="#{testname}" enabled="true">
17
17
  <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
18
18
  <collectionProp name="Arguments.arguments"/>
19
19
  </elementProp>
@@ -26,7 +26,7 @@ module RubyJmeter
26
26
  </SoapSampler>)
27
27
  EOS
28
28
  update params
29
- update_at_xpath params if params[:update_at_xpath]
29
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
30
30
  end
31
31
  end
32
32
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'SplineVisualizer'
14
+ testname = params.kind_of?(Array) ? 'SplineVisualizer' : (params[:name] || 'SplineVisualizer')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <ResultCollector guiclass="SplineVisualizer" testclass="ResultCollector" testname="#{params[:name]}" enabled="true">
16
+ <ResultCollector guiclass="SplineVisualizer" testclass="ResultCollector" testname="#{testname}" enabled="true">
17
17
  <boolProp name="ResultCollector.error_logging">false</boolProp>
18
18
  <objProp>
19
19
  <name>saveConfig</name>
@@ -48,7 +48,7 @@ module RubyJmeter
48
48
  </ResultCollector>)
49
49
  EOS
50
50
  update params
51
- update_at_xpath params if params[:update_at_xpath]
51
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
52
52
  end
53
53
  end
54
54
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'SummaryReport'
14
+ testname = params.kind_of?(Array) ? 'SummaryReport' : (params[:name] || 'SummaryReport')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <ResultCollector guiclass="SummaryReport" testclass="ResultCollector" testname="#{params[:name]}" enabled="true">
16
+ <ResultCollector guiclass="SummaryReport" testclass="ResultCollector" testname="#{testname}" enabled="true">
17
17
  <boolProp name="ResultCollector.error_logging">false</boolProp>
18
18
  <objProp>
19
19
  <name>saveConfig</name>
@@ -48,7 +48,7 @@ module RubyJmeter
48
48
  </ResultCollector>)
49
49
  EOS
50
50
  update params
51
- update_at_xpath params if params[:update_at_xpath]
51
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
52
52
  end
53
53
  end
54
54
 
@@ -11,14 +11,14 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'SwitchController'
14
+ testname = params.kind_of?(Array) ? 'SwitchController' : (params[:name] || 'SwitchController')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <SwitchController guiclass="SwitchControllerGui" testclass="SwitchController" testname="#{params[:name]}" enabled="true">
16
+ <SwitchController guiclass="SwitchControllerGui" testclass="SwitchController" testname="#{testname}" enabled="true">
17
17
  <stringProp name="SwitchController.value"/>
18
18
  </SwitchController>)
19
19
  EOS
20
20
  update params
21
- update_at_xpath params if params[:update_at_xpath]
21
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
22
22
  end
23
23
  end
24
24
 
@@ -11,14 +11,14 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'SynchronizingTimer'
14
+ testname = params.kind_of?(Array) ? 'SynchronizingTimer' : (params[:name] || 'SynchronizingTimer')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <SyncTimer guiclass="TestBeanGUI" testclass="SyncTimer" testname="#{params[:name]}" enabled="true">
16
+ <SyncTimer guiclass="TestBeanGUI" testclass="SyncTimer" testname="#{testname}" enabled="true">
17
17
  <intProp name="groupSize">0</intProp>
18
18
  </SyncTimer>)
19
19
  EOS
20
20
  update params
21
- update_at_xpath params if params[:update_at_xpath]
21
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
22
22
  end
23
23
  end
24
24
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'TcpSampler'
14
+ testname = params.kind_of?(Array) ? 'TcpSampler' : (params[:name] || 'TcpSampler')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <TCPSampler guiclass="TCPSamplerGui" testclass="TCPSampler" testname="#{params[:name]}" enabled="true">
16
+ <TCPSampler guiclass="TCPSamplerGui" testclass="TCPSampler" testname="#{testname}" enabled="true">
17
17
  <stringProp name="TCPSampler.server"/>
18
18
  <boolProp name="TCPSampler.reUseConnection">true</boolProp>
19
19
  <stringProp name="TCPSampler.port"/>
@@ -26,7 +26,7 @@ module RubyJmeter
26
26
  </TCPSampler>)
27
27
  EOS
28
28
  update params
29
- update_at_xpath params if params[:update_at_xpath]
29
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
30
30
  end
31
31
  end
32
32
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'TcpSamplerConfig'
14
+ testname = params.kind_of?(Array) ? 'TcpSamplerConfig' : (params[:name] || 'TcpSamplerConfig')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <ConfigTestElement guiclass="TCPConfigGui" testclass="ConfigTestElement" testname="#{params[:name]}" enabled="true">
16
+ <ConfigTestElement guiclass="TCPConfigGui" testclass="ConfigTestElement" testname="#{testname}" enabled="true">
17
17
  <stringProp name="TCPSampler.server"/>
18
18
  <boolProp name="TCPSampler.reUseConnection">true</boolProp>
19
19
  <stringProp name="TCPSampler.port"/>
@@ -24,7 +24,7 @@ module RubyJmeter
24
24
  </ConfigTestElement>)
25
25
  EOS
26
26
  update params
27
- update_at_xpath params if params[:update_at_xpath]
27
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
28
28
  end
29
29
  end
30
30
 
@@ -11,16 +11,16 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'TestAction'
14
+ testname = params.kind_of?(Array) ? 'TestAction' : (params[:name] || 'TestAction')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <TestAction guiclass="TestActionGui" testclass="TestAction" testname="#{params[:name]}" enabled="true">
16
+ <TestAction guiclass="TestActionGui" testclass="TestAction" testname="#{testname}" enabled="true">
17
17
  <intProp name="ActionProcessor.action">1</intProp>
18
18
  <intProp name="ActionProcessor.target">0</intProp>
19
19
  <stringProp name="ActionProcessor.duration"/>
20
20
  </TestAction>)
21
21
  EOS
22
22
  update params
23
- update_at_xpath params if params[:update_at_xpath]
23
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
24
24
  end
25
25
  end
26
26
 
@@ -11,20 +11,20 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'TestPlan'
14
+ testname = params.kind_of?(Array) ? 'TestPlan' : (params[:name] || 'TestPlan')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="#{params[:name]}" enabled="true">
16
+ <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="#{testname}" enabled="true">
17
17
  <stringProp name="TestPlan.comments"/>
18
18
  <boolProp name="TestPlan.functional_mode">false</boolProp>
19
19
  <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
20
- <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="#{params[:name]}" enabled="true">
20
+ <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="#{testname}" enabled="true">
21
21
  <collectionProp name="Arguments.arguments"/>
22
22
  </elementProp>
23
23
  <stringProp name="TestPlan.user_define_classpath"/>
24
24
  </TestPlan>)
25
25
  EOS
26
26
  update params
27
- update_at_xpath params if params[:update_at_xpath]
27
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
28
28
  end
29
29
  end
30
30
 
@@ -11,11 +11,11 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'ThreadGroup'
14
+ testname = params.kind_of?(Array) ? 'ThreadGroup' : (params[:name] || 'ThreadGroup')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="#{params[:name]}" enabled="true">
16
+ <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="#{testname}" enabled="true">
17
17
  <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
18
- <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="#{params[:name]}" enabled="true">
18
+ <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="#{testname}" enabled="true">
19
19
  <boolProp name="LoopController.continue_forever">false</boolProp>
20
20
  <stringProp name="LoopController.loops">1</stringProp>
21
21
  </elementProp>
@@ -29,7 +29,7 @@ module RubyJmeter
29
29
  </ThreadGroup>)
30
30
  EOS
31
31
  update params
32
- update_at_xpath params if params[:update_at_xpath]
32
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
33
33
  end
34
34
  end
35
35
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'ThroughputController'
14
+ testname = params.kind_of?(Array) ? 'ThroughputController' : (params[:name] || 'ThroughputController')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="#{params[:name]}" enabled="true">
16
+ <ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="#{testname}" enabled="true">
17
17
  <intProp name="ThroughputController.style">0</intProp>
18
18
  <boolProp name="ThroughputController.perThread">false</boolProp>
19
19
  <intProp name="ThroughputController.maxThroughput">1</intProp>
@@ -25,7 +25,7 @@ module RubyJmeter
25
25
  </ThroughputController>)
26
26
  EOS
27
27
  update params
28
- update_at_xpath params if params[:update_at_xpath]
28
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
29
29
  end
30
30
  end
31
31
 
@@ -11,15 +11,15 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'TransactionController'
14
+ testname = params.kind_of?(Array) ? 'TransactionController' : (params[:name] || 'TransactionController')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <TransactionController guiclass="TransactionControllerGui" testclass="TransactionController" testname="#{params[:name]}" enabled="true">
16
+ <TransactionController guiclass="TransactionControllerGui" testclass="TransactionController" testname="#{testname}" enabled="true">
17
17
  <boolProp name="TransactionController.parent">true</boolProp>
18
18
  <boolProp name="TransactionController.includeTimers">false</boolProp>
19
19
  </TransactionController>)
20
20
  EOS
21
21
  update params
22
- update_at_xpath params if params[:update_at_xpath]
22
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
23
23
  end
24
24
  end
25
25
 
@@ -11,15 +11,15 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'UniformRandomTimer'
14
+ testname = params.kind_of?(Array) ? 'UniformRandomTimer' : (params[:name] || 'UniformRandomTimer')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <UniformRandomTimer guiclass="UniformRandomTimerGui" testclass="UniformRandomTimer" testname="#{params[:name]}" enabled="true">
16
+ <UniformRandomTimer guiclass="UniformRandomTimerGui" testclass="UniformRandomTimer" testname="#{testname}" enabled="true">
17
17
  <stringProp name="ConstantTimer.delay">0</stringProp>
18
18
  <stringProp name="RandomTimer.range">100.0</stringProp>
19
19
  </UniformRandomTimer>)
20
20
  EOS
21
21
  update params
22
- update_at_xpath params if params[:update_at_xpath]
22
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
23
23
  end
24
24
  end
25
25
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'UserDefinedVariables'
14
+ testname = params.kind_of?(Array) ? 'UserDefinedVariables' : (params[:name] || 'UserDefinedVariables')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <Arguments guiclass="ArgumentsPanel" testclass="Arguments" testname="#{params[:name]}" enabled="true">
16
+ <Arguments guiclass="ArgumentsPanel" testclass="Arguments" testname="#{testname}" enabled="true">
17
17
  <collectionProp name="Arguments.arguments">
18
18
  <elementProp name="testguid" elementType="Argument">
19
19
  <stringProp name="Argument.name"/>
@@ -25,7 +25,7 @@ module RubyJmeter
25
25
  </Arguments>)
26
26
  EOS
27
27
  update params
28
- update_at_xpath params if params[:update_at_xpath]
28
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
29
29
  end
30
30
  end
31
31
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'UserParameters'
14
+ testname = params.kind_of?(Array) ? 'UserParameters' : (params[:name] || 'UserParameters')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <UserParameters guiclass="UserParametersGui" testclass="UserParameters" testname="#{params[:name]}" enabled="true">
16
+ <UserParameters guiclass="UserParametersGui" testclass="UserParameters" testname="#{testname}" enabled="true">
17
17
  <collectionProp name="UserParameters.names"/>
18
18
  <collectionProp name="UserParameters.thread_values">
19
19
  <collectionProp name="1"/>
@@ -22,7 +22,7 @@ module RubyJmeter
22
22
  </UserParameters>)
23
23
  EOS
24
24
  update params
25
- update_at_xpath params if params[:update_at_xpath]
25
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
26
26
  end
27
27
  end
28
28
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'ViewResultsInTable'
14
+ testname = params.kind_of?(Array) ? 'ViewResultsInTable' : (params[:name] || 'ViewResultsInTable')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <ResultCollector guiclass="TableVisualizer" testclass="ResultCollector" testname="#{params[:name]}" enabled="true">
16
+ <ResultCollector guiclass="TableVisualizer" testclass="ResultCollector" testname="#{testname}" enabled="true">
17
17
  <boolProp name="ResultCollector.error_logging">false</boolProp>
18
18
  <objProp>
19
19
  <name>saveConfig</name>
@@ -48,7 +48,7 @@ module RubyJmeter
48
48
  </ResultCollector>)
49
49
  EOS
50
50
  update params
51
- update_at_xpath params if params[:update_at_xpath]
51
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
52
52
  end
53
53
  end
54
54
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'ViewResultsTree'
14
+ testname = params.kind_of?(Array) ? 'ViewResultsTree' : (params[:name] || 'ViewResultsTree')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="#{params[:name]}" enabled="true">
16
+ <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="#{testname}" enabled="true">
17
17
  <boolProp name="ResultCollector.error_logging">false</boolProp>
18
18
  <objProp>
19
19
  <name>saveConfig</name>
@@ -48,7 +48,7 @@ module RubyJmeter
48
48
  </ResultCollector>)
49
49
  EOS
50
50
  update params
51
- update_at_xpath params if params[:update_at_xpath]
51
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
52
52
  end
53
53
  end
54
54
 
@@ -11,14 +11,14 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'WhileController'
14
+ testname = params.kind_of?(Array) ? 'WhileController' : (params[:name] || 'WhileController')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <WhileController guiclass="WhileControllerGui" testclass="WhileController" testname="#{params[:name]}" enabled="true">
16
+ <WhileController guiclass="WhileControllerGui" testclass="WhileController" testname="#{testname}" enabled="true">
17
17
  <stringProp name="WhileController.condition"/>
18
18
  </WhileController>)
19
19
  EOS
20
20
  update params
21
- update_at_xpath params if params[:update_at_xpath]
21
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
22
22
  end
23
23
  end
24
24
 
@@ -11,12 +11,12 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'XmlAssertion'
14
+ testname = params.kind_of?(Array) ? 'XmlAssertion' : (params[:name] || 'XmlAssertion')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <XMLAssertion guiclass="XMLAssertionGui" testclass="XMLAssertion" testname="#{params[:name]}" enabled="true"/>)
16
+ <XMLAssertion guiclass="XMLAssertionGui" testclass="XMLAssertion" testname="#{testname}" enabled="true"/>)
17
17
  EOS
18
18
  update params
19
- update_at_xpath params if params[:update_at_xpath]
19
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
20
20
  end
21
21
  end
22
22
 
@@ -11,14 +11,14 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'XmlSchemaAssertion'
14
+ testname = params.kind_of?(Array) ? 'XmlSchemaAssertion' : (params[:name] || 'XmlSchemaAssertion')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <XMLSchemaAssertion guiclass="XMLSchemaAssertionGUI" testclass="XMLSchemaAssertion" testname="#{params[:name]}" enabled="true">
16
+ <XMLSchemaAssertion guiclass="XMLSchemaAssertionGUI" testclass="XMLSchemaAssertion" testname="#{testname}" enabled="true">
17
17
  <stringProp name="xmlschema_assertion_filename"/>
18
18
  </XMLSchemaAssertion>)
19
19
  EOS
20
20
  update params
21
- update_at_xpath params if params[:update_at_xpath]
21
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
22
22
  end
23
23
  end
24
24
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'XpathAssertion'
14
+ testname = params.kind_of?(Array) ? 'XpathAssertion' : (params[:name] || 'XpathAssertion')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <XPathAssertion guiclass="XPathAssertionGui" testclass="XPathAssertion" testname="#{params[:name]}" enabled="true">
16
+ <XPathAssertion guiclass="XPathAssertionGui" testclass="XPathAssertion" testname="#{testname}" enabled="true">
17
17
  <boolProp name="XPath.negate">false</boolProp>
18
18
  <stringProp name="XPath.xpath">/</stringProp>
19
19
  <boolProp name="XPath.validate">false</boolProp>
@@ -23,7 +23,7 @@ module RubyJmeter
23
23
  </XPathAssertion>)
24
24
  EOS
25
25
  update params
26
- update_at_xpath params if params[:update_at_xpath]
26
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
27
27
  end
28
28
  end
29
29
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'XpathExtractor'
14
+ testname = params.kind_of?(Array) ? 'XpathExtractor' : (params[:name] || 'XpathExtractor')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <XPathExtractor guiclass="XPathExtractorGui" testclass="XPathExtractor" testname="#{params[:name]}" enabled="true">
16
+ <XPathExtractor guiclass="XPathExtractorGui" testclass="XPathExtractor" testname="#{testname}" enabled="true">
17
17
  <stringProp name="XPathExtractor.default"/>
18
18
  <stringProp name="XPathExtractor.refname"/>
19
19
  <stringProp name="XPathExtractor.xpathQuery"/>
@@ -23,7 +23,7 @@ module RubyJmeter
23
23
  </XPathExtractor>)
24
24
  EOS
25
25
  update params
26
- update_at_xpath params if params[:update_at_xpath]
26
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
27
27
  end
28
28
  end
29
29