From 352fc813aae588c2018cc9f1de35cd99d967cd94 Mon Sep 17 00:00:00 2001 From: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com> Date: Thu, 3 Oct 2024 12:56:14 +0530 Subject: [PATCH] MOSIP-36077 - Restructured the config manager (#902) * MOSIP-35671 -Merging java21 with develop Signed-off-by: Mohanachandran S * MOSIP-35911 - Added DB queries Signed-off-by: Mohanachandran S * MOSIP-35916 - Renamed the apitest folder to api-test Signed-off-by: Mohanachandran S * MOSIP-36077 - Restructured the config manager Signed-off-by: Mohanachandran S * MOSIP-36077 - Restructured the config manager Signed-off-by: Mohanachandran S * MOSIP-36077 - Restructured the config manager Signed-off-by: Mohanachandran S --------- Signed-off-by: Mohanachandran S --- .../apirig/testrunner/MosipTestRunner.java | 42 +-- .../apirig/testscripts/AuditValidator.java | 8 +- .../apirig/testscripts/DBValidator.java | 4 +- .../apirig/testscripts/GetWithParam.java | 4 +- .../apirig/testscripts/GetWithQueryParam.java | 6 +- .../PatchWithPathParamsAndBody.java | 4 +- .../PostWithBodyAndPathParams.java | 5 +- .../testscripts/PostWithOnlyPathParam.java | 4 +- .../testscripts/PutWithPathParamsAndBody.java | 5 +- .../testscripts/SimplePatchForAutoGenId.java | 4 +- .../apirig/testscripts/SimplePost.java | 4 +- .../testscripts/SimplePostForAutoGenId.java | 5 +- .../testrig/apirig/testscripts/SimplePut.java | 4 +- .../testrig/apirig/utils/PMSConfigManger.java | 30 ++ .../main/resources/config/Kernel.properties | 283 ------------------ .../src/main/resources/config/pms.properties | 5 + 16 files changed, 72 insertions(+), 345 deletions(-) create mode 100644 api-test/src/main/java/io/mosip/testrig/apirig/utils/PMSConfigManger.java delete mode 100644 api-test/src/main/resources/config/Kernel.properties create mode 100644 api-test/src/main/resources/config/pms.properties diff --git a/api-test/src/main/java/io/mosip/testrig/apirig/testrunner/MosipTestRunner.java b/api-test/src/main/java/io/mosip/testrig/apirig/testrunner/MosipTestRunner.java index cfb573bfa9..0dfd302ffe 100644 --- a/api-test/src/main/java/io/mosip/testrig/apirig/testrunner/MosipTestRunner.java +++ b/api-test/src/main/java/io/mosip/testrig/apirig/testrunner/MosipTestRunner.java @@ -23,16 +23,14 @@ import io.mosip.testrig.apirig.dbaccess.DBManager; import io.mosip.testrig.apirig.utils.AdminTestUtil; -import io.mosip.testrig.apirig.utils.CertificateGenerationUtil; import io.mosip.testrig.apirig.utils.CertsUtil; -import io.mosip.testrig.apirig.utils.ConfigManager; -import io.mosip.testrig.apirig.utils.EncryptionDecrptionUtil; import io.mosip.testrig.apirig.utils.GlobalConstants; import io.mosip.testrig.apirig.utils.JWKKeyUtil; import io.mosip.testrig.apirig.utils.KeyCloakUserAndAPIKeyGeneration; import io.mosip.testrig.apirig.utils.KeycloakUserManager; import io.mosip.testrig.apirig.utils.MispPartnerAndLicenseKeyGeneration; import io.mosip.testrig.apirig.utils.OutputValidationUtil; +import io.mosip.testrig.apirig.utils.PMSConfigManger; import io.mosip.testrig.apirig.utils.PartnerRegistration; import io.mosip.testrig.apirig.utils.SkipTestCaseHandler; @@ -63,14 +61,15 @@ public static void main(String[] arg) { for (String envName : envMap.keySet()) { LOGGER.info(String.format("ENV %s = %s%n", envName, envMap.get(envName))); } + BaseTestCase.setRunContext(getRunType(), jarUrl); ExtractResource.removeOldMosipTestTestResource(); - if (checkRunType().equalsIgnoreCase("JAR")) { + if (getRunType().equalsIgnoreCase("JAR")) { ExtractResource.extractCommonResourceFromJar(); } else { ExtractResource.copyCommonResources(); } - ConfigManager.init(); - BaseTestCase.suiteSetup(); + PMSConfigManger.init(); + BaseTestCase.suiteSetup(getRunType()); SkipTestCaseHandler.loadTestcaseToBeSkippedList("testCaseSkippedList.txt"); setLogLevels(); @@ -91,7 +90,7 @@ public static void main(String[] arg) { LOGGER.error("Exception " + e.getMessage()); } - MockSMTPListener.bTerminate = true; + OTPListener.bTerminate = true; if (BaseTestCase.isTargetEnvLTS()) HealthChecker.bTerminate = true; @@ -128,7 +127,7 @@ public static void startTestRunner() { List modulesToRun = BaseTestCase.listOfModules; String os = System.getProperty("os.name"); LOGGER.info(os); - if (checkRunType().contains("IDE") || os.toLowerCase().contains("windows")) { + if (getRunType().contains("IDE") || os.toLowerCase().contains("windows")) { homeDir = new File(System.getProperty("user.dir") + "/testNgXmlFiles"); LOGGER.info("IDE :" + homeDir); } else { @@ -157,18 +156,6 @@ public static void startTestRunner() { * @return String * @throws IOException */ - /* - * public static String getGlobalResourcePath() { if - * (checkRunType().equalsIgnoreCase("JAR")) { return new - * File(jarUrl).getParentFile().getAbsolutePath() + - * "/MosipTestResource/MosipTemporaryTestResource"; } else if - * (checkRunType().equalsIgnoreCase("IDE")) { String path = new - * File(MosipTestRunner.class.getClassLoader().getResource("").getPath()). - * getAbsolutePath() + "/MosipTestResource/MosipTemporaryTestResource"; if - * (path.contains(GlobalConstants.TESTCLASSES)) path = - * path.replace(GlobalConstants.TESTCLASSES, "classes"); return path; } return - * "Global Resource File Path Not Found"; } - */ public static String getGlobalResourcePath() { if (cachedPath != null) { @@ -176,9 +163,9 @@ public static String getGlobalResourcePath() { } String path = null; - if (checkRunType().equalsIgnoreCase("JAR")) { + if (getRunType().equalsIgnoreCase("JAR")) { path = new File(jarUrl).getParentFile().getAbsolutePath() + "/MosipTestResource/MosipTemporaryTestResource"; - } else if (checkRunType().equalsIgnoreCase("IDE")) { + } else if (getRunType().equalsIgnoreCase("IDE")) { path = new File(MosipTestRunner.class.getClassLoader().getResource("").getPath()).getAbsolutePath() + "/MosipTestResource/MosipTemporaryTestResource"; if (path.contains(GlobalConstants.TESTCLASSES)) @@ -195,15 +182,6 @@ public static String getGlobalResourcePath() { public static String getResourcePath() { return getGlobalResourcePath(); -// if (checkRunType().equalsIgnoreCase("JAR")) { -// return new File(jarUrl).getParentFile().getAbsolutePath(); -// } else if (checkRunType().equalsIgnoreCase("IDE")) { -// String path = new File(MosipTestRunner.class.getClassLoader().getResource("").getPath()).getAbsolutePath(); -// if (path.contains(GlobalConstants.TESTCLASSES)) -// path = path.replace(GlobalConstants.TESTCLASSES, "classes"); -// return path; -// } -// return "Global Resource File Path Not Found"; } public static String generatePulicKey() { @@ -297,7 +275,7 @@ public static Properties getproperty(String path) { * * @return */ - public static String checkRunType() { + public static String getRunType() { if (MosipTestRunner.class.getResource("MosipTestRunner.class").getPath().contains(".jar")) return "JAR"; else diff --git a/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/AuditValidator.java b/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/AuditValidator.java index ec8c152fb0..5b7116973d 100644 --- a/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/AuditValidator.java +++ b/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/AuditValidator.java @@ -29,9 +29,9 @@ import io.mosip.testrig.apirig.utils.AdminTestException; import io.mosip.testrig.apirig.utils.AdminTestUtil; import io.mosip.testrig.apirig.utils.AuthenticationTestException; -import io.mosip.testrig.apirig.utils.ConfigManager; import io.mosip.testrig.apirig.utils.GlobalConstants; import io.mosip.testrig.apirig.utils.OutputValidationUtil; +import io.mosip.testrig.apirig.utils.PMSConfigManger; import io.mosip.testrig.apirig.utils.PMSUtil; import io.restassured.response.Response; @@ -50,7 +50,7 @@ public String getTestName() { @BeforeClass public static void setLogLevel() { - if (ConfigManager.IsDebugEnabled()) + if (PMSConfigManger.IsDebugEnabled()) logger.setLevel(Level.ALL); else logger.setLevel(Level.ERROR); @@ -79,7 +79,7 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad String[] templateFields = testCaseDTO.getTemplateFields(); List queryProp = Arrays.asList(templateFields); logger.info(queryProp); - String query = "select * from audit.app_audit_log where cr_by = '"+BaseTestCase.currentModule +"-"+propsKernel.getProperty("partner_userName")+"'"; + String query = "select * from audit.app_audit_log where cr_by = '"+BaseTestCase.currentModule +"-"+PMSConfigManger.getproperty("partner_userName")+"'"; logger.info(query); @@ -113,7 +113,7 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad @AfterMethod(alwaysRun = true) public void setResultTestName(ITestResult result) { - String deleteQuery = "delete from audit.app_audit_log where cr_by = '"+propsKernel.getProperty("partner_userName")+"'"; + String deleteQuery = "delete from audit.app_audit_log where cr_by = '"+PMSConfigManger.getproperty("partner_userName")+"'"; logger.info(deleteQuery); AuditDBManager.executeQueryAndDeleteRecord("audit", deleteQuery); try { diff --git a/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/DBValidator.java b/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/DBValidator.java index 48ed31d0dc..fd9dd09013 100644 --- a/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/DBValidator.java +++ b/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/DBValidator.java @@ -30,9 +30,9 @@ import io.mosip.testrig.apirig.utils.AdminTestException; import io.mosip.testrig.apirig.utils.AdminTestUtil; import io.mosip.testrig.apirig.utils.AuthenticationTestException; -import io.mosip.testrig.apirig.utils.ConfigManager; import io.mosip.testrig.apirig.utils.GlobalConstants; import io.mosip.testrig.apirig.utils.OutputValidationUtil; +import io.mosip.testrig.apirig.utils.PMSConfigManger; import io.mosip.testrig.apirig.utils.PMSUtil; import io.restassured.response.Response; @@ -44,7 +44,7 @@ public class DBValidator extends AdminTestUtil implements ITest { @BeforeClass public static void setLogLevel() { - if (ConfigManager.IsDebugEnabled()) + if (PMSConfigManger.IsDebugEnabled()) logger.setLevel(Level.ALL); else logger.setLevel(Level.ERROR); diff --git a/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/GetWithParam.java b/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/GetWithParam.java index a029545b3e..24dc99c3a9 100644 --- a/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/GetWithParam.java +++ b/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/GetWithParam.java @@ -26,9 +26,9 @@ import io.mosip.testrig.apirig.utils.AdminTestException; import io.mosip.testrig.apirig.utils.AdminTestUtil; import io.mosip.testrig.apirig.utils.AuthenticationTestException; -import io.mosip.testrig.apirig.utils.ConfigManager; import io.mosip.testrig.apirig.utils.GlobalConstants; import io.mosip.testrig.apirig.utils.OutputValidationUtil; +import io.mosip.testrig.apirig.utils.PMSConfigManger; import io.mosip.testrig.apirig.utils.PMSUtil; import io.mosip.testrig.apirig.utils.ReportUtil; import io.restassured.response.Response; @@ -41,7 +41,7 @@ public class GetWithParam extends AdminTestUtil implements ITest { @BeforeClass public static void setLogLevel() { - if (ConfigManager.IsDebugEnabled()) + if (PMSConfigManger.IsDebugEnabled()) logger.setLevel(Level.ALL); else logger.setLevel(Level.ERROR); diff --git a/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/GetWithQueryParam.java b/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/GetWithQueryParam.java index dbe7875d2f..8b9cfe9a47 100644 --- a/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/GetWithQueryParam.java +++ b/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/GetWithQueryParam.java @@ -26,9 +26,9 @@ import io.mosip.testrig.apirig.utils.AdminTestException; import io.mosip.testrig.apirig.utils.AdminTestUtil; import io.mosip.testrig.apirig.utils.AuthenticationTestException; -import io.mosip.testrig.apirig.utils.ConfigManager; import io.mosip.testrig.apirig.utils.GlobalConstants; import io.mosip.testrig.apirig.utils.OutputValidationUtil; +import io.mosip.testrig.apirig.utils.PMSConfigManger; import io.mosip.testrig.apirig.utils.PMSUtil; import io.mosip.testrig.apirig.utils.ReportUtil; import io.restassured.response.Response; @@ -40,7 +40,7 @@ public class GetWithQueryParam extends AdminTestUtil implements ITest { @BeforeClass public static void setLogLevel() { - if (ConfigManager.IsDebugEnabled()) + if (PMSConfigManger.IsDebugEnabled()) logger.setLevel(Level.ALL); else logger.setLevel(Level.ERROR); @@ -83,7 +83,7 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad throw new SkipException( GlobalConstants.TARGET_ENV_HEALTH_CHECK_FAILED + HealthChecker.healthCheckFailureMapS); } - if (ConfigManager.isInServiceNotDeployedList(GlobalConstants.ADMIN) && testCaseName.contains("BulkUpload_")) { + if (PMSConfigManger.isInServiceNotDeployedList(GlobalConstants.ADMIN) && testCaseName.contains("BulkUpload_")) { throw new SkipException(GlobalConstants.SERVICE_NOT_DEPLOYED_MESSAGE); } diff --git a/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/PatchWithPathParamsAndBody.java b/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/PatchWithPathParamsAndBody.java index 65fe6ecdba..6a18f37242 100644 --- a/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/PatchWithPathParamsAndBody.java +++ b/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/PatchWithPathParamsAndBody.java @@ -25,9 +25,9 @@ import io.mosip.testrig.apirig.utils.AdminTestException; import io.mosip.testrig.apirig.utils.AdminTestUtil; import io.mosip.testrig.apirig.utils.AuthenticationTestException; -import io.mosip.testrig.apirig.utils.ConfigManager; import io.mosip.testrig.apirig.utils.GlobalConstants; import io.mosip.testrig.apirig.utils.OutputValidationUtil; +import io.mosip.testrig.apirig.utils.PMSConfigManger; import io.mosip.testrig.apirig.utils.PMSUtil; import io.mosip.testrig.apirig.utils.ReportUtil; import io.restassured.response.Response; @@ -40,7 +40,7 @@ public class PatchWithPathParamsAndBody extends AdminTestUtil implements ITest { @BeforeClass public static void setLogLevel() { - if (ConfigManager.IsDebugEnabled()) + if (PMSConfigManger.IsDebugEnabled()) logger.setLevel(Level.ALL); else logger.setLevel(Level.ERROR); diff --git a/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithBodyAndPathParams.java b/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithBodyAndPathParams.java index fff03ea3c1..b32d12dc93 100644 --- a/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithBodyAndPathParams.java +++ b/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithBodyAndPathParams.java @@ -22,14 +22,13 @@ import io.mosip.testrig.apirig.dto.OutputValidationDto; import io.mosip.testrig.apirig.dto.TestCaseDTO; -import io.mosip.testrig.apirig.testrunner.BaseTestCase; import io.mosip.testrig.apirig.testrunner.HealthChecker; import io.mosip.testrig.apirig.utils.AdminTestException; import io.mosip.testrig.apirig.utils.AdminTestUtil; import io.mosip.testrig.apirig.utils.AuthenticationTestException; -import io.mosip.testrig.apirig.utils.ConfigManager; import io.mosip.testrig.apirig.utils.GlobalConstants; import io.mosip.testrig.apirig.utils.OutputValidationUtil; +import io.mosip.testrig.apirig.utils.PMSConfigManger; import io.mosip.testrig.apirig.utils.PMSUtil; import io.mosip.testrig.apirig.utils.ReportUtil; import io.restassured.response.Response; @@ -43,7 +42,7 @@ public class PostWithBodyAndPathParams extends AdminTestUtil implements ITest { @BeforeClass public static void setLogLevel() { - if (ConfigManager.IsDebugEnabled()) + if (PMSConfigManger.IsDebugEnabled()) logger.setLevel(Level.ALL); else logger.setLevel(Level.ERROR); diff --git a/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithOnlyPathParam.java b/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithOnlyPathParam.java index ec708926c7..5b0d0fe465 100644 --- a/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithOnlyPathParam.java +++ b/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithOnlyPathParam.java @@ -26,9 +26,9 @@ import io.mosip.testrig.apirig.utils.AdminTestException; import io.mosip.testrig.apirig.utils.AdminTestUtil; import io.mosip.testrig.apirig.utils.AuthenticationTestException; -import io.mosip.testrig.apirig.utils.ConfigManager; import io.mosip.testrig.apirig.utils.GlobalConstants; import io.mosip.testrig.apirig.utils.OutputValidationUtil; +import io.mosip.testrig.apirig.utils.PMSConfigManger; import io.mosip.testrig.apirig.utils.PMSUtil; import io.mosip.testrig.apirig.utils.ReportUtil; import io.restassured.response.Response; @@ -40,7 +40,7 @@ public class PostWithOnlyPathParam extends AdminTestUtil implements ITest { @BeforeClass public static void setLogLevel() { - if (ConfigManager.IsDebugEnabled()) + if (PMSConfigManger.IsDebugEnabled()) logger.setLevel(Level.ALL); else logger.setLevel(Level.ERROR); diff --git a/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/PutWithPathParamsAndBody.java b/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/PutWithPathParamsAndBody.java index e1614beb48..250b43d3ae 100644 --- a/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/PutWithPathParamsAndBody.java +++ b/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/PutWithPathParamsAndBody.java @@ -22,14 +22,13 @@ import io.mosip.testrig.apirig.dto.OutputValidationDto; import io.mosip.testrig.apirig.dto.TestCaseDTO; -import io.mosip.testrig.apirig.testrunner.BaseTestCase; import io.mosip.testrig.apirig.testrunner.HealthChecker; import io.mosip.testrig.apirig.utils.AdminTestException; import io.mosip.testrig.apirig.utils.AdminTestUtil; import io.mosip.testrig.apirig.utils.AuthenticationTestException; -import io.mosip.testrig.apirig.utils.ConfigManager; import io.mosip.testrig.apirig.utils.GlobalConstants; import io.mosip.testrig.apirig.utils.OutputValidationUtil; +import io.mosip.testrig.apirig.utils.PMSConfigManger; import io.mosip.testrig.apirig.utils.PMSUtil; import io.mosip.testrig.apirig.utils.ReportUtil; import io.restassured.response.Response; @@ -42,7 +41,7 @@ public class PutWithPathParamsAndBody extends AdminTestUtil implements ITest { @BeforeClass public static void setLogLevel() { - if (ConfigManager.IsDebugEnabled()) + if (PMSConfigManger.IsDebugEnabled()) logger.setLevel(Level.ALL); else logger.setLevel(Level.ERROR); diff --git a/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePatchForAutoGenId.java b/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePatchForAutoGenId.java index 014b10d97d..037dfaed83 100644 --- a/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePatchForAutoGenId.java +++ b/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePatchForAutoGenId.java @@ -26,9 +26,9 @@ import io.mosip.testrig.apirig.utils.AdminTestException; import io.mosip.testrig.apirig.utils.AdminTestUtil; import io.mosip.testrig.apirig.utils.AuthenticationTestException; -import io.mosip.testrig.apirig.utils.ConfigManager; import io.mosip.testrig.apirig.utils.GlobalConstants; import io.mosip.testrig.apirig.utils.OutputValidationUtil; +import io.mosip.testrig.apirig.utils.PMSConfigManger; import io.mosip.testrig.apirig.utils.PMSUtil; import io.mosip.testrig.apirig.utils.ReportUtil; import io.restassured.response.Response; @@ -41,7 +41,7 @@ public class SimplePatchForAutoGenId extends AdminTestUtil implements ITest { @BeforeClass public static void setLogLevel() { - if (ConfigManager.IsDebugEnabled()) + if (PMSConfigManger.IsDebugEnabled()) logger.setLevel(Level.ALL); else logger.setLevel(Level.ERROR); diff --git a/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePost.java b/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePost.java index 1747f4b422..baeb91046f 100644 --- a/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePost.java +++ b/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePost.java @@ -26,9 +26,9 @@ import io.mosip.testrig.apirig.utils.AdminTestException; import io.mosip.testrig.apirig.utils.AdminTestUtil; import io.mosip.testrig.apirig.utils.AuthenticationTestException; -import io.mosip.testrig.apirig.utils.ConfigManager; import io.mosip.testrig.apirig.utils.GlobalConstants; import io.mosip.testrig.apirig.utils.OutputValidationUtil; +import io.mosip.testrig.apirig.utils.PMSConfigManger; import io.mosip.testrig.apirig.utils.PMSUtil; import io.mosip.testrig.apirig.utils.ReportUtil; import io.restassured.response.Response; @@ -41,7 +41,7 @@ public class SimplePost extends AdminTestUtil implements ITest { @BeforeClass public static void setLogLevel() { - if (ConfigManager.IsDebugEnabled()) + if (PMSConfigManger.IsDebugEnabled()) logger.setLevel(Level.ALL); else logger.setLevel(Level.ERROR); diff --git a/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePostForAutoGenId.java b/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePostForAutoGenId.java index abaac3ee96..b2a0abec04 100644 --- a/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePostForAutoGenId.java +++ b/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePostForAutoGenId.java @@ -23,14 +23,13 @@ import io.mosip.testrig.apirig.dto.OutputValidationDto; import io.mosip.testrig.apirig.dto.TestCaseDTO; -import io.mosip.testrig.apirig.testrunner.BaseTestCase; import io.mosip.testrig.apirig.testrunner.HealthChecker; import io.mosip.testrig.apirig.utils.AdminTestException; import io.mosip.testrig.apirig.utils.AdminTestUtil; import io.mosip.testrig.apirig.utils.AuthenticationTestException; -import io.mosip.testrig.apirig.utils.ConfigManager; import io.mosip.testrig.apirig.utils.GlobalConstants; import io.mosip.testrig.apirig.utils.OutputValidationUtil; +import io.mosip.testrig.apirig.utils.PMSConfigManger; import io.mosip.testrig.apirig.utils.PMSUtil; import io.mosip.testrig.apirig.utils.ReportUtil; import io.restassured.response.Response; @@ -44,7 +43,7 @@ public class SimplePostForAutoGenId extends AdminTestUtil implements ITest { @BeforeClass public static void setLogLevel() { - if (ConfigManager.IsDebugEnabled()) + if (PMSConfigManger.IsDebugEnabled()) logger.setLevel(Level.ALL); else logger.setLevel(Level.ERROR); diff --git a/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePut.java b/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePut.java index e752ec397e..410d955dc9 100644 --- a/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePut.java +++ b/api-test/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePut.java @@ -27,9 +27,9 @@ import io.mosip.testrig.apirig.utils.AdminTestException; import io.mosip.testrig.apirig.utils.AdminTestUtil; import io.mosip.testrig.apirig.utils.AuthenticationTestException; -import io.mosip.testrig.apirig.utils.ConfigManager; import io.mosip.testrig.apirig.utils.GlobalConstants; import io.mosip.testrig.apirig.utils.OutputValidationUtil; +import io.mosip.testrig.apirig.utils.PMSConfigManger; import io.mosip.testrig.apirig.utils.PMSUtil; import io.mosip.testrig.apirig.utils.ReportUtil; import io.restassured.response.Response; @@ -41,7 +41,7 @@ public class SimplePut extends AdminTestUtil implements ITest { @BeforeClass public static void setLogLevel() { - if (ConfigManager.IsDebugEnabled()) + if (PMSConfigManger.IsDebugEnabled()) logger.setLevel(Level.ALL); else logger.setLevel(Level.ERROR); diff --git a/api-test/src/main/java/io/mosip/testrig/apirig/utils/PMSConfigManger.java b/api-test/src/main/java/io/mosip/testrig/apirig/utils/PMSConfigManger.java new file mode 100644 index 0000000000..75309ca836 --- /dev/null +++ b/api-test/src/main/java/io/mosip/testrig/apirig/utils/PMSConfigManger.java @@ -0,0 +1,30 @@ +package io.mosip.testrig.apirig.utils; + +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + +import org.apache.log4j.Logger; + +import io.mosip.testrig.apirig.testrunner.MosipTestRunner; + +public class PMSConfigManger extends ConfigManager{ + private static final Logger LOGGER = Logger.getLogger(PMSConfigManger.class); + + public static void init() { + Map moduleSpecificPropertiesMap = new HashMap<>(); + // Load scope specific properties + try { + String path = MosipTestRunner.getGlobalResourcePath() + "/config/pms.properties"; + Properties props = getproperties(path); + // Convert Properties to Map and add to moduleSpecificPropertiesMap + for (String key : props.stringPropertyNames()) { + moduleSpecificPropertiesMap.put(key, props.getProperty(key)); + } + } catch (Exception e) { + LOGGER.error(e.getMessage()); + } + // Add module specific properties as well. + init(moduleSpecificPropertiesMap); + } +} \ No newline at end of file diff --git a/api-test/src/main/resources/config/Kernel.properties b/api-test/src/main/resources/config/Kernel.properties deleted file mode 100644 index ef3fce0c27..0000000000 --- a/api-test/src/main/resources/config/Kernel.properties +++ /dev/null @@ -1,283 +0,0 @@ -#---------------------------------- End point(s) relative URLs ----------------------------------# -authclientidsecretkeyURL = /v1/authmanager/authenticate/clientidsecretkey -authentication = /v1/authmanager/authenticate/useridPwd -authenticationInternal = /v1/authmanager/authenticate/internal/useridPwd -keycloakAuthURL = /auth/realms/master/protocol/openid-connect/token -auditLog_URI = /v1/auditmanager/audits -CentetMachineUserMappingToMasterData_uri = /v1/masterdata/registrationmachineusermappings -EmailNotification_URI = /v1/notifier/email/send -encrypt_URI = /v1/keymanager/encrypt -decrypt_URI = /v1/keymanager/decrypt -FetchApplication_URI = /v1/masterdata/applicationtypes -FetchApplication_lang_URI = /v1/masterdata/applicationtypes/{langcode} -FetchApplication_id_lang_URI = /v1/masterdata/applicationtypes/{code}/{langcode} -FetchBiometricAttribute_URI = /v1/masterdata/getbiometricattributesbyauthtype/{langcode}/{biometrictypecode} -FetchBiometricAuthType_URI = /v1/masterdata/biometrictypes/{langcode} -FetchBlackListedWord_URI = /v1/masterdata/blacklistedwords/{langcode} -FetchDevice_lang_URI = /v1/masterdata/devices/{languagecode} -FetchDevice_id_lang_URI = /v1/masterdata/devices/{languagecode}/{deviceType} -FetchDeviceSpec_lang_URI = /v1/masterdata/devicespecifications/{langcode} -FetchDeviceSpec_id_lang_URI = /v1/masterdata/devicespecifications/{langcode}/{devicetypecode} -FetchDocumentCategories_URI = /v1/masterdata/documentcategories/{langcode} -FetchDocumentCategories_URI_withcodeAndLangCode = /v1/masterdata/documentcategories/{code}/{langcode} -FetchDocumentTypes_URI = /v1/masterdata/documenttypes/{documentcategorycode}/{langcode} -FetchGenderType_URI = /v1/masterdata/gendertypes -FetchGenderType_id_lang_URI = /v1/masterdata/gendertypes/{langcode} -FetchHolidays_URI = /v1/masterdata/holidays -FetchHolidays_id_URI = /v1/masterdata/holidays/{holidayid} -FetchHolidays_id_lang_URI = /v1/masterdata/holidays/{holidayid}/{langcode} -FetchIDlist_URI = /v1/masterdata/idtypes/{langcode} -FetchLocationHierarchy_URI_withlangCode = /v1/masterdata/locations/{langcode} -FetchLocationHierarchy_URI_locationcode = /v1/masterdata/locations/{locationcode}/{langcode} -FetchLocationHierarchy_URI_hierarchyname = /v1/masterdata/locations/locationhierarchy/{hierarchyname} -FetchMachine_URI = /v1/masterdata/machines -FetchMachine_lang_URI = /v1/masterdata/machines/{langcode} -FetchMachine_id_lang_URI = /v1/masterdata/machines/{id}/{langcode} -FetchMachineHistory_URI = /v1/masterdata/machineshistories/{id}/{langcode}/{effdatetimes} -FetchRegCent_URI = /v1/masterdata/registrationcenters -FetchRegCent_id_lang_URI = /v1/masterdata/registrationcenters/{id}/{langcode} -FetchRegCent_loc_lang_URI = /v1/masterdata/getlocspecificregistrationcenters/{langcode}/{locationcode} -FetchRegCent_hir_name_lang_URI = /v1/masterdata/registrationcenters/{langcode}/{hierarchylevel}/{name} -FetchRegCent_prox_lang_URI = /v1/masterdata/getcoordinatespecificregistrationcenters/{langcode}/{longitude}/{latitude}/{proximitydistance} -FetchRegCentHistory_URI = /v1/masterdata/registrationcentershistory/{registrationCenterId}/{langcode}/{effectiveDate} -FetchRegCentHolidays_URI = /v1/masterdata/getregistrationcenterholidays/{langcode}/{registrationcenterid}/{year} -FetchRegcentMachUserMaping_URI = /v1/masterdata/getregistrationmachineusermappinghistory/{effdtimes}/{registrationcenterid}/{machineid}/{userid} -FetchRejectionReason_URI = /v1/masterdata/packetrejectionreasons/{reasoncategorycode}/{langcode} -FetchTemplate_URI = /v1/masterdata/templates -FetchTemplate_lang_URI = /v1/masterdata/templates/{langcode} -FetchTemplate_id_lang_URI = /v1/masterdata/templates/{langcode}/{templatetypecode} -FetchTitle_URI = /v1/masterdata/title/{langcode} -fetchAllTemplate = /v1/masterdata/templates/templatetypecodes/{code} -getApplicantType = /v1/masterdata/getApplicantType -fetchDeviceHistory = /v1/masterdata/deviceshistories/{id}/{langcode}/{effdatetimes} -getDocType_DocCatByAppID = /v1/masterdata/applicanttype/{applicantId}/languages -getDocTypeDocCatByLangCode = /v1/masterdata/validdocuments/{languagecode} -fetchImmediateChildLocation = /v1/masterdata/locations/immediatechildren/{locationcode}/{langcode} -getIndividualType = /v1/masterdata/individualtypes -getRoles = /v1/syncdata/roles -fetchRegCenter = /v1/masterdata/registrationcenters/validate/{id}/{langCode}/{timestamp} -fetchRegistrationCenterDeviceHistory = /v1/masterdata/registrationcenterdevicehistory/{regcenterid}/{deviceid}/{effdatetimes} -getusersBasedOnRegCenter = /v1/syncdata/userdetails/{regid} -licKeyGenerator = /v1/keymanager/license/generate -mapLicenseKey = /v1/keymanager/license/permission -fetchmapLicenseKey = /v1/keymanager/license/permission -OTPGeneration = /v1/otpmanager/otp/generate -OTPValidation = /v1/otpmanager/otp/validate -otpNotifier = /v1/otpnotifier/otp/send -RIDGenerator_URI = /v1/ridgenerator/generate/rid/{centerid}/{machineid} -SmsNotification_URI = /v1/notifier/sms/send -syncConf = /v1/syncdata/configs -fetchIncrementalData = /v1/syncjob/syncjobdef -fetchmasterdata = /v1/syncdata/masterdata -fetchmasterdatawithRID = /v1/syncdata/masterdata/{regcenterId} -SyncPublicKeyToRegClient_URI = /v1/keymanager/publickey/ -uingenerator = /v1/idgenerator/uin -validateGenderByName = /v1/masterdata/gendertypes/validate/{gendername} -validateLocationByName = /v1/masterdata/locations/validate/{locationname} -tokenIdGenerator_URI = /v1/keymanager/{uin}/{partnercode} -getRIDByUserId = /v1/authmanager/rid/{appid}/{userid} -syncMdatawithKeyIndex = /v1/syncdata/clientsettings -syncMdatawithRegCentIdKeyIndex = /v1/syncdata/clientsettings/{regcenterid} -uploadpublickey = /v1/syncdata/tpm/publickey -getUserHistory = /v1/masterdata/users/{id}/{eff_dtimes} -sendOtp = /v1/authmanager/authenticate/sendotp -useridOTP = /v1/authmanager/authenticate/useridOTP -preregSendOtp = /preregistration/v1/login/sendOtp/langcode -preregValidateOtp = /preregistration/v1/login/validateOtp -zoneMappingUrl = /v1/masterdata/zoneuser -zoneNameUrl = /v1/masterdata/zones/zonename -zoneMappingActivateUrl = /v1/masterdata/zoneuser -userCenterMappingUrl = /v1/masterdata/usercentermapping -bulkUploadUrl = /v1/admin/bulkupload -currentUserURI=/#/uinservices/viewhistory -actuatorEndpoint=/resident/v1/actuator/env -actuatorAdminEndpoint=/v1/admin/actuator/env -actuatorMasterDataEndpoint=/v1/masterdata/actuator/env -actuatorIDAEndpoint=/idauthentication/v1/actuator/env -actuatorRegprocEndpoint=/registrationprocessor/v1/registrationtransaction/actuator/env -actuatorEsignetEndpoint=/v1/esignet/actuator/env -tokenEndpoint=/v1/esignet/oauth/token -auditActuatorEndpoint=/v1/auditmanager/actuator/info -validateBindingEndpoint=ida-binding -esignetWellKnownEndPoint=/v1/esignet/oidc/.well-known/openid-configuration -signupSettingsEndPoint=/v1/signup/settings -esignetActuatorPropertySection=esignet-default.properties - - - -#---------------------------------- APP IDs ----------------------------------# -#-- When test rig ran in docker, these values dervied from the environment ---# -mosip_pms_app_id = partner -mosip_resident_app_id = resident -mosip_idrepo_app_id = idrepo -mosip_regclient_app_id = registrationclient -mosip_hotlist_app_id = hotlist -mosip_regprocclient_app_id = regproc -AuthAppID = resident -mosip_admin_app_id = admin - - - -#---------------------------------- Client IDs -------------------------------# -#-- When test rig ran in docker, these values dervied from the environment ---# -mosip_pms_client_id = mosip-pms-client -mosip_partner_client_id = mosip-partner-client -mosip_resident_client_id = mosip-resident-client -mosip_idrepo_client_id = mosip-idrepo-client -mosip_reg_client_id = mosip-reg-client -mosip_admin_client_id = mosip-admin-client -mosip_hotlist_client_id = mosip-hotlist-client -mosip_regproc_client_id = mosip-regproc-client -mpartner_default_mobile_client_id = mpartner-default-mobile -mosip_testrig_client_id = mosip-testrig-client -AuthClientID = mosip-resident-client - - - -#---------------------------------- Client Secret Keys -----------------------# -#-- When test rig ran in docker, these values dervied from the environment ---# -mosip_partner_client_secret = -mosip_pms_client_secret = -mosip_resident_client_secret = -mosip_idrepo_client_secret = -mosip_reg_client_secret = -mosip_admin_client_secret = -mosip_hotlist_client_secret = -mosip_regproc_client_secret = -mpartner_default_mobile_secret = -mosip_testrig_client_secret = -AuthClientSecret = - - - -#----------------------------- minio proprties ------------------------------# -s3-user-key = minioadmin -s3-user-secret = minioadmin -s3-host = http://minio.minio:9000 -s3-account = automation -s3-region = null -reportExpirationInDays = 3 -s3-account-for-persona-data = personaData -push-reports-to-s3 = yes - - -#-------------------- Keycloak User Creation proprties ----------------------# -#-- When test rig ran in docker,few of below dervied from the environment ---# -new_Resident_User = 111995 -new_Resident_Password = mosip123 -new_Resident_Role = default-roles-mosip,PARTNER_ADMIN -roles.111995 = PARTNER_ADMIN,default-roles-mosip -keycloak_UserName = admin -keycloak_Password = sMDr9Ainw9 -keycloak-external-url = https://iam.qa-inji.mosip.net -keycloak-realm-id = mosip -iam-users-to-create = 111997,111998,220005,111992,globaladmin,111887,111999 -iam-users-password = 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 -roles.111887 = AUTH_PARTNER,PARTNER_ADMIN,PMS_ADMIN,REGISTRATION_SUPERVISOR -roles.111998 = POLICYMANAGER -roles.111992 = GLOBAL_ADMIN -roles.globaladmin = GLOBAL_ADMIN,REGISTRATION_ADMIN,uma_authorization,ZONAL_ADMIN,default-roles-mosip - - -#------------------------- DB Connectivity proprties ------------------------# -#-- When test rig ran in docker,few of below dervied from the environment ---# -driver_class=org.postgresql.Driver -pool_size=1 -dialect=org.hibernate.dialect.PostgreSQLDialect -show_sql=true -current_session_context_class=thread -audit_url=jdbc:postgresql://qa-inji.mosip.net:5432/mosip_audit -audit_username=postgres -audit_password=2BhgiSpCaT -audit_default_schema=audit -DB_PORT= -installation-domain= -partner_url=jdbc:postgresql://qa-inji.mosip.net:5432/mosip_ida -partner_username=postgres -partner_password=2BhgiSpCaT -partner_default_schema=partner -reportLogPath=automationLogAndReport -postgresqlUser=postgresql -db-port=5432 -db-server=qa-inji.mosip.net -hibernate.connection.driver_class=org.postgresql.Driver -hibernate.connection.pool_size=1 -hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect -hibernate.show_sql=true -hibernate.current_session_context_class=thread -db-su-user=postgres -postgres-password=2BhgiSpCaT -pms_db_schema=pms -km_db_schema=keymgr -master_db_schema=master -audit_db_schema=audit -ida_db_schema=ida - - -#------------------------- DSL specific proprties ------------------------# -#------------------------- We need to see how to have DSL specific proprties file ------------------------# -packetUtilityBaseUrl=http://localhost:8080 -mountPathForScenario=D:/centralized/mountvolume -mountPath=/home/mosip/mountvolume -# Add scenarios to skip from automation and server side -# supported values "S-scnearioNumber" for server side and "A-scnearioNumber" for automation -scenariosToSkip= -# Add scenarios to include in the the execution list -# Empty if we want to execute all the scenarios--- -scenariosToExecute= -# supported values yes or no -useExternalScenarioSheet=yes -# supported values are 1 to 8 -threadCount=1 - -#------------------------ Generic properties ------------------------# -enableDebug=yes -preconfiguredOtp=111111 -usePreConfiguredOtp=true -# supported values yes or no. Assume that by Default e-signet is deployed -eSignetDeployed=yes -partnerUrlSuffix=oYf63Lax0DY2QkYMRHnrmDqhmO3RMWQagwm0ftgLlkuin1KOND/666/576732 -reportIgnoredTestCases=no -reportKnownIssueTestCases=no -servicesNotDeployed= -esignetMockBaseURL=esignet-insurance. -sunBirdBaseURL=registry -slack-webhook-url= -serverErrorsToMonitor=IDA-MLC-018 -pmsAuthInternal=true -partner_password=mosip123 -partner_userName=111997 -partner_revamp_userName=111999 -partner_user_password=mosip123 -policytest_password=mosip123 -policytest_userName=111998 -policytest_without_pmrole_userName=111887 -admin_password=mosip123 -admin_userName=220005 -admin_zone_password=mosip123 -admin_zone_userName=globaladmin -mockNotificationChannel=email,phone -mountPathForReport=/home/mosip/testrig/report - - -#------------------------- Need to check if these are used or not ------------------------# -OTPTimeOut = 181 -attempt = 10 -ConfigParameters=mosip.kernel.rid.length,mosip.kernel.uin.length,mosip.kernel.sms.country.code,mosip.kernel.sms.number.length,mosip.kernel.otp.default-length,mosip.kernel.otp.expiry-time,mosip.kernel.otp.key-freeze-time,mosip.kernel.otp.validation-attempt-threshold,mosip.kernel.otp.min-key-length,mosip.kernel.otp.max-key-length,mosip.kernel.licensekey.length,mosip.supported-languages -# supported values are 0 ,1, 2 based on number of env languages -langselect=0 - - - -#----------------------------------AuthDemoService Host properties----------------------------------------------------------# -#authCertsPath= -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 diff --git a/api-test/src/main/resources/config/pms.properties b/api-test/src/main/resources/config/pms.properties new file mode 100644 index 0000000000..d6b757b522 --- /dev/null +++ b/api-test/src/main/resources/config/pms.properties @@ -0,0 +1,5 @@ +#------------------------- DB Connectivity proprties ------------------------# +#-- When test rig ran in docker,few of below dervied from the environment ---# +pms_db_schema=pms +km_db_schema=keymgr +audit_db_schema=audit \ No newline at end of file