Lianhao Lu | de0e18b | 2018-11-07 16:39:31 +0800 | [diff] [blame] | 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="stability 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 name="PDP_HOST" elementType="Argument"> |
| 12 | <stringProp name="Argument.name">PDP_HOST</stringProp> |
| 13 | <stringProp name="Argument.value">${__P(host,10.239.40.43)}</stringProp> |
| 14 | <stringProp name="Argument.metadata">=</stringProp> |
| 15 | </elementProp> |
| 16 | <elementProp name="CSAR_DIR" elementType="Argument"> |
| 17 | <stringProp name="Argument.name">CSAR_DIR</stringProp> |
| 18 | <stringProp name="Argument.value">${__P(csardir, /tmp/policy_distribution/csar)}</stringProp> |
| 19 | <stringProp name="Argument.metadata">=</stringProp> |
| 20 | </elementProp> |
| 21 | <elementProp name="SCRIPT_DIR" elementType="Argument"> |
| 22 | <stringProp name="Argument.name">SCRIPT_DIR</stringProp> |
| 23 | <stringProp name="Argument.value">${__BeanShell(import org.apache.jmeter.services.FileServer; FileServer.getFileServer().getBaseDir();)}${__BeanShell(File.separator,)}</stringProp> |
| 24 | <stringProp name="Argument.metadata">=</stringProp> |
| 25 | </elementProp> |
| 26 | <elementProp name="DURATION" elementType="Argument"> |
| 27 | <stringProp name="Argument.name">DURATION</stringProp> |
| 28 | <stringProp name="Argument.value">${__P(duration, 30)}</stringProp> |
| 29 | <stringProp name="Argument.metadata">=</stringProp> |
| 30 | </elementProp> |
| 31 | <elementProp name="rescode" elementType="Argument"> |
| 32 | <stringProp name="Argument.name">rescode</stringProp> |
| 33 | <stringProp name="Argument.value">0</stringProp> |
| 34 | <stringProp name="Argument.metadata">=</stringProp> |
| 35 | </elementProp> |
| 36 | <elementProp name="RETRY" elementType="Argument"> |
| 37 | <stringProp name="Argument.name">RETRY</stringProp> |
| 38 | <stringProp name="Argument.value">${__P(retry, 10)}</stringProp> |
| 39 | <stringProp name="Argument.metadata">=</stringProp> |
| 40 | </elementProp> |
| 41 | <elementProp name="RETRY_WAIT" elementType="Argument"> |
| 42 | <stringProp name="Argument.name">RETRY_WAIT</stringProp> |
| 43 | <stringProp name="Argument.value">${__P(wait, 1000)}</stringProp> |
| 44 | <stringProp name="Argument.metadata">=</stringProp> |
| 45 | </elementProp> |
| 46 | <elementProp name="counter" elementType="Argument"> |
| 47 | <stringProp name="Argument.name">counter</stringProp> |
| 48 | <stringProp name="Argument.value">0</stringProp> |
| 49 | <stringProp name="Argument.metadata">=</stringProp> |
| 50 | </elementProp> |
| 51 | </collectionProp> |
| 52 | </elementProp> |
| 53 | <stringProp name="TestPlan.user_define_classpath"></stringProp> |
| 54 | </TestPlan> |
| 55 | <hashTree> |
| 56 | <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true"> |
| 57 | <stringProp name="ThreadGroup.on_sample_error">continue</stringProp> |
| 58 | <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true"> |
| 59 | <boolProp name="LoopController.continue_forever">false</boolProp> |
| 60 | <intProp name="LoopController.loops">-1</intProp> |
| 61 | </elementProp> |
| 62 | <stringProp name="ThreadGroup.num_threads">1</stringProp> |
| 63 | <stringProp name="ThreadGroup.ramp_time">1</stringProp> |
| 64 | <boolProp name="ThreadGroup.scheduler">true</boolProp> |
| 65 | <stringProp name="ThreadGroup.duration">${DURATION}</stringProp> |
| 66 | <stringProp name="ThreadGroup.delay">1</stringProp> |
| 67 | </ThreadGroup> |
| 68 | <hashTree> |
| 69 | <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="GET_POLICY_HTTP_HEADER" enabled="true"> |
| 70 | <collectionProp name="HeaderManager.headers"> |
| 71 | <elementProp name="" elementType="Header"> |
| 72 | <stringProp name="Header.name">Content-Type</stringProp> |
| 73 | <stringProp name="Header.value">application/json</stringProp> |
| 74 | </elementProp> |
| 75 | <elementProp name="" elementType="Header"> |
| 76 | <stringProp name="Header.name">Accept</stringProp> |
| 77 | <stringProp name="Header.value">application/json</stringProp> |
| 78 | </elementProp> |
| 79 | <elementProp name="" elementType="Header"> |
| 80 | <stringProp name="Header.name">ClientAuth</stringProp> |
| 81 | <stringProp name="Header.value">cHl0aG9uOnRlc3Q=</stringProp> |
| 82 | </elementProp> |
| 83 | <elementProp name="" elementType="Header"> |
| 84 | <stringProp name="Header.name">Authorization</stringProp> |
| 85 | <stringProp name="Header.value">Basic dGVzdHBkcDphbHBoYTEyMw==</stringProp> |
| 86 | </elementProp> |
| 87 | <elementProp name="" elementType="Header"> |
| 88 | <stringProp name="Header.name">Environment</stringProp> |
| 89 | <stringProp name="Header.value">TEST</stringProp> |
| 90 | </elementProp> |
| 91 | </collectionProp> |
| 92 | </HeaderManager> |
| 93 | <hashTree/> |
| 94 | <RandomVariableConfig guiclass="TestBeanGUI" testclass="RandomVariableConfig" testname="Random Variable" enabled="true"> |
| 95 | <stringProp name="maximumValue">100000000</stringProp> |
| 96 | <stringProp name="minimumValue">1</stringProp> |
| 97 | <stringProp name="outputFormat">00000000</stringProp> |
| 98 | <boolProp name="perThread">false</boolProp> |
| 99 | <stringProp name="randomSeed"></stringProp> |
| 100 | <stringProp name="variableName">RESID</stringProp> |
| 101 | </RandomVariableConfig> |
| 102 | <hashTree/> |
| 103 | <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="check if existing policy" enabled="true"/> |
| 104 | <hashTree> |
| 105 | <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="list_policy" enabled="true"> |
| 106 | <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> |
| 107 | <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> |
| 108 | <collectionProp name="Arguments.arguments"> |
| 109 | <elementProp name="" elementType="HTTPArgument"> |
| 110 | <boolProp name="HTTPArgument.always_encode">false</boolProp> |
| 111 | <stringProp name="Argument.value">{"policyName": "oofCasablanca.*s3p_${RESID}.*"}</stringProp> |
| 112 | <stringProp name="Argument.metadata">=</stringProp> |
| 113 | </elementProp> |
| 114 | </collectionProp> |
| 115 | </elementProp> |
| 116 | <stringProp name="HTTPSampler.domain">${PDP_HOST}</stringProp> |
| 117 | <stringProp name="HTTPSampler.port">8081</stringProp> |
| 118 | <stringProp name="HTTPSampler.protocol">https</stringProp> |
| 119 | <stringProp name="HTTPSampler.contentEncoding"></stringProp> |
| 120 | <stringProp name="HTTPSampler.path">/pdp/api/listConfig</stringProp> |
| 121 | <stringProp name="HTTPSampler.method">POST</stringProp> |
| 122 | <boolProp name="HTTPSampler.follow_redirects">true</boolProp> |
| 123 | <boolProp name="HTTPSampler.auto_redirects">false</boolProp> |
| 124 | <boolProp name="HTTPSampler.use_keepalive">true</boolProp> |
| 125 | <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> |
| 126 | <stringProp name="HTTPSampler.embedded_url_re"></stringProp> |
| 127 | <stringProp name="HTTPSampler.connect_timeout"></stringProp> |
| 128 | <stringProp name="HTTPSampler.response_timeout"></stringProp> |
| 129 | </HTTPSamplerProxy> |
| 130 | <hashTree> |
| 131 | <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="JSR223 PostProcessor" enabled="true"> |
| 132 | <stringProp name="scriptLanguage">groovy</stringProp> |
| 133 | <stringProp name="parameters"></stringProp> |
| 134 | <stringProp name="filename"></stringProp> |
| 135 | <stringProp name="cacheKey">true</stringProp> |
| 136 | <stringProp name="script">import groovy.json.JsonSlurper; |
| 137 | |
| 138 | def to_delete = []; |
| 139 | if (prev.getResponseCode() == '200') { |
| 140 | def jsonSlurper = new JsonSlurper(); |
| 141 | to_delete = jsonSlurper.parseText(prev.getResponseDataAsString()); |
| 142 | } |
| 143 | vars.putObject('to_delete', to_delete); |
| 144 | </stringProp> |
| 145 | </JSR223PostProcessor> |
| 146 | <hashTree/> |
| 147 | </hashTree> |
| 148 | <WhileController guiclass="WhileControllerGui" testclass="WhileController" testname="While Controller" enabled="true"> |
| 149 | <stringProp name="WhileController.condition">${__groovy(vars.getObject('to_delete').size() > 0)}</stringProp> |
| 150 | </WhileController> |
| 151 | <hashTree> |
| 152 | <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="delete_policy_pdp" enabled="true"> |
| 153 | <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> |
| 154 | <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> |
| 155 | <collectionProp name="Arguments.arguments"> |
| 156 | <elementProp name="" elementType="HTTPArgument"> |
| 157 | <boolProp name="HTTPArgument.always_encode">false</boolProp> |
| 158 | <stringProp name="Argument.value">{
 |
| 159 | "pdpGroup": "default",
 |
| 160 | "policyComponent": "PDP",
 |
| 161 | "policyType": "Optimization",
 |
| 162 | "policyName": "${policyname}"
 |
| 163 | }</stringProp> |
| 164 | <stringProp name="Argument.metadata">=</stringProp> |
| 165 | </elementProp> |
| 166 | </collectionProp> |
| 167 | </elementProp> |
| 168 | <stringProp name="HTTPSampler.domain">${PDP_HOST}</stringProp> |
| 169 | <stringProp name="HTTPSampler.port">8081</stringProp> |
| 170 | <stringProp name="HTTPSampler.protocol">https</stringProp> |
| 171 | <stringProp name="HTTPSampler.contentEncoding"></stringProp> |
| 172 | <stringProp name="HTTPSampler.path">/pdp/api/deletePolicy</stringProp> |
| 173 | <stringProp name="HTTPSampler.method">DELETE</stringProp> |
| 174 | <boolProp name="HTTPSampler.follow_redirects">true</boolProp> |
| 175 | <boolProp name="HTTPSampler.auto_redirects">false</boolProp> |
| 176 | <boolProp name="HTTPSampler.use_keepalive">true</boolProp> |
| 177 | <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> |
| 178 | <stringProp name="HTTPSampler.embedded_url_re"></stringProp> |
| 179 | <stringProp name="HTTPSampler.connect_timeout"></stringProp> |
| 180 | <stringProp name="HTTPSampler.response_timeout"></stringProp> |
| 181 | </HTTPSamplerProxy> |
| 182 | <hashTree> |
| 183 | <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="JSR223 PreProcessor" enabled="true"> |
| 184 | <stringProp name="cacheKey">true</stringProp> |
| 185 | <stringProp name="filename"></stringProp> |
| 186 | <stringProp name="parameters"></stringProp> |
| 187 | <stringProp name="script">def to_delete = vars.getObject('to_delete'); |
| 188 | def policyname = to_delete.pop() |
| 189 | vars.put('policyname', policyname.toString()); |
| 190 | vars.putObject('to_delete', to_delete); |
| 191 | </stringProp> |
| 192 | <stringProp name="scriptLanguage">groovy</stringProp> |
| 193 | </JSR223PreProcessor> |
| 194 | <hashTree/> |
| 195 | </hashTree> |
| 196 | <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="delete_policy_pap" enabled="true"> |
| 197 | <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> |
| 198 | <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> |
| 199 | <collectionProp name="Arguments.arguments"> |
| 200 | <elementProp name="" elementType="HTTPArgument"> |
| 201 | <boolProp name="HTTPArgument.always_encode">false</boolProp> |
| 202 | <stringProp name="Argument.value">{
 |
| 203 | "deleteCondition":"ALL",
 |
| 204 | "policyComponent": "PAP",
 |
| 205 | "policyType": "Optimization",
 |
| 206 | "policyName": "${policyname}"
 |
| 207 | }</stringProp> |
| 208 | <stringProp name="Argument.metadata">=</stringProp> |
| 209 | </elementProp> |
| 210 | </collectionProp> |
| 211 | </elementProp> |
| 212 | <stringProp name="HTTPSampler.domain">${PDP_HOST}</stringProp> |
| 213 | <stringProp name="HTTPSampler.port">8081</stringProp> |
| 214 | <stringProp name="HTTPSampler.protocol">https</stringProp> |
| 215 | <stringProp name="HTTPSampler.contentEncoding"></stringProp> |
| 216 | <stringProp name="HTTPSampler.path">/pdp/api/deletePolicy</stringProp> |
| 217 | <stringProp name="HTTPSampler.method">DELETE</stringProp> |
| 218 | <boolProp name="HTTPSampler.follow_redirects">true</boolProp> |
| 219 | <boolProp name="HTTPSampler.auto_redirects">false</boolProp> |
| 220 | <boolProp name="HTTPSampler.use_keepalive">true</boolProp> |
| 221 | <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> |
| 222 | <stringProp name="HTTPSampler.embedded_url_re"></stringProp> |
| 223 | <stringProp name="HTTPSampler.connect_timeout"></stringProp> |
| 224 | <stringProp name="HTTPSampler.response_timeout"></stringProp> |
| 225 | </HTTPSamplerProxy> |
| 226 | <hashTree/> |
| 227 | </hashTree> |
| 228 | </hashTree> |
| 229 | <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="generate random csar" enabled="true"/> |
| 230 | <hashTree> |
| 231 | <SystemSampler guiclass="SystemSamplerGui" testclass="SystemSampler" testname="Generate_CSAR" enabled="true"> |
| 232 | <boolProp name="SystemSampler.checkReturnCode">true</boolProp> |
| 233 | <stringProp name="SystemSampler.expectedReturnCode">0</stringProp> |
| 234 | <stringProp name="SystemSampler.command">${SCRIPT_DIR}generate.sh</stringProp> |
| 235 | <elementProp name="SystemSampler.arguments" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> |
| 236 | <collectionProp name="Arguments.arguments"> |
| 237 | <elementProp name="" elementType="Argument"> |
| 238 | <stringProp name="Argument.name"></stringProp> |
| 239 | <stringProp name="Argument.value">${CSAR_DIR}</stringProp> |
| 240 | <stringProp name="Argument.metadata">=</stringProp> |
| 241 | </elementProp> |
| 242 | <elementProp name="" elementType="Argument"> |
| 243 | <stringProp name="Argument.name"></stringProp> |
| 244 | <stringProp name="Argument.value">${RESID}</stringProp> |
| 245 | <stringProp name="Argument.metadata">=</stringProp> |
| 246 | </elementProp> |
| 247 | </collectionProp> |
| 248 | </elementProp> |
| 249 | <elementProp name="SystemSampler.environment" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> |
| 250 | <collectionProp name="Arguments.arguments"/> |
| 251 | </elementProp> |
| 252 | <stringProp name="SystemSampler.directory"></stringProp> |
| 253 | </SystemSampler> |
| 254 | <hashTree/> |
| 255 | <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Reset Loop" enabled="true"> |
| 256 | <stringProp name="cacheKey">true</stringProp> |
| 257 | <stringProp name="filename"></stringProp> |
| 258 | <stringProp name="parameters"></stringProp> |
| 259 | <stringProp name="script">vars.put("rescode", "0"); |
| 260 | vars.put('counter', '0');</stringProp> |
| 261 | <stringProp name="scriptLanguage">groovy</stringProp> |
| 262 | </JSR223Sampler> |
| 263 | <hashTree/> |
| 264 | </hashTree> |
| 265 | <WhileController guiclass="WhileControllerGui" testclass="WhileController" testname="WC" enabled="true"> |
| 266 | <stringProp name="WhileController.condition">${__javaScript(${counter} < ${RETRY} && "${rescode}" != "200")}</stringProp> |
| 267 | </WhileController> |
| 268 | <hashTree> |
| 269 | <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Get_Policy" enabled="true"> |
| 270 | <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> |
| 271 | <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> |
| 272 | <collectionProp name="Arguments.arguments"> |
| 273 | <elementProp name="" elementType="HTTPArgument"> |
| 274 | <boolProp name="HTTPArgument.always_encode">false</boolProp> |
| 275 | <stringProp name="Argument.value">{"policyName": "oofCasablanca.*s3p_${RESID}.*"}</stringProp> |
| 276 | <stringProp name="Argument.metadata">=</stringProp> |
| 277 | </elementProp> |
| 278 | </collectionProp> |
| 279 | </elementProp> |
| 280 | <stringProp name="HTTPSampler.domain">${PDP_HOST}</stringProp> |
| 281 | <stringProp name="HTTPSampler.port">8081</stringProp> |
| 282 | <stringProp name="HTTPSampler.protocol">https</stringProp> |
| 283 | <stringProp name="HTTPSampler.contentEncoding"></stringProp> |
| 284 | <stringProp name="HTTPSampler.path">/pdp/api/getConfig</stringProp> |
| 285 | <stringProp name="HTTPSampler.method">POST</stringProp> |
| 286 | <boolProp name="HTTPSampler.follow_redirects">true</boolProp> |
| 287 | <boolProp name="HTTPSampler.auto_redirects">false</boolProp> |
| 288 | <boolProp name="HTTPSampler.use_keepalive">true</boolProp> |
| 289 | <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> |
| 290 | <stringProp name="HTTPSampler.embedded_url_re"></stringProp> |
| 291 | <stringProp name="HTTPSampler.connect_timeout"></stringProp> |
| 292 | <stringProp name="HTTPSampler.response_timeout"></stringProp> |
| 293 | </HTTPSamplerProxy> |
| 294 | <hashTree> |
| 295 | <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="JSR223 PostProcessor" enabled="true"> |
| 296 | <stringProp name="cacheKey">true</stringProp> |
| 297 | <stringProp name="filename"></stringProp> |
| 298 | <stringProp name="parameters"></stringProp> |
| 299 | <stringProp name="script">def rescode = prev.getResponseCode(); |
| 300 | vars.put('rescode', rescode);</stringProp> |
| 301 | <stringProp name="scriptLanguage">groovy</stringProp> |
| 302 | </JSR223PostProcessor> |
| 303 | <hashTree/> |
| 304 | <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="Constant Timer" enabled="true"> |
| 305 | <stringProp name="ConstantTimer.delay">${RETRY_WAIT}</stringProp> |
| 306 | </ConstantTimer> |
| 307 | <hashTree/> |
| 308 | <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="true"> |
| 309 | <stringProp name="cacheKey">true</stringProp> |
| 310 | <stringProp name="filename"></stringProp> |
| 311 | <stringProp name="parameters"></stringProp> |
| 312 | <stringProp name="script">def counter=vars.get('counter').toInteger(); |
| 313 | def retry=vars.get('RETRY').toInteger(); |
| 314 | def rescode = prev.getResponseCode(); |
| 315 | |
| 316 | if (counter >= retry && rescode !='200') { |
| 317 | //log.info('counter: ' + counter); |
| 318 | //log.info('retry: ' + retry); |
| 319 | AssertionResult.setFailure(true); |
| 320 | AssertionResult.setFailureMessage('get policy failed for resource ' + vars.get('RESID')); |
| 321 | } |
| 322 | </stringProp> |
| 323 | <stringProp name="scriptLanguage">groovy</stringProp> |
| 324 | </JSR223Assertion> |
| 325 | <hashTree/> |
| 326 | </hashTree> |
| 327 | <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="Counter" enabled="true"> |
| 328 | <stringProp name="CounterConfig.start">1</stringProp> |
| 329 | <stringProp name="CounterConfig.end"></stringProp> |
| 330 | <stringProp name="CounterConfig.incr">1</stringProp> |
| 331 | <stringProp name="CounterConfig.name">counter</stringProp> |
| 332 | <stringProp name="CounterConfig.format"></stringProp> |
| 333 | <boolProp name="CounterConfig.per_user">true</boolProp> |
| 334 | <boolProp name="CounterConfig.reset_on_tg_iteration">true</boolProp> |
| 335 | </CounterConfig> |
| 336 | <hashTree/> |
| 337 | </hashTree> |
| 338 | </hashTree> |
| 339 | </hashTree> |
| 340 | </hashTree> |
| 341 | </jmeterTestPlan> |