diff --git a/apitest-commons/pom.xml b/apitest-commons/pom.xml
index 4d3265e430..115374a359 100644
--- a/apitest-commons/pom.xml
+++ b/apitest-commons/pom.xml
@@ -388,6 +388,11 @@
java-jwt
4.4.0
+
+ org.glassfish.tyrus.bundles
+ tyrus-standalone-client
+ 1.13.1
+
io.mosip.authentication
authentication-core
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 c8ecea10f9..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
@@ -19,7 +19,6 @@
import org.apache.log4j.PropertyConfigurator;
import org.json.JSONArray;
import org.json.simple.JSONObject;
-import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.testng.ITestContext;
import org.testng.annotations.AfterSuite;
@@ -44,7 +43,7 @@
* All suite level before and after tests will be completed here.
*
*/
-public class BaseTestCase extends AbstractTestNGSpringContextTests {
+public class BaseTestCase {
protected static Logger logger = Logger.getLogger(BaseTestCase.class);
public static OTPListener otpListener = null;
@@ -75,6 +74,7 @@ public class BaseTestCase extends AbstractTestNGSpringContextTests {
public String partnerCookie = null;
public String partnerrevampCookie = null;
public String partnerrevampdeviceCookie = null;
+ public String partnerrevampftmCookie = null;
public String partnerNewCookie = null;
public String withoutpartnerCookie = null;
public String withoutpolicyCookie = null;
@@ -133,6 +133,8 @@ public class BaseTestCase extends AbstractTestNGSpringContextTests {
public static String hierarchyName = "";
public static int hierarchyLevel = 0;
public static String parentLocCode = "";
+ public static String locationName = "";
+ public static int hierarchyLevelWithLocationCode = 0;
public static String locationCode = "";
public static String ZonelocationCode = "";
@@ -208,7 +210,7 @@ public static String getGlobalResourcePath() {
if (runTypeS.equalsIgnoreCase("JAR")) {
path = new File(jarURLS).getParentFile().getAbsolutePath() + "/MosipTestResource/MosipTemporaryTestResource";
} else if (runTypeS.equalsIgnoreCase("IDE")) {
- path = new File(MosipTestRunner.class.getClassLoader().getResource("").getPath()).getAbsolutePath()
+ path = new File(BaseTestCase.class.getClassLoader().getResource("").getPath()).getAbsolutePath()
+ "/MosipTestResource/MosipTemporaryTestResource";
if (path.contains(GlobalConstants.TESTCLASSES))
path = path.replace(GlobalConstants.TESTCLASSES, "classes");
@@ -571,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;
@@ -585,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/ExtractResource.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/testrunner/ExtractResource.java
index 47e585b786..246d3d902e 100644
--- a/apitest-commons/src/main/java/io/mosip/testrig/apirig/testrunner/ExtractResource.java
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/testrunner/ExtractResource.java
@@ -58,7 +58,7 @@ public static void copyCommonResources(String moduleName) {
public static void getListOfFilesFromJarAndCopyToExternalResource(String key) {
ZipInputStream zipInputStream = null;
try {
- CodeSource src = MosipTestRunner.class.getProtectionDomain().getCodeSource();
+ CodeSource src = BaseTestCase.class.getProtectionDomain().getCodeSource();
if (src != null) {
URL jar = src.getLocation();
zipInputStream = new ZipInputStream(jar.openStream());
@@ -106,7 +106,7 @@ private static boolean copyFilesFromJarToOutsideResource(String resourceFilePare
String resourceFileAbsolutePath = resourceFileParentPath + "MosipTemporaryTestResource/" + resourceFileName;
File destinationFile = new File(resourceFileAbsolutePath);
LOGGER.info("resourceFile : " + BaseTestCase.jarURLS + "destinationFile : " + resourceFileAbsolutePath);
- org.apache.commons.io.FileUtils.copyInputStreamToFile(MosipTestRunner.class.getResourceAsStream("/" + resourceFileName), destinationFile);
+ org.apache.commons.io.FileUtils.copyInputStreamToFile(BaseTestCase.class.getResourceAsStream("/" + resourceFileName), destinationFile);
return true;
} catch (Exception e) {
LOGGER.error(
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/testrunner/MosipTestRunner.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/testrunner/MosipTestRunner.java
deleted file mode 100644
index 4465045970..0000000000
--- a/apitest-commons/src/main/java/io/mosip/testrig/apirig/testrunner/MosipTestRunner.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package io.mosip.testrig.apirig.testrunner;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-/**
- * Class to initiate mosip api test execution
- *
- * @author Vignesh
- *
- */
-public class MosipTestRunner {
- private static final Logger LOGGER = Logger.getLogger(MosipTestRunner.class);
-
- public static String jarUrl = MosipTestRunner.class.getProtectionDomain().getCodeSource().getLocation().getPath();
- public static List languageList = new ArrayList<>();
-
- public static void main(String[] arg) {}
-}
\ No newline at end of file
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 58acd9aba5..bd7d03687a 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,6 +1,7 @@
package io.mosip.testrig.apirig.utils;
import static io.restassured.RestAssured.given;
+import static org.mockito.ArgumentMatchers.contains;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
@@ -141,7 +142,7 @@ public class AdminTestUtil extends BaseTestCase {
+ "config/healthCheckEndpoint.properties";
private static String serverComponentsCommitDetails;
private static boolean foundHandlesInIdSchema= false;
-
+ private static JSONArray globalRequiredFields = null;
protected static String token = null;
String idToken = null;
String adminAutoGeneratedIdPropFileName = properties.getProperty("adminAutoGeneratedIdPropFileName");
@@ -158,6 +159,7 @@ public class AdminTestUtil extends BaseTestCase {
String mimotoAutoGeneratedIdPropFileName = properties.getProperty("mimotoAutoGeneratedIdPropFileName");
String pmsAutoGeneratedIdPropFileName = properties.getProperty("pmsAutoGeneratedIdPropFileName");
String injiCertifyAutoGeneratedIdPropFileName = properties.getProperty("injiCertifyAutoGeneratedIdPropFileName");
+ String signupAutoGeneratedIdPropFileName = properties.getProperty("signupAutoGeneratedIdPropFileName");
String fullNameForSunBirdRC = properties.getProperty("fullNameForSunBirdRC");
String dobForSunBirdRC = properties.getProperty("dobForSunBirdRC");
@@ -254,7 +256,7 @@ public class AdminTestUtil extends BaseTestCase {
public static final String BINDINGCERTCONSENTEMPTYCLAIMFILE = "BINDINGCERTCONSENTEMPTYCLAIMFile";
public static final String BINDINGCERTCONSENTUSER2FILE = "BINDINGCERTCONSENTUSER2File";
public static final String BINDINGCERTVIDCONSENTUSER2FILE = "BINDINGCERTCONSENTVIDUSER2File";
- private static String selectedHandlesValue=null;
+
private static final String UIN_CODE_VERIFIER_POS_1 = generateRandomAlphaNumericString(GlobalConstants.INTEGER_36);
@@ -663,13 +665,16 @@ public void getvalueFromResponseHeader(Response response, String testCaseName) {
if (eachSetCookieValue.trim().startsWith("IDV_TRANSACTION_ID")) {
getCookieAndWriteAutoGenId(eachSetCookieValue, "idvTransactionID", testCaseName);
}
+ if (eachSetCookieValue.trim().startsWith("IDV_SLOT_ALLOTTED")) {
+ getCookieAndWriteAutoGenId(eachSetCookieValue, "idvSlotAllotted", testCaseName);
+ }
}
}
}
}
protected void getCookieAndWriteAutoGenId(String cookieValue, String key, String testCaseName) {
- if (!cookieValue.split("=")[1].isBlank()) {
+ if (cookieValue.split("=").length > 1 && !cookieValue.split("=")[1].isBlank()) {
String value = cookieValue.split("=")[1];
writeAutoGeneratedId(testCaseName, key, value);
}
@@ -718,8 +723,11 @@ protected Response postRequestWithCookieAuthHeaderAndXsrfTokenForAutoGenId(Strin
JSONObject request = new JSONObject(inputJson);
String encodedResp = null;
String transactionId = null;
+ String headerTransactionID = "";
String pathFragmentCookie = null;
String pathFragmentCookieTransactionId = null;
+ Map cookiesMap = new HashMap<>();
+
if (request.has(GlobalConstants.ENCODEDHASH)) {
encodedResp = request.get(GlobalConstants.ENCODEDHASH).toString();
request.remove(GlobalConstants.ENCODEDHASH);
@@ -740,7 +748,7 @@ protected Response postRequestWithCookieAuthHeaderAndXsrfTokenForAutoGenId(Strin
request.remove(GlobalConstants.PATH_FRAGMENT_COOKIE_TRANSACTIONID);
request.remove(GlobalConstants.PATH_FRAGMENT_COOKIE);
}
-
+
inputJson = request.toString();
if (BaseTestCase.currentModule.equals(GlobalConstants.MIMOTO) || BaseTestCase.currentModule.equals("auth")
|| BaseTestCase.currentModule.equals(GlobalConstants.ESIGNET)
@@ -749,12 +757,24 @@ protected Response postRequestWithCookieAuthHeaderAndXsrfTokenForAutoGenId(Strin
}
token = properties.getProperty(GlobalConstants.XSRFTOKEN);
+
+ if (request.has(GlobalConstants.IDV_TRANSACTION_ID)) {
+ headerTransactionID = request.get(GlobalConstants.IDV_TRANSACTION_ID).toString();
+ headers.put(GlobalConstants.IDV_TRANSACTION_ID_KEY, headerTransactionID);
+ cookiesMap.put(GlobalConstants.IDV_TRANSACTION_ID_KEY, headerTransactionID);
+ cookiesMap.put(GlobalConstants.XSRF_TOKEN, token);
+ request.remove(GlobalConstants.IDV_TRANSACTION_ID);
+ }
+
logger.info(GlobalConstants.POST_REQ_URL + url);
GlobalMethods.reportRequest(headers.toString(), inputJson, url);
try {
if (pathFragmentCookie!=null) {
response = RestClient.postRequestWithMultipleHeadersAndMultipleCookies(url, inputJson, MediaType.APPLICATION_JSON,
MediaType.APPLICATION_JSON, pathFragmentCookieTransactionId, pathFragmentCookie, headers);
+ } else if (cookiesMap.containsKey(GlobalConstants.IDV_TRANSACTION_ID_KEY)) {
+ response = RestClient.postRequestWithMultipleHeadersAndCookies(url, inputJson,
+ MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, cookiesMap, headers);
} else {
response = RestClient.postRequestWithMultipleHeadersAndCookies(url, inputJson, MediaType.APPLICATION_JSON,
MediaType.APPLICATION_JSON, cookieName, token, headers);
@@ -792,8 +812,14 @@ protected Response getRequestWithCookieAuthHeaderAndXsrfToken(String url, String
headers.put(XSRF_HEADERNAME, properties.getProperty(GlobalConstants.XSRFTOKEN));
headers.put(OAUTH_HASH_HEADERNAME, encodedResp);
headers.put(OAUTH_TRANSID_HEADERNAME, transactionId);
-
+
token = null;
+
+ if (request.has(GlobalConstants.IDV_SLOT_ALLOTED)) {
+ token = request.get(GlobalConstants.IDV_SLOT_ALLOTED).toString();
+ cookieName = "IDV_SLOT_ALLOTTED";
+ request.remove(GlobalConstants.IDV_SLOT_ALLOTED);
+ }
logger.info(GlobalConstants.GET_REQ_STRING + url);
GlobalMethods.reportRequest(headers.toString(), null, url);
try {
@@ -2874,6 +2900,10 @@ public static void initiateMimotoTest() {
public static void initiateesignetTest() {
copyEsignetTestResource();
}
+
+ public static void initiateSignupTest() {
+ copySignupTestResource();
+ }
public static void initiateSyncDataTest() {
copySyncDataTestResource();
@@ -2894,6 +2924,10 @@ public static void copyMimotoTestResource() {
public static void copyEsignetTestResource() {
copymoduleSpecificAndConfigFile(GlobalConstants.ESIGNET);
}
+
+ public static void copySignupTestResource() {
+ copymoduleSpecificAndConfigFile(GlobalConstants.SIGNUP);
+ }
public static void copySyncDataTestResource() {
copymoduleSpecificAndConfigFile("syncdata");
@@ -3066,12 +3100,57 @@ public static String getAuthTransactionId(String oidcTransactionId) {
}
return new String(authTransactionIdBytes);
}
+
+
+ private static String removeSuffixUnderscores(String input, String[] suffixes) {
+ for (String suffix : suffixes) {
+ if (input.endsWith(suffix)) {
+ // Remove underscores from the suffix
+ String modifiedSuffix = suffix.replace("_", "");
+ // Replace the original suffix in the input string with the modified one
+ return input.substring(0, input.length() - suffix.length()) + modifiedSuffix;
+ }
+ }
+ return input; // Return the original input if no suffix matches
+ }
+
+
+ public static String getTestCaseIDFromKeyword(String keyword) {
+
+ String[] suffixes = { "time_slot_from$", "appointment_date$", "access_token$" };
+
+ keyword = removeSuffixUnderscores(keyword, suffixes);
+
+ // Find the index of the last underscore
+ int lastUnderscoreIndex = keyword.lastIndexOf("_");
+
+ // Extract substring before the last underscore
+ String result = keyword.substring(0, lastUnderscoreIndex);
+
+ result = result.replace("$ID:", "");
+
+ String tempString = getTestCaseUniqueIdentifier(result);
+
+ if (tempString == null || tempString.isBlank()) {
+ return result;
+ }
+
+ return tempString;
+ }
+
public String replaceKeywordWithValue(String jsonString, String keyword, String value) {
if (value != null && !value.isEmpty())
return jsonString.replace(keyword, value);
- else
- throw new SkipException("Marking testcase as skipped as required fields are empty " + keyword);
+ else {
+ if (keyword.contains("$ID:"))
+ throw new SkipException("Marking testcase as skipped as required field is empty " + keyword
+ + " please check the results of testcase: " + getTestCaseIDFromKeyword(keyword));
+ else
+ throw new SkipException("Marking testcase as skipped as required field is empty " + keyword);
+
+ }
+
}
public static String addIdentityPassword = "";
@@ -3307,15 +3386,26 @@ public String inputJsonKeyWordHandeler(String jsonString, String testCaseName) {
jsonString = replaceKeywordWithValue(jsonString, "$LOCATIONCODE$", locationCode);
// Need to handle int replacement
- if (jsonString.contains("$HIERARCHYLEVEL$"))
+ if (jsonString.contains("$HIERARCHYLEVEL$")) {
getLocationData();
jsonString = replaceKeywordWithValue(jsonString, "$HIERARCHYLEVEL$", String.valueOf(hierarchyLevel));
+ }
- if (jsonString.contains("$HIERARCHYNAME$"))
+ if (jsonString.contains("$HIERARCHYNAME$")) {
jsonString = replaceKeywordWithValue(jsonString, "$HIERARCHYNAME$", hierarchyName);
+ }
- if (jsonString.contains("$PARENTLOCCODE$"))
+ if (jsonString.contains("$PARENTLOCCODE$")) {
jsonString = replaceKeywordWithValue(jsonString, "$PARENTLOCCODE$", parentLocCode);
+ }
+
+ if (jsonString.contains("$LOCATIONNAME$")) {
+ jsonString = replaceKeywordWithValue(jsonString, "$LOCATIONNAME$", locationName);
+ }
+
+ if (jsonString.contains("$HIERARCHYLEVELWITHLOCATIONCODE$")) {
+ jsonString = replaceKeywordWithValue(jsonString, "$HIERARCHYLEVELWITHLOCATIONCODE$", String.valueOf(hierarchyLevelWithLocationCode));
+ }
if (jsonString.contains("$CACERT$")) {
JSONObject request = new JSONObject(jsonString);
@@ -4306,6 +4396,8 @@ else if (testCaseName.toLowerCase().startsWith(GlobalConstants.PARTNERNEW))
autoGenFileName = pmsAutoGeneratedIdPropFileName;
else if (testCaseName.toLowerCase().startsWith(GlobalConstants.INJICERTIFY))
autoGenFileName = injiCertifyAutoGeneratedIdPropFileName;
+ else if (testCaseName.toLowerCase().startsWith(GlobalConstants.SIGNUP))
+ autoGenFileName = signupAutoGeneratedIdPropFileName;
else {
autoGenFileName = "default";
@@ -4431,8 +4523,6 @@ private String replaceIdWithAutogeneratedId(String jsonString, String idKey, Str
// $ID:AddIdentity_withValidParameters_smoke_Pos_EMAIL$
// $ID:AddIdentity_withValidParameters_smoke_Pos_PHONE$@phone
-
-
if (keyForIdProperty.endsWith("_EMAIL") && ConfigManager.getMockNotificationChannel().equalsIgnoreCase("phone")) {
String temp = idKey + keyForIdProperty + "$" ; //$ID:AddIdentity_withValidParameters_smoke_Pos_EMAIL$
@@ -4450,19 +4540,6 @@ private String replaceIdWithAutogeneratedId(String jsonString, String idKey, Str
keyToReplace = idKey + keyForIdProperty + "$"; //AddIdentity_withValidParameters_smoke_Pos_EMAIL
}
-
-
-
-
-
-
-
-
-
-
-
-
-
Properties props = new Properties();
try (FileInputStream inputStream = new FileInputStream(getResourcePath() + autoGenIdFileName);) {
@@ -7009,11 +7086,31 @@ public static String getRegprocWaitFromActuator() {
return waitInterval;
}
}
+
+ private static Map testcaseIDNameMap = new HashMap<>();
+
+ public static void addTestCaseDetailsToMap(String testCaseName,String uniqueIdentifier) {
+ testcaseIDNameMap.put(testCaseName, uniqueIdentifier);
+ }
+
+ public static String getTestCaseUniqueIdentifier(String testCaseName) {
+ return testcaseIDNameMap.get(testCaseName);
+ }
+
public static String isTestCaseValidForExecution(TestCaseDTO testCaseDTO) {
String testCaseName = testCaseDTO.getTestCaseName();
+
+ int indexof = testCaseName.indexOf("_");
+ String modifiedTestCaseName = testCaseName.substring(indexof + 1);
+
+ addTestCaseDetailsToMap(modifiedTestCaseName, testCaseDTO.getUniqueIdentifier());
+
JSONArray dobArray = new JSONArray(getValueFromAuthActuator("json-property", "dob"));
JSONArray emailArray = new JSONArray(getValueFromAuthActuator("json-property", "emailId"));
+ JSONArray phoneArray = new JSONArray(getValueFromAuthActuator("json-property", "phone_number"));
+ JSONArray postalCodeArray = new JSONArray(getValueFromAuthActuator("json-property", "postal_code"));
+
JSONArray individualBiometricsArray = new JSONArray(
getValueFromAuthActuator("json-property", "individualBiometrics"));
String dob = dobArray.getString(0);
@@ -7027,9 +7124,25 @@ public static String isTestCaseValidForExecution(TestCaseDTO testCaseDTO) {
}
if (testCaseName.startsWith("IdRepository_") && testCaseName.contains("_handle") && foundHandlesInIdSchema == false) {
- throw new SkipException(GlobalConstants.HANDLE_SCHEMA_NOT_DEPLOYED_MESSAGE);
+ throw new SkipException(GlobalConstants.FEATURE_NOT_SUPPORTED_MESSAGE);
}
+ if (testCaseName.startsWith("IdRepository_") &&
+ (testCaseName.contains("_withInvalidEmail") ||
+ testCaseName.contains("_with_invalid_Email") ||
+ testCaseName.contains("_with_Missing_Email") ||
+ testCaseName.contains("_with_Empty_Email") ||
+ testCaseName.contains("_with_SpaceVal_Email")) &&
+ (globalRequiredFields != null && !globalRequiredFields.toList().contains(emailArray))) {
+ throw new SkipException(GlobalConstants.FEATURE_NOT_SUPPORTED_MESSAGE);
+ }
+
+ if (testCaseName.startsWith("IdRepository_") &&
+ testCaseName.contains("_with_Missing_phone") &&
+ (globalRequiredFields != null && !globalRequiredFields.toList().contains(phoneArray))) {
+ throw new SkipException(GlobalConstants.FEATURE_NOT_SUPPORTED_MESSAGE);
+ }
+
else if (testCaseName.startsWith("IdRepository_") && testCaseName.contains("Email")
@@ -7065,6 +7178,14 @@ else if (testCaseName.startsWith("IdRepository_") && testCaseName.contains("Inva
&& (ConfigManager.isInServiceNotDeployedList(GlobalConstants.HOTLIST))) {
throw new SkipException(GlobalConstants.SERVICE_NOT_DEPLOYED_MESSAGE);
}
+
+ }
+
+ else if (testCaseName.startsWith("Prereg_")
+ && (testCaseName.contains("_Invalid_PostalCode_")
+ || testCaseName.contains("_SpacialCharacter_PostalCode_"))
+ && (globalRequiredFields != null && !globalRequiredFields.toList().contains(postalCodeArray))) {
+ throw new SkipException(GlobalConstants.FEATURE_NOT_SUPPORTED_MESSAGE);
}
// else if (BaseTestCase.currentModule.equalsIgnoreCase(GlobalConstants.ESIGNET)) {
@@ -7121,8 +7242,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"))
@@ -7662,6 +7783,63 @@ public static void getZoneName() {
logger.error(GlobalConstants.EXCEPTION_STRING_2 + e);
}
}
+
+ public static void getRegistrationCenterData() {
+
+ Response response = null;
+ JSONObject responseJson = null;
+ String url = ApplnURI + props.getProperty("fetchRegCent");
+ String token = kernelAuthLib.getTokenByRole("globalAdmin");
+
+ try {
+
+ response = RestClient.getRequestWithCookie(url, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON,
+ GlobalConstants.AUTHORIZATION, token);
+
+ responseJson = new JSONObject(response.getBody().asString());
+
+ try {
+ JSONObject responseObject = responseJson.getJSONObject("response").getJSONArray("registrationCenters").getJSONObject(0);
+
+ locationCode = responseObject.getString("locationCode");
+
+ } catch (Exception e) {
+ logger.error(e.getMessage());
+ }
+
+ } catch (Exception e) {
+ logger.error(GlobalConstants.EXCEPTION_STRING_2 + e);
+ }
+ }
+
+ public static void getLocationDataWithLocationCode(String locationCode) {
+
+ Response response = null;
+ JSONObject responseJson = null;
+ String url = ApplnURI + props.getProperty("fetchLocationDataWithCode") + locationCode + "/" + BaseTestCase.getLanguageList().get(0);
+ String token = kernelAuthLib.getTokenByRole("globalAdmin");
+
+ try {
+
+ response = RestClient.getRequestWithCookie(url, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON,
+ GlobalConstants.AUTHORIZATION, token);
+
+ responseJson = new JSONObject(response.getBody().asString());
+
+ try {
+ JSONObject responseObject = responseJson.getJSONObject("response");
+
+ hierarchyLevelWithLocationCode = responseObject.getInt("hierarchyLevel");
+ locationName = responseObject.getString("name");
+
+ } catch (Exception e) {
+ logger.error(e.getMessage());
+ }
+
+ } catch (Exception e) {
+ logger.error(GlobalConstants.EXCEPTION_STRING_2 + e);
+ }
+ }
public static String inputTitleHandler(String jsonString) {
Response response = null;
@@ -7881,642 +8059,6 @@ public static boolean IsCertSyncd(String certSubjectSubString) {
return false;
}
- public String replaceArrayHandleValues(String inputJson, String testCaseName) {
- JSONObject jsonObj = new JSONObject(inputJson);
- JSONObject request = jsonObj.getJSONObject("request");
- JSONObject identity = request.getJSONObject("identity");
- JSONArray selectedHandles = identity.getJSONArray("selectedHandles");
- String email = getValueFromAuthActuator("json-property", "emailId");
- String emailResult = email.replaceAll("\\[\"|\"\\]", "");
-
- for (int i = 0; i < selectedHandles.length(); i++) {
- String handle = selectedHandles.getString(i);
-
- if (identity.has(handle)) {
- Object handleObj = identity.get(handle); // Dynamically get the handle object
-
- // Check if the handle is an array
- if (handleObj instanceof JSONArray) {
- JSONArray handleArray = (JSONArray) handleObj;
-
- if (testCaseName.contains("_onlywithtags")) {
- for (int j = 0; j < handleArray.length(); j++) {
- JSONObject obj = handleArray.getJSONObject(j);
- obj.remove("value");
- }
- } else if (testCaseName.contains("_withouttags")) {
- for (int j = 0; j < handleArray.length(); j++) {
- JSONObject obj = handleArray.getJSONObject(j);
- obj.remove("tags");
- }
- } else if (testCaseName.contains("_withtagwithoutselectedhandles")) {
- for (int j = 0; j < handleArray.length(); j++) {
- JSONObject obj = handleArray.getJSONObject(j);
- obj.remove("selectedHandles");
- }
- } else if (testCaseName.contains("_withinvalidtag")) {
- for (int j = 0; j < handleArray.length(); j++) {
- JSONObject obj = handleArray.getJSONObject(j);
- JSONArray tags = obj.optJSONArray("tags");
- if (tags != null) {
- for (int k = 0; k < tags.length(); k++) {
- String tag = tags.getString(k);
- tags.put(k, tag + "_invalid" + "RANDOM_ID");
- }
- obj.put("tags", tags);
- }
- }
- } else if (testCaseName.contains("_withmultiplevalues")) {
- for (int j = 0; j < handleArray.length(); j++) {
- JSONObject obj = handleArray.getJSONObject(j);
- JSONArray valuesArray = new JSONArray();
- valuesArray.put("mosip501724826584965_modified_1");
- valuesArray.put("mosip501724826584965_modified_2");
- valuesArray.put("mosip501724826584965_modified_3");
- obj.put("values", valuesArray);
- }
- } else if (testCaseName.contains("_withmultiplevaluesandwithouttags")) {
- for (int j = 0; j < handleArray.length(); j++) {
- JSONObject obj = handleArray.getJSONObject(j);
- JSONArray valuesArray = new JSONArray();
- valuesArray.put("mosip501724826584965_modified_1");
- valuesArray.put("mosip501724826584965_modified_2");
- valuesArray.put("mosip501724826584965_modified_3");
- obj.put("values", valuesArray);
- obj.remove("tags");
- }
- } else if (testCaseName.contains("_withemptyselecthandles")) {
- identity.put("selectedHandles", new JSONArray());
- } else if (testCaseName.contains("_withoutselectedhandles")) {
- identity.remove("selectedHandles");
- break;
- } else if (testCaseName.contains("_withmultiplehandleswithoutvalue")) {
- String phone = getValueFromAuthActuator("json-property", "phone_number");
- String result = phone.replaceAll("\\[\"|\"\\]", "");
- boolean containsPhone = false;
- for (int j = 0; j < selectedHandles.length(); j++) {
- if (result.equalsIgnoreCase(selectedHandles.getString(j))) {
- containsPhone = true;
- break;
- }
- }
- if (!containsPhone) {
- selectedHandles.put(result);
- JSONObject phoneEntry = new JSONObject();
- phoneEntry.put("value", "$PHONENUMBERFORIDENTITY$");
- JSONArray phoneArray = new JSONArray();
- phoneArray.put(phoneEntry);
- identity.put(result, phoneArray);
- }
- for (int j = 0; j < handleArray.length(); j++) {
- JSONObject obj = handleArray.getJSONObject(j);
- obj.remove("value");
- }
- } else if (testCaseName.contains("_withfunctionalIds") && handle.equals("functionalId")) {
- for (int j = 0; j < handleArray.length(); j++) {
- JSONObject obj = handleArray.getJSONObject(j);
- obj.remove("tags");
- }
- } else if (testCaseName.contains("_withfunctionalIdsUsedFirstTwoValue") && handle.equals("functionalId")) {
- if (handleArray.length() < 3) {
- JSONObject secondValue = new JSONObject();
- secondValue.put("value", "RANDOM_ID_2" + 12);
- secondValue.put("tags", new JSONArray().put("handle"));
- JSONObject thirdValue = new JSONObject();
- thirdValue.put("value", "RANDOM_ID_2" + 34);
- handleArray.put(secondValue);
- handleArray.put(thirdValue);
- }
- } else if (testCaseName.contains("_withfunctionalIdsandPhoneWithoutTags")) {
- String phone = getValueFromAuthActuator("json-property", "phone_number");
- String result = phone.replaceAll("\\[\"|\"\\]", "");
- boolean containsPhone = false;
- for (int j = 0; j < selectedHandles.length(); j++) {
- if (result.equalsIgnoreCase(selectedHandles.getString(j))) {
- containsPhone = true;
- break;
- }
- }
- if (!containsPhone) {
- selectedHandles.put(result);
- JSONObject phoneEntry = new JSONObject();
- phoneEntry.put("value", "$PHONENUMBERFORIDENTITY$");
- JSONArray phoneArray = new JSONArray();
- phoneArray.put(phoneEntry);
- identity.put(result, phoneArray);
- }
- for (int j = 0; j < handleArray.length(); j++) {
- JSONObject obj = handleArray.getJSONObject(j);
- obj.remove("tags");
- }
- } else if (testCaseName.contains("_withfunctionalIdsUsedFirstTwoValueOutOfFive")) {
- String baseValue = "";
- if (handleArray.length() > 0) {
- baseValue = handleArray.getJSONObject(0).getString("value");
- }
- for (int j = 0; j < 4; j++) {
- JSONObject obj = new JSONObject();
- if (j < 1) {
- obj.put("value", baseValue + j);
- obj.put("tags", new JSONArray().put("handle"));
- } else {
- obj.put("value", baseValue + j);
- }
- handleArray.put(obj);
- }
- }
- //43 in update identity
- else if (testCaseName.contains("_removeexceptfirsthandle")) {
- if (identity.has("selectedHandles")) {
-
- if (selectedHandles.length() > 0) {
- String firstHandleToKeep = selectedHandles.getString(0);
-
- for (int j = 1; j < selectedHandles.length(); j++) {
- if (identity.has(handle)) {
- identity.remove(handle);
- }
- }
- while (selectedHandles.length() > 1) {
- selectedHandles.remove(1);
- }
- }
- }
- }
- //44 in update identity
- else if (testCaseName.contains("_withinvaliddemofield_inupdate")) {
- if (identity.has("selectedHandles")) {
-
- if (selectedHandles.length() > 0) {
- String firstHandleToKeep = selectedHandles.getString(0);
-
- for (int j = 1; j < selectedHandles.length(); j++) {
- if (identity.has(handle)) {
- identity.remove(handle);
- }
- }
- while (selectedHandles.length() > 1) {
- selectedHandles.remove(1);
- }
- }
- }
- }
- //50
- else if (testCaseName.contains("_withonedemofield")) {
- if (identity.has("selectedHandles")) {
- String firstHandle = selectedHandles.getString(0);
- for (int j = 1; j < selectedHandles.length(); j++) {
- if (identity.has(handle)) {
- Object handleValue = identity.get(handle);
- if (handleValue instanceof JSONArray) {
- identity.remove(handle);
- }
- }
- }
- JSONArray newSelectedHandles = new JSONArray();
- newSelectedHandles.put(firstHandle);
- identity.put("selectedHandles", newSelectedHandles);
- }
- }
-
- //82
-
- else if (testCaseName.contains("_withcasesensitivehandles")) {
- for (int j = 0; j < handleArray.length(); j++) {
- JSONObject obj = handleArray.getJSONObject(j);
- obj.put("value", "HANDLES");
- }
- }
- //77
- else if (testCaseName.contains("_replaceselectedhandles")) {
- identity.put("selectedHandles", new JSONArray().put(emailResult));
- }
- //76
- else if (testCaseName.contains("_onlywithemail")) {
- identity.put("selectedHandles", new JSONArray().put(emailResult));
- }
-
- //73
- else if (testCaseName.contains("_withoutselectedhandlesinidentity")) {
- identity.remove("selectedHandles");
- }
-
- else if (testCaseName.contains("_withdublicatevalue")) {
- for (int j = 0; j < handleArray.length(); j++) {
- JSONObject obj = handleArray.getJSONObject(j);
- if (testCaseName.contains("_save_withdublicatevalue"))
- selectedHandlesValue=obj.getString("value");
- obj.put("value", selectedHandlesValue);
- }
- }
- else if (testCaseName.contains("_withmultipledublicatevalue")) {
- JSONObject secondValue = new JSONObject();
- secondValue.put("value", selectedHandlesValue);
- secondValue.put("tags", new JSONArray().put("handle"));
- handleArray.put(secondValue);
- }
- else if (testCaseName.contains("_removevalueaddexistingvalue")) {
- for (int j = 0; j < handleArray.length(); j++) {
- JSONObject obj = handleArray.getJSONObject(j);
- obj.remove("value");
- obj.put("value", selectedHandlesValue);
- }
- }
- else if (testCaseName.contains("_withselectedhandlephone")) {
- if (identity.has("selectedHandles")) {
- // Remove "email" and "functionalId", keep only "phone"
- JSONArray updatedHandles = new JSONArray();
- boolean containsPhone = false;
-
- for (int j = 0; j < selectedHandles.length(); j++) {
- handle = selectedHandles.getString(j);
- if (handle.equalsIgnoreCase("phone")) {
- containsPhone = true;
- updatedHandles.put("phone"); // Ensure "phone" is kept
- }
- }
-
- // Add "phone" if not present
- if (!containsPhone) {
- updatedHandles.put("phone");
- }
-
- // Update the identity with the modified selectedHandles array
- identity.put("selectedHandles", updatedHandles);
- }else if (testCaseName.contains("_removealltagshandles")) {
- removeTagsHandles(jsonObj);
-
-
- } else {
- // If "selectedHandles" doesn't exist, create it with "phone"
- JSONArray newSelectedHandles = new JSONArray();
- newSelectedHandles.put("phone");
- identity.put("selectedHandles", newSelectedHandles);
- }
- }
-
-
- else {
- for (int j = 0; j < handleArray.length(); j++) {
- JSONObject obj = handleArray.getJSONObject(j);
- obj.put("value", obj.getString("value"));
- }
- }
-
- identity.put(handle, handleArray);
- }
- }
- }
-
- return jsonObj.toString();
- }
- private void removeTagsHandles(JSONObject jsonObj) {
- for (String key : jsonObj.keySet()) {
- Object value = jsonObj.get(key);
- if (value instanceof JSONObject) {
- JSONObject nestedObject = (JSONObject) value;
- if (nestedObject.has("tags")) {
- JSONArray tagsArray = nestedObject.getJSONArray("tags");
- if (tagsArray.length() == 1 && "handles".equals(tagsArray.getString(0))) {
- nestedObject.remove("tags");
- }
- }
- removeTagsHandles(nestedObject); // Recursively call for deeper levels
- } else if (value instanceof JSONArray) {
- JSONArray jsonArray = (JSONArray) value;
- for (int i = 0; i < jsonArray.length(); i++) {
- Object arrayElement = jsonArray.get(i);
- if (arrayElement instanceof JSONObject) {
- removeTagsHandles((JSONObject) arrayElement); // Recursively handle each element
- }
- }
- }
- }
- }
-
- public String replaceArrayHandleValuesForUpdateIdentity(String inputJson, String testCaseName) {
- JSONObject jsonObj = new JSONObject(inputJson);
- JSONObject request = jsonObj.getJSONObject("request");
- JSONObject identity = request.getJSONObject("identity");
- JSONArray selectedHandles = identity.getJSONArray("selectedHandles");
- String phone = getValueFromAuthActuator("json-property", "phone_number");
- String result = phone.replaceAll("\\[\"|\"\\]", "");
- String email = getValueFromAuthActuator("json-property", "emailId");
- String emailResult = email.replaceAll("\\[\"|\"\\]", "");
-
-
-
- // Iterate over each handle in the selectedHandles array
- for (int i = 0; i < selectedHandles.length(); i++) {
- String handle = selectedHandles.getString(i);
-
- // Check if the handle exists in identity and if its value is a JSONArray
- if (identity.has(handle) && identity.get(handle) instanceof JSONArray) {
- JSONArray handleArray = identity.getJSONArray(handle);
-
- if (testCaseName.contains("_withupdatevalues")) {
- for (int j = 0; j < handleArray.length(); j++) {
- JSONObject handleObj = handleArray.getJSONObject(j);
- handleObj.put("value", "mosip" + RANDOM_ID + "_" + j);
- }
- } else if (testCaseName.contains("_withmultiplevalues")) {
- for (int j = 0; j < handleArray.length(); j++) {
- JSONObject handleObj = handleArray.getJSONObject(j);
- JSONArray valuesArray = new JSONArray();
- valuesArray.put("mosip501724826584965_modified_1");
- valuesArray.put("mosip501724826584965_modified_2");
- valuesArray.put("mosip501724826584965_modified_3");
- handleObj.put("values", valuesArray);
- }
- } else if (testCaseName.contains("_withupdatetags")) {
- for (int j = 0; j < handleArray.length(); j++) {
- JSONObject handleObj = handleArray.getJSONObject(j);
- JSONArray tags = handleObj.optJSONArray("tags");
- if (tags != null) {
- for (int k = 0; k < tags.length(); k++) {
- tags.put(k, tags.getString(k) + "_invalid" + RANDOM_ID);
- }
- }
- }
- } else if (testCaseName.contains("_withupdatetagsandhandles")) {
- for (int j = 0; j < handleArray.length(); j++) {
- JSONObject handleObj = handleArray.getJSONObject(j);
- JSONArray tags = handleObj.optJSONArray("tags");
- if (tags != null) {
- for (int k = 0; k < tags.length(); k++) {
- tags.put(k, tags.getString(k) + "_invalid" + RANDOM_ID);
- }
- }
- JSONArray values = handleObj.optJSONArray("value");
- if (values != null) {
- for (int k = 0; k < values.length(); k++) {
- values.put(k, values.getString(k) + "_invalid" + RANDOM_ID);
- }
- }
- }
- } else if (testCaseName.contains("_withmultipledemohandles")) {
- // Handle specific demo handles by checking and adding them to the selectedHandles
-
- boolean containsPhone = false;
- for (int j = 0; j < selectedHandles.length(); j++) {
- if (result.equalsIgnoreCase(selectedHandles.getString(j))) {
- containsPhone = true;
- break;
- }
- }
- if (!containsPhone) {
- selectedHandles.put(result);
- JSONObject phoneEntry = new JSONObject();
- phoneEntry.put("value", "$PHONENUMBERFORIDENTITY$");
- JSONArray phoneArray = new JSONArray();
- phoneArray.put(phoneEntry);
- identity.put(result, phoneArray);
- }
- } else if (testCaseName.contains("_withdeletehandlefromrecord")) {
- for (int j = 0; j < selectedHandles.length(); j++) {
- String handleToDelete = selectedHandles.getString(j);
- if (identity.has(handleToDelete)) {
- identity.remove(handleToDelete);
- }
- }
- identity.remove("selectedHandles");
- } else if (testCaseName.contains("_withupdatedselectedhandle")) {
- String firstHandle = selectedHandles.getString(0);
- String updatedHandle = firstHandle + RANDOM_ID;
- selectedHandles.put(0, updatedHandle);
- } else if (testCaseName.contains("_withupdatedselectedhandleanddemo")) {
- if (selectedHandles.length() > 0) {
- String originalHandle = selectedHandles.getString(0);
- String updatedHandle = originalHandle + RANDOM_ID;
- selectedHandles.put(0, updatedHandle);
- if (identity.has(originalHandle)) {
- JSONArray originalHandleArray = identity.getJSONArray(originalHandle);
- for (int J = 0; J < originalHandleArray.length(); J++) {
- JSONObject handleObject = originalHandleArray.getJSONObject(i);
- String originalValue = handleObject.optString("value", "");
- handleObject.put("value", originalValue + RANDOM_ID);
- originalHandleArray.put(J, handleObject);
- }
- identity.remove(originalHandle);
- identity.put(updatedHandle, originalHandleArray);
- }
- }
- } else if (testCaseName.contains("_withupdatedselectedhandleandfirstattribute")) {
- Iterator keys = identity.keys();
- if (keys.hasNext()) {
- String firstKey = keys.next();
- if (!firstKey.equals("selectedHandles")) {
- selectedHandles.put(0, firstKey);
- if (identity.has(firstKey)) {
- JSONArray originalArray = identity.getJSONArray(firstKey);
- for (int j = 0; j < originalArray.length(); j++) {
- JSONObject handleObject = originalArray.getJSONObject(j);
- if (handleObject.has("value")) {
- String originalValue = handleObject.getString("value");
- handleObject.put("value", originalValue + "123");
- }
- if (handleObject.has("tags")) {
- JSONArray tagsArray = handleObject.getJSONArray("tags");
- for (int k = 0; k < tagsArray.length(); k++) {
- String tag = tagsArray.getString(k);
- tagsArray.put(k, tag + "123");
- }
- handleObject.put("tags", tagsArray);
- }
- originalArray.put(j, handleObject);
- }
- identity.remove(firstKey);
- identity.put(firstKey, originalArray);
- }
- }
- }
- }
- else if (testCaseName.contains("_withremovedtaggedattribute")) {
- for (int j = 0; j < selectedHandles.length(); j++) {
- String handle1 = selectedHandles.getString(j);
-
- if (identity.has(handle1) && identity.get(handle1) instanceof JSONArray) {
- JSONArray handleArray1 = identity.getJSONArray(handle1);
-
- for (int k = 0; k < handleArray1.length(); k++) {
- JSONObject handleObject = handleArray1.getJSONObject(k);
- if (handleObject.has("tags")) {
- handleObject.remove("tags");
- }
- }
- identity.put(handle, handleArray);
- }
- }
- }
- else if (testCaseName.contains("_withemptyhandles")) {
- identity.remove("selectedHandles");
-
- }
-
- else if (testCaseName.contains("_withouthandlesattr")) {
- if (identity.has("selectedHandles")) {
- selectedHandles = identity.getJSONArray("selectedHandles");
- for (int j = 0; j < selectedHandles.length(); j++) {
- handle = selectedHandles.getString(j);
- if (identity.has(handle)) {
- identity.remove(handle);
- }
- }
- identity.remove("selectedHandles");
- }
- }
-
- //44
- else if (testCaseName.contains("_withinvaliddemofield")) {
- if (identity.has("selectedHandles")) {
- for (int j = 0; j < selectedHandles.length(); j++) {
- if (identity.has(handle)) {
- Object currentValue = identity.get(handle);
- if (currentValue instanceof String) {
- identity.put(handle, "invalid_" + currentValue);
- } else if (currentValue instanceof JSONArray) {
- JSONArray jsonArray = (JSONArray) currentValue;
- for (int k = 0; k < jsonArray.length(); k++) {
- JSONObject obj = jsonArray.getJSONObject(k);
- if (obj.has("value")) {
- obj.put("value", "invalid_" + obj.getString("value"));
- }
- }
- identity.put(handle, jsonArray);
- }
- }
- selectedHandles.put(i, "invalid_" + handle);
- }
- identity.put("selectedHandles", selectedHandles);
- }
- }
- //49
- else if (testCaseName.contains("_withoutselectedhandlesandattri")) {
-
- for (int j = 0; j < selectedHandles.length(); j++) {
-
- if (identity.has(handle)) {
- identity.remove(handle);
- }
- }
-
- identity.remove("selectedHandles");
- }
-
- else if (testCaseName.contains("_withalldemofieldsremoved")) {
-
- for (int j = 0; j < selectedHandles.length(); j++) {
- if (identity.has(handle)) {
- identity.remove(handle);
- }
- }
- }
-
- else if (testCaseName.contains("_withemptyselectedhandle")) {
- if (identity.has("selectedHandles")) {
- identity.put("selectedHandles", new JSONArray());
- }
- }
-
-
- else if (testCaseName.contains("_witharandomnonhandleattr")) {
- if (identity.has("selectedHandles")) {
- List existingHandles = new ArrayList<>();
- for (int j = 0; j < selectedHandles.length(); j++) {
- existingHandles.add(selectedHandles.getString(j));
- }
- Iterator keys = identity.keys();
- while (keys.hasNext()) {
- String key = keys.next();
- if (key.equals("selectedHandles")) {
- continue;
- }
- if (!existingHandles.contains(key)) {
- selectedHandles.put(key);
- break;
- }
- }
- }
- }
-
- else if (testCaseName.contains("_updateselectedhandleswithinvalid")) {
- JSONArray updatedHandlesArray = new JSONArray();
- updatedHandlesArray.put("invalidscehema123");
- identity.put("selectedHandles", updatedHandlesArray);
- }
-
- else if (testCaseName.contains("_withinvaliddhandle")) {
- selectedHandles.put("newFieldHandle");
- }
-
- else if (testCaseName.contains("_updateselectedhandleswithscehmaattrwhichisnothandle")) {
- Iterator keys = identity.keys();
- while (keys.hasNext()) {
- String key = keys.next();
- if (!selectedHandles.toList().contains(key) && identity.optString(key) != null && identity.get(key) instanceof String) {
- selectedHandles.put(key);
- break;
- }
- }
- }
-
- else if (testCaseName.contains("_removeselectedhandle_updatephone")) {
- if (identity.has("selectedHandles")) {
- identity.remove("selectedHandles");
- }
-
- if (identity.has(result)) {
- identity.put(result, generateRandomNumberString(10));
- }
- }
-
- else if (testCaseName.contains("_withupdatedhandlewhichisnotinschema")) {
- JSONArray newSelectedHandles = new JSONArray();
- newSelectedHandles.put("invalid12@@");
- identity.put("selectedHandles", newSelectedHandles);
- }
-
- else if (testCaseName.contains("_replaceselectedhandles")) {
- identity.put("selectedHandles", new JSONArray().put(result));
- }
-
- else if (testCaseName.contains("_updatewithphoneemail")) {
- JSONArray updatedHandles = new JSONArray();
- updatedHandles.put(emailResult);
- updatedHandles.put(result);
-
- identity.put("selectedHandles", updatedHandles);
- }
- else if (testCaseName.contains("_withusedphone")) {
- if (identity.has(result)) {
- identity.put(result, "$ID:AddIdentity_array_handle_value_smoke_Pos_withphonenumber_PHONE$" );
- }
- }
- else if (testCaseName.contains("_withphonevalue")) {
- if (identity.has(result)) {
- identity.put(result, "$ID:AddIdentity_array_handle_value_smoke_Pos_withselectedhandlephone_PHONE$" );
- }
- }
- else if (testCaseName.contains("_removeselectedhandlesandupdateemail")) {
- if (identity.has("selectedHandles")) {
- identity.remove("selectedHandles");
- }
- if (identity.has(emailResult)) {
- identity.put(emailResult, "$ID:AddIdentity_array_handle_value_update_smoke_Pos_withselectedhandlephone_EMAIL$" );
- }
- }
-
- identity.put(handle, handleArray);
- }
- }
-
- // Return the modified JSON as a string
- return jsonObj.toString();
- }
-
-
-
-
public static void setfoundHandlesInIdSchema(boolean foundHandles) {
@@ -8569,6 +8111,38 @@ public static boolean isHandlesAvailableInIdSchema(boolean foundHandles) {
// }
// return false;
// }
+
+
+ public static JSONArray getRequiredField() {
+
+
+
+ JSONObject requestJson = new JSONObject();
+ 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);
+
+ org.json.JSONObject responseJson = new org.json.JSONObject(response.asString());
+ org.json.JSONObject schemaData = (org.json.JSONObject) responseJson.get(GlobalConstants.RESPONSE);
+
+ Double schemaVersion = ((BigDecimal) schemaData.get(GlobalConstants.ID_VERSION)).doubleValue();
+ idSchemaVersion = ((BigDecimal) schemaData.get(GlobalConstants.ID_VERSION)).doubleValue();
+ String schemaJsonData = schemaData.getString(GlobalConstants.SCHEMA_JSON);
+
+ String schemaFile = schemaJsonData;
+
+ JSONObject schemaFileJson = new JSONObject(schemaFile);
+ JSONObject schemaPropsJson = schemaFileJson.getJSONObject("properties");
+ JSONObject schemaIdentityJson = schemaPropsJson.getJSONObject("identity");
+ globalRequiredFields = schemaIdentityJson.getJSONArray("required");
+
+ return globalRequiredFields;
+
+ }
+
}
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/ConfigManager.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/ConfigManager.java
index 5d228308e2..e5145bffee 100644
--- a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/ConfigManager.java
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/ConfigManager.java
@@ -69,6 +69,14 @@ public static void getValueForKeyAddToPropertiesMap(Properties props, String key
value = System.getProperty("env.endpoint").replace("api-internal", "signup");
}
propertiesMap.put(key, value);
+ } else if (key.equalsIgnoreCase("injiCertifyBaseURL")){
+ String value = null;
+ if (System.getenv("injiCertifyBaseURL") != null) {
+ value = System.getenv("injiCertifyBaseURL");
+ } else {
+ value = System.getProperty("env.endpoint").replace("api-internal", "injicertify");
+ }
+ propertiesMap.put(key, value);
} else if (key.equalsIgnoreCase("mosip_components_base_urls")){
String components_base_urls = System.getenv("mosip_components_base_urls") == null
? props.getProperty("mosip_components_base_urls")
@@ -119,6 +127,10 @@ public static String getproperty(String key) {
public static String getRolesForUser(String userId) {
return getproperty("roles." + userId);
}
+
+ public static String getRolesForUser() {
+ return getproperty("roles");
+ }
public static String getServerErrorsToMonitor() { return getproperty("serverErrorsToMonitor"); }
public static String getEnableDebug() { return getproperty("enableDebug"); }
@@ -168,6 +180,7 @@ public static String getRolesForUser(String userId) {
public static String getKMDbUrl() { return "jdbc:postgresql://" + getproperty("db-server") + ":" + getproperty("db-port") + "/mosip_keymgr"; }
public static String getMASTERDbUrl() { return "jdbc:postgresql://" + getproperty("db-server") + ":" + getproperty("db-port") + "/mosip_master"; }
public static String getUserAdminName() { return getproperty("admin_userName"); }
+ public static String getUserAdminPassword() { return getproperty("admin_password"); }
public static String getPmsClientSecret() { return getproperty("mosip_pms_client_secret"); }
public static String getPartnerClientSecret() { return getproperty("mosip_partner_client_secret"); }
public static String getPartnerClientId() { return getproperty("mosip_partner_client_id"); }
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/GlobalConstants.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/GlobalConstants.java
index c2e6e01d21..27fa513cf4 100644
--- a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/GlobalConstants.java
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/GlobalConstants.java
@@ -54,6 +54,7 @@ public class GlobalConstants {
public static final String MIMOTO = "mimoto";
public static final String INJICERTIFY = "injicertify";
public static final String ESIGNET = "esignet";
+ public static final String SIGNUP = "signup";
public static final String APIKEY = "apiKey";
public static final String PARTNER_APIKEY = "partnerApiKey";
public static final String PARTNERID = "partnerId";
@@ -238,4 +239,6 @@ public class GlobalConstants {
public static final String PATH_FRAGMENT_COOKIE_TRANSACTIONID = "pathFragmentCookieTransactionId";
public static final String IDV_TRANSACTION_ID = "idvTransactionID";
public static final String IDV_TRANSACTION_ID_KEY = "IDV_TRANSACTION_ID";
+ public static final String IDV_SLOT_ALLOTED = "idvSlotAllotted";
+ public static final String IDV_SLOT_ALLOTED_KEY = "IDV_SLOT_ALLOTTED=";
}
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/KernelAuthentication.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/KernelAuthentication.java
index f21505b194..a344b15d74 100644
--- a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/KernelAuthentication.java
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/KernelAuthentication.java
@@ -21,7 +21,7 @@ public class KernelAuthentication extends BaseTestCase {
CommonLibrary clib = new CommonLibrary();
public final Map props = clib.readProperty("Kernel");
- private String admin_password = props.get("admin_password");
+ private String admin_password = ConfigManager.getUserAdminPassword();
// private String admin_userName = props.get("admin_userName");
private String admin_userName = ConfigManager.getUserAdminName();
@@ -30,6 +30,7 @@ public class KernelAuthentication extends BaseTestCase {
private String partner_userName = props.get("partner_userName");
private String partner_revamp_userName = props.get("partner_revamp_userName");
private String partner_revamp_device_userName = props.get("partner_revamp_device_userName");
+ private String partner_revamp_ftm_userName = props.get("partner_revamp_ftm_userName");
private String partner_userName_without_role = props.get("policytest_userName");
private String partner_userName_without_pm_role = props.get("policytest_without_pmrole_userName");
@@ -123,6 +124,10 @@ public String getTokenByRole(String role, String tokenType) {
if (!kernelCmnLib.isValidToken(partnerrevampdeviceCookie))
partnerrevampdeviceCookie = kernelAuthLib.getAuthForPartnerRevampDevice();
return partnerrevampdeviceCookie;
+ case "partnerrevampftm":
+ if (!kernelCmnLib.isValidToken(partnerrevampftmCookie))
+ partnerrevampftmCookie = kernelAuthLib.getAuthForPartnerRevampFtm();
+ return partnerrevampftmCookie;
case "partner":
if (!kernelCmnLib.isValidToken(partnerCookie))
partnerCookie = kernelAuthLib.getAuthForPartner();
@@ -192,8 +197,8 @@ public String getTokenByRole(String role, String tokenType) {
case "hotlist":
if (BaseTestCase.isTargetEnvLTS()) {
if (!kernelCmnLib.isValidToken(hotlistCookie))
- residentCookie = kernelAuthLib.getAuthForHotlist();
- return residentCookie;
+ hotlistCookie = kernelAuthLib.getAuthForHotlist();
+ return hotlistCookie;
} else {
if (!kernelCmnLib.isValidToken(regProCookie))
regProCookie = kernelAuthLib.getAuthForRegProc();
@@ -340,6 +345,30 @@ public String getAuthForPartnerRevampDevice() {
String responseBody = reponse.getBody().asString();
return new org.json.JSONObject(responseBody).getJSONObject(dataKey).getString(GlobalConstants.TOKEN);
}
+
+ @SuppressWarnings({ "unchecked" })
+ public String getAuthForPartnerRevampFtm() {
+
+ JSONObject request = new JSONObject();
+
+ request.put(GlobalConstants.APPID, ConfigManager.getPmsAppId());
+ request.put(GlobalConstants.PASSWORD, partner_password);
+ request.put(GlobalConstants.USER_NAME, partner_revamp_ftm_userName);
+ JSONObject actualInternalrequest = getRequestJson(authInternalRequest);
+ if (BaseTestCase.isTargetEnvLTS()) {
+ request.put(GlobalConstants.CLIENTID, ConfigManager.getPmsClientId());
+ request.put(GlobalConstants.CLIENTSECRET, ConfigManager.getPmsClientSecret());
+ } else {
+ request.put(GlobalConstants.CLIENTID, ConfigManager.getPartnerClientId());
+ request.put(GlobalConstants.CLIENTSECRET, ConfigManager.getPartnerClientSecret());
+ }
+ request.put(GlobalConstants.CLIENTID, ConfigManager.getPmsClientId());
+
+ actualInternalrequest.put(GlobalConstants.REQUEST, request);
+ Response reponse = appl.postWithJson(authenticationInternalEndpoint, actualInternalrequest);
+ String responseBody = reponse.getBody().asString();
+ return new org.json.JSONObject(responseBody).getJSONObject(dataKey).getString(GlobalConstants.TOKEN);
+ }
@SuppressWarnings({ "unchecked" })
public String getAuthForNewPartner() {
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/KeycloakUserManager.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/KeycloakUserManager.java
index c7f3073514..9f710f75ac 100644
--- a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/KeycloakUserManager.java
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/KeycloakUserManager.java
@@ -84,16 +84,7 @@ else if(needsToBeCreatedUser.equals("masterdata-220005")){
moduleSpecificUser = needsToBeCreatedUser;
}
-
- else if(needsToBeCreatedUser.equals("111999")){
- moduleSpecificUser = needsToBeCreatedUser;
-
- }
- else if(needsToBeCreatedUser.equals("111998")){
- moduleSpecificUser = needsToBeCreatedUser;
-
- }
-
+
else {
moduleSpecificUser = BaseTestCase.currentModule +"-"+ needsToBeCreatedUser;
}
@@ -312,7 +303,7 @@ public static void createUsers(String userid, String pwd, String rolenum, Map allRoles = realmResource.roles().list();
List availableRoles = new ArrayList<>();
- List toBeAssignedRoles = List.of(propsKernel.getProperty(rolenum).split(","));
+ List toBeAssignedRoles = List.of(ConfigManager.getRolesForUser().split(","));
for (String role : toBeAssignedRoles) {
if (allRoles.stream().anyMatch((r -> r.getName().equalsIgnoreCase(role)))) {
if (allRoles.stream().filter(r->r.getName().equals(role)).findFirst().isPresent())
diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/WebSocketClientUtil.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/WebSocketClientUtil.java
new file mode 100644
index 0000000000..74790ce9c1
--- /dev/null
+++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/WebSocketClientUtil.java
@@ -0,0 +1,174 @@
+package io.mosip.testrig.apirig.utils;
+
+import javax.websocket.*;
+import org.apache.log4j.Logger;
+import java.net.URI;
+import java.util.Collections;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ConcurrentHashMap;
+
+@ClientEndpoint
+public class WebSocketClientUtil extends Endpoint {
+
+ private static final Logger logger = Logger.getLogger(WebSocketClientUtil.class);
+ private Session session;
+ private CountDownLatch latch;
+ private String cookie;
+ private String subscribeDestination;
+ private String sendDestination;
+
+
+ // Global map to store received messages, keyed by message ID or custom key
+ private static final Map messageStore = new ConcurrentHashMap<>();
+
+ public WebSocketClientUtil(String cookie, String subscribeDestination, String sendDestination) {
+ this.cookie = cookie;
+ this.subscribeDestination = subscribeDestination;
+ this.sendDestination = sendDestination;
+ latch = new CountDownLatch(1); // Initially, latch is set to 1
+ }
+
+ @Override
+ public void onOpen(Session session, EndpointConfig config) {
+ this.session = session;
+ logger.info("WebSocket opened");
+
+ // Add message handler
+ session.addMessageHandler(String.class, this::onMessage);
+
+ try {
+ // Send CONNECT frame to initiate WebSocket handshake
+ String connectFrame = "CONNECT\naccept-version:1.2\n\n\u0000";
+ session.getBasicRemote().sendText(connectFrame);
+ logger.info("Sent CONNECT frame: " + connectFrame);
+
+ // Send SUBSCRIBE frame to subscribe to destination
+ String subscribeFrame = String.format("SUBSCRIBE\nid:sub-0\ndestination:%s\n\n\u0000", subscribeDestination);
+ session.getBasicRemote().sendText(subscribeFrame);
+ logger.info("Sent SUBSCRIBE frame: " + subscribeFrame);
+
+ } catch (Exception e) {
+ logger.error("Error during connection setup", e);
+ latch.countDown();
+ }
+ }
+
+ public void connect(String uri) {
+ WebSocketContainer container = ContainerProvider.getWebSocketContainer();
+
+ ClientEndpointConfig config = ClientEndpointConfig.Builder.create()
+ .configurator(new ClientEndpointConfig.Configurator() {
+ @Override
+ public void beforeRequest(Map> headers) {
+ headers.put("Cookie", Collections.singletonList(cookie));
+ logger.info("Request headers: " + headers);
+ }
+ }).build();
+
+ try {
+ logger.info("Attempting to connect to: " + uri);
+ container.connectToServer(this, config, new URI(uri));
+
+ logger.info("Successfully connected to the WebSocket server.");
+
+ } catch (Exception e) {
+ logger.error("Connection failed: ", e);
+ }
+ }
+
+ @OnMessage
+ public void onMessage(String message) {
+ logger.info("Received message: " + message);
+
+ // Store the received message in the global map (keyed by message ID or custom identifier)
+ // Assuming the message contains a message-id field
+ String messageId = extractMessageId(message);
+ if (messageId != null) {
+ messageStore.put(messageId, message);
+ logger.info("Stored message with ID: " + messageId);
+ } else {
+ logger.warn("Received message without a valid message ID: " + message);
+ }
+ }
+
+ @OnClose
+ public void onClose(Session session, CloseReason closeReason) {
+ if (closeReason != null) {
+ logger.info("Connection closed: " + closeReason.getCloseCode() + " (" + closeReason.getReasonPhrase() + ")");
+ } else {
+ logger.info("Connection closed with no specific reason.");
+ }
+ latch.countDown();
+ }
+
+ @OnError
+ public void onError(Session session, Throwable throwable) {
+ logger.error("Error occurred: ", throwable);
+ if (session != null && session.isOpen()) {
+ try {
+ // Attempting to reconnect if needed
+ logger.info("Attempting to reconnect...");
+ connect("wss://your-websocket-url");
+ } catch (Exception e) {
+ logger.error("Error reconnecting: ", e);
+ }
+ }
+ latch.countDown();
+ }
+
+
+ public void sendMessage(String messageContent) {
+ if (session != null && session.isOpen()) {
+ try {
+ String sendFrame = String.format("SEND\ndestination:%s\ncontent-type:application/json\n\n%s\u0000", sendDestination, messageContent);
+ session.getBasicRemote().sendText(sendFrame);
+ logger.info("Sent message: " + sendFrame);
+ } catch (Exception e) {
+ logger.error("Error sending message: ", e);
+ }
+ } else {
+ logger.warn("Connection is not open. Unable to send message.");
+ session = null;
+ }
+ }
+
+ public void closeConnection() {
+ try {
+ if (session != null && session.isOpen()) {
+ session.close();
+ logger.info("WebSocket connection closed.");
+ }
+ } catch (Exception e) {
+ logger.error("Error closing connection", e);
+ }
+ }
+
+ // Method to extract the message ID from the received message (this is a placeholder)
+ private String extractMessageId(String message) {
+ try {
+ if (message.contains("message-id")) {
+ String[] parts = message.split("message-id:");
+ if (parts.length > 1) {
+ String messageId = parts[1].split("-")[0].trim(); // Adjust extraction logic as needed
+ return messageId;
+ }
+ }
+ } catch (Exception e) {
+ logger.error("Error extracting message ID", e);
+ }
+ return null;
+ }
+
+ public static Map getMessageStore() {
+ return messageStore;
+ }
+
+ public Session getSession() {
+ return session;
+ }
+
+ public CountDownLatch getLatch() {
+ return latch;
+ }
+}
\ No newline at end of file
diff --git a/apitest-commons/src/main/resources/config/Kernel.properties b/apitest-commons/src/main/resources/config/Kernel.properties
index 4066c82165..b88adfcf24 100644
--- a/apitest-commons/src/main/resources/config/Kernel.properties
+++ b/apitest-commons/src/main/resources/config/Kernel.properties
@@ -104,6 +104,7 @@ signupSettingsEndPoint=/v1/signup/settings
esignetActuatorPropertySection=esignet-default.properties
eSignetbaseurl=
signupBaseUrl=
+injiCertifyBaseURL=
@@ -173,8 +174,8 @@ keycloak_UserName = admin
keycloak_Password =
keycloak-external-url = https://iam.camdgc-qa1.mosip.net
keycloak-realm-id = mosip
-iam-users-to-create=111997,111998,220005,111992,globaladmin,111999,111887
-iam-users-password=mosip123,mosip123,mosip123,mosip123,mosip123,mosip123,mosip123
+iam-users-to-create=111997,111998,220005,111992,globaladmin,111999,111887,111888
+iam-users-password=mosip123,mosip123,mosip123,mosip123,mosip123,mosip123,mosip123,mosip123
roles.220005=GLOBAL_ADMIN,ID_AUTHENTICATION,REGISTRATION_ADMIN,REGISTRATION_SUPERVISOR,ZONAL_ADMIN
roles.111997=AUTH_PARTNER,PARTNER_ADMIN,PMS_ADMIN,POLICYMANAGER,REGISTRATION_SUPERVISOR
roles.111999=AUTH_PARTNER,PARTNER_ADMIN,PMS_ADMIN,POLICYMANAGER,REGISTRATION_SUPERVISOR
@@ -182,6 +183,7 @@ roles.111887=AUTH_PARTNER,PARTNER_ADMIN,PMS_ADMIN,REGISTRATION_SUPERVISOR
roles.111998=POLICYMANAGER
roles.111992=GLOBAL_ADMIN
roles.111998=DEVICE_PROVIDER,PARTNER_ADMIN,PMS_ADMIN,POLICYMANAGER,REGISTRATION_SUPERVISOR
+roles.111888= FTM_PROVIDER,PARTNER_ADMIN,PMS_ADMIN,POLICYMANAGER,REGISTRATION_SUPERVISOR
roles.globaladmin = GLOBAL_ADMIN,REGISTRATION_ADMIN,uma_authorization,ZONAL_ADMIN,default-roles-mosip
@@ -234,8 +236,9 @@ serverErrorsToMonitor=IDA-MLC-018
pmsAuthInternal=true
partner_password=mosip123
partner_userName=111997
-partner_revamp_userName=111999
-partner_revamp_device_userName=111998
+partner_revamp_userName=pms-111999
+partner_revamp_device_userName=pms-111998
+partner_revamp_ftm_userName=pms-111888
partner_user_password=mosip123
policytest_password=mosip123
policytest_userName=111998
@@ -266,4 +269,4 @@ authCertsPath=/home/mosip/authcerts
mosip_components_base_urls=
-#auditmanager=api-internal.dev1.mosip.net;idrepository=api-internal.dev1.mosip.net;partnermanager=api-internal.qa-inji.mosip.net;idauthentication=api-internal.qa-inji.mosip.net;policymanager=api-internal.qa-inji.mosip.net;authmanager=api-internal.released.mosip.net;
+#auditmanager=api-internal.released.mosip.net;idrepository=api-internal.released.mosip.net;partnermanager=api-internal.released.mosip.net;idauthentication=api-internal.released.mosip.net;policymanager=api-internal.released.mosip.net;authmanager=api-internal.released.mosip.net;resident=api-internal.released.mosip.net;preregistration=api-internal.released.mosip.net;masterdata=api-internal.released.mosip.net;idgenerator=api-internal.released.mosip.net;
\ No newline at end of file
diff --git a/authentication-demo-service/README.md b/authentication-demo-service/README.md
index 57901d7447..0dba382d4f 100644
--- a/authentication-demo-service/README.md
+++ b/authentication-demo-service/README.md
@@ -3,4 +3,24 @@
## Overview
Demo authentication service used by automation tests.
+## Build & run (for developers)
+Prerequisites:
+[Config Server](https://docs.mosip.io/1.2.0/modules/module-configuration#config-server)
+The project requires JDK 1.21.
+1. Build and install:
+ ```
+ $ cd authentication-demo-service
+ $ mvn install -DskipTests=true -Dmaven.javadoc.skip=true -Dgpg.skip=true
+ ```
+
+2. Build Docker for a service:
+ ```
+ $ cd
+ $ docker build -f Dockerfile
+ ```
+
+### Configuration
+[application-default.properties](https://github.com/mosip/mosip-config/blob/dev-integration/application-default.properties)
+
+defined here.
\ No newline at end of file
diff --git a/authentication-demo-service/pom.xml b/authentication-demo-service/pom.xml
index 1f9fa8d852..f323215349 100644
--- a/authentication-demo-service/pom.xml
+++ b/authentication-demo-service/pom.xml
@@ -1,4 +1,4 @@
-
4.0.0
diff --git a/authentication-demo-service/src/main/resources/application.properties b/authentication-demo-service/src/main/resources/application.properties
index 0ca94feea6..435d631de7 100644
--- a/authentication-demo-service/src/main/resources/application.properties
+++ b/authentication-demo-service/src/main/resources/application.properties
@@ -1,3 +1,7 @@
+subdomain=dev
+mosip.api.public.host=api.${subdomain}.mosip.net
+mosip.api.internal.host=api-internal.${subdomain}.mosip.net
+mosip.api.internal.url=https://${mosip.api.internal.host}
mosip.base.url=${mosip.api.internal.url}
websub.publisher.url=http://localhost:9191/websub/publish