Adds basic stability tests for Policy PAP
[policy/pap.git] / testsuites / stability / src / main / resources / testplans / stability.jmx
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3   ============LICENSE_START=======================================================
4   ONAP Policy PAP
5   ================================================================================
6   Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
7   ================================================================================
8   Licensed under the Apache License, Version 2.0 (the "License");
9   you may not use this file except in compliance with the License.
10   You may obtain a copy of the License at
11
12        http://www.apache.org/licenses/LICENSE-2.0
13
14   Unless required by applicable law or agreed to in writing, software
15   distributed under the License is distributed on an "AS IS" BASIS,
16   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   See the License for the specific language governing permissions and
18   limitations under the License.
19   ============LICENSE_END=========================================================
20   -->
21 <jmeterTestPlan version="1.2" properties="5.0" jmeter="5.0 r1840935">
22   <hashTree>
23     <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Policy PAP Stability" enabled="true">
24       <stringProp name="TestPlan.comments">Policy PAP Stability Tests</stringProp>
25       <boolProp name="TestPlan.functional_mode">false</boolProp>
26       <boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
27       <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
28       <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
29         <collectionProp name="Arguments.arguments">
30           <elementProp name="PAP_HOST" elementType="Argument">
31             <stringProp name="Argument.name">PAP_HOST</stringProp>
32             <stringProp name="Argument.value">${__P(host,10.12.6.164)}</stringProp>
33             <stringProp name="Argument.metadata">=</stringProp>
34           </elementProp>
35           <elementProp name="DURATION" elementType="Argument">
36             <stringProp name="Argument.name">DURATION</stringProp>
37             <stringProp name="Argument.value">${__P(duration, 5)}</stringProp>
38             <stringProp name="Argument.metadata">=</stringProp>
39           </elementProp>
40           <elementProp name="USERS" elementType="Argument">
41             <stringProp name="Argument.name">USERS</stringProp>
42             <stringProp name="Argument.value">${__P(users, 1)}</stringProp>
43             <stringProp name="Argument.metadata">=</stringProp>
44           </elementProp>
45           <elementProp name="PORT" elementType="Argument">
46             <stringProp name="Argument.name">PORT</stringProp>
47             <stringProp name="Argument.value">${__P(port,  6969)}</stringProp>
48             <stringProp name="Argument.metadata">=</stringProp>
49           </elementProp>
50         </collectionProp>
51       </elementProp>
52       <stringProp name="TestPlan.user_define_classpath"></stringProp>
53     </TestPlan>
54     <hashTree>
55       <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Health Check PAP" enabled="true">
56         <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
57         <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
58           <boolProp name="LoopController.continue_forever">false</boolProp>
59           <intProp name="LoopController.loops">-1</intProp>
60         </elementProp>
61         <stringProp name="ThreadGroup.num_threads">${USERS}</stringProp>
62         <stringProp name="ThreadGroup.ramp_time">1</stringProp>
63         <boolProp name="ThreadGroup.scheduler">true</boolProp>
64         <stringProp name="ThreadGroup.duration">${DURATION}</stringProp>
65         <stringProp name="ThreadGroup.delay">1</stringProp>
66       </ThreadGroup>
67       <hashTree>
68         <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Check Health" enabled="true">
69           <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
70             <collectionProp name="Arguments.arguments"/>
71           </elementProp>
72           <stringProp name="HTTPSampler.domain">${PAP_HOST}</stringProp>
73           <stringProp name="HTTPSampler.port">6969</stringProp>
74           <stringProp name="HTTPSampler.protocol">https</stringProp>
75           <stringProp name="HTTPSampler.contentEncoding"></stringProp>
76           <stringProp name="HTTPSampler.path">healthcheck</stringProp>
77           <stringProp name="HTTPSampler.method">GET</stringProp>
78           <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
79           <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
80           <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
81           <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
82           <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
83           <stringProp name="HTTPSampler.connect_timeout"></stringProp>
84           <stringProp name="HTTPSampler.response_timeout"></stringProp>
85           <stringProp name="TestPlan.comments">Basic Health Check</stringProp>
86         </HTTPSamplerProxy>
87         <hashTree>
88           <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true">
89             <collectionProp name="Asserion.test_strings">
90               <stringProp name="49586">200</stringProp>
91             </collectionProp>
92             <stringProp name="Assertion.custom_message"></stringProp>
93             <stringProp name="Assertion.test_field">Assertion.response_code</stringProp>
94             <boolProp name="Assertion.assume_success">false</boolProp>
95             <intProp name="Assertion.test_type">1</intProp>
96           </ResponseAssertion>
97           <hashTree/>
98           <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="true">
99             <stringProp name="scriptLanguage">groovy</stringProp>
100             <stringProp name="parameters"></stringProp>
101             <stringProp name="filename"></stringProp>
102             <stringProp name="cacheKey">true</stringProp>
103             <stringProp name="script">import groovy.json.JsonSlurper;
104
105 def res = [];
106 if (prev.getResponseCode() == &apos;200&apos;) {
107     def jsonSlurper = new JsonSlurper();
108     res = jsonSlurper.parseText(prev.getResponseDataAsString());
109
110     assert res instanceof Map;
111     assert res.code == 200;
112     assert res.name == &quot;Policy PAP&quot;;
113     assert res.healthy==true;
114     assert res.message==&quot;alive&quot;;
115 }
116 </stringProp>
117           </JSR223Assertion>
118           <hashTree/>
119         </hashTree>
120         <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true">
121           <collectionProp name="HeaderManager.headers">
122             <elementProp name="" elementType="Header">
123               <stringProp name="Header.name">Accept</stringProp>
124               <stringProp name="Header.value">application/json</stringProp>
125             </elementProp>
126             <elementProp name="" elementType="Header">
127               <stringProp name="Header.name">Content-Type</stringProp>
128               <stringProp name="Header.value">application/json</stringProp>
129             </elementProp>
130           </collectionProp>
131         </HeaderManager>
132         <hashTree/>
133         <AuthManager guiclass="AuthPanel" testclass="AuthManager" testname="HTTP Authorization Manager" enabled="true">
134           <collectionProp name="AuthManager.auth_list">
135             <elementProp name="" elementType="Authorization">
136               <stringProp name="Authorization.url">https://${PAP_HOST}:6969/healthcheck</stringProp>
137               <stringProp name="Authorization.username">healthcheck</stringProp>
138               <stringProp name="Authorization.password">zb!XztG34</stringProp>
139               <stringProp name="Authorization.domain"></stringProp>
140               <stringProp name="Authorization.realm"></stringProp>
141             </elementProp>
142           </collectionProp>
143           <boolProp name="AuthManager.clearEachIteration">true</boolProp>
144         </AuthManager>
145         <hashTree/>
146         <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true">
147           <boolProp name="ResultCollector.error_logging">false</boolProp>
148           <objProp>
149             <name>saveConfig</name>
150             <value class="SampleSaveConfiguration">
151               <time>true</time>
152               <latency>true</latency>
153               <timestamp>true</timestamp>
154               <success>true</success>
155               <label>true</label>
156               <code>true</code>
157               <message>true</message>
158               <threadName>true</threadName>
159               <dataType>true</dataType>
160               <encoding>false</encoding>
161               <assertions>true</assertions>
162               <subresults>true</subresults>
163               <responseData>false</responseData>
164               <samplerData>false</samplerData>
165               <xml>false</xml>
166               <fieldNames>true</fieldNames>
167               <responseHeaders>false</responseHeaders>
168               <requestHeaders>false</requestHeaders>
169               <responseDataOnError>false</responseDataOnError>
170               <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
171               <assertionsResultsToSave>0</assertionsResultsToSave>
172               <bytes>true</bytes>
173               <sentBytes>true</sentBytes>
174               <url>true</url>
175               <threadCounts>true</threadCounts>
176               <idleTime>true</idleTime>
177               <connectTime>true</connectTime>
178             </value>
179           </objProp>
180           <stringProp name="filename"></stringProp>
181         </ResultCollector>
182         <hashTree/>
183       </hashTree>
184       <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Statistics Check PAP" enabled="true">
185         <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
186         <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
187           <boolProp name="LoopController.continue_forever">false</boolProp>
188           <intProp name="LoopController.loops">-1</intProp>
189         </elementProp>
190         <stringProp name="ThreadGroup.num_threads">${USERS}</stringProp>
191         <stringProp name="ThreadGroup.ramp_time">1</stringProp>
192         <boolProp name="ThreadGroup.scheduler">true</boolProp>
193         <stringProp name="ThreadGroup.duration">${DURATION}</stringProp>
194         <stringProp name="ThreadGroup.delay">1</stringProp>
195       </ThreadGroup>
196       <hashTree>
197         <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Check Statistics PAP" enabled="true">
198           <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
199             <collectionProp name="Arguments.arguments"/>
200           </elementProp>
201           <stringProp name="HTTPSampler.domain">${PAP_HOST}</stringProp>
202           <stringProp name="HTTPSampler.port">6969</stringProp>
203           <stringProp name="HTTPSampler.protocol">https</stringProp>
204           <stringProp name="HTTPSampler.contentEncoding"></stringProp>
205           <stringProp name="HTTPSampler.path">statistics</stringProp>
206           <stringProp name="HTTPSampler.method">GET</stringProp>
207           <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
208           <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
209           <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
210           <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
211           <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
212           <stringProp name="HTTPSampler.connect_timeout"></stringProp>
213           <stringProp name="HTTPSampler.response_timeout"></stringProp>
214           <stringProp name="TestPlan.comments">Basic Health Check</stringProp>
215         </HTTPSamplerProxy>
216         <hashTree>
217           <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true">
218             <collectionProp name="Asserion.test_strings">
219               <stringProp name="49586">200</stringProp>
220             </collectionProp>
221             <stringProp name="Assertion.custom_message"></stringProp>
222             <stringProp name="Assertion.test_field">Assertion.response_code</stringProp>
223             <boolProp name="Assertion.assume_success">false</boolProp>
224             <intProp name="Assertion.test_type">1</intProp>
225           </ResponseAssertion>
226           <hashTree/>
227           <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="true">
228             <stringProp name="scriptLanguage">groovy</stringProp>
229             <stringProp name="parameters"></stringProp>
230             <stringProp name="filename"></stringProp>
231             <stringProp name="cacheKey">true</stringProp>
232             <stringProp name="script">import groovy.json.JsonSlurper;
233
234 def res = [];
235 if (prev.getResponseCode() == &apos;200&apos;) {
236     def jsonSlurper = new JsonSlurper();
237     res = jsonSlurper.parseText(prev.getResponseDataAsString());
238
239     assert res instanceof Map;
240     assert res.code == 200;
241     assert res.totalPdpCount == 0;
242     assert res.totalPdpGroupCount==0;
243     assert res.totalPolicyDeployCount==0;
244     assert res.policyDeploySuccessCount==0;
245
246 }
247 </stringProp>
248           </JSR223Assertion>
249           <hashTree/>
250         </hashTree>
251         <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true">
252           <collectionProp name="HeaderManager.headers">
253             <elementProp name="" elementType="Header">
254               <stringProp name="Header.name">Accept</stringProp>
255               <stringProp name="Header.value">application/json</stringProp>
256             </elementProp>
257             <elementProp name="" elementType="Header">
258               <stringProp name="Header.name">Content-Type</stringProp>
259               <stringProp name="Header.value">application/json</stringProp>
260             </elementProp>
261           </collectionProp>
262         </HeaderManager>
263         <hashTree/>
264         <AuthManager guiclass="AuthPanel" testclass="AuthManager" testname="HTTP Authorization Manager" enabled="true">
265           <collectionProp name="AuthManager.auth_list">
266             <elementProp name="" elementType="Authorization">
267               <stringProp name="Authorization.url">https://${PAP_HOST}:6969/statistics</stringProp>
268               <stringProp name="Authorization.username">healthcheck</stringProp>
269               <stringProp name="Authorization.password">zb!XztG34</stringProp>
270               <stringProp name="Authorization.domain"></stringProp>
271               <stringProp name="Authorization.realm"></stringProp>
272             </elementProp>
273           </collectionProp>
274           <boolProp name="AuthManager.clearEachIteration">true</boolProp>
275         </AuthManager>
276         <hashTree/>
277         <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true">
278           <boolProp name="ResultCollector.error_logging">false</boolProp>
279           <objProp>
280             <name>saveConfig</name>
281             <value class="SampleSaveConfiguration">
282               <time>true</time>
283               <latency>true</latency>
284               <timestamp>true</timestamp>
285               <success>true</success>
286               <label>true</label>
287               <code>true</code>
288               <message>true</message>
289               <threadName>true</threadName>
290               <dataType>true</dataType>
291               <encoding>false</encoding>
292               <assertions>true</assertions>
293               <subresults>true</subresults>
294               <responseData>false</responseData>
295               <samplerData>false</samplerData>
296               <xml>false</xml>
297               <fieldNames>true</fieldNames>
298               <responseHeaders>false</responseHeaders>
299               <requestHeaders>false</requestHeaders>
300               <responseDataOnError>false</responseDataOnError>
301               <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
302               <assertionsResultsToSave>0</assertionsResultsToSave>
303               <bytes>true</bytes>
304               <sentBytes>true</sentBytes>
305               <url>true</url>
306               <threadCounts>true</threadCounts>
307               <idleTime>true</idleTime>
308               <connectTime>true</connectTime>
309             </value>
310           </objProp>
311           <stringProp name="filename"></stringProp>
312         </ResultCollector>
313         <hashTree/>
314       </hashTree>
315     </hashTree>
316   </hashTree>
317 </jmeterTestPlan>