From bd02d8583471e12158911fcb7c34fd20b5e100bf Mon Sep 17 00:00:00 2001 From: Nandhukumar Date: Wed, 11 Sep 2024 15:16:23 +0530 Subject: [PATCH] MOSIP-35700 Signed-off-by: Nandhukumar --- .../testrig/apirig/utils/AdminTestUtil.java | 47 +++++-------------- .../apirig/utils/OutputValidationUtil.java | 3 +- 2 files changed, 15 insertions(+), 35 deletions(-) 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 d1b8b6660d..b54d22c04e 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 @@ -1,8 +1,7 @@ package io.mosip.testrig.apirig.utils; import static io.restassured.RestAssured.given; -import de.mkammerer.argon2.Argon2; -import de.mkammerer.argon2.Argon2Factory; + import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.BufferedWriter; @@ -33,8 +32,6 @@ import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; -import java.security.interfaces.RSAPrivateKey; -import java.security.interfaces.RSAPublicKey; import java.text.SimpleDateFormat; import java.time.Instant; import java.time.LocalDate; @@ -56,6 +53,8 @@ import java.util.Set; import java.util.TimeZone; import java.util.UUID; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import java.util.stream.Collectors; import javax.ws.rs.core.MediaType; @@ -79,9 +78,7 @@ import org.testng.SkipException; import org.yaml.snakeyaml.Yaml; -import java.lang.Double; import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.github.jknack.handlebars.Context; import com.github.jknack.handlebars.Handlebars; @@ -119,8 +116,6 @@ import io.restassured.RestAssured; import io.restassured.http.ContentType; import io.restassured.response.Response; -import java.util.regex.Matcher; -import java.util.regex.Pattern; /** * @author Ravi Kant @@ -2737,9 +2732,8 @@ public String getAutogenIdKeyName(String testCaseName, String fieldName) { return null; int indexof = testCaseName.indexOf("_"); String autogenIdKeyName = testCaseName.substring(indexof + 1); - if ((!BaseTestCase.isTargetEnvLTS() || isOTPEnabled().equals("false")) && fieldName.equals("VID") - && (BaseTestCase.currentModule.equals("auth") || BaseTestCase.currentModule.equals("esignet") - || BaseTestCase.currentModule.equals(GlobalConstants.MIMOTO))) + if ((!BaseTestCase.isTargetEnvLTS()) && fieldName.equals("VID") + && (BaseTestCase.currentModule.equals("auth") || BaseTestCase.currentModule.equals("esignet"))) autogenIdKeyName = autogenIdKeyName + "_" + fieldName.toLowerCase(); else autogenIdKeyName = autogenIdKeyName + "_" + fieldName; @@ -3397,10 +3391,6 @@ public String inputJsonKeyWordHandeler(String jsonString, String testCaseName) { jsonString = replaceKeywordWithValue(jsonString, "$DOB$", getValueFromActuator(GlobalConstants.RESIDENT_DEFAULT_PROPERTIES, "mosip.date-of-birth.pattern")); } - if (jsonString.contains("$GETCLIENTIDFROMMIMOTOACTUATOR$")) { - jsonString = replaceKeywordWithValue(jsonString, "$GETCLIENTIDFROMMIMOTOACTUATOR$", - getValueFromMimotoActuator("overrides", "mimoto.oidc.partner.clientid")); - } if (jsonString.contains("$IDPREDIRECTURI$")) { jsonString = replaceKeywordWithValue(jsonString, "$IDPREDIRECTURI$", ApplnURI.replace(GlobalConstants.API_INTERNAL, "healthservices") + "/userprofile"); @@ -5165,7 +5155,7 @@ else if (eachRequiredProp.equals("password")) { } } } - if (selectedHandles != null) { + if (selectedHandles != null && selectedHandles.size()>=1) { setfoundHandlesInIdSchema(true); identityJson.put("selectedHandles", selectedHandles); } @@ -6538,17 +6528,16 @@ public static String getValueFromActuator(String section, String key) { } public static JSONArray mimotoActuatorResponseArray = null; - private static String otpEnabled = "true"; - - public static String isOTPEnabled() { - String value = getValueFromMimotoActuator("/mimoto-default.properties", "mosip.otp.download.enable"); - if (value != null && !(value.isBlank())) - otpEnabled = value; - return otpEnabled; - } public static String getValueFromMimotoActuator(String section, String key) { String url = ApplnURI + propsKernel.getProperty("actuatorMimotoEndpoint"); + if (!(System.getenv("useOldContextURL") == null) + && !(System.getenv("useOldContextURL").isBlank()) + && System.getenv("useOldContextURL").equalsIgnoreCase("true")) { + if (url.contains("/v1/mimoto/")) { + url = url.replace("/v1/mimoto/", "/residentmobileapp/"); + } + } String actuatorCacheKey = url + section + key; String value = actuatorValueCache.get(actuatorCacheKey); if (value != null && !value.isEmpty()) @@ -6846,16 +6835,6 @@ else if (testCaseName.startsWith("IdRepository_") && testCaseName.contains("Inva && (!isElementPresent(new JSONArray(schemaRequiredField), individualBiometrics))) { throw new SkipException(GlobalConstants.FEATURE_NOT_SUPPORTED_MESSAGE); } - } else if (BaseTestCase.currentModule.equalsIgnoreCase(GlobalConstants.MIMOTO)) { - if (isOTPEnabled().equals("false") && (testCaseDTO.getEndPoint().contains(GlobalConstants.SEND_OTP_ENDPOINT) - || testCaseDTO.getInput().contains(GlobalConstants.SEND_OTP_ENDPOINT) - || testCaseName.startsWith(GlobalConstants.MIMOTO_CREDENTIAL_STATUS))) { - throw new SkipException(GlobalConstants.OTP_FEATURE_NOT_SUPPORTED); - } else if (isOTPEnabled().equals("true") - && testCaseDTO.getEndPoint().contains(GlobalConstants.CREATE_VID_ENDPOINT)) { - throw new SkipException( - GlobalConstants.VID_GENERATED_USING_RESIDENT_API_SO_FEATURE_NOT_SUPPORTED_OR_NEEDED_MESSAGE); - } } if ((ConfigManager.isInServiceNotDeployedList(GlobalConstants.ESIGNET)) diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/OutputValidationUtil.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/OutputValidationUtil.java index 6d9ee59985..82d3f6b839 100644 --- a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/OutputValidationUtil.java +++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/OutputValidationUtil.java @@ -581,7 +581,8 @@ public static boolean doesResponseHasErrorCode(String responseString, String all public static void reportServerIssues(String responseString, TestCaseDTO testCaseDTO) throws AdminTestException { if (responseString.startsWith("") || responseString.startsWith("