From cb32623650a014de1fd5eac2742d0f116d179009 Mon Sep 17 00:00:00 2001 From: Nandhukumar Date: Wed, 30 Oct 2024 16:02:03 +0530 Subject: [PATCH] ES-1425 Signed-off-by: Nandhukumar --- .../mosip/testrig/apirig/testrunner/BaseTestCase.java | 10 +++++++--- .../mosip/testrig/apirig/testrunner/OTPListener.java | 9 ++++----- .../io/mosip/testrig/apirig/utils/AdminTestUtil.java | 4 ++-- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/testrunner/BaseTestCase.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/testrunner/BaseTestCase.java index 0255a572c9..7a83d814ef 100644 --- a/apitest-commons/src/main/java/io/mosip/testrig/apirig/testrunner/BaseTestCase.java +++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/testrunner/BaseTestCase.java @@ -573,10 +573,12 @@ public static List getLanguageList() { } private static String targetEnvVersion = ""; + + public static boolean isTargetEnvLatest = false; public static boolean isTargetEnvLTS() { - if (targetEnvVersion.isEmpty()) { + if (targetEnvVersion.isEmpty() && isTargetEnvLatest == false) { Response response = null; org.json.JSONObject responseJson = null; @@ -587,14 +589,16 @@ public static boolean isTargetEnvLTS() { responseJson = new org.json.JSONObject(response.getBody().asString()); targetEnvVersion = responseJson.getJSONObject("build").getString("version"); + isTargetEnvLatest = isVersionGreaterOrEqual(targetEnvVersion, "1.2"); } catch (Exception e) { logger.error(GlobalConstants.EXCEPTION_STRING_2 + e); } } - + // Compare the version numbers, ignoring any suffix like "-SNAPSHOT" - return isVersionGreaterOrEqual(targetEnvVersion, "1.2"); + + return isTargetEnvLatest; } private static boolean isVersionGreaterOrEqual(String version1, String version2) { diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/testrunner/OTPListener.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/testrunner/OTPListener.java index 32d96a5259..20315bc27a 100644 --- a/apitest-commons/src/main/java/io/mosip/testrig/apirig/testrunner/OTPListener.java +++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/testrunner/OTPListener.java @@ -129,17 +129,16 @@ public void onError(WebSocket webSocket, Throwable error) { } public static String getOtp(String emailId) { + if (ConfigManager.getUsePreConfiguredOtp().equalsIgnoreCase(GlobalConstants.TRUE_STRING)) { + return ConfigManager.getPreConfiguredOtp(); + } int otpExpTime = AdminTestUtil.getOtpExpTimeFromActuator(); int otpCheckLoopCount = (otpExpTime * 1000) / AdminTestUtil.OTP_CHECK_INTERVAL; int counter = 0; String otp = ""; - - - if (ConfigManager.getUsePreConfiguredOtp().equalsIgnoreCase(GlobalConstants.TRUE_STRING)) { - return ConfigManager.getPreConfiguredOtp(); - } + while (counter < otpCheckLoopCount) { if (emailNotificationMapS.get(emailId) != null) { String html = (String) emailNotificationMapS.get(emailId); diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/AdminTestUtil.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/AdminTestUtil.java index ebc2b56b72..5556314604 100644 --- a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/AdminTestUtil.java +++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/AdminTestUtil.java @@ -7190,8 +7190,8 @@ public String generateFullNameToRegisterUser(String inputJson, String testCaseNa String fullNamePattern = getValueFromSignUpSettings("fullname.pattern").toString(); List fullnames = Arrays.asList(" ឮᨪដ", "᧦", "ᨃ", "៻៥᧿", "ᩅᨎ", "ᩭឫ", " ឃ ំ ដ ៹ម"); String randomFullName = getRandomElement(fullnames); - List languageList = new ArrayList<>(); - languageList = BaseTestCase.getLanguageList(); + List languageList = new ArrayList<>(BaseTestCase.getLanguageList()); +// languageList = BaseTestCase.getLanguageList(); // For current sprint eng is removed. if (languageList.contains("eng"))