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 61c9584933..b5b9259aa8 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 @@ -5310,7 +5310,7 @@ public static String modifySchemaGenerateHbs(boolean regenerateHbs) { JSONObject requestJson = new JSONObject(); kernelAuthLib = new KernelAuthentication(); String token = kernelAuthLib.getTokenByRole(GlobalConstants.ADMIN); - String url = ApplnURI + properties.getProperty(GlobalConstants.MASTER_SCHEMA_URL); + String url = getSchemaURL(); Response response = RestClient.getRequestWithCookie(url, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, GlobalConstants.AUTHORIZATION, token); @@ -5542,6 +5542,18 @@ else if (eachRequiredProp.equals("password")) { identityHbs = requestJson.toString(); return identityHbs; } + + + public static String getSchemaURL() { + String schemaURL = ApplnURI + properties.getProperty(GlobalConstants.MASTER_SCHEMA_URL); + String schemaVersion = ConfigManager.getproperty(GlobalConstants.SCHEMA_VERSION); + + if (schemaVersion != null && !schemaVersion.isEmpty()) { + schemaURL = schemaURL + "?schemaVersion=" + schemaVersion; + } + + return schemaURL; + } public static String updateIdentityHbs(boolean regenerateHbs) { @@ -5552,7 +5564,7 @@ public static String updateIdentityHbs(boolean regenerateHbs) { JSONObject requestJson = new JSONObject(); kernelAuthLib = new KernelAuthentication(); String token = kernelAuthLib.getTokenByRole(GlobalConstants.ADMIN); - String url = ApplnURI + properties.getProperty(GlobalConstants.MASTER_SCHEMA_URL); + String url = getSchemaURL(); Response response = RestClient.getRequestWithCookie(url, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, GlobalConstants.AUTHORIZATION, token); @@ -5759,7 +5771,7 @@ else if (eachRequiredProp.equals("proofOfIdentity")) { public static String generateLatestSchemaVersion() { kernelAuthLib = new KernelAuthentication(); String token = kernelAuthLib.getTokenByRole(GlobalConstants.ADMIN); - String url = ApplnURI + properties.getProperty(GlobalConstants.MASTER_SCHEMA_URL); + String url = getSchemaURL(); Response response = RestClient.getRequestWithCookie(url, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, GlobalConstants.AUTHORIZATION, token); @@ -5782,7 +5794,7 @@ public static String generateHbsForUpdateDraft() { JSONObject requestJson = new JSONObject(); kernelAuthLib = new KernelAuthentication(); String token = kernelAuthLib.getTokenByRole(GlobalConstants.ADMIN); - String url = ApplnURI + properties.getProperty(GlobalConstants.MASTER_SCHEMA_URL); + String url = getSchemaURL(); Response response = RestClient.getRequestWithCookie(url, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, GlobalConstants.AUTHORIZATION, token); @@ -6076,7 +6088,7 @@ public static String generateHbsForPrereg(boolean isItUpdate) { JSONObject requestJson = new JSONObject(); kernelAuthLib = new KernelAuthentication(); String token = kernelAuthLib.getTokenByRole(GlobalConstants.ADMIN); - String url = ApplnURI + properties.getProperty(GlobalConstants.MASTER_SCHEMA_URL); + String url = getSchemaURL(); Response response = RestClient.getRequestWithCookie(url, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, GlobalConstants.AUTHORIZATION, token); @@ -8204,7 +8216,7 @@ 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); + String url = getSchemaURL(); Response response = RestClient.getRequestWithCookie(url, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, GlobalConstants.AUTHORIZATION, token); 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 27fa513cf4..f16d1592da 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 @@ -99,6 +99,7 @@ public class GlobalConstants { public static final String MOSIP_ESIGNET_ACCESS_TOKEN_EXPIRE_SECONDS = "mosip.esignet.access-token-expire-seconds"; public static final String ERROR_BOOK_APPOINTMENT = "Failed to fetch registration details while booking appointment"; public static final String MASTER_SCHEMA_URL = "masterSchemaURL"; + public static final String SCHEMA_VERSION = "schemaVersion"; public static final String ID_VERSION = "idVersion"; public static final String SCHEMA_JSON = "schemaJson"; public static final String REQUIRED = "required"; diff --git a/apitest-commons/src/main/resources/config/Kernel.properties b/apitest-commons/src/main/resources/config/Kernel.properties index d508aa1ae8..d625ca2eaa 100644 --- a/apitest-commons/src/main/resources/config/Kernel.properties +++ b/apitest-commons/src/main/resources/config/Kernel.properties @@ -269,4 +269,4 @@ authCertsPath=/home/mosip/authcerts mosip_components_base_urls= -#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 +#auditmanager=api-internal.released.mosip.net;idrepository=api-internal.released.mosip.net;authmanager=api-internal.released.mosip.net;resident=api-internal.released.mosip.net;partnermanager=api-internal.released.mosip.net;idauthentication=api-internal.released.mosip.net;masterdata=api-internal.released.mosip.net;idgenerator=api-internal.released.mosip.net;policymanager=api-internal.released.mosip.net;preregistration=api-internal.released.mosip.net;keymanager=api-internal.released.mosip.net \ No newline at end of file