Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MOSIP-36175 #1624

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -123,29 +123,29 @@ private static Session getDataBaseConnection(String dbName) {

private static SessionFactory getDataBaseConnectionSessionFactory(String dbName) {
SessionFactory factory = null;
String dbschema = ConfigManager.getValueForKey("audit_db_schema");
String dbschema = ConfigManager.getAuditDbSchema();

if(dbName.equalsIgnoreCase("partner"))
dbschema=ConfigManager.getValueForKey("ida_db_schema");
dbschema=ConfigManager.getIdaDbSchema();

if(dbName.equalsIgnoreCase("master"))
dbschema=ConfigManager.getValueForKey("master_db_schema");
dbschema=ConfigManager.getMasterDbSchema();

try {
Configuration config = new Configuration();
config.setProperty("hibernate.connection.driver_class", propsKernel.getProperty("driver_class"));
config.setProperty("hibernate.connection.driver_class", ConfigManager.getproperty("driver_class"));
config.setProperty("hibernate.connection.url",
"jdbc:" + propsKernel.getProperty("postgresqlUser") + "://"
+ ConfigManager.getValueForKey("db-server") + ":" + ConfigManager.getValueForKey("db-port")
"jdbc:" + ConfigManager.getproperty("postgresqlUser") + "://"
+ ConfigManager.getDbServer() + ":" + ConfigManager.getDbPort()
+ "/mosip_" + dbschema);
config.setProperty("hibernate.connection.username", ConfigManager.getAuditDbUser());
config.setProperty("hibernate.connection.password", ConfigManager.getValueForKey(ConfigManager.DB_PASSWORD_KEY));
config.setProperty("hibernate.default_schema", propsKernel.getProperty(dbName + "_default_schema"));
config.setProperty("hibernate.connection.pool_size", propsKernel.getProperty("pool_size"));
config.setProperty("hibernate.dialect", propsKernel.getProperty("dialect"));
config.setProperty("hibernate.show_sql", propsKernel.getProperty("show_sql"));
config.setProperty("hibernate.connection.password", ConfigManager.getAuditDbPass());
config.setProperty("hibernate.default_schema", ConfigManager.getproperty(dbName + "_default_schema"));
config.setProperty("hibernate.connection.pool_size", ConfigManager.getproperty("pool_size"));
config.setProperty("hibernate.dialect", ConfigManager.getproperty("dialect"));
config.setProperty("hibernate.show_sql", ConfigManager.getproperty("show_sql"));
config.setProperty("hibernate.current_session_context_class",
propsKernel.getProperty("current_session_context_class"));
ConfigManager.getproperty("current_session_context_class"));
factory = config.buildSessionFactory();
} catch (HibernateException e) {
DBCONNECTION_LOGGER.error("Exception in Database Connection with following message: " + e.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,10 @@ public class BaseTestCase extends AbstractTestNGSpringContextTests {
private static String zoneMappingRequest = "config/Authorization/zoneMappingRequest.json";
public static Properties props = getproperty(
MosipTestRunner.getGlobalResourcePath() + "/" + "config/application.properties");
public static Properties propsKernel = getproperty(
MosipTestRunner.getGlobalResourcePath() + "/" + "config/Kernel.properties");
/*
* public static Properties propsKernel = getproperty(
* MosipTestRunner.getGlobalResourcePath() + "/" + "config/Kernel.properties");
*/

public static String currentRunningLanguage = "";

Expand Down Expand Up @@ -420,7 +422,7 @@ private void copyReportAndLog() {
public static void mapUserToZone() {

String token = kernelAuthLib.getTokenByRole("globalAdmin");
String url = ApplnURI + propsKernel.getProperty("zoneMappingUrl");
String url = ApplnURI + ConfigManager.getproperty("zoneMappingUrl");
org.json.simple.JSONObject actualrequest = getRequestJson(zoneMappingRequest);
JSONObject request = new JSONObject();
request.put("zoneCode", hierarchyZoneCode);
Expand All @@ -441,7 +443,7 @@ public static void mapUserToZone() {
public static void mapUserToZone(String user, String zone) {

String token = kernelAuthLib.getTokenByRole("globalAdmin");
String url = ApplnURI + propsKernel.getProperty("zoneMappingUrl");
String url = ApplnURI + ConfigManager.getproperty("zoneMappingUrl");
org.json.simple.JSONObject actualrequest = getRequestJson(zoneMappingRequest);
JSONObject request = new JSONObject();
request.put("zoneCode", zone);
Expand All @@ -460,7 +462,7 @@ public static void mapUserToZone(String user, String zone) {
public static void mapZone() {

String token = kernelAuthLib.getTokenByRole("globalAdmin");
String url = ApplnURI + propsKernel.getProperty("zoneMappingActivateUrl");
String url = ApplnURI + ConfigManager.getproperty("zoneMappingActivateUrl");
HashMap<String, String> map = new HashMap<>();
map.put(GlobalConstants.ISACTIVE, GlobalConstants.TRUE_STRING);
map.put("userId", BaseTestCase.currentModule + "-" + ConfigManager.getUserAdminName());
Expand All @@ -472,7 +474,7 @@ public static void mapZone() {
public static void mapZone(String user) {

String token = kernelAuthLib.getTokenByRole("globalAdmin");
String url = ApplnURI + propsKernel.getProperty("zoneMappingActivateUrl");
String url = ApplnURI + ConfigManager.getproperty("zoneMappingActivateUrl");
HashMap<String, String> map = new HashMap<>();
map.put(GlobalConstants.ISACTIVE, GlobalConstants.TRUE_STRING);
map.put("userId", user);
Expand All @@ -484,7 +486,7 @@ public static void mapZone(String user) {
public static boolean zoneName() {
boolean firstUser = true;
String token = kernelAuthLib.getTokenByRole("admin");
String url = ApplnURI + propsKernel.getProperty("zoneNameUrl");
String url = ApplnURI + ConfigManager.getproperty("zoneNameUrl");

HashMap<String, String> map = new HashMap<>();

Expand All @@ -506,7 +508,7 @@ public static boolean zoneName() {
public static void userCenterMapping() {

String token = kernelAuthLib.getTokenByRole("admin");
String url = ApplnURI + propsKernel.getProperty("userCenterMappingUrl");
String url = ApplnURI + ConfigManager.getproperty("userCenterMappingUrl");

HashMap<String, String> requestMap = new HashMap<>();

Expand Down Expand Up @@ -534,7 +536,7 @@ public static void userCenterMapping() {
public static void userCenterMappingStatus() {

String token = kernelAuthLib.getTokenByRole("admin");
String url = ApplnURI + propsKernel.getProperty("userCenterMappingUrl");
String url = ApplnURI + ConfigManager.getproperty("userCenterMappingUrl");

HashMap<String, String> map = new HashMap<>();

Expand Down Expand Up @@ -596,12 +598,12 @@ public static List<String> getLanguageList() {
section = "/mosip-config/sandbox/admin-mz.properties";
try {

optionalLanguages = getValueFromActuators(propsKernel.getProperty("actuatorMasterDataEndpoint"), section,
optionalLanguages = getValueFromActuators(ConfigManager.getproperty("actuatorMasterDataEndpoint"), section,
"mosip.optional-languages");

logger.info("optionalLanguages from env:" + optionalLanguages);

mandatoryLanguages = getValueFromActuators(propsKernel.getProperty("actuatorMasterDataEndpoint"), section,
mandatoryLanguages = getValueFromActuators(ConfigManager.getproperty("actuatorMasterDataEndpoint"), section,
"mosip.mandatory-languages");

logger.info("mandatoryLanguages from env:" + mandatoryLanguages);
Expand All @@ -626,7 +628,7 @@ public static boolean isTargetEnvLTS() {

Response response = null;
org.json.JSONObject responseJson = null;
String url = ApplnURI + propsKernel.getProperty("auditActuatorEndpoint");
String url = ApplnURI + ConfigManager.getproperty("auditActuatorEndpoint");
try {
response = RestClient.getRequest(url, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON);
GlobalMethods.reportResponse(response.getHeaders().asList().toString(), url, response);
Expand Down Expand Up @@ -683,7 +685,7 @@ public static List<String> getSupportedIdTypesValueFromActuator() {

org.json.JSONObject responseJson = null;
JSONArray responseArray = null;
String url = ApplnURI + propsKernel.getProperty("actuatorIDAEndpoint");
String url = ApplnURI + ConfigManager.getproperty("actuatorIDAEndpoint");
try {
response = RestClient.getRequest(url, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON);
GlobalMethods.reportResponse(response.getHeaders().asList().toString(), url, response);
Expand Down Expand Up @@ -743,7 +745,7 @@ public static String generateRandomNumberString(int length) {
}

public static int getRecommendedHierarchyLevel() {
String recommendedHierarchLevel = getValueFromActuators(propsKernel.getProperty("actuatorMasterDataEndpoint"),
String recommendedHierarchLevel = getValueFromActuators(ConfigManager.getproperty("actuatorMasterDataEndpoint"),
"/mosip-config/application-default.properties", "mosip.recommended.centers.locCode");
return Integer.parseInt(recommendedHierarchLevel);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public MockSMTPListener() {

public void run() {
try {
Properties kernelprops = ConfigManager.propsKernel;
// Properties kernelprops = ConfigManager.propsKernel;
String a1 = "wss://smtp.";
String externalurl = kernelprops.getProperty("keycloak-external-url");
String externalurl = ConfigManager.getIAMUrl();
String a2 = externalurl.substring(externalurl.indexOf(".") + 1);
String a3 = "/mocksmtp/websocket";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static void main(String[] arg) {
} else {
ExtractResource.copyCommonResources();
}
ConfigManager.init();
// ConfigManager.init();
BaseTestCase.suiteSetup();
setLogLevels();

Expand Down
Loading
Loading