Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
nandhu-kumar committed Oct 29, 2024
2 parents 277254f + 5368f35 commit 08b2bc6
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ public class BaseTestCase {
public static String hierarchyName = "";
public static int hierarchyLevel = 0;
public static String parentLocCode = "";
public static String locationName = "";
public static int hierarchyLevelWithLocationCode = 0;

public static String locationCode = "";
public static String ZonelocationCode = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3361,15 +3361,26 @@ public String inputJsonKeyWordHandeler(String jsonString, String testCaseName) {
jsonString = replaceKeywordWithValue(jsonString, "$LOCATIONCODE$", locationCode);

// Need to handle int replacement
if (jsonString.contains("$HIERARCHYLEVEL$"))
if (jsonString.contains("$HIERARCHYLEVEL$")) {
getLocationData();
jsonString = replaceKeywordWithValue(jsonString, "$HIERARCHYLEVEL$", String.valueOf(hierarchyLevel));
}

if (jsonString.contains("$HIERARCHYNAME$"))
if (jsonString.contains("$HIERARCHYNAME$")) {
jsonString = replaceKeywordWithValue(jsonString, "$HIERARCHYNAME$", hierarchyName);
}

if (jsonString.contains("$PARENTLOCCODE$"))
if (jsonString.contains("$PARENTLOCCODE$")) {
jsonString = replaceKeywordWithValue(jsonString, "$PARENTLOCCODE$", parentLocCode);
}

if (jsonString.contains("$LOCATIONNAME$")) {
jsonString = replaceKeywordWithValue(jsonString, "$LOCATIONNAME$", locationName);
}

if (jsonString.contains("$HIERARCHYLEVELWITHLOCATIONCODE$")) {
jsonString = replaceKeywordWithValue(jsonString, "$HIERARCHYLEVELWITHLOCATIONCODE$", String.valueOf(hierarchyLevelWithLocationCode));
}

if (jsonString.contains("$CACERT$")) {
JSONObject request = new JSONObject(jsonString);
Expand Down Expand Up @@ -7720,6 +7731,63 @@ public static void getZoneName() {
logger.error(GlobalConstants.EXCEPTION_STRING_2 + e);
}
}

public static void getRegistrationCenterData() {

Response response = null;
JSONObject responseJson = null;
String url = ApplnURI + props.getProperty("fetchRegCent");
String token = kernelAuthLib.getTokenByRole("globalAdmin");

try {

response = RestClient.getRequestWithCookie(url, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON,
GlobalConstants.AUTHORIZATION, token);

responseJson = new JSONObject(response.getBody().asString());

try {
JSONObject responseObject = responseJson.getJSONObject("response").getJSONArray("registrationCenters").getJSONObject(0);

locationCode = responseObject.getString("locationCode");

} catch (Exception e) {
logger.error(e.getMessage());
}

} catch (Exception e) {
logger.error(GlobalConstants.EXCEPTION_STRING_2 + e);
}
}

public static void getLocationDataWithLocationCode(String locationCode) {

Response response = null;
JSONObject responseJson = null;
String url = ApplnURI + props.getProperty("fetchLocationDataWithCode") + locationCode + "/" + BaseTestCase.getLanguageList().get(0);
String token = kernelAuthLib.getTokenByRole("globalAdmin");

try {

response = RestClient.getRequestWithCookie(url, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON,
GlobalConstants.AUTHORIZATION, token);

responseJson = new JSONObject(response.getBody().asString());

try {
JSONObject responseObject = responseJson.getJSONObject("response");

hierarchyLevelWithLocationCode = responseObject.getInt("hierarchyLevel");
locationName = responseObject.getString("name");

} catch (Exception e) {
logger.error(e.getMessage());
}

} catch (Exception e) {
logger.error(GlobalConstants.EXCEPTION_STRING_2 + e);
}
}

public static String inputTitleHandler(String jsonString) {
Response response = null;
Expand Down

0 comments on commit 08b2bc6

Please sign in to comment.