I'm performing load testing on my APIs using Jmeter. I'm making an Http Request and the response of that Http Request is passed as part of request body to my 2nd Http Request. There, I'm passing the dynamic values from a text file as follows :- Obj.txt
"Details": {
"Start": "2019-08-28T11:39:57.153",
"Expiry": "2020-08-28T11:39:57.153",
"Accounts": [
{
"accType": "SAVINGS",
"ReferenceNumber": "${RefNumber}",
"AccNumber": "${AccNumber}"
}
]
}
This json object is read in my java program. I'm calculating a signature for that json object as follows :-
public static String signConsent() throws Exception{
String objDetail = loadDetailsObject();
String keysJson = "Random String";
JsonWebKeySet jsonWebKeySet = new JsonWebKeySet(keysJson);
String signature = sign(objDetail, jsonWebKeySet);
return signature;
}
How do I read dynamic values from a text file. I'm loading the textfile using loadDetailsObject
function as follows :-
public static String loadDetailsObject() {
String details = "";
try {
consentDetails = FileUtils.readFileToString(new File("Obj.txt"), Charset.defaultCharset());
} catch (IOException e) {
log.error("Erorr\n", e);
}
return details;
}
The RefNumber
and AccNumber
will change each time and the signature accordingly will change. How do I read these dynamic values in java from a .txt file?