Skip to content

Commit

Permalink
Merge pull request mosip#1584 from mohanachandran-s/develop_temp
Browse files Browse the repository at this point in the history
MOSIP-35082 - Fixing non English failure test cases
  • Loading branch information
lsivanand authored Aug 23, 2024
2 parents f52dc23 + 216c9b0 commit 614f4c6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -740,4 +740,10 @@ public static String generateRandomNumberString(int length) {
}
return numericString.toString();
}

public static int getRecommendedHierarchyLevel() {
String recommendedHierarchLevel = getValueFromActuators(propsKernel.getProperty("actuatorMasterDataEndpoint"),
"/mosip-config/application-default.properties", "mosip.recommended.centers.locCode");
return Integer.parseInt(recommendedHierarchLevel);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ public class AdminTestUtil extends BaseTestCase {
public static final String AUTH_HEADER_VALUE = "Some String";
public static final String SIGNATURE_HEADERNAME = GlobalConstants.SIGNATURE;
public static String updatedPolicyId = "";
public static String currentLanguage;
// public static BioDataUtility bioDataUtil = new BioDataUtility();
//
// public static BioDataUtility getBioDataUtil() {
Expand Down Expand Up @@ -6965,6 +6966,7 @@ public static void getLocationData() {
JSONObject responseJson = null;
String url = ApplnURI + props.getProperty("fetchLocationData");
String token = kernelAuthLib.getTokenByRole(GlobalConstants.ADMIN);
int recommendedHierarchyLevel = getRecommendedHierarchyLevel();
try {
response = RestClient.getRequestWithCookie(url, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON,
GlobalConstants.AUTHORIZATION, token);
Expand All @@ -6975,15 +6977,21 @@ public static void getLocationData() {
JSONObject responseObject = responseJson.getJSONObject("response");
JSONArray data = responseObject.getJSONArray("data");

if (!(languageList.size() > 1)) {
currentLanguage = BaseTestCase.languageList.get(0);
}

for (int i = 0; i < data.length(); i++) {
JSONObject entry = data.getJSONObject(i);
String langCode = entry.getString("langCode");

if (BaseTestCase.languageList.get(0).equals(langCode)) {
hierarchyName = entry.getString("hierarchyName");
hierarchyLevel = entry.getInt("hierarchyLevel");
parentLocCode = entry.optString("parentLocCode", "");
break;
hierarchyLevel = entry.getInt("hierarchyLevel");

if (hierarchyLevel == recommendedHierarchyLevel) {
if (currentLanguage.equals(langCode)) {
hierarchyName = entry.getString("hierarchyName");
parentLocCode = entry.optString("parentLocCode", "");
break;
}
}
}

Expand Down

0 comments on commit 614f4c6

Please sign in to comment.