in wilma-extras/shortCircuit/src/main/java/com/epam/wilma/extras/shortcircuit/ShortCircuitResponseInformationFileHandler.java [160:197]
private ShortCircuitResponseInformation loadMapObject(String fileName) {
ShortCircuitResponseInformation result = null;
File file = new File(fileName);
if (file.exists()) {
//load the file
String fileContent = loadFileToString(fileName);
if (fileContent != null) {
JSONObject obj = new JSONObject(fileContent);
String hashKey = obj.getString("Key");
int responseCode = obj.getInt("ResponseCode");
String contentType = obj.getString("ContentType");
String body = decodeString(obj.getJSONObject("Body").getString("Body"));
JSONArray headerArray = obj.getJSONArray("Headers");
ShortCircuitResponseInformation information = null;
if (hashKey != null && contentType != null) {
information = new ShortCircuitResponseInformation(Long.MAX_VALUE);
information.setHashCode(hashKey);
information.setStatusCode(responseCode);
information.setContentType(contentType);
information.setBody(body);
}
if (headerArray != null && information != null) {
Map<String, String> headers = new HashMap<>();
for (int i = 0; i < headerArray.length(); i++) {
JSONObject o = headerArray.getJSONObject(i);
Iterator j = o.keys();
while (j.hasNext()) {
String key = (String) j.next();
headers.put(key, decodeString(o.getString(key)));
}
}
information.setHeaders(headers);
}
result = information;
}
}
return result;
}