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,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'Jsr223Listener'
14
+ testname = params.kind_of?(Array) ? 'Jsr223Listener' : (params[:name] || 'Jsr223Listener')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <JSR223Listener guiclass="TestBeanGUI" testclass="JSR223Listener" testname="#{params[:name]}" enabled="true">
16
+ <JSR223Listener guiclass="TestBeanGUI" testclass="JSR223Listener" testname="#{testname}" enabled="true">
17
17
  <stringProp name="cacheKey"/>
18
18
  <stringProp name="filename"/>
19
19
  <stringProp name="parameters"/>
@@ -22,7 +22,7 @@ module RubyJmeter
22
22
  </JSR223Listener>)
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] ||= 'Jsr223Postprocessor'
14
+ testname = params.kind_of?(Array) ? 'Jsr223Postprocessor' : (params[:name] || 'Jsr223Postprocessor')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="#{params[:name]}" enabled="true">
16
+ <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="#{testname}" enabled="true">
17
17
  <stringProp name="cacheKey"/>
18
18
  <stringProp name="filename"/>
19
19
  <stringProp name="parameters"/>
@@ -22,7 +22,7 @@ module RubyJmeter
22
22
  </JSR223PostProcessor>)
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] ||= 'Jsr223Preprocessor'
14
+ testname = params.kind_of?(Array) ? 'Jsr223Preprocessor' : (params[:name] || 'Jsr223Preprocessor')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="#{params[:name]}" enabled="true">
16
+ <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="#{testname}" enabled="true">
17
17
  <stringProp name="cacheKey"/>
18
18
  <stringProp name="filename"/>
19
19
  <stringProp name="parameters"/>
@@ -22,7 +22,7 @@ module RubyJmeter
22
22
  </JSR223PreProcessor>)
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] ||= 'Jsr223Sampler'
14
+ testname = params.kind_of?(Array) ? 'Jsr223Sampler' : (params[:name] || 'Jsr223Sampler')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="#{params[:name]}" enabled="true">
16
+ <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="#{testname}" enabled="true">
17
17
  <stringProp name="cacheKey"/>
18
18
  <stringProp name="filename"/>
19
19
  <stringProp name="parameters"/>
@@ -22,7 +22,7 @@ module RubyJmeter
22
22
  </JSR223Sampler>)
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] ||= 'Jsr223Timer'
14
+ testname = params.kind_of?(Array) ? 'Jsr223Timer' : (params[:name] || 'Jsr223Timer')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <JSR223Timer guiclass="TestBeanGUI" testclass="JSR223Timer" testname="#{params[:name]}" enabled="true">
16
+ <JSR223Timer guiclass="TestBeanGUI" testclass="JSR223Timer" testname="#{testname}" enabled="true">
17
17
  <stringProp name="cacheKey"/>
18
18
  <stringProp name="filename"/>
19
19
  <stringProp name="parameters"/>
@@ -22,7 +22,7 @@ module RubyJmeter
22
22
  </JSR223Timer>)
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] ||= 'JunitRequest'
14
+ testname = params.kind_of?(Array) ? 'JunitRequest' : (params[:name] || 'JunitRequest')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <JUnitSampler guiclass="JUnitTestSamplerGui" testclass="JUnitSampler" testname="#{params[:name]}" enabled="true">
16
+ <JUnitSampler guiclass="JUnitTestSamplerGui" testclass="JUnitSampler" testname="#{testname}" enabled="true">
17
17
  <stringProp name="junitSampler.classname">test.RerunTest</stringProp>
18
18
  <stringProp name="junitsampler.constructorstring"/>
19
19
  <stringProp name="junitsampler.method">testRerun</stringProp>
@@ -30,7 +30,7 @@ module RubyJmeter
30
30
  </JUnitSampler>)
31
31
  EOS
32
32
  update params
33
- update_at_xpath params if params[:update_at_xpath]
33
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
34
34
  end
35
35
  end
36
36
 
@@ -11,16 +11,16 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'KeystoreConfiguration'
14
+ testname = params.kind_of?(Array) ? 'KeystoreConfiguration' : (params[:name] || 'KeystoreConfiguration')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <KeystoreConfig guiclass="TestBeanGUI" testclass="KeystoreConfig" testname="#{params[:name]}" enabled="true">
16
+ <KeystoreConfig guiclass="TestBeanGUI" testclass="KeystoreConfig" testname="#{testname}" enabled="true">
17
17
  <stringProp name="endIndex"/>
18
18
  <stringProp name="preload">True</stringProp>
19
19
  <stringProp name="startIndex"/>
20
20
  </KeystoreConfig>)
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,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'LdapExtendedRequest'
14
+ testname = params.kind_of?(Array) ? 'LdapExtendedRequest' : (params[:name] || 'LdapExtendedRequest')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <LDAPExtSampler guiclass="LdapExtTestSamplerGui" testclass="LDAPExtSampler" testname="#{params[:name]}" enabled="true">
16
+ <LDAPExtSampler guiclass="LdapExtTestSamplerGui" testclass="LDAPExtSampler" testname="#{testname}" enabled="true">
17
17
  <stringProp name="servername"/>
18
18
  <stringProp name="port"/>
19
19
  <stringProp name="rootdn"/>
@@ -35,7 +35,7 @@ module RubyJmeter
35
35
  </LDAPExtSampler>)
36
36
  EOS
37
37
  update params
38
- update_at_xpath params if params[:update_at_xpath]
38
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
39
39
  end
40
40
  end
41
41
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'LdapExtendedRequestDefaults'
14
+ testname = params.kind_of?(Array) ? 'LdapExtendedRequestDefaults' : (params[:name] || 'LdapExtendedRequestDefaults')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <ConfigTestElement guiclass="LdapExtConfigGui" testclass="ConfigTestElement" testname="#{params[:name]}" enabled="true">
16
+ <ConfigTestElement guiclass="LdapExtConfigGui" testclass="ConfigTestElement" testname="#{testname}" enabled="true">
17
17
  <stringProp name="servername"/>
18
18
  <stringProp name="port"/>
19
19
  <stringProp name="rootdn"/>
@@ -35,7 +35,7 @@ module RubyJmeter
35
35
  </ConfigTestElement>)
36
36
  EOS
37
37
  update params
38
- update_at_xpath params if params[:update_at_xpath]
38
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
39
39
  end
40
40
  end
41
41
 
@@ -11,16 +11,16 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'LdapRequest'
14
+ testname = params.kind_of?(Array) ? 'LdapRequest' : (params[:name] || 'LdapRequest')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <LDAPSampler guiclass="LdapTestSamplerGui" testclass="LDAPSampler" testname="#{params[:name]}" enabled="true">
16
+ <LDAPSampler guiclass="LdapTestSamplerGui" testclass="LDAPSampler" testname="#{testname}" enabled="true">
17
17
  <stringProp name="servername"/>
18
18
  <stringProp name="port"/>
19
19
  <stringProp name="rootdn"/>
20
20
  <boolProp name="user_defined">false</boolProp>
21
21
  <stringProp name="test">add</stringProp>
22
22
  <stringProp name="base_entry_dn"/>
23
- <elementProp name="arguments" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="#{params[:name]}" enabled="true">
23
+ <elementProp name="arguments" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="#{testname}" enabled="true">
24
24
  <collectionProp name="Arguments.arguments"/>
25
25
  </elementProp>
26
26
  <stringProp name="ConfigTestElement.username"/>
@@ -28,7 +28,7 @@ module RubyJmeter
28
28
  </LDAPSampler>)
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,16 +11,16 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'LdapRequestDefaults'
14
+ testname = params.kind_of?(Array) ? 'LdapRequestDefaults' : (params[:name] || 'LdapRequestDefaults')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <ConfigTestElement guiclass="LdapConfigGui" testclass="ConfigTestElement" testname="#{params[:name]}" enabled="true">
16
+ <ConfigTestElement guiclass="LdapConfigGui" testclass="ConfigTestElement" testname="#{testname}" enabled="true">
17
17
  <stringProp name="servername"/>
18
18
  <stringProp name="port"/>
19
19
  <stringProp name="rootdn"/>
20
20
  <boolProp name="user_defined">false</boolProp>
21
21
  <stringProp name="test">add</stringProp>
22
22
  <stringProp name="base_entry_dn"/>
23
- <elementProp name="arguments" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="#{params[:name]}" enabled="true">
23
+ <elementProp name="arguments" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="#{testname}" enabled="true">
24
24
  <collectionProp name="Arguments.arguments">
25
25
  <elementProp name="testguid" elementType="Argument">
26
26
  <stringProp name="Argument.name"/>
@@ -33,7 +33,7 @@ module RubyJmeter
33
33
  </ConfigTestElement>)
34
34
  EOS
35
35
  update params
36
- update_at_xpath params if params[:update_at_xpath]
36
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
37
37
  end
38
38
  end
39
39
 
@@ -11,15 +11,15 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'LoginConfigElement'
14
+ testname = params.kind_of?(Array) ? 'LoginConfigElement' : (params[:name] || 'LoginConfigElement')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <ConfigTestElement guiclass="LoginConfigGui" testclass="ConfigTestElement" testname="#{params[:name]}" enabled="true">
16
+ <ConfigTestElement guiclass="LoginConfigGui" testclass="ConfigTestElement" testname="#{testname}" enabled="true">
17
17
  <stringProp name="ConfigTestElement.username"/>
18
18
  <stringProp name="ConfigTestElement.password"/>
19
19
  </ConfigTestElement>)
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] ||= 'LoopController'
14
+ testname = params.kind_of?(Array) ? 'LoopController' : (params[:name] || 'LoopController')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="#{params[:name]}" enabled="true">
16
+ <LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="#{testname}" enabled="true">
17
17
  <boolProp name="LoopController.continue_forever">true</boolProp>
18
18
  <stringProp name="LoopController.loops">1</stringProp>
19
19
  </LoopController>)
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] ||= 'MailReaderSampler'
14
+ testname = params.kind_of?(Array) ? 'MailReaderSampler' : (params[:name] || 'MailReaderSampler')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <MailReaderSampler guiclass="MailReaderSamplerGui" testclass="MailReaderSampler" testname="#{params[:name]}" enabled="true">
16
+ <MailReaderSampler guiclass="MailReaderSamplerGui" testclass="MailReaderSampler" testname="#{testname}" enabled="true">
17
17
  <stringProp name="host_type">pop3</stringProp>
18
18
  <stringProp name="folder">INBOX</stringProp>
19
19
  <stringProp name="host"/>
@@ -30,7 +30,7 @@ module RubyJmeter
30
30
  </MailReaderSampler>)
31
31
  EOS
32
32
  update params
33
- update_at_xpath params if params[:update_at_xpath]
33
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
34
34
  end
35
35
  end
36
36
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'MailerVisualizer'
14
+ testname = params.kind_of?(Array) ? 'MailerVisualizer' : (params[:name] || 'MailerVisualizer')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <MailerResultCollector guiclass="MailerVisualizer" testclass="MailerResultCollector" testname="#{params[:name]}" enabled="true">
16
+ <MailerResultCollector guiclass="MailerVisualizer" testclass="MailerResultCollector" testname="#{testname}" enabled="true">
17
17
  <boolProp name="ResultCollector.error_logging">false</boolProp>
18
18
  <objProp>
19
19
  <name>saveConfig</name>
@@ -57,7 +57,7 @@ module RubyJmeter
57
57
  </MailerResultCollector>)
58
58
  EOS
59
59
  update params
60
- update_at_xpath params if params[:update_at_xpath]
60
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
61
61
  end
62
62
  end
63
63
 
@@ -11,14 +11,14 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'Md5hexAssertion'
14
+ testname = params.kind_of?(Array) ? 'Md5hexAssertion' : (params[:name] || 'Md5hexAssertion')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <MD5HexAssertion guiclass="MD5HexAssertionGUI" testclass="MD5HexAssertion" testname="#{params[:name]}" enabled="true">
16
+ <MD5HexAssertion guiclass="MD5HexAssertionGUI" testclass="MD5HexAssertion" testname="#{testname}" enabled="true">
17
17
  <stringProp name="MD5HexAssertion.size"/>
18
18
  </MD5HexAssertion>)
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] ||= 'ModuleController'
14
+ testname = params.kind_of?(Array) ? 'ModuleController' : (params[:name] || 'ModuleController')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <ModuleController guiclass="ModuleControllerGui" testclass="ModuleController" testname="#{params[:name]}" enabled="true"/>)
16
+ <ModuleController guiclass="ModuleControllerGui" testclass="ModuleController" 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] ||= 'MonitorResults'
14
+ testname = params.kind_of?(Array) ? 'MonitorResults' : (params[:name] || 'MonitorResults')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <ResultCollector guiclass="MonitorHealthVisualizer" testclass="ResultCollector" testname="#{params[:name]}" enabled="true">
16
+ <ResultCollector guiclass="MonitorHealthVisualizer" 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,12 +11,12 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'OnceOnlyController'
14
+ testname = params.kind_of?(Array) ? 'OnceOnlyController' : (params[:name] || 'OnceOnlyController')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <OnceOnlyController guiclass="OnceOnlyControllerGui" testclass="OnceOnlyController" testname="#{params[:name]}" enabled="true"/>)
16
+ <OnceOnlyController guiclass="OnceOnlyControllerGui" testclass="OnceOnlyController" 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,23 +11,23 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'OsProcessSampler'
14
+ testname = params.kind_of?(Array) ? 'OsProcessSampler' : (params[:name] || 'OsProcessSampler')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <SystemSampler guiclass="SystemSamplerGui" testclass="SystemSampler" testname="#{params[:name]}" enabled="true">
16
+ <SystemSampler guiclass="SystemSamplerGui" testclass="SystemSampler" testname="#{testname}" enabled="true">
17
17
  <boolProp name="SystemSampler.checkReturnCode">false</boolProp>
18
18
  <stringProp name="SystemSampler.expectedReturnCode">0</stringProp>
19
19
  <stringProp name="SystemSampler.command"/>
20
- <elementProp name="SystemSampler.arguments" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="#{params[:name]}" enabled="true">
20
+ <elementProp name="SystemSampler.arguments" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="#{testname}" enabled="true">
21
21
  <collectionProp name="Arguments.arguments"/>
22
22
  </elementProp>
23
- <elementProp name="SystemSampler.environment" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="#{params[:name]}" enabled="true">
23
+ <elementProp name="SystemSampler.environment" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="#{testname}" enabled="true">
24
24
  <collectionProp name="Arguments.arguments"/>
25
25
  </elementProp>
26
26
  <stringProp name="SystemSampler.directory"/>
27
27
  </SystemSampler>)
28
28
  EOS
29
29
  update params
30
- update_at_xpath params if params[:update_at_xpath]
30
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
31
31
  end
32
32
  end
33
33
 
@@ -11,15 +11,15 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'PoissonRandomTimer'
14
+ testname = params.kind_of?(Array) ? 'PoissonRandomTimer' : (params[:name] || 'PoissonRandomTimer')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <PoissonRandomTimer guiclass="PoissonRandomTimerGui" testclass="PoissonRandomTimer" testname="#{params[:name]}" enabled="true">
16
+ <PoissonRandomTimer guiclass="PoissonRandomTimerGui" testclass="PoissonRandomTimer" testname="#{testname}" enabled="true">
17
17
  <stringProp name="ConstantTimer.delay">300</stringProp>
18
18
  <stringProp name="RandomTimer.range">100</stringProp>
19
19
  </PoissonRandomTimer>)
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,14 +11,14 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'RandomController'
14
+ testname = params.kind_of?(Array) ? 'RandomController' : (params[:name] || 'RandomController')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <RandomController guiclass="RandomControlGui" testclass="RandomController" testname="#{params[:name]}" enabled="true">
16
+ <RandomController guiclass="RandomControlGui" testclass="RandomController" testname="#{testname}" enabled="true">
17
17
  <intProp name="InterleaveControl.style">1</intProp>
18
18
  </RandomController>)
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] ||= 'RandomOrderController'
14
+ testname = params.kind_of?(Array) ? 'RandomOrderController' : (params[:name] || 'RandomOrderController')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <RandomOrderController guiclass="RandomOrderControllerGui" testclass="RandomOrderController" testname="#{params[:name]}" enabled="true"/>)
16
+ <RandomOrderController guiclass="RandomOrderControllerGui" testclass="RandomOrderController" 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] ||= 'RandomVariable'
14
+ testname = params.kind_of?(Array) ? 'RandomVariable' : (params[:name] || 'RandomVariable')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <RandomVariableConfig guiclass="TestBeanGUI" testclass="RandomVariableConfig" testname="#{params[:name]}" enabled="true">
16
+ <RandomVariableConfig guiclass="TestBeanGUI" testclass="RandomVariableConfig" testname="#{testname}" enabled="true">
17
17
  <stringProp name="maximumValue"/>
18
18
  <stringProp name="minimumValue">1</stringProp>
19
19
  <stringProp name="outputFormat"/>
@@ -23,7 +23,7 @@ module RubyJmeter
23
23
  </RandomVariableConfig>)
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,12 +11,12 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'RecordingController'
14
+ testname = params.kind_of?(Array) ? 'RecordingController' : (params[:name] || 'RecordingController')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <RecordingController guiclass="RecordController" testclass="RecordingController" testname="#{params[:name]}" enabled="true"/>)
16
+ <RecordingController guiclass="RecordController" testclass="RecordingController" 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,16 +11,16 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'RegexUserParameters'
14
+ testname = params.kind_of?(Array) ? 'RegexUserParameters' : (params[:name] || 'RegexUserParameters')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <RegExUserParameters guiclass="RegExUserParametersGui" testclass="RegExUserParameters" testname="#{params[:name]}" enabled="true">
16
+ <RegExUserParameters guiclass="RegExUserParametersGui" testclass="RegExUserParameters" testname="#{testname}" enabled="true">
17
17
  <stringProp name="RegExUserParameters.regex_ref_name"/>
18
18
  <stringProp name="RegExUserParameters.param_names_gr_nr"/>
19
19
  <stringProp name="RegExUserParameters.param_values_gr_nr"/>
20
20
  </RegExUserParameters>)
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,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'RegularExpressionExtractor'
14
+ testname = params.kind_of?(Array) ? 'RegularExpressionExtractor' : (params[:name] || 'RegularExpressionExtractor')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="#{params[:name]}" enabled="true">
16
+ <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="#{testname}" enabled="true">
17
17
  <stringProp name="RegexExtractor.useHeaders">false</stringProp>
18
18
  <stringProp name="RegexExtractor.refname"/>
19
19
  <stringProp name="RegexExtractor.regex"/>
@@ -24,7 +24,7 @@ module RubyJmeter
24
24
  </RegexExtractor>)
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,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'ResponseAssertion'
14
+ testname = params.kind_of?(Array) ? 'ResponseAssertion' : (params[:name] || 'ResponseAssertion')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="#{params[:name]}" enabled="true">
16
+ <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="#{testname}" enabled="true">
17
17
  <collectionProp name="Asserion.test_strings">
18
18
  <stringProp name="match"/>
19
19
  </collectionProp>
@@ -24,7 +24,7 @@ module RubyJmeter
24
24
  </ResponseAssertion>)
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,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'ResponseTimeGraph'
14
+ testname = params.kind_of?(Array) ? 'ResponseTimeGraph' : (params[:name] || 'ResponseTimeGraph')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <ResultCollector guiclass="RespTimeGraphVisualizer" testclass="ResultCollector" testname="#{params[:name]}" enabled="true">
16
+ <ResultCollector guiclass="RespTimeGraphVisualizer" 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