diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/dbaccess/DBManager.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dbaccess/DBManager.java index 111f7d4025..9c2dd2dd99 100644 --- a/apitest-commons/src/main/java/io/mosip/testrig/apirig/dbaccess/DBManager.java +++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dbaccess/DBManager.java @@ -64,6 +64,20 @@ public static void clearKeyManagerDbDataForPartnerRevamp() { } } } + public static void clearIDADbDataForPartnerRevamp() { + Session session = null; + try { + session = getDataBaseConnection(ConfigManager.getIdaDbUrl(), ConfigManager.getIdaDbUser(), + ConfigManager.getPMSDbPass(), ConfigManager.getIdaDbSchema()); + executeQueries(session, MosipTestRunner.getGlobalResourcePath() + "/" + "config/partnerRevampDataDeleteQueriesForIDA.txt"); + } catch (Exception e) { + logger.error("Error:: While executing IDA DB Quiries." + e.getMessage()); + } finally { + if (session != null) { + session.close(); + } + } + } public static void clearKeyManagerDbData() { Session session = null; diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/testrunner/BaseTestCase.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/testrunner/BaseTestCase.java index 5d01003120..d89618a739 100644 --- a/apitest-commons/src/main/java/io/mosip/testrig/apirig/testrunner/BaseTestCase.java +++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/testrunner/BaseTestCase.java @@ -7,6 +7,7 @@ import java.security.SecureRandom; import java.util.ArrayList; import java.util.Arrays; +import java.util.Calendar; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -39,6 +40,8 @@ import io.mosip.testrig.apirig.utils.GlobalConstants; import io.mosip.testrig.apirig.utils.GlobalMethods; import io.mosip.testrig.apirig.utils.KernelAuthentication; +import io.mosip.testrig.apirig.utils.KeycloakUserManager; +import io.mosip.testrig.apirig.utils.PartnerRegistration; import io.mosip.testrig.apirig.utils.RestClient; import io.restassured.RestAssured; import io.restassured.response.Response; @@ -184,6 +187,15 @@ public class BaseTestCase extends AbstractTestNGSpringContextTests { MosipTestRunner.getGlobalResourcePath() + "/" + "config/Kernel.properties"); public static String currentRunningLanguage = ""; + + //Need to handle this + /* + * static String timeStamp = + * String.valueOf(Calendar.getInstance().getTimeInMillis()); static String + * partnerId = "Tech-1245"; static String emailId = "mosip_1" + timeStamp + + * "@gmail.com"; static String role = PartnerRegistration.partnerType; + */ + public static String getOSType() { String type = System.getProperty("os.name"); @@ -315,7 +327,11 @@ public static void suiteSetup() { BaseTestCase.currentModule = GlobalConstants.PARTNERNEW; DBManager.clearPartnerRevampDbData(); DBManager.clearKeyManagerDbDataForPartnerRevamp(); - //DBManager.clearKeyManagerDbData(); + DBManager.clearIDADbDataForPartnerRevamp(); + //KeycloakUserManager.createKeyCloakUsers(partnerId, emailId, role); + + + BaseTestCase.currentModule = GlobalConstants.PARTNERNEW; setReportName(GlobalConstants.PARTNERNEW); AdminTestUtil.copyPmsNewTestResource(); diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/KernelAuthentication.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/KernelAuthentication.java index 619c9858f4..bf40ce6a12 100644 --- a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/KernelAuthentication.java +++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/KernelAuthentication.java @@ -117,11 +117,11 @@ public String getTokenByRole(String role, String tokenType) { return zonalApproverCookie; case "partnerrevamp": if (!kernelCmnLib.isValidToken(partnerrevampCookie)) - partnerrevampCookie = kernelAuthLib.getAuthForPartner(); + partnerrevampCookie = kernelAuthLib.getAuthForPartnerRevamp(); return partnerrevampCookie; case "partner": if (!kernelCmnLib.isValidToken(partnerCookie)) - partnerCookie = kernelAuthLib.getAuthForPartnerRevamp(); + partnerCookie = kernelAuthLib.getAuthForPartner(); return partnerCookie; case "partnernew": if (!kernelCmnLib.isValidToken(partnerNewCookie)) @@ -296,7 +296,7 @@ public String getAuthForPartnerRevamp() { request.put(GlobalConstants.APPID, ConfigManager.getPmsAppId()); request.put(GlobalConstants.PASSWORD, partner_password); - request.put(GlobalConstants.USER_NAME, BaseTestCase.currentModule + "-" + partner_revamp_userName); + request.put(GlobalConstants.USER_NAME, partner_revamp_userName); JSONObject actualInternalrequest = getRequestJson(authInternalRequest); if (BaseTestCase.isTargetEnvLTS()) { request.put(GlobalConstants.CLIENTID, ConfigManager.getPmsClientId()); diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/KeycloakUserManager.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/KeycloakUserManager.java index 0e4bdd5226..80f1ed8b66 100644 --- a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/KeycloakUserManager.java +++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/KeycloakUserManager.java @@ -87,6 +87,11 @@ else if(needsToBeCreatedUser.equals("masterdata-220005")){ } + else if(needsToBeCreatedUser.equals("111999")){ + moduleSpecificUser = needsToBeCreatedUser; + + } + else { moduleSpecificUser = BaseTestCase.currentModule +"-"+ needsToBeCreatedUser; } diff --git a/apitest-commons/src/main/resources/config/Kernel.properties b/apitest-commons/src/main/resources/config/Kernel.properties index cfc8017656..2796cf4f6c 100644 --- a/apitest-commons/src/main/resources/config/Kernel.properties +++ b/apitest-commons/src/main/resources/config/Kernel.properties @@ -109,49 +109,49 @@ partner_revamp_userName=111999 partner_user_password=mosip123 mosip_pms_client_id=mosip-pms-client mosip_partner_client_id=mosip-partner-client -mosip_partner_client_secret=vXS7WUyPDpfWYuoz -mosip_pms_client_secret=5Qj8vn989OL1Vlu6 +mosip_partner_client_secret= +mosip_pms_client_secret= policytest_password=mosip123 policytest_userName=111998 policytest_without_pmrole_userName=111887 #RESIDENT & IDA mosip_resident_app_id=resident mosip_resident_client_id=mosip-resident-client -mosip_resident_client_secret=SnZQ6nnVwN9YWvdM +mosip_resident_client_secret= #IDREPO mosip_idrepo_app_id=idrepo mosip_idrepo_client_id=mosip-idrepo-client -mosip_idrepo_client_secret=AeM2TwFuuZygCuvO +mosip_idrepo_client_secret= #admin mosip_admin_app_id=admin admin_password=mosip123 admin_userName=220005 mosip_admin_client_id=mosip-admin-client -mosip_admin_client_secret=Styop9nqkshXMTgj +mosip_admin_client_secret= #admin admin_zone_password=mosip123 admin_zone_userName=globaladmin mosip_regclient_app_id=registrationclient mosip_reg_client_id=mosip-reg-client -mosip_reg_client_secret=DLXygc82rkAkjrwV +mosip_reg_client_secret= #admin mosip_regprocclient_app_id=regproc mosip_regproc_client_id=mosip-regproc-client -mosip_regproc_client_secret=eyeXdyhO0u2ETibw +mosip_regproc_client_secret= #mparter_mobile mpartner_default_mobile_client_id=mpartner-default-mobile -mpartner_default_mobile_secret=iCkj8BRZU6hP6MAN +mpartner_default_mobile_secret= #This credentials are used to execute auth demo service AuthClientID=mosip-resident-client -AuthClientSecret=SnZQ6nnVwN9YWvdM +AuthClientSecret= AuthAppID=resident mosip_hotlist_app_id=hotlist mosip_hotlist_client_id=mosip-hotlist-client -mosip_hotlist_client_secret=TKyc4cqWymxjiLEsVydX4uME1xU3i9xl +mosip_hotlist_client_secret= ###Keycloak_User-Creation_Properties #Dontchange the partner user_111997 @@ -162,16 +162,15 @@ roles.111995=PARTNER_ADMIN,default-roles-mosip keycloak_UserName = admin -keycloak_Password = sMDr9Ainw9 +keycloak_Password = keycloak-external-url=https://iam.qa-inji.mosip.net mosip_testrig_client_id=mosip-testrig-client -mosip_testrig_client_secret=AonuXbikoWmHP5ug +mosip_testrig_client_secret= keycloak-realm-id=mosip -iam-users-to-create=111997,111998,220005,111992,globaladmin,111887,111999 -#iam-users-to-create=111997,220005,111992 -iam-users-password=mosip123,mosip123,mosip123,mosip123,mosip123 +iam-users-to-create=111997,111998,220005,111992,globaladmin,111999,111887 +iam-users-password=mosip123,mosip123,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 @@ -188,14 +187,14 @@ current_session_context_class=thread #audit details audit_url=jdbc:postgresql://qa-inji.mosip.net:5432/mosip_audit audit_username=postgres -audit_password=2BhgiSpCaT +audit_password= audit_default_schema=audit #ida-partner details DB_PORT= installation-domain= partner_url=jdbc:postgresql://qa-inji.mosip.net:5432/mosip_ida partner_username=postgres -partner_password=2BhgiSpCaT +partner_password= partner_default_schema=partner reportLogPath=automationLogAndReport #--------minio proprties---------------- @@ -223,7 +222,7 @@ hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect hibernate.show_sql=true hibernate.current_session_context_class=thread db-su-user=postgres -postgres-password=2BhgiSpCaT +postgres-password= pms_db_schema=pms km_db_schema=keymgr master_db_schema=master