select_aggr_rule.jmx 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <jmeterTestPlan version="1.2" properties="4.0" jmeter="4.0 r1823414">
  3. <hashTree>
  4. <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
  5. <stringProp name="TestPlan.comments"></stringProp>
  6. <boolProp name="TestPlan.functional_mode">false</boolProp>
  7. <boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
  8. <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
  9. <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
  10. <collectionProp name="Arguments.arguments"/>
  11. </elementProp>
  12. <stringProp name="TestPlan.user_define_classpath"></stringProp>
  13. </TestPlan>
  14. <hashTree>
  15. <Arguments guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
  16. <collectionProp name="Arguments.arguments">
  17. <elementProp name="srv" elementType="Argument">
  18. <stringProp name="Argument.name">srv</stringProp>
  19. <stringProp name="Argument.value">${__property(srv,,127.0.0.1)}</stringProp>
  20. <stringProp name="Argument.metadata">=</stringProp>
  21. </elementProp>
  22. <elementProp name="rest_port" elementType="Argument">
  23. <stringProp name="Argument.name">rest_port</stringProp>
  24. <stringProp name="Argument.value">9081</stringProp>
  25. <stringProp name="Argument.metadata">=</stringProp>
  26. </elementProp>
  27. <elementProp name="mqtt_srv" elementType="Argument">
  28. <stringProp name="Argument.name">mqtt_srv</stringProp>
  29. <stringProp name="Argument.value">${__property(mqtt_srv,,127.0.0.1)}</stringProp>
  30. <stringProp name="Argument.metadata">=</stringProp>
  31. </elementProp>
  32. </collectionProp>
  33. </Arguments>
  34. <hashTree/>
  35. <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Rules" enabled="true">
  36. <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
  37. <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
  38. <boolProp name="LoopController.continue_forever">false</boolProp>
  39. <stringProp name="LoopController.loops">1</stringProp>
  40. </elementProp>
  41. <stringProp name="ThreadGroup.num_threads">1</stringProp>
  42. <stringProp name="ThreadGroup.ramp_time">1</stringProp>
  43. <boolProp name="ThreadGroup.scheduler">false</boolProp>
  44. <stringProp name="ThreadGroup.duration"></stringProp>
  45. <stringProp name="ThreadGroup.delay"></stringProp>
  46. </ThreadGroup>
  47. <hashTree>
  48. <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true">
  49. <boolProp name="ResultCollector.error_logging">false</boolProp>
  50. <objProp>
  51. <name>saveConfig</name>
  52. <value class="SampleSaveConfiguration">
  53. <time>true</time>
  54. <latency>true</latency>
  55. <timestamp>true</timestamp>
  56. <success>true</success>
  57. <label>true</label>
  58. <code>true</code>
  59. <message>true</message>
  60. <threadName>true</threadName>
  61. <dataType>true</dataType>
  62. <encoding>false</encoding>
  63. <assertions>true</assertions>
  64. <subresults>true</subresults>
  65. <responseData>false</responseData>
  66. <samplerData>false</samplerData>
  67. <xml>false</xml>
  68. <fieldNames>true</fieldNames>
  69. <responseHeaders>false</responseHeaders>
  70. <requestHeaders>false</requestHeaders>
  71. <responseDataOnError>false</responseDataOnError>
  72. <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
  73. <assertionsResultsToSave>0</assertionsResultsToSave>
  74. <bytes>true</bytes>
  75. <sentBytes>true</sentBytes>
  76. <threadCounts>true</threadCounts>
  77. <idleTime>true</idleTime>
  78. <connectTime>true</connectTime>
  79. </value>
  80. </objProp>
  81. <stringProp name="filename"></stringProp>
  82. </ResultCollector>
  83. <hashTree/>
  84. <TransactionController guiclass="TransactionControllerGui" testclass="TransactionController" testname="API" enabled="true">
  85. <boolProp name="TransactionController.includeTimers">false</boolProp>
  86. <boolProp name="TransactionController.parent">false</boolProp>
  87. </TransactionController>
  88. <hashTree>
  89. <net.xmeter.samplers.ConnectSampler guiclass="net.xmeter.gui.ConnectSamplerUI" testclass="net.xmeter.samplers.ConnectSampler" testname="MQTT Connect" enabled="true">
  90. <stringProp name="mqtt.server">${mqtt_srv}</stringProp>
  91. <stringProp name="mqtt.port">1883</stringProp>
  92. <stringProp name="mqtt.version">3.1</stringProp>
  93. <stringProp name="mqtt.conn_timeout">10</stringProp>
  94. <boolProp name="mqtt.private_protocol">false</boolProp>
  95. <stringProp name="mqtt.listener_timeout">10</stringProp>
  96. <stringProp name="mqtt.protocol">TCP</stringProp>
  97. <boolProp name="mqtt.dual_ssl_authentication">false</boolProp>
  98. <stringProp name="mqtt.keystore_file_path"></stringProp>
  99. <stringProp name="mqtt.keystore_password"></stringProp>
  100. <stringProp name="mqtt.clientcert_file_path"></stringProp>
  101. <stringProp name="mqtt.clientcert_password"></stringProp>
  102. <stringProp name="mqtt.user_name"></stringProp>
  103. <stringProp name="mqtt.password"></stringProp>
  104. <stringProp name="mqtt.client_id_prefix">conn_</stringProp>
  105. <boolProp name="mqtt.client_id_suffix">true</boolProp>
  106. <stringProp name="mqtt.conn_keep_alive">300</stringProp>
  107. <stringProp name="mqtt.conn_attampt_max">0</stringProp>
  108. <stringProp name="mqtt.reconn_attampt_max">0</stringProp>
  109. </net.xmeter.samplers.ConnectSampler>
  110. <hashTree/>
  111. <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="API_CreateStream" enabled="true">
  112. <boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
  113. <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
  114. <collectionProp name="Arguments.arguments">
  115. <elementProp name="" elementType="HTTPArgument">
  116. <boolProp name="HTTPArgument.always_encode">false</boolProp>
  117. <stringProp name="Argument.value">{&#xd;
  118. &quot;sql&quot; : &quot;create stream demo (temperature float, humidity bigint) WITH (FORMAT=\&quot;JSON\&quot;, DATASOURCE=\&quot;devices/+/messages\&quot; )&quot;&#xd;
  119. }</stringProp>
  120. <stringProp name="Argument.metadata">=</stringProp>
  121. </elementProp>
  122. </collectionProp>
  123. </elementProp>
  124. <stringProp name="HTTPSampler.domain">${srv}</stringProp>
  125. <stringProp name="HTTPSampler.port">${rest_port}</stringProp>
  126. <stringProp name="HTTPSampler.protocol"></stringProp>
  127. <stringProp name="HTTPSampler.contentEncoding"></stringProp>
  128. <stringProp name="HTTPSampler.path">/streams</stringProp>
  129. <stringProp name="HTTPSampler.method">POST</stringProp>
  130. <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
  131. <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
  132. <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
  133. <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
  134. <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
  135. <stringProp name="HTTPSampler.connect_timeout"></stringProp>
  136. <stringProp name="HTTPSampler.response_timeout"></stringProp>
  137. </HTTPSamplerProxy>
  138. <hashTree>
  139. <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true">
  140. <collectionProp name="Asserion.test_strings">
  141. <stringProp name="-1754954177">Stream demo is created.</stringProp>
  142. </collectionProp>
  143. <stringProp name="Assertion.custom_message"></stringProp>
  144. <stringProp name="Assertion.test_field">Assertion.response_data</stringProp>
  145. <boolProp name="Assertion.assume_success">true</boolProp>
  146. <intProp name="Assertion.test_type">16</intProp>
  147. </ResponseAssertion>
  148. <hashTree/>
  149. </hashTree>
  150. <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="API_CreateRule" enabled="true">
  151. <boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
  152. <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
  153. <collectionProp name="Arguments.arguments">
  154. <elementProp name="" elementType="HTTPArgument">
  155. <boolProp name="HTTPArgument.always_encode">false</boolProp>
  156. <stringProp name="Argument.value">{&#xd;
  157. &quot;id&quot;: &quot;rule1&quot;,&#xd;
  158. &quot;sql&quot;: &quot;SELECT avg(temperature) AS t_av, max(temperature) AS t_max, min(temperature) AS t_min, COUNT(*) As t_count, split_value(mqtt(topic), \&quot;/\&quot;, 1) AS device_id FROM demo GROUP BY device_id, TUMBLINGWINDOW(ss, 5)&quot;,&#xd;
  159. &quot;actions&quot;: [&#xd;
  160. {&#xd;
  161. &quot;mqtt&quot;: {&#xd;
  162. &quot;server&quot;: &quot;tcp://${mqtt_srv}:1883&quot;,&#xd;
  163. &quot;topic&quot;: &quot;devices/result&quot;,&#xd;
  164. &quot;qos&quot;: 1,&#xd;
  165. &quot;clientId&quot;: &quot;demo_001&quot;&#xd;
  166. }&#xd;
  167. }&#xd;
  168. ]&#xd;
  169. }</stringProp>
  170. <stringProp name="Argument.metadata">=</stringProp>
  171. </elementProp>
  172. </collectionProp>
  173. </elementProp>
  174. <stringProp name="HTTPSampler.domain">${srv}</stringProp>
  175. <stringProp name="HTTPSampler.port">${rest_port}</stringProp>
  176. <stringProp name="HTTPSampler.protocol"></stringProp>
  177. <stringProp name="HTTPSampler.contentEncoding"></stringProp>
  178. <stringProp name="HTTPSampler.path">/rules</stringProp>
  179. <stringProp name="HTTPSampler.method">POST</stringProp>
  180. <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
  181. <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
  182. <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
  183. <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
  184. <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
  185. <stringProp name="HTTPSampler.connect_timeout"></stringProp>
  186. <stringProp name="HTTPSampler.response_timeout"></stringProp>
  187. </HTTPSamplerProxy>
  188. <hashTree>
  189. <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true">
  190. <collectionProp name="Asserion.test_strings">
  191. <stringProp name="-2022196798">Rule rule1 was created</stringProp>
  192. </collectionProp>
  193. <stringProp name="Assertion.custom_message"></stringProp>
  194. <stringProp name="Assertion.test_field">Assertion.response_data</stringProp>
  195. <boolProp name="Assertion.assume_success">true</boolProp>
  196. <intProp name="Assertion.test_type">16</intProp>
  197. </ResponseAssertion>
  198. <hashTree/>
  199. </hashTree>
  200. <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="API_GetRuleStatus" enabled="true">
  201. <boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
  202. <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
  203. <collectionProp name="Arguments.arguments">
  204. <elementProp name="" elementType="HTTPArgument">
  205. <boolProp name="HTTPArgument.always_encode">false</boolProp>
  206. <stringProp name="Argument.value"></stringProp>
  207. <stringProp name="Argument.metadata">=</stringProp>
  208. </elementProp>
  209. </collectionProp>
  210. </elementProp>
  211. <stringProp name="HTTPSampler.domain">${srv}</stringProp>
  212. <stringProp name="HTTPSampler.port">${rest_port}</stringProp>
  213. <stringProp name="HTTPSampler.protocol"></stringProp>
  214. <stringProp name="HTTPSampler.contentEncoding"></stringProp>
  215. <stringProp name="HTTPSampler.path">/rules/rule1/status</stringProp>
  216. <stringProp name="HTTPSampler.method">GET</stringProp>
  217. <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
  218. <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
  219. <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
  220. <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
  221. <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
  222. <stringProp name="HTTPSampler.connect_timeout"></stringProp>
  223. <stringProp name="HTTPSampler.response_timeout"></stringProp>
  224. </HTTPSamplerProxy>
  225. <hashTree>
  226. <JSONPathAssertion guiclass="JSONPathAssertionGui" testclass="JSONPathAssertion" testname="JSON Assertion" enabled="true">
  227. <stringProp name="JSON_PATH">$.source_demo_0_records_in_total</stringProp>
  228. <stringProp name="EXPECTED_VALUE">0</stringProp>
  229. <boolProp name="JSONVALIDATION">true</boolProp>
  230. <boolProp name="EXPECT_NULL">false</boolProp>
  231. <boolProp name="INVERT">false</boolProp>
  232. <boolProp name="ISREGEX">false</boolProp>
  233. </JSONPathAssertion>
  234. <hashTree/>
  235. </hashTree>
  236. <LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="loop_controller" enabled="true">
  237. <boolProp name="LoopController.continue_forever">true</boolProp>
  238. <stringProp name="LoopController.loops">10</stringProp>
  239. </LoopController>
  240. <hashTree>
  241. <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="CSV Data Set Config" enabled="true">
  242. <stringProp name="delimiter">,</stringProp>
  243. <stringProp name="fileEncoding"></stringProp>
  244. <stringProp name="filename">iot_data.txt</stringProp>
  245. <boolProp name="ignoreFirstLine">false</boolProp>
  246. <boolProp name="quotedData">false</boolProp>
  247. <boolProp name="recycle">true</boolProp>
  248. <stringProp name="shareMode">shareMode.thread</stringProp>
  249. <boolProp name="stopThread">false</boolProp>
  250. <stringProp name="variableNames">device_id,temperature,humidity</stringProp>
  251. </CSVDataSet>
  252. <hashTree/>
  253. <net.xmeter.samplers.PubSampler guiclass="net.xmeter.gui.PubSamplerUI" testclass="net.xmeter.samplers.PubSampler" testname="MQTT Pub Sampler" enabled="true">
  254. <stringProp name="mqtt.topic_name">devices/${device_id}/messages</stringProp>
  255. <stringProp name="mqtt.qos_level">0</stringProp>
  256. <boolProp name="mqtt.add_timestamp">false</boolProp>
  257. <stringProp name="mqtt.message_type">String</stringProp>
  258. <stringProp name="mqtt.message_type_fixed_length">1024</stringProp>
  259. <stringProp name="mqtt.message_to_sent">{&quot;temperature&quot;: ${temperature}, &quot;humidity&quot; : ${humidity}}</stringProp>
  260. </net.xmeter.samplers.PubSampler>
  261. <hashTree/>
  262. </hashTree>
  263. <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="API_GetRuleStatus" enabled="true">
  264. <boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
  265. <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
  266. <collectionProp name="Arguments.arguments">
  267. <elementProp name="" elementType="HTTPArgument">
  268. <boolProp name="HTTPArgument.always_encode">false</boolProp>
  269. <stringProp name="Argument.value"></stringProp>
  270. <stringProp name="Argument.metadata">=</stringProp>
  271. </elementProp>
  272. </collectionProp>
  273. </elementProp>
  274. <stringProp name="HTTPSampler.domain">${srv}</stringProp>
  275. <stringProp name="HTTPSampler.port">${rest_port}</stringProp>
  276. <stringProp name="HTTPSampler.protocol"></stringProp>
  277. <stringProp name="HTTPSampler.contentEncoding"></stringProp>
  278. <stringProp name="HTTPSampler.path">/rules/rule1/status</stringProp>
  279. <stringProp name="HTTPSampler.method">GET</stringProp>
  280. <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
  281. <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
  282. <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
  283. <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
  284. <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
  285. <stringProp name="HTTPSampler.connect_timeout"></stringProp>
  286. <stringProp name="HTTPSampler.response_timeout"></stringProp>
  287. </HTTPSamplerProxy>
  288. <hashTree>
  289. <JSONPathAssertion guiclass="JSONPathAssertionGui" testclass="JSONPathAssertion" testname="JSON Assertion" enabled="true">
  290. <stringProp name="JSON_PATH">$.source_demo_0_records_in_total</stringProp>
  291. <stringProp name="EXPECTED_VALUE">10</stringProp>
  292. <boolProp name="JSONVALIDATION">true</boolProp>
  293. <boolProp name="EXPECT_NULL">false</boolProp>
  294. <boolProp name="INVERT">false</boolProp>
  295. <boolProp name="ISREGEX">false</boolProp>
  296. </JSONPathAssertion>
  297. <hashTree/>
  298. <JSONPathAssertion guiclass="JSONPathAssertionGui" testclass="JSONPathAssertion" testname="JSON Assertion" enabled="false">
  299. <stringProp name="JSON_PATH">$.sink_sink_mqtt_0_records_in_total</stringProp>
  300. <stringProp name="EXPECTED_VALUE">6</stringProp>
  301. <boolProp name="JSONVALIDATION">true</boolProp>
  302. <boolProp name="EXPECT_NULL">false</boolProp>
  303. <boolProp name="INVERT">false</boolProp>
  304. <boolProp name="ISREGEX">false</boolProp>
  305. </JSONPathAssertion>
  306. <hashTree/>
  307. <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="Constant Timer" enabled="true">
  308. <stringProp name="ConstantTimer.delay">5000</stringProp>
  309. </ConstantTimer>
  310. <hashTree/>
  311. </hashTree>
  312. <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="API_DropRule" enabled="true">
  313. <boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
  314. <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
  315. <collectionProp name="Arguments.arguments">
  316. <elementProp name="" elementType="HTTPArgument">
  317. <boolProp name="HTTPArgument.always_encode">false</boolProp>
  318. <stringProp name="Argument.value"></stringProp>
  319. <stringProp name="Argument.metadata">=</stringProp>
  320. </elementProp>
  321. </collectionProp>
  322. </elementProp>
  323. <stringProp name="HTTPSampler.domain">${srv}</stringProp>
  324. <stringProp name="HTTPSampler.port">${rest_port}</stringProp>
  325. <stringProp name="HTTPSampler.protocol"></stringProp>
  326. <stringProp name="HTTPSampler.contentEncoding"></stringProp>
  327. <stringProp name="HTTPSampler.path">/rules/rule1</stringProp>
  328. <stringProp name="HTTPSampler.method">DELETE</stringProp>
  329. <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
  330. <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
  331. <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
  332. <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
  333. <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
  334. <stringProp name="HTTPSampler.connect_timeout"></stringProp>
  335. <stringProp name="HTTPSampler.response_timeout"></stringProp>
  336. </HTTPSamplerProxy>
  337. <hashTree>
  338. <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true">
  339. <collectionProp name="Asserion.test_strings">
  340. <stringProp name="717250485">Rule rule1 is dropped.</stringProp>
  341. </collectionProp>
  342. <stringProp name="Assertion.custom_message"></stringProp>
  343. <stringProp name="Assertion.test_field">Assertion.response_data</stringProp>
  344. <boolProp name="Assertion.assume_success">false</boolProp>
  345. <intProp name="Assertion.test_type">16</intProp>
  346. </ResponseAssertion>
  347. <hashTree/>
  348. </hashTree>
  349. <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="API_Drop_Stream" enabled="true">
  350. <boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
  351. <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
  352. <collectionProp name="Arguments.arguments">
  353. <elementProp name="" elementType="HTTPArgument">
  354. <boolProp name="HTTPArgument.always_encode">false</boolProp>
  355. <stringProp name="Argument.value"></stringProp>
  356. <stringProp name="Argument.metadata">=</stringProp>
  357. </elementProp>
  358. </collectionProp>
  359. </elementProp>
  360. <stringProp name="HTTPSampler.domain">${srv}</stringProp>
  361. <stringProp name="HTTPSampler.port">${rest_port}</stringProp>
  362. <stringProp name="HTTPSampler.protocol"></stringProp>
  363. <stringProp name="HTTPSampler.contentEncoding"></stringProp>
  364. <stringProp name="HTTPSampler.path">/streams/demo</stringProp>
  365. <stringProp name="HTTPSampler.method">DELETE</stringProp>
  366. <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
  367. <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
  368. <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
  369. <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
  370. <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
  371. <stringProp name="HTTPSampler.connect_timeout"></stringProp>
  372. <stringProp name="HTTPSampler.response_timeout"></stringProp>
  373. </HTTPSamplerProxy>
  374. <hashTree>
  375. <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true">
  376. <collectionProp name="Asserion.test_strings">
  377. <stringProp name="287881319">Stream demo is dropped.</stringProp>
  378. </collectionProp>
  379. <stringProp name="Assertion.custom_message"></stringProp>
  380. <stringProp name="Assertion.test_field">Assertion.response_data</stringProp>
  381. <boolProp name="Assertion.assume_success">false</boolProp>
  382. <intProp name="Assertion.test_type">16</intProp>
  383. </ResponseAssertion>
  384. <hashTree/>
  385. </hashTree>
  386. <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="Constant Timer" enabled="true">
  387. <stringProp name="ConstantTimer.delay">500</stringProp>
  388. </ConstantTimer>
  389. <hashTree/>
  390. </hashTree>
  391. </hashTree>
  392. <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Result" enabled="true">
  393. <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
  394. <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
  395. <boolProp name="LoopController.continue_forever">false</boolProp>
  396. <stringProp name="LoopController.loops">1</stringProp>
  397. </elementProp>
  398. <stringProp name="ThreadGroup.num_threads">1</stringProp>
  399. <stringProp name="ThreadGroup.ramp_time">1</stringProp>
  400. <boolProp name="ThreadGroup.scheduler">false</boolProp>
  401. <stringProp name="ThreadGroup.duration"></stringProp>
  402. <stringProp name="ThreadGroup.delay"></stringProp>
  403. </ThreadGroup>
  404. <hashTree>
  405. <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true">
  406. <boolProp name="ResultCollector.error_logging">false</boolProp>
  407. <objProp>
  408. <name>saveConfig</name>
  409. <value class="SampleSaveConfiguration">
  410. <time>true</time>
  411. <latency>true</latency>
  412. <timestamp>true</timestamp>
  413. <success>true</success>
  414. <label>true</label>
  415. <code>true</code>
  416. <message>true</message>
  417. <threadName>true</threadName>
  418. <dataType>true</dataType>
  419. <encoding>false</encoding>
  420. <assertions>true</assertions>
  421. <subresults>true</subresults>
  422. <responseData>false</responseData>
  423. <samplerData>false</samplerData>
  424. <xml>false</xml>
  425. <fieldNames>true</fieldNames>
  426. <responseHeaders>false</responseHeaders>
  427. <requestHeaders>false</requestHeaders>
  428. <responseDataOnError>false</responseDataOnError>
  429. <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
  430. <assertionsResultsToSave>0</assertionsResultsToSave>
  431. <bytes>true</bytes>
  432. <sentBytes>true</sentBytes>
  433. <threadCounts>true</threadCounts>
  434. <idleTime>true</idleTime>
  435. <connectTime>true</connectTime>
  436. </value>
  437. </objProp>
  438. <stringProp name="filename"></stringProp>
  439. </ResultCollector>
  440. <hashTree/>
  441. <OnceOnlyController guiclass="OnceOnlyControllerGui" testclass="OnceOnlyController" testname="Once Only Controller" enabled="true"/>
  442. <hashTree>
  443. <net.xmeter.samplers.ConnectSampler guiclass="net.xmeter.gui.ConnectSamplerUI" testclass="net.xmeter.samplers.ConnectSampler" testname="MQTT Connect" enabled="true">
  444. <stringProp name="mqtt.server">${mqtt_srv}</stringProp>
  445. <stringProp name="mqtt.port">1883</stringProp>
  446. <stringProp name="mqtt.version">3.1</stringProp>
  447. <stringProp name="mqtt.conn_timeout">10</stringProp>
  448. <boolProp name="mqtt.private_protocol">false</boolProp>
  449. <stringProp name="mqtt.listener_timeout">10</stringProp>
  450. <stringProp name="mqtt.protocol">TCP</stringProp>
  451. <boolProp name="mqtt.dual_ssl_authentication">false</boolProp>
  452. <stringProp name="mqtt.keystore_file_path"></stringProp>
  453. <stringProp name="mqtt.keystore_password"></stringProp>
  454. <stringProp name="mqtt.clientcert_file_path"></stringProp>
  455. <stringProp name="mqtt.clientcert_password"></stringProp>
  456. <stringProp name="mqtt.user_name"></stringProp>
  457. <stringProp name="mqtt.password"></stringProp>
  458. <stringProp name="mqtt.client_id_prefix">conn_</stringProp>
  459. <boolProp name="mqtt.client_id_suffix">true</boolProp>
  460. <stringProp name="mqtt.conn_keep_alive">300</stringProp>
  461. <stringProp name="mqtt.conn_attampt_max">0</stringProp>
  462. <stringProp name="mqtt.reconn_attampt_max">0</stringProp>
  463. </net.xmeter.samplers.ConnectSampler>
  464. <hashTree/>
  465. </hashTree>
  466. <net.xmeter.samplers.SubSampler guiclass="net.xmeter.gui.SubSamplerUI" testclass="net.xmeter.samplers.SubSampler" testname="AnalysisResult" enabled="true">
  467. <stringProp name="mqtt.topic_name">devices/result</stringProp>
  468. <stringProp name="mqtt.qos_level">0</stringProp>
  469. <boolProp name="mqtt.add_timestamp">false</boolProp>
  470. <boolProp name="mqtt.debug_response">true</boolProp>
  471. <stringProp name="mqtt.sample_condition">specified elapsed time (ms)</stringProp>
  472. <stringProp name="mqtt.sample_condition_value">15000</stringProp>
  473. </net.xmeter.samplers.SubSampler>
  474. <hashTree>
  475. <BeanShellAssertion guiclass="BeanShellAssertionGui" testclass="BeanShellAssertion" testname="BeanShell Assertion" enabled="true">
  476. <stringProp name="BeanShellAssertion.query">import net.sf.json.JSONArray;
  477. import net.sf.json.JSONObject;
  478. String response = SampleResult.getResponseDataAsString();
  479. String[] arr = response.split(&quot;\n&quot;);
  480. for(int i = 0; i &lt; arr.length; i++) {
  481. JSONArray jsonArr = JSONArray.fromObject(arr[i]);
  482. for(int j = 0; j &lt; jsonArr.size(); j++) {
  483. String deviceid = jsonArr.getJSONObject(j).getString(&quot;device_id&quot;);
  484. int count = jsonArr.getJSONObject(j).getInt(&quot;t_count&quot;);
  485. String oldCount = vars.get(deviceid);
  486. if(oldCount == null) {
  487. vars.put(deviceid, String.valueOf(count));
  488. } else {
  489. int c = Integer.parseInt(oldCount);
  490. c += count;
  491. vars.put(deviceid, String.valueOf(c));
  492. }
  493. }
  494. }
  495. String d1 = vars.get(&quot;1&quot;);
  496. String d2 = vars.get(&quot;2&quot;);
  497. if(d1 == null || (!&quot;5&quot;.equals(d1)) || d2 == null || (!&quot;5&quot;.equals(d2))) {
  498. Failure = true;
  499. FailureMessage = &quot;The analyis result is not correct!&quot;;
  500. }</stringProp>
  501. <stringProp name="BeanShellAssertion.filename"></stringProp>
  502. <stringProp name="BeanShellAssertion.parameters"></stringProp>
  503. <boolProp name="BeanShellAssertion.resetInterpreter">false</boolProp>
  504. </BeanShellAssertion>
  505. <hashTree/>
  506. </hashTree>
  507. </hashTree>
  508. </hashTree>
  509. </hashTree>
  510. </jmeterTestPlan>