Skip to content

Commit

Permalink
fix kernal path
Browse files Browse the repository at this point in the history
  • Loading branch information
Jayesh Kharode committed Sep 18, 2023
1 parent 6c59882 commit 7de1dc8
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,15 @@ public boolean isValidToken(String cookie) {
public Map<String, String> readProperty(String propertyFileName) {
Properties prop = new Properties();
try {
if(propertyFileName.equals("Kernel")) {
File propertyFile = new File(getResourcePathForKernel() + "config/" +TestRunner.GetKernalFilename());
prop.load(new FileInputStream(propertyFile));
}else {
logger.info("propertyFileName: " + propertyFileName + "Path :" + getResourcePathForKernel() + "config/" + propertyFileName + ".properties");
logger.info("propertyFileName: " + propertyFileName + "Path :" + getResourcePathForKernel() + "config/" + propertyFileName + ".properties");
File propertyFile = new File(getResourcePathForKernel() + "config/" + propertyFileName + ".properties");
prop.load(new FileInputStream(propertyFile));
}

} catch (IOException e) {
logger.info("Error occrued while reading propertyFileName " + propertyFileName + e.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ public class ConfigManager {
// private static String km_db_pass;
// private static String km_db_schema;
//
private static String enableDebug;
private static String master_db_user;
private static String master_db_pass;
private static String master_db_schema;
Expand Down Expand Up @@ -210,7 +211,8 @@ public static String getValueForKey(String key) {

public static void init() {
// Loading Kernel property
propsKernel = getproperty(TestRunner.getResourcePath() + "/" + "config/Kernel.properties");
// propsKernel = getproperty(TestRunner.getResourcePath() + "/" + "config/Kernel.properties");
propsKernel = getproperty(TestRunner.getResourcePath() + "/" + "config/"+TestRunner.GetKernalFilename());

idrepo_client_secret = getValueForKey(MOSIP_IDREPO_CLIENT_SECRET);
idrepo_client_id = getValueForKey(MOSIP_IDREPO_CLIENT_ID);
Expand Down Expand Up @@ -398,6 +400,9 @@ public static String getShowSql() {
public static String getDbSessionContext() {
return hibernate_current_session_context_class;
}
public static Boolean IsDebugEnabled() {
return enableDebug.equalsIgnoreCase("yes");
}
//
// public static String getAuditDbUser() {
// return audit_db_user;
Expand Down Expand Up @@ -494,7 +499,9 @@ public static String getIAMUsersPassword() {
}

public static String getRolesForUser(String userId) {
propsKernel = getproperty(TestRunner.getResourcePath() + "/" + "config/Kernel.properties");
// propsKernel = getproperty(TestRunner.getResourcePath() + "/" + "config/Kernel.properties");
propsKernel = getproperty(TestRunner.getResourcePath() + "/" + "config/"+TestRunner.GetKernalFilename());

return propsKernel.getProperty("roles." + userId);
}

Expand All @@ -521,5 +528,7 @@ public static String getiam_apiinternalendpoint() {
// public static String getAuthDemoServiceUrl() {
// return ConfigManager.getAuthDemoServiceBaseUrl() + ":" + ConfigManager.getAuthDemoServicePort();
// }



}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public class KeycloakUserManager extends BaseTestCaseFunc {

private static final Logger logger = Logger.getLogger(KeycloakUserManager.class);

public static Properties propsKernel = getproperty(TestRunner.getResourcePath() + "/"+"config/Kernel.properties");
// public static Properties propsKernel = getproperty(TestRunner.getResourcePath() + "/"+"config/Kernel.properties");
public static Properties propsKernel = getproperty(TestRunner.getResourcePath() + "/" + "config/"+TestRunner.GetKernalFilename());

private static Keycloak getKeycloakInstance() {
Keycloak key=null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.nio.file.Path;
import java.util.HashMap;
Expand All @@ -25,6 +26,7 @@
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.Assert;
import org.testng.ITest;
import org.testng.ITestResult;
import org.testng.Reporter;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
Expand Down Expand Up @@ -215,4 +217,7 @@ private String getCommitId(){
}

}



}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class BaseTestCaseFunc {
public static Properties props = getproperty(
TestRunner.getResourcePath() + "/" + "config/application.properties");
public static Properties propsKernel = getproperty(
TestRunner.getResourcePath() + "/" + "config/Kernel.properties");
TestRunner.getResourcePath() + "/" + "config/"+TestRunner.GetKernalFilename());
public static Properties propsMap = getproperty(
TestRunner.getResourcePath() + "/" + "config/valueMapping.properties");
public static Properties propsBio = getproperty(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static ExtentReports getReports() {
if(extent==null) {
extent=new ExtentReports();
extent=new ExtentReports();
Filepath=System.getProperty("user.dir")+"/Reports/"+"admin-ui-report-"+Commons.appendDate+".html";
Filepath=System.getProperty("user.dir")+"/extent_reports/"+"admin-ui-report-"+Commons.appendDate+".html";
html=new ExtentSparkReporter(Filepath);
extent.attachReporter(html);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.mosip.testrig.adminui.utility;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;
Expand Down Expand Up @@ -38,7 +39,7 @@ public static void main(String[] args) throws Exception {
// BaseTestCase.setReportName("masterdata-" + localLanguageList.get(i));
//startTestRunner();

testNg=new TestNG();
/* testNg=new TestNG();
String listExcludedGroups=JsonUtil.JsonObjParsing(Commons.getTestData(),"setExcludedGroups");
testNg.setExcludedGroups(listExcludedGroups);
Expand All @@ -58,9 +59,52 @@ public static void main(String[] args) throws Exception {
});
// testNg.addListener(tla);
// testNg.run();*/

// MockSMTPListener mockSMTPListener = new MockSMTPListener();
// mockSMTPListener.run();
startTestRunner();
}


public static void startTestRunner() throws Exception {
File homeDir = null;
// TestNG runner = new TestNG();
testNg=new TestNG();

String listExcludedGroups=JsonUtil.JsonObjParsing(Commons.getTestData(),"setExcludedGroups");
testNg.setExcludedGroups(listExcludedGroups);
testNg.setTestClasses(new Class[] {

CenterTest.class,HolidaysTest.class,TemplateTest.class

,

DeviceTest.class,MachineTest.class
,BlockListTest.class,CenterTypeTest.class,
DeviceSpecificationTest.class,DeviceTypesTest.class,
MachineSpecificationTest.class,MachineTypesTest.class,
DynamicFieldTest.class,DocumentCategoriesTest.class,DocumentTypes.class,

BulkUploadTest.class

});

System.getProperties().setProperty("testng.outpur.dir", "testng-report");
testNg.setOutputDirectory("testng-report");
System.getProperties().setProperty("emailable.report2.name", "AdminUI" + "-"
+ System.getProperty("env.user") + System.currentTimeMillis() + "-report.html");


testNg.run();

// MockSMTPListener mockSMTPListener = new MockSMTPListener();
// mockSMTPListener.bTerminate = true;

System.exit(0);
}


public static String getGlobalResourcePath() {
if (checkRunType().equalsIgnoreCase("JAR")) {
return new File(jarUrl).getParentFile().getAbsolutePath().toString();
Expand Down Expand Up @@ -95,6 +139,12 @@ public static String checkRunType() {
else
return "IDE";
}
public static String GetKernalFilename(){
String path = System.getProperty("env.user");

String kernalpath="Kernel_"+path+".properties";
return kernalpath;

}

}

0 comments on commit 7de1dc8

Please sign in to comment.