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

Develop #1345

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open

Develop #1345

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 @@ -30,6 +30,7 @@
import io.mosip.testrig.apirig.utils.EncryptionDecrptionUtil;
import io.mosip.testrig.apirig.utils.GlobalConstants;
import io.mosip.testrig.apirig.utils.GlobalMethods;
import io.mosip.testrig.apirig.utils.IdAuthConfigManager;
import io.mosip.testrig.apirig.utils.JWKKeyUtil;
import io.mosip.testrig.apirig.utils.KeyCloakUserAndAPIKeyGeneration;
import io.mosip.testrig.apirig.utils.KeycloakUserManager;
Expand Down Expand Up @@ -71,7 +72,7 @@ public static void main(String[] arg) {
} else {
ExtractResource.copyCommonResources();
}
ConfigManager.init();
IdAuthConfigManager.init();
BaseTestCase.suiteSetup();
SkipTestCaseHandler.loadTestcaseToBeSkippedList("testCaseSkippedList.txt");
setLogLevels();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import io.mosip.testrig.apirig.utils.AuthenticationTestException;
import io.mosip.testrig.apirig.utils.ConfigManager;
import io.mosip.testrig.apirig.utils.GlobalConstants;
import io.mosip.testrig.apirig.utils.IdAuthConfigManager;
import io.mosip.testrig.apirig.utils.IdAuthenticationUtil;
import io.mosip.testrig.apirig.utils.KernelAuthentication;
import io.mosip.testrig.apirig.utils.KeycloakUserManager;
Expand Down Expand Up @@ -125,8 +126,8 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad
String picture = properties.getProperty("picturevalue");
list.add(picture);
attrmap.put("picture", list);
KeycloakUserManager.createVidUsers(propsKernel.getProperty("new_Resident_User"),
propsKernel.getProperty("new_Resident_Password"), propsKernel.getProperty("new_Resident_Role"),
KeycloakUserManager.createVidUsers(IdAuthConfigManager.getproperty("new_Resident_User"),
IdAuthConfigManager.getproperty("new_Resident_Password"), IdAuthConfigManager.getproperty("new_Resident_Role"),
attrmap);
}

Expand All @@ -137,7 +138,7 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad
inputJson = inputJson.replace("$UIN$", uin);
inputJson = inputJson.replace("$RID$", genRid);
String phoneNumber = "";
String email = testCaseName + "@mosip.net";
String email = testCaseName +"@mosip.net";
if (inputJson.contains("$PHONENUMBERFORIDENTITY$")) {
if (!phoneSchemaRegex.isEmpty())
try {
Expand All @@ -147,7 +148,7 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad
}
inputJson = replaceKeywordWithValue(inputJson, "$PHONENUMBERFORIDENTITY$", phoneNumber);
inputJson = replaceKeywordWithValue(inputJson, "$EMAILVALUE$", email);

}

response = postWithBodyAndCookie(ApplnURI + testCaseDTO.getEndPoint(), inputJson, COOKIENAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import io.mosip.testrig.apirig.utils.AdminTestUtil;
import io.mosip.testrig.apirig.utils.AuthenticationTestException;
import io.mosip.testrig.apirig.utils.BioDataUtility;
import io.mosip.testrig.apirig.utils.ConfigManager;
import io.mosip.testrig.apirig.utils.IdAuthConfigManager;
import io.mosip.testrig.apirig.utils.EncryptionDecrptionUtil;
import io.mosip.testrig.apirig.utils.IdAuthenticationUtil;
import io.mosip.testrig.apirig.utils.OutputValidationUtil;
Expand All @@ -47,7 +47,7 @@ public class BioAuth extends AdminTestUtil implements ITest {

@BeforeClass
public static void setLogLevel() {
if (ConfigManager.IsDebugEnabled())
if (IdAuthConfigManager.IsDebugEnabled())
logger.setLevel(Level.ALL);
else
logger.setLevel(Level.ERROR);
Expand Down Expand Up @@ -159,206 +159,10 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad
throw new AdminTestException("Failed at output validation");


/*
* if (testCaseName.toLowerCase().contains("kyc")) { String error = null; if
* (response.getBody().asString().contains("errors")) error =
* JsonPrecondtion.getJsonValueFromJson(response.getBody().asString(),
* "errors"); if (error.equalsIgnoreCase("null"))
* encryptDecryptUtil.validateThumbPrintAndIdentity(response,
* testCaseDTO.getEndPoint()); }
*/


/*
* if
* (!encryptDecryptUtil.verifyResponseUsingDigitalSignature(response.asString(),
* response.getHeader(props.getProperty("signatureheaderKey")))) throw new
* AdminTestException("Failed at Signature validation");
*/

}



// /**
// * Test method for OTP Generation execution
// *
// * @param objTestParameters
// * @param testScenario
// * @param testcaseName
// * @throws AuthenticationTestException
// * @throws AdminTestException
// */
// @Test(dataProvider = "testcaselist")
// public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException {
// testCaseName = testCaseDTO.getTestCaseName();
// String[] kycFields = testCaseDTO.getKycFields();
//
// if (HealthChecker.signalTerminateExecution) {
// throw new SkipException(
// GlobalConstants.TARGET_ENV_HEALTH_CHECK_FAILED + HealthChecker.healthCheckFailureMapS);
// }
//
// testCaseName = isTestCaseValidForExecution(testCaseDTO);
//
// if (testCaseDTO.getTestCaseName().contains("uin") || testCaseDTO.getTestCaseName().contains("UIN")) {
// if (!BaseTestCase.getSupportedIdTypesValueFromActuator().contains("UIN")
// && !BaseTestCase.getSupportedIdTypesValueFromActuator().contains("uin")) {
// throw new SkipException(GlobalConstants.UIN_FEATURE_NOT_SUPPORTED);
// }
// }
//
// if (testCaseDTO.getTestCaseName().contains("VID") || testCaseDTO.getTestCaseName().contains("Vid")) {
// if (!BaseTestCase.getSupportedIdTypesValueFromActuator().contains("VID")
// && !BaseTestCase.getSupportedIdTypesValueFromActuator().contains("vid")) {
// throw new SkipException(GlobalConstants.VID_FEATURE_NOT_SUPPORTED);
// }
// }
//
// if (testCaseDTO.getEndPoint().contains("$PartnerKeyURL$")) {
// testCaseDTO.setEndPoint(
// testCaseDTO.getEndPoint().replace("$PartnerKeyURL$", PartnerRegistration.partnerKeyUrl));
// }
//
// if (testCaseDTO.getEndPoint().contains("$KycPartnerKeyURL$")) {
// testCaseDTO.setEndPoint(
// testCaseDTO.getEndPoint().replace("$KycPartnerKeyURL$", PartnerRegistration.ekycPartnerKeyUrl));
// }
//
// if (testCaseDTO.getEndPoint().contains("$UpdatedPartnerKeyURL$")) {
// testCaseDTO.setEndPoint(testCaseDTO.getEndPoint().replace("$UpdatedPartnerKeyURL$",
// PartnerRegistration.updatedpartnerKeyUrl));
// }
//
// if (testCaseDTO.getEndPoint().contains("$PartnerName$")) {
// testCaseDTO.setEndPoint(testCaseDTO.getEndPoint().replace("$PartnerName$", PartnerRegistration.partnerId));
// }
//
// if (testCaseDTO.getEndPoint().contains("$KycPartnerName$")) {
// testCaseDTO.setEndPoint(
// testCaseDTO.getEndPoint().replace("$KycPartnerName$", PartnerRegistration.ekycPartnerId));
// }
// String request = testCaseDTO.getInput();
// request = buildIdentityRequest(request);
//
// String inputJSON = getJsonFromTemplate(request, testCaseDTO.getInputTemplate());
// String resolvedUri = null;
// String individualId = null;
// resolvedUri = uriKeyWordHandelerUri(testCaseDTO.getEndPoint(), testCaseName);
//
// individualId = AdminTestUtil.getValueFromUrl(resolvedUri, "id");
//
// String url = ConfigManager.getAuthDemoServiceUrl();
//
// response = postWithBodyAndCookie(url + testCaseDTO.getEndPoint(), inputJSON, COOKIENAME, testCaseDTO.getRole(),
// testCaseDTO.getTestCaseName());
//
// String ActualOPJson = getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate());
//
// if (testCaseDTO.getTestCaseName().contains("uin") || testCaseDTO.getTestCaseName().contains("UIN")) {
// if (BaseTestCase.getSupportedIdTypesValueFromActuator().contains("UIN")
// || BaseTestCase.getSupportedIdTypesValueFromActuator().contains("uin")) {
// ActualOPJson = getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate());
// } else {
// if (testCaseDTO.getTestCaseName().contains("auth_EkycBio")) {
// ActualOPJson = AdminTestUtil.getRequestJson("config/errorUINKyc.json").toString();
// } else {
// ActualOPJson = AdminTestUtil.getRequestJson("config/errorUIN.json").toString();
// }
//
// }
// } else {
// if (testCaseDTO.getTestCaseName().contains("VID") || testCaseDTO.getTestCaseName().contains("Vid")) {
// if (BaseTestCase.getSupportedIdTypesValueFromActuator().contains("VID")
// || BaseTestCase.getSupportedIdTypesValueFromActuator().contains("vid")) {
// ActualOPJson = getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate());
// } else {
// if (testCaseDTO.getTestCaseName().contains("auth_EkycBio")) {
// ActualOPJson = AdminTestUtil.getRequestJson("config/errorUINKyc.json").toString();
// } else {
// ActualOPJson = AdminTestUtil.getRequestJson("config/errorUIN.json").toString();
// }
//
// }
// }
// }
//
// Map<String, List<OutputValidationDto>> ouputValid = OutputValidationUtil
// .doJsonOutputValidation(response.asString(), ActualOPJson, testCaseDTO, response.getStatusCode());
// Reporter.log(ReportUtil.getOutputValidationReport(ouputValid));
//
// if (!OutputValidationUtil.publishOutputResult(ouputValid))
// throw new AdminTestException("Failed at output validation");
//
// if (testCaseName.toLowerCase().contains("kyc")) {
// JSONObject resJsonObject = new JSONObject(response.asString());
// String res = "";
// try {
// // res = resJsonObject.get("response").toString();
// resJsonObject = new JSONObject(response.getBody().asString()).getJSONObject("authResponse")
// .getJSONObject("body").getJSONObject("response");
//
// res = AdminTestUtil.ekycDataDecryption(url, resJsonObject, PartnerRegistration.ekycPartnerId, true);
//
// JSONObject jsonObjectkycRes = new JSONObject(res);
// JSONObject jsonObjectFromKycData = new JSONObject();
// JSONObject jsonObjectFromIdentityData = new JSONObject();
// // List<String> myList =new ArrayList<>();
//
// ArrayList<String> names = new ArrayList<>();
// ArrayList<String> names2 = new ArrayList<>();
//
// for (int i = 0; i < kycFields.length; i++) {
// for (String key : jsonObjectkycRes.keySet()) {
// if (key.contains(kycFields[i])) {
// names.add(key);// dob gender_eng
// names2.add(kycFields[i]);// dob gender
// jsonObjectFromKycData.append(key, jsonObjectkycRes.getString(key));
// break;
// }
// }
//
// }
//
// newResponse = RestClient.getRequestWithCookie(
// ApplnURI + props.getProperty("retrieveIdByUin") + individualId, MediaType.APPLICATION_JSON,
// MediaType.APPLICATION_JSON, COOKIENAME, kernelAuthLib.getTokenByRole("idrepo"),
// IDTOKENCOOKIENAME, null);
//
// GlobalMethods.reportResponse(newResponse.getHeaders().asList().toString(), url, newResponse);
//
// JSONObject responseBody = new JSONObject(newResponse.getBody().asString()).getJSONObject("response")
// .getJSONObject("identity");
//
// for (int j = 0; j < names2.size(); j++) {
//
// String mappingField = getValueFromAuthActuator("json-property", names2.get(j));
// mappingField = mappingField.replaceAll("\\[\"|\"\\]", "");
// JSONArray valueOfJsonArray = responseBody.optJSONArray(mappingField);
// if (valueOfJsonArray != null) {
// jsonObjectFromIdentityData.append(names.get(j), valueOfJsonArray.getJSONObject(0).get("value"));
//
// valueOfJsonArray = null;
// } else {
// jsonObjectFromIdentityData.append(names.get(j), responseBody.getString(mappingField));
// }
//
// }
//
// ouputValid = OutputValidationUtil.doJsonOutputValidation(jsonObjectFromIdentityData.toString(),
// jsonObjectFromKycData.toString(), testCaseDTO, response.getStatusCode());
// Reporter.log(ReportUtil.getOutputValidationReport(ouputValid));
//
// if (!OutputValidationUtil.publishOutputResult(ouputValid))
// throw new AdminTestException("Failed at output validation");
//
// } catch (JSONException e) {
// logger.error(e.getMessage());
// }
//
// }
// }

/**
* The method ser current test name to result
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import io.mosip.testrig.apirig.utils.AdminTestException;
import io.mosip.testrig.apirig.utils.AdminTestUtil;
import io.mosip.testrig.apirig.utils.AuthenticationTestException;
import io.mosip.testrig.apirig.utils.ConfigManager;
import io.mosip.testrig.apirig.utils.IdAuthConfigManager;
import io.mosip.testrig.apirig.utils.EncryptionDecrptionUtil;
import io.mosip.testrig.apirig.utils.IdAuthenticationUtil;
import io.mosip.testrig.apirig.utils.OutputValidationUtil;
Expand All @@ -46,7 +46,7 @@ public class DemoAuth extends AdminTestUtil implements ITest {

@BeforeClass
public static void setLogLevel() {
if (ConfigManager.IsDebugEnabled())
if (IdAuthConfigManager.IsDebugEnabled())
logger.setLevel(Level.ALL);
else
logger.setLevel(Level.ERROR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import io.mosip.testrig.apirig.utils.AdminTestException;
import io.mosip.testrig.apirig.utils.AdminTestUtil;
import io.mosip.testrig.apirig.utils.AuthenticationTestException;
import io.mosip.testrig.apirig.utils.ConfigManager;
import io.mosip.testrig.apirig.utils.IdAuthConfigManager;
import io.mosip.testrig.apirig.utils.GlobalConstants;
import io.mosip.testrig.apirig.utils.GlobalMethods;
import io.mosip.testrig.apirig.utils.IdAuthenticationUtil;
Expand All @@ -53,7 +53,7 @@ public class DemoAuthSimplePostForAutoGenId extends AdminTestUtil implements ITe

@BeforeClass
public static void setLogLevel() {
if (ConfigManager.IsDebugEnabled())
if (IdAuthConfigManager.IsDebugEnabled())
logger.setLevel(Level.ALL);
else
logger.setLevel(Level.ERROR);
Expand Down Expand Up @@ -201,9 +201,9 @@ public void test(TestCaseDTO testCaseDTO)
} else {
if (testCaseName.contains("partnerDemoDown")) {

//url = ConfigManager.getAuthDemoServiceUrl() + "local";
//url = IdAuthConfigManager.getAuthDemoServiceUrl() + "local";
} else {
//url = ConfigManager.getAuthDemoServiceUrl();
//url = IdAuthConfigManager.getAuthDemoServiceUrl();
}

response = postWithBodyAndCookie(url + testCaseDTO.getEndPoint(), inputJson, COOKIENAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import io.mosip.testrig.apirig.utils.AdminTestException;
import io.mosip.testrig.apirig.utils.AdminTestUtil;
import io.mosip.testrig.apirig.utils.AuthenticationTestException;
import io.mosip.testrig.apirig.utils.ConfigManager;
import io.mosip.testrig.apirig.utils.IdAuthConfigManager;
import io.mosip.testrig.apirig.utils.GlobalConstants;
import io.mosip.testrig.apirig.utils.IdAuthenticationUtil;
import io.mosip.testrig.apirig.utils.OutputValidationUtil;
Expand All @@ -42,7 +42,7 @@ public class GetWithParam extends AdminTestUtil implements ITest {

@BeforeClass
public static void setLogLevel() {
if (ConfigManager.IsDebugEnabled())
if (IdAuthConfigManager.IsDebugEnabled())
logger.setLevel(Level.ALL);
else
logger.setLevel(Level.ERROR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import io.mosip.testrig.apirig.utils.AdminTestException;
import io.mosip.testrig.apirig.utils.AdminTestUtil;
import io.mosip.testrig.apirig.utils.AuthenticationTestException;
import io.mosip.testrig.apirig.utils.ConfigManager;
import io.mosip.testrig.apirig.utils.IdAuthConfigManager;
import io.mosip.testrig.apirig.utils.GlobalConstants;
import io.mosip.testrig.apirig.utils.IdAuthenticationUtil;
import io.mosip.testrig.apirig.utils.OutputValidationUtil;
Expand All @@ -43,7 +43,7 @@ public class GetWithParamForAutoGenId extends AdminTestUtil implements ITest {

@BeforeClass
public static void setLogLevel() {
if (ConfigManager.IsDebugEnabled())
if (IdAuthConfigManager.IsDebugEnabled())
logger.setLevel(Level.ALL);
else
logger.setLevel(Level.ERROR);
Expand Down
Loading
Loading