We can generate multiple access tokens and persist them to token table
using following script. With that we will generate random users and
tokens. Then insert them in to access token table. At the same time we
can write them to text file so JMeter can use that file to load tokens.
When we have multiple tokens and users then it will cause to increase
number of throttle context created in system. And it can use to generate traffic pattern which is almost same to real
production traffic.
#!/bin/bash
# Use for loop
for (( c=1; c<=100000; c++ ))
do
ACCESS_KEY=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
AUTHZ_USER=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 6 | head -n 1)
echo INSERT INTO "apimgt.IDN_OAUTH2_ACCESS_ TOKEN (ACCESS_TOKEN,REFRESH_TOKEN, ACCESS_KEY,AUTHZ_USER,USER_ TYPE,TIME_CREATED,VALIDITY_ PERIOD,TOKEN_SCOPE,TOKEN_ STATE,TOKEN_STATE_ID) VALUES ('$ACCESS_KEY',' 4af2f02e6de335dfa36d98192ec2df 1', 'C2aNkK1HRJfWHuF2jo64oWA1xiAa' ,
'$AUTHZ_USER@carbon.super', 'APPLICATION_USER', '2015-04-01 09:32:46',
99999999000, 'default', 'ACTIVE', 'NONE');" >> access_token3.sql
echo $ACCESS_KEY >> keys3.txt
done
#!/bin/bash
# Use for loop
for (( c=1; c<=100000; c++ ))
do
ACCESS_KEY=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
AUTHZ_USER=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 6 | head -n 1)
echo INSERT INTO "apimgt.IDN_OAUTH2_ACCESS_
echo $ACCESS_KEY >> keys3.txt
done