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-34075 #1522

Merged
merged 2 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -36,6 +37,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;
Expand Down Expand Up @@ -181,6 +184,15 @@ public class BaseTestCase {
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");
Expand Down Expand Up @@ -312,7 +324,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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ else if(needsToBeCreatedUser.equals("masterdata-220005")){

}

else if(needsToBeCreatedUser.equals("111999")){
moduleSpecificUser = needsToBeCreatedUser;

}

else {
moduleSpecificUser = BaseTestCase.currentModule +"-"+ needsToBeCreatedUser;
}
Expand Down
5 changes: 2 additions & 3 deletions apitest-commons/src/main/resources/config/Kernel.properties
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,8 @@ mosip_testrig_client_id=mosip-testrig-client
mosip_testrig_client_secret=AonuXbikoWmHP5ug

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
Expand Down
Loading