Skip to content

Commit

Permalink
Merge pull request #917 from nandhu-kumar/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
ckm007 authored Oct 8, 2024
2 parents 0f886b4 + 9321302 commit 126feab
Showing 1 changed file with 33 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.util.Map;
import java.util.Properties;

import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.bouncycastle.openssl.jcajce.JcaPEMWriter;
import org.testng.TestNG;
Expand All @@ -23,6 +24,7 @@

import io.mosip.testrig.apirig.dbaccess.DBManager;
import io.mosip.testrig.apirig.utils.AdminTestUtil;
import io.mosip.testrig.apirig.utils.AuthTestsUtil;
import io.mosip.testrig.apirig.utils.CertsUtil;
import io.mosip.testrig.apirig.utils.GlobalConstants;
import io.mosip.testrig.apirig.utils.JWKKeyUtil;
Expand Down Expand Up @@ -70,7 +72,7 @@ public static void main(String[] arg) {
}
AdminTestUtil.init();
PMSConfigManger.init();
BaseTestCase.suiteSetup(getRunType());
suiteSetup(getRunType());
SkipTestCaseHandler.loadTestcaseToBeSkippedList("testCaseSkippedList.txt");
setLogLevels();

Expand All @@ -95,7 +97,7 @@ public static void main(String[] arg) {

if (BaseTestCase.isTargetEnvLTS())
HealthChecker.bTerminate = true;

if (BaseTestCase.listOfModules.contains("partner")) {
DBManager.executeDBQueries(PMSConfigManger.getPMSDbUrl(), PMSConfigManger.getPMSDbUser(),
PMSConfigManger.getPMSDbPass(), PMSConfigManger.getPMSDbSchema(),
Expand All @@ -104,11 +106,37 @@ public static void main(String[] arg) {
PMSConfigManger.getKMDbPass(), PMSConfigManger.getKMDbSchema(),
getGlobalResourcePath() + "/" + "config/keyManagerDataDeleteQueries.txt");
}


System.exit(0);

}

public static void suiteSetup(String runType) {
if (PMSConfigManger.IsDebugEnabled())
LOGGER.setLevel(Level.ALL);
else
LOGGER.info("Test Framework for Mosip api Initialized");
BaseTestCase.initialize();
LOGGER.info("Done with BeforeSuite and test case setup! su TEST EXECUTION!\n\n");

if (!runType.equalsIgnoreCase("JAR")) {
AuthTestsUtil.removeOldMosipTempTestResource();
}
BaseTestCase.currentModule = "partner";
DBManager.executeDBQueries(PMSConfigManger.getPMSDbUrl(), PMSConfigManger.getPMSDbUser(),
PMSConfigManger.getPMSDbPass(), PMSConfigManger.getPMSDbSchema(),
getGlobalResourcePath() + "/" + "config/pmsDataDeleteQueries.txt");

DBManager.executeDBQueries(PMSConfigManger.getKMDbUrl(), PMSConfigManger.getKMDbUser(),
PMSConfigManger.getKMDbPass(), PMSConfigManger.getKMDbSchema(),
getGlobalResourcePath() + "/" + "config/keyManagerDataDeleteQueries.txt");

BaseTestCase.currentModule = "partner";
BaseTestCase.setReportName("partner");
AdminTestUtil.copyPartnerTestResource();
BaseTestCase.otpListener = new OTPListener();
BaseTestCase.otpListener.run();
}

private static void setLogLevels() {
AdminTestUtil.setLogLevel();
Expand All @@ -129,7 +157,6 @@ public static void startTestRunner() {
File homeDir = null;
TestNG runner = new TestNG();
List<String> suitefiles = new ArrayList<>();
List<String> modulesToRun = BaseTestCase.listOfModules;
String os = System.getProperty("os.name");
LOGGER.info(os);
if (getRunType().contains("IDE") || os.toLowerCase().contains("windows")) {
Expand All @@ -141,12 +168,8 @@ public static void startTestRunner() {
LOGGER.info("ELSE :" + homeDir);
}
for (File file : homeDir.listFiles()) {
for (String fileName : modulesToRun) {
if (file.getName().toLowerCase().contains(fileName)) {
suitefiles.add(file.getAbsolutePath());
} else if (fileName.equals("all") && file.getName().toLowerCase().contains("testng")) {
suitefiles.add(file.getAbsolutePath());
}
if (file.getName().toLowerCase().contains("partner")) {
suitefiles.add(file.getAbsolutePath());
}
}
runner.setTestSuites(suitefiles);
Expand Down

0 comments on commit 126feab

Please sign in to comment.