Adds basic performance tests for XACML PDP
[policy/xacml-pdp.git] / testsuites / stability / src / main / resources / testplans / stability.jmx
1 <?xml version="1.0" encoding="UTF-8"?>
2 <jmeterTestPlan version="1.2" properties="5.0" jmeter="5.0 r1840935">
3   <hashTree>
4     <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Policy XACML PDP Stability" enabled="true">
5       <stringProp name="TestPlan.comments">Policy XACML PDP Stability Tests</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 name="POLICY_XACML_PDP_HOST" elementType="Argument">
12             <stringProp name="Argument.name">POLICY_XACML_PDP_HOST</stringProp>
13             <stringProp name="Argument.value">${__P(host,10.12.6.164)}</stringProp>
14             <stringProp name="Argument.metadata">=</stringProp>
15           </elementProp>
16           <elementProp name="DURATION" elementType="Argument">
17             <stringProp name="Argument.name">DURATION</stringProp>
18             <stringProp name="Argument.value">${__P(duration, 5)}</stringProp>
19             <stringProp name="Argument.metadata">=</stringProp>
20           </elementProp>
21           <elementProp name="USERS" elementType="Argument">
22             <stringProp name="Argument.name">USERS</stringProp>
23             <stringProp name="Argument.value">${__P(users, 1)}</stringProp>
24             <stringProp name="Argument.metadata">=</stringProp>
25           </elementProp>
26           <elementProp name="PORT" elementType="Argument">
27             <stringProp name="Argument.name">PORT</stringProp>
28             <stringProp name="Argument.value">${__P(port, 6969)}</stringProp>
29             <stringProp name="Argument.metadata">=</stringProp>
30           </elementProp>
31         </collectionProp>
32       </elementProp>
33       <stringProp name="TestPlan.user_define_classpath"></stringProp>
34     </TestPlan>
35     <hashTree>
36       <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="XACML PDP Health Check Test" enabled="true">
37         <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
38         <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
39           <boolProp name="LoopController.continue_forever">false</boolProp>
40           <intProp name="LoopController.loops">-1</intProp>
41         </elementProp>
42         <stringProp name="ThreadGroup.num_threads">${USERS}</stringProp>
43         <stringProp name="ThreadGroup.ramp_time">1</stringProp>
44         <boolProp name="ThreadGroup.scheduler">true</boolProp>
45         <stringProp name="ThreadGroup.duration">${DURATION}</stringProp>
46         <stringProp name="ThreadGroup.delay">1</stringProp>
47       </ThreadGroup>
48       <hashTree>
49         <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Check Health" enabled="true">
50           <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
51             <collectionProp name="Arguments.arguments"/>
52           </elementProp>
53           <stringProp name="HTTPSampler.domain">${POLICY_XACML_PDP_HOST}</stringProp>
54           <stringProp name="HTTPSampler.port">6969</stringProp>
55           <stringProp name="HTTPSampler.protocol">https</stringProp>
56           <stringProp name="HTTPSampler.contentEncoding"></stringProp>
57           <stringProp name="HTTPSampler.path">policy/pdpx/v1/healthcheck</stringProp>
58           <stringProp name="HTTPSampler.method">GET</stringProp>
59           <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
60           <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
61           <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
62           <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
63           <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
64           <stringProp name="HTTPSampler.connect_timeout"></stringProp>
65           <stringProp name="HTTPSampler.response_timeout"></stringProp>
66           <stringProp name="TestPlan.comments">Basic Health Check</stringProp>
67         </HTTPSamplerProxy>
68         <hashTree>
69           <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true">
70             <collectionProp name="Asserion.test_strings">
71               <stringProp name="49586">200</stringProp>
72             </collectionProp>
73             <stringProp name="Assertion.custom_message"></stringProp>
74             <stringProp name="Assertion.test_field">Assertion.response_code</stringProp>
75             <boolProp name="Assertion.assume_success">false</boolProp>
76             <intProp name="Assertion.test_type">1</intProp>
77           </ResponseAssertion>
78           <hashTree/>
79           <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="true">
80             <stringProp name="scriptLanguage">groovy</stringProp>
81             <stringProp name="parameters"></stringProp>
82             <stringProp name="filename"></stringProp>
83             <stringProp name="cacheKey">true</stringProp>
84             <stringProp name="script">import groovy.json.JsonSlurper;
85
86 def res = [];
87 if (prev.getResponseCode() == &apos;200&apos;) {
88     def jsonSlurper = new JsonSlurper();
89     res = jsonSlurper.parseText(prev.getResponseDataAsString());
90
91     assert res instanceof Map;
92     assert res.code == 200;
93     assert res.name == &quot;Policy Xacml PDP&quot;;
94     assert res.healthy==true;
95     assert res.message==&quot;alive&quot;;
96
97 }</stringProp>
98           </JSR223Assertion>
99           <hashTree/>
100         </hashTree>
101         <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true">
102           <collectionProp name="HeaderManager.headers">
103             <elementProp name="" elementType="Header">
104               <stringProp name="Header.name">Accept</stringProp>
105               <stringProp name="Header.value">application/json</stringProp>
106             </elementProp>
107             <elementProp name="" elementType="Header">
108               <stringProp name="Header.name">Content-Type</stringProp>
109               <stringProp name="Header.value">application/json</stringProp>
110             </elementProp>
111           </collectionProp>
112         </HeaderManager>
113         <hashTree/>
114         <AuthManager guiclass="AuthPanel" testclass="AuthManager" testname="HTTP Authorization Manager" enabled="true">
115           <collectionProp name="AuthManager.auth_list">
116             <elementProp name="" elementType="Authorization">
117               <stringProp name="Authorization.url">https://${POLICY_XACML_PDP_HOST}:6969/policy/pdpx/v1/healthcheck</stringProp>
118               <stringProp name="Authorization.username">healthcheck</stringProp>
119               <stringProp name="Authorization.password">zb!XztG34</stringProp>
120               <stringProp name="Authorization.domain"></stringProp>
121               <stringProp name="Authorization.realm"></stringProp>
122             </elementProp>
123           </collectionProp>
124           <boolProp name="AuthManager.clearEachIteration">true</boolProp>
125         </AuthManager>
126         <hashTree/>
127         <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true">
128           <boolProp name="ResultCollector.error_logging">false</boolProp>
129           <objProp>
130             <name>saveConfig</name>
131             <value class="SampleSaveConfiguration">
132               <time>true</time>
133               <latency>true</latency>
134               <timestamp>true</timestamp>
135               <success>true</success>
136               <label>true</label>
137               <code>true</code>
138               <message>true</message>
139               <threadName>true</threadName>
140               <dataType>true</dataType>
141               <encoding>false</encoding>
142               <assertions>true</assertions>
143               <subresults>true</subresults>
144               <responseData>false</responseData>
145               <samplerData>false</samplerData>
146               <xml>false</xml>
147               <fieldNames>true</fieldNames>
148               <responseHeaders>false</responseHeaders>
149               <requestHeaders>false</requestHeaders>
150               <responseDataOnError>false</responseDataOnError>
151               <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
152               <assertionsResultsToSave>0</assertionsResultsToSave>
153               <bytes>true</bytes>
154               <sentBytes>true</sentBytes>
155               <url>true</url>
156               <threadCounts>true</threadCounts>
157               <idleTime>true</idleTime>
158               <connectTime>true</connectTime>
159             </value>
160           </objProp>
161           <stringProp name="filename"></stringProp>
162         </ResultCollector>
163         <hashTree/>
164       </hashTree>
165       <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="XACML PDP Statistics API" enabled="true">
166         <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
167         <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
168           <boolProp name="LoopController.continue_forever">false</boolProp>
169           <intProp name="LoopController.loops">-1</intProp>
170         </elementProp>
171         <stringProp name="ThreadGroup.num_threads">${USERS}</stringProp>
172         <stringProp name="ThreadGroup.ramp_time">1</stringProp>
173         <boolProp name="ThreadGroup.scheduler">true</boolProp>
174         <stringProp name="ThreadGroup.duration">${DURATION}</stringProp>
175         <stringProp name="ThreadGroup.delay">1</stringProp>
176       </ThreadGroup>
177       <hashTree>
178         <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Check Statistics" enabled="true">
179           <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
180             <collectionProp name="Arguments.arguments"/>
181           </elementProp>
182           <stringProp name="HTTPSampler.domain">${POLICY_XACML_PDP_HOST}</stringProp>
183           <stringProp name="HTTPSampler.port">6969</stringProp>
184           <stringProp name="HTTPSampler.protocol">https</stringProp>
185           <stringProp name="HTTPSampler.contentEncoding"></stringProp>
186           <stringProp name="HTTPSampler.path">policy/pdpx/v1/statistics</stringProp>
187           <stringProp name="HTTPSampler.method">GET</stringProp>
188           <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
189           <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
190           <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
191           <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
192           <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
193           <stringProp name="HTTPSampler.connect_timeout"></stringProp>
194           <stringProp name="HTTPSampler.response_timeout"></stringProp>
195           <stringProp name="TestPlan.comments">Basic Health Check</stringProp>
196         </HTTPSamplerProxy>
197         <hashTree>
198           <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true">
199             <collectionProp name="Asserion.test_strings">
200               <stringProp name="49586">200</stringProp>
201             </collectionProp>
202             <stringProp name="Assertion.custom_message"></stringProp>
203             <stringProp name="Assertion.test_field">Assertion.response_code</stringProp>
204             <boolProp name="Assertion.assume_success">false</boolProp>
205             <intProp name="Assertion.test_type">1</intProp>
206           </ResponseAssertion>
207           <hashTree/>
208           <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="true">
209             <stringProp name="scriptLanguage">groovy</stringProp>
210             <stringProp name="parameters"></stringProp>
211             <stringProp name="filename"></stringProp>
212             <stringProp name="cacheKey">true</stringProp>
213             <stringProp name="script">import groovy.json.JsonSlurper;
214
215 def res = [];
216 if (prev.getResponseCode() == &apos;200&apos;) {
217     def jsonSlurper = new JsonSlurper();
218     res = jsonSlurper.parseText(prev.getResponseDataAsString());
219
220     assert res instanceof Map;
221     assert res.code == 200;
222     assert res.totalPoliciesCount == 0;
223     assert res.permitDecisionsCount == 0;
224     assert res.denyDecisionsCount == 0;
225     assert res.indeterminantDecisionsCount == 0;
226     assert res.notApplicableDecisionsCount == 0;
227     
228
229
230 }</stringProp>
231           </JSR223Assertion>
232           <hashTree/>
233         </hashTree>
234         <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true">
235           <collectionProp name="HeaderManager.headers">
236             <elementProp name="" elementType="Header">
237               <stringProp name="Header.name">Accept</stringProp>
238               <stringProp name="Header.value">application/json</stringProp>
239             </elementProp>
240             <elementProp name="" elementType="Header">
241               <stringProp name="Header.name">Content-Type</stringProp>
242               <stringProp name="Header.value">application/json</stringProp>
243             </elementProp>
244           </collectionProp>
245         </HeaderManager>
246         <hashTree/>
247         <AuthManager guiclass="AuthPanel" testclass="AuthManager" testname="HTTP Authorization Manager" enabled="true">
248           <collectionProp name="AuthManager.auth_list">
249             <elementProp name="" elementType="Authorization">
250               <stringProp name="Authorization.url">https://${POLICY_XACML_PDP_HOST}:6969/policy/pdpx/v1/statistics</stringProp>
251               <stringProp name="Authorization.username">healthcheck</stringProp>
252               <stringProp name="Authorization.password">zb!XztG34</stringProp>
253               <stringProp name="Authorization.domain"></stringProp>
254               <stringProp name="Authorization.realm"></stringProp>
255             </elementProp>
256           </collectionProp>
257           <boolProp name="AuthManager.clearEachIteration">true</boolProp>
258         </AuthManager>
259         <hashTree/>
260         <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true">
261           <boolProp name="ResultCollector.error_logging">false</boolProp>
262           <objProp>
263             <name>saveConfig</name>
264             <value class="SampleSaveConfiguration">
265               <time>true</time>
266               <latency>true</latency>
267               <timestamp>true</timestamp>
268               <success>true</success>
269               <label>true</label>
270               <code>true</code>
271               <message>true</message>
272               <threadName>true</threadName>
273               <dataType>true</dataType>
274               <encoding>false</encoding>
275               <assertions>true</assertions>
276               <subresults>true</subresults>
277               <responseData>false</responseData>
278               <samplerData>false</samplerData>
279               <xml>false</xml>
280               <fieldNames>true</fieldNames>
281               <responseHeaders>false</responseHeaders>
282               <requestHeaders>false</requestHeaders>
283               <responseDataOnError>false</responseDataOnError>
284               <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
285               <assertionsResultsToSave>0</assertionsResultsToSave>
286               <bytes>true</bytes>
287               <sentBytes>true</sentBytes>
288               <url>true</url>
289               <threadCounts>true</threadCounts>
290               <idleTime>true</idleTime>
291               <connectTime>true</connectTime>
292             </value>
293           </objProp>
294           <stringProp name="filename"></stringProp>
295         </ResultCollector>
296         <hashTree/>
297       </hashTree>
298     </hashTree>
299   </hashTree>
300 </jmeterTestPlan>