9a3ad6bed08c0ce80d5d1410f5c697484e2934ae
[policy/xacml-pdp.git] / testsuites / stability / src / main / resources / testplans / stability.jmx
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3   ============LICENSE_START=======================================================
4   ONAP Policy XACML PDP
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 XACML PDP Stability" enabled="true">
24       <stringProp name="TestPlan.comments">Policy XACML PDP 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="POLICY_XACML_PDP_HOST" elementType="Argument">
31             <stringProp name="Argument.name">POLICY_XACML_PDP_HOST</stringProp>
32             <stringProp name="Argument.value">${__P(host,127.0.0.1)}</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="XACML PDP Health Check Test" 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">${POLICY_XACML_PDP_HOST}</stringProp>
73           <stringProp name="HTTPSampler.port">6969</stringProp>
74           <stringProp name="HTTPSampler.protocol">http</stringProp>
75           <stringProp name="HTTPSampler.contentEncoding"></stringProp>
76           <stringProp name="HTTPSampler.path">policy/pdpx/v1/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 Xacml PDP&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">http://${POLICY_XACML_PDP_HOST}:6969/policy/pdpx/v1/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="XACML PDP Statistics API" 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" 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">${POLICY_XACML_PDP_HOST}</stringProp>
202           <stringProp name="HTTPSampler.port">6969</stringProp>
203           <stringProp name="HTTPSampler.protocol">http</stringProp>
204           <stringProp name="HTTPSampler.contentEncoding"></stringProp>
205           <stringProp name="HTTPSampler.path">policy/pdpx/v1/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.totalPoliciesCount == 0;
242     assert res.permitDecisionsCount == 0;
243     assert res.denyDecisionsCount == 0;
244     assert res.indeterminantDecisionsCount == 0;
245     assert res.notApplicableDecisionsCount == 0;
246     
247
248
249 }</stringProp>
250           </JSR223Assertion>
251           <hashTree/>
252         </hashTree>
253         <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true">
254           <collectionProp name="HeaderManager.headers">
255             <elementProp name="" elementType="Header">
256               <stringProp name="Header.name">Accept</stringProp>
257               <stringProp name="Header.value">application/json</stringProp>
258             </elementProp>
259             <elementProp name="" elementType="Header">
260               <stringProp name="Header.name">Content-Type</stringProp>
261               <stringProp name="Header.value">application/json</stringProp>
262             </elementProp>
263           </collectionProp>
264         </HeaderManager>
265         <hashTree/>
266         <AuthManager guiclass="AuthPanel" testclass="AuthManager" testname="HTTP Authorization Manager" enabled="true">
267           <collectionProp name="AuthManager.auth_list">
268             <elementProp name="" elementType="Authorization">
269               <stringProp name="Authorization.url">http://${POLICY_XACML_PDP_HOST}:6969/policy/pdpx/v1/statistics</stringProp>
270               <stringProp name="Authorization.username">healthcheck</stringProp>
271               <stringProp name="Authorization.password">zb!XztG34</stringProp>
272               <stringProp name="Authorization.domain"></stringProp>
273               <stringProp name="Authorization.realm"></stringProp>
274             </elementProp>
275           </collectionProp>
276           <boolProp name="AuthManager.clearEachIteration">true</boolProp>
277         </AuthManager>
278         <hashTree/>
279         <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true">
280           <boolProp name="ResultCollector.error_logging">false</boolProp>
281           <objProp>
282             <name>saveConfig</name>
283             <value class="SampleSaveConfiguration">
284               <time>true</time>
285               <latency>true</latency>
286               <timestamp>true</timestamp>
287               <success>true</success>
288               <label>true</label>
289               <code>true</code>
290               <message>true</message>
291               <threadName>true</threadName>
292               <dataType>true</dataType>
293               <encoding>false</encoding>
294               <assertions>true</assertions>
295               <subresults>true</subresults>
296               <responseData>false</responseData>
297               <samplerData>false</samplerData>
298               <xml>false</xml>
299               <fieldNames>true</fieldNames>
300               <responseHeaders>false</responseHeaders>
301               <requestHeaders>false</requestHeaders>
302               <responseDataOnError>false</responseDataOnError>
303               <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
304               <assertionsResultsToSave>0</assertionsResultsToSave>
305               <bytes>true</bytes>
306               <sentBytes>true</sentBytes>
307               <url>true</url>
308               <threadCounts>true</threadCounts>
309               <idleTime>true</idleTime>
310               <connectTime>true</connectTime>
311             </value>
312           </objProp>
313           <stringProp name="filename"></stringProp>
314         </ResultCollector>
315         <hashTree/>
316       </hashTree>
317     </hashTree>
318   </hashTree>
319 </jmeterTestPlan>