From 7c550ac033f152e8564541ffb8e6c826676fc291 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Wed, 25 Sep 2024 22:08:53 +0530 Subject: [PATCH] MOSIP-36023 Signed-off-by: Jayesh Kharode --- uitest-resident/pom.xml | 2 +- .../residentui/fw/util/AdminTestUtil.java | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/uitest-resident/pom.xml b/uitest-resident/pom.xml index 2581b360..59f4eb10 100644 --- a/uitest-resident/pom.xml +++ b/uitest-resident/pom.xml @@ -60,7 +60,7 @@ io.mosip.kernel kernel-bom - 1.2.1-java21-SNAPSHOT + 1.2.1-SNAPSHOT pom import diff --git a/uitest-resident/src/main/java/io/mosip/testrig/residentui/fw/util/AdminTestUtil.java b/uitest-resident/src/main/java/io/mosip/testrig/residentui/fw/util/AdminTestUtil.java index 2c4b5c63..8c80b92a 100644 --- a/uitest-resident/src/main/java/io/mosip/testrig/residentui/fw/util/AdminTestUtil.java +++ b/uitest-resident/src/main/java/io/mosip/testrig/residentui/fw/util/AdminTestUtil.java @@ -4,6 +4,7 @@ import java.io.File; import java.io.FileReader; import java.io.IOException; +import java.math.BigDecimal; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; @@ -121,11 +122,18 @@ public static void genrateCredentialRequest(String rid,String role) { } public static String buildaddIdentityRequestBody(String schemaJson, String uin, String rid) { - org.json.JSONObject schemaresponseJson = new org.json.JSONObject(schemaJson); + JSONObject schemaresponseJson = new JSONObject(schemaJson); - org.json.JSONObject schemaData = (org.json.JSONObject) schemaresponseJson.get("response"); - Double schemaVersion = (Double) schemaData.get("idVersion"); - String schemaJsonData = schemaData.getString("schemaJson"); + JSONObject schemaData = (JSONObject) schemaresponseJson.get("response"); + Double schemaVersion = null; + Object idVersion = schemaData.get("idVersion"); + if (idVersion instanceof BigDecimal) { + schemaVersion = ((BigDecimal) idVersion).doubleValue(); + } else if (idVersion instanceof Double) { + schemaVersion = (Double) idVersion; + } else { + throw new ClassCastException("Unsupported type for idVersion: " + idVersion.getClass().getName()); + } String schemaJsonData = schemaData.getString("schemaJson"); String schemaFile = schemaJsonData.toString(); JSONObject schemaFileJson = new JSONObject(schemaFile); // jObj