From eee75552b9f566f79b1bb07daf397c34bd0e49bc Mon Sep 17 00:00:00 2001 From: Mohanachandran S Date: Thu, 3 Oct 2024 12:02:18 +0530 Subject: [PATCH] MOSIP-36077 - Restructured the config manager Signed-off-by: Mohanachandran S --- .../apirig/testrunner/MosipTestRunner.java | 36 +++++-------------- .../testrig/apirig/utils/PMSConfigManger.java | 3 -- 2 files changed, 8 insertions(+), 31 deletions(-) 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 78ab461d57..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 @@ -61,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(); } PMSConfigManger.init(); - BaseTestCase.suiteSetup(); + BaseTestCase.suiteSetup(getRunType()); SkipTestCaseHandler.loadTestcaseToBeSkippedList("testCaseSkippedList.txt"); setLogLevels(); @@ -89,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; @@ -126,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 { @@ -155,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) { @@ -174,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)) @@ -193,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() { @@ -295,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/utils/PMSConfigManger.java b/api-test/src/main/java/io/mosip/testrig/apirig/utils/PMSConfigManger.java index f2ad2e5e99..75309ca836 100644 --- 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 @@ -27,7 +27,4 @@ public static void init() { // Add module specific properties as well. init(moduleSpecificPropertiesMap); } - - - } \ No newline at end of file