From 36c4fef54c86886f0777d99088a9e69121ac1608 Mon Sep 17 00:00:00 2001 From: Sohan Kumar Dey <72375959+Sohandey@users.noreply.github.com> Date: Fri, 15 Sep 2023 12:34:06 +0530 Subject: [PATCH] MOSIP-29454 --- .../apirig/admin/fw/util/AdminTestUtil.java | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/admin/fw/util/AdminTestUtil.java b/automationtests/src/main/java/io/mosip/testrig/apirig/admin/fw/util/AdminTestUtil.java index 4054244fdbc..dee61ea8e12 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/admin/fw/util/AdminTestUtil.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/admin/fw/util/AdminTestUtil.java @@ -3996,6 +3996,7 @@ public static String modifySchemaGenerateHbs(boolean regenerateHbs) { kernelAuthLib = new KernelAuthentication(); String token = kernelAuthLib.getTokenByRole(GlobalConstants.ADMIN); String url = ApplnURI + properties.getProperty(GlobalConstants.MASTER_SCHEMA_URL); + Response response = RestClient.getRequestWithCookie(url, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, GlobalConstants.AUTHORIZATION, token); @@ -4014,24 +4015,27 @@ public static String modifySchemaGenerateHbs(boolean regenerateHbs) { FileReader fileReader = null; BufferedReader bufferedReader = null; + boolean emailFieldAdditionallyAdded=false; try { JSONObject jObj = new JSONObject(schemaFile); JSONObject objIDJson4 = jObj.getJSONObject(GlobalConstants.PROPERTIES); JSONObject objIDJson = objIDJson4.getJSONObject(GlobalConstants.IDENTITY); JSONObject objIDJson2 = objIDJson.getJSONObject(GlobalConstants.PROPERTIES); JSONArray objIDJson1 = objIDJson.getJSONArray(GlobalConstants.REQUIRED); + String phone = getValueFromAuthActuator("json-property", "phone_number"); String result = phone.replaceAll("\\[\"|\"\\]", ""); - - if (!isElementPresent(objIDJson1, result)) { - objIDJson1.put(result); - } - System.out.println("result is:" + result); + /* + * if (!isElementPresent(objIDJson1, result)) { objIDJson1.put(result); } + */ + + //System.out.println("result is:" + result); String email = getValueFromAuthActuator("json-property", "emailId"); String emailResult = email.replaceAll("\\[\"|\"\\]", ""); if (!isElementPresent(objIDJson1, emailResult)) { objIDJson1.put(emailResult); + emailFieldAdditionallyAdded=true; } @@ -4058,7 +4062,7 @@ public static String modifySchemaGenerateHbs(boolean regenerateHbs) { ja3 = "{\n\t\t \"language\":"; for (int j = 0; j < BaseTestCase.getLanguageList().size(); j++) { - { + if(BaseTestCase.getLanguageList().get(j)!=null && !BaseTestCase.getLanguageList().get(j).isEmpty()) { JSONObject studentJSON = new JSONObject(); studentJSON.put(GlobalConstants.LANGUAGE, BaseTestCase.getLanguageList().get(j)); if (objIDJson3.contains(GlobalConstants.FULLNAME) && regenerateHbs == true) { @@ -4106,8 +4110,15 @@ else if (objIDJson3.equals(result)) { } else if (objIDJson3.equals(emailResult)) { - fileWriter2 - .write("\t \"" + objIDJson3 + "\":" + " " + "\"" + "{{" + objIDJson3 + "}}\"" + ",\n"); + if(emailFieldAdditionallyAdded) { + fileWriter2 + .write(",\t \"" + objIDJson3 + "\":" + " " + "\"" + "{{" + objIDJson3 + "}}\"" + "\n"); + } + else { + fileWriter2 + .write("\t \"" + objIDJson3 + "\":" + " " + "\"" + "{{" + objIDJson3 + "}}\"" + ",\n"); + } + } else if (objIDJson3.equals(GlobalConstants.INDIVIDUALBIOMETRICS)) {