Skip to content

Commit

Permalink
Merge pull request #1217 from nandhu-kumar/camdgc-develop
Browse files Browse the repository at this point in the history
MOSIP-30311
  • Loading branch information
lsivanand authored Nov 29, 2023
2 parents f6889f8 + 56f8ad0 commit baaaac4
Show file tree
Hide file tree
Showing 44 changed files with 373 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -620,42 +620,42 @@ public static List<String> getSupportedIdTypesValueFromActuator() {
if (!supportedIdType.isEmpty()) {
return supportedIdType;
}
supportedIdType.add("UIN");
return supportedIdType;

String section = "/mosip-config/id-authentication-default.properties";
if (!BaseTestCase.isTargetEnvLTS())
section = "/mosip-config/sandbox/id-authentication-lts.properties";

Response response = null;

org.json.JSONObject responseJson = null;
JSONArray responseArray = null;
String url = ApplnURI + propsKernel.getProperty("actuatorIDAEndpoint");
try {
response = RestClient.getRequest(url, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON);
GlobalMethods.reportResponse(response.getHeaders().asList().toString(), url, response);

responseJson = new org.json.JSONObject(response.getBody().asString());
responseArray = responseJson.getJSONArray("propertySources");

for (int i = 0, size = responseArray.length(); i < size; i++) {
org.json.JSONObject eachJson = responseArray.getJSONObject(i);
logger.info("eachJson is :" + eachJson.toString());
if (eachJson.get("name").toString().contains(section)) {
org.json.JSONObject idTypes = (org.json.JSONObject) eachJson.getJSONObject("properties")
.get("request.idtypes.allowed");
String newIdTypes = idTypes.getString(GlobalConstants.VALUE);

supportedIdType.addAll(Arrays.asList((newIdTypes).split(",")));

break;
}
}

return supportedIdType;
} catch (Exception e) {
logger.error(GlobalConstants.EXCEPTION_STRING_2 + e);
return supportedIdType;
}
/*
* String section = "/mosip-config/id-authentication-default.properties"; if
* (!BaseTestCase.isTargetEnvLTS()) section =
* "/mosip-config/sandbox/id-authentication-lts.properties";
*
* Response response = null;
*
* org.json.JSONObject responseJson = null; JSONArray responseArray = null;
* String url = ApplnURI + propsKernel.getProperty("actuatorIDAEndpoint"); try {
* response = RestClient.getRequest(url, MediaType.APPLICATION_JSON,
* MediaType.APPLICATION_JSON);
* GlobalMethods.reportResponse(response.getHeaders().asList().toString(), url,
* response);
*
* responseJson = new org.json.JSONObject(response.getBody().asString());
* responseArray = responseJson.getJSONArray("propertySources");
*
* for (int i = 0, size = responseArray.length(); i < size; i++) {
* org.json.JSONObject eachJson = responseArray.getJSONObject(i);
* logger.info("eachJson is :" + eachJson.toString()); if
* (eachJson.get("name").toString().contains(section)) { org.json.JSONObject
* idTypes = (org.json.JSONObject) eachJson.getJSONObject("properties")
* .get("request.idtypes.allowed"); String newIdTypes =
* idTypes.getString(GlobalConstants.VALUE);
*
* supportedIdType.addAll(Arrays.asList((newIdTypes).split(",")));
*
* break; } }
*
* return supportedIdType; } catch (Exception e) {
* logger.error(GlobalConstants.EXCEPTION_STRING_2 + e); return supportedIdType;
* }
*/

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad
if (HealthChecker.signalTerminateExecution) {
throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS);
}
if (testCaseDTO.getTestCaseName().contains("vid") || testCaseDTO.getTestCaseName().contains("VID")) {
if (!BaseTestCase.getSupportedIdTypesValueFromActuator().contains("VID")
&& !BaseTestCase.getSupportedIdTypesValueFromActuator().contains("vid")) {
throw new SkipException("Idtype VID is not supported. Hence skipping the testcase");
}
}
String[] templateFields = testCaseDTO.getTemplateFields();

if (testCaseDTO.getTemplateFields() != null && templateFields.length > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad
if (HealthChecker.signalTerminateExecution) {
throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS);
}

if (testCaseDTO.getTestCaseName().contains("vid") || testCaseDTO.getTestCaseName().contains("VID")) {
if (!BaseTestCase.getSupportedIdTypesValueFromActuator().contains("VID")
&& !BaseTestCase.getSupportedIdTypesValueFromActuator().contains("vid")) {
throw new SkipException("Idtype VID is not supported. Hence skipping the testcase");
}
}
auditLogCheck = testCaseDTO.isAuditLogCheck();
String[] templateFields = testCaseDTO.getTemplateFields();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import io.mosip.testrig.apirig.authentication.fw.util.ReportUtil;
import io.mosip.testrig.apirig.global.utils.GlobalConstants;
import io.mosip.testrig.apirig.kernel.util.ConfigManager;
import io.mosip.testrig.apirig.service.BaseTestCase;
import io.mosip.testrig.apirig.testrunner.HealthChecker;
import io.restassured.response.Response;

Expand Down Expand Up @@ -87,6 +88,13 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad
if (HealthChecker.signalTerminateExecution) {
throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS);
}

if (testCaseDTO.getTestCaseName().contains("vid") || testCaseDTO.getTestCaseName().contains("VID")) {
if (!BaseTestCase.getSupportedIdTypesValueFromActuator().contains("VID")
&& !BaseTestCase.getSupportedIdTypesValueFromActuator().contains("vid")) {
throw new SkipException("Idtype VID is not supported. Hence skipping the testcase");
}
}
auditLogCheck = testCaseDTO.isAuditLogCheck();
String[] templateFields = testCaseDTO.getTemplateFields();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import io.mosip.testrig.apirig.authentication.fw.util.OutputValidationUtil;
import io.mosip.testrig.apirig.authentication.fw.util.ReportUtil;
import io.mosip.testrig.apirig.kernel.util.ConfigManager;
import io.mosip.testrig.apirig.service.BaseTestCase;
import io.mosip.testrig.apirig.testrunner.HealthChecker;
import io.restassured.response.Response;

Expand Down Expand Up @@ -81,6 +82,13 @@ public void test(TestCaseDTO testCaseDTO) throws AdminTestException {
if (HealthChecker.signalTerminateExecution) {
throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS);
}

if (testCaseDTO.getTestCaseName().contains("vid") || testCaseDTO.getTestCaseName().contains("VID")) {
if (!BaseTestCase.getSupportedIdTypesValueFromActuator().contains("VID")
&& !BaseTestCase.getSupportedIdTypesValueFromActuator().contains("vid")) {
throw new SkipException("Idtype VID is not supported. Hence skipping the testcase");
}
}

response = getWithPathParamAndCookieForAutoGeneratedIdForKeyCloak(
ApplnURIForKeyCloak + testCaseDTO.getEndPoint(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import io.mosip.testrig.apirig.admin.fw.util.TestCaseDTO;
import io.mosip.testrig.apirig.global.utils.GlobalMethods;
import io.mosip.testrig.apirig.kernel.util.ConfigManager;
import io.mosip.testrig.apirig.service.BaseTestCase;
import io.mosip.testrig.apirig.testrunner.HealthChecker;
import io.restassured.response.Response;

Expand Down Expand Up @@ -84,6 +85,13 @@ public void test(TestCaseDTO testCaseDTO) throws AdminTestException {
if (HealthChecker.signalTerminateExecution) {
throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS);
}

if (testCaseDTO.getTestCaseName().contains("vid") || testCaseDTO.getTestCaseName().contains("VID")) {
if (!BaseTestCase.getSupportedIdTypesValueFromActuator().contains("VID")
&& !BaseTestCase.getSupportedIdTypesValueFromActuator().contains("vid")) {
throw new SkipException("Idtype VID is not supported. Hence skipping the testcase");
}
}
auditLogCheck = testCaseDTO.isAuditLogCheck();
pdf = getWithPathParamAndCookieForPdf(ApplnURI + testCaseDTO.getEndPoint(), getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()), auditLogCheck, COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), sendEsignetToken);
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad
if (HealthChecker.signalTerminateExecution) {
throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS);
}

if (testCaseDTO.getTestCaseName().contains("vid") || testCaseDTO.getTestCaseName().contains("VID")) {
if (!BaseTestCase.getSupportedIdTypesValueFromActuator().contains("VID")
&& !BaseTestCase.getSupportedIdTypesValueFromActuator().contains("vid")) {
throw new SkipException("Idtype VID is not supported. Hence skipping the testcase");
}
}

JSONObject req = new JSONObject(testCaseDTO.getInput());
String otpRequest = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad
throw new SkipException("Service not deployed. Hence skipping this test case");
}

if (testCaseDTO.getTestCaseName().contains("vid") || testCaseDTO.getTestCaseName().contains("VID")) {
if (!BaseTestCase.getSupportedIdTypesValueFromActuator().contains("VID")
&& !BaseTestCase.getSupportedIdTypesValueFromActuator().contains("vid")) {
throw new SkipException("Idtype VID is not supported. Hence skipping the testcase");
}
}

String[] templateFields = testCaseDTO.getTemplateFields();

if (testCaseDTO.getTemplateFields() != null && templateFields.length > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import io.mosip.testrig.apirig.global.utils.GlobalConstants;
import io.mosip.testrig.apirig.global.utils.GlobalMethods;
import io.mosip.testrig.apirig.kernel.util.ConfigManager;
import io.mosip.testrig.apirig.service.BaseTestCase;
import io.mosip.testrig.apirig.testrunner.HealthChecker;
import io.restassured.response.Response;

Expand Down Expand Up @@ -85,6 +86,14 @@ public void test(TestCaseDTO testCaseDTO) throws Exception {
if (HealthChecker.signalTerminateExecution) {
throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS);
}

if (testCaseDTO.getTestCaseName().contains("vid") || testCaseDTO.getTestCaseName().contains("VID")) {
if (!BaseTestCase.getSupportedIdTypesValueFromActuator().contains("VID")
&& !BaseTestCase.getSupportedIdTypesValueFromActuator().contains("vid")) {
throw new SkipException("Idtype VID is not supported. Hence skipping the testcase");
}
}

String[] templateFields = testCaseDTO.getTemplateFields();

if (testCaseDTO.getTemplateFields() != null && templateFields.length > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import io.mosip.testrig.apirig.authentication.fw.util.ReportUtil;
import io.mosip.testrig.apirig.global.utils.GlobalConstants;
import io.mosip.testrig.apirig.kernel.util.ConfigManager;
import io.mosip.testrig.apirig.service.BaseTestCase;
import io.mosip.testrig.apirig.testrunner.HealthChecker;
import io.restassured.response.Response;

Expand Down Expand Up @@ -83,6 +84,13 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad
if (HealthChecker.signalTerminateExecution) {
throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS);
}

if (testCaseDTO.getTestCaseName().contains("vid") || testCaseDTO.getTestCaseName().contains("VID")) {
if (!BaseTestCase.getSupportedIdTypesValueFromActuator().contains("VID")
&& !BaseTestCase.getSupportedIdTypesValueFromActuator().contains("vid")) {
throw new SkipException("Idtype VID is not supported. Hence skipping the testcase");
}
}
testCaseName = isTestCaseValidForExecution(testCaseDTO);
JSONObject request = new JSONObject(testCaseDTO.getInput());
String kycAuthEndPoint = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import io.mosip.testrig.apirig.authentication.fw.util.ReportUtil;
import io.mosip.testrig.apirig.global.utils.GlobalConstants;
import io.mosip.testrig.apirig.kernel.util.ConfigManager;
import io.mosip.testrig.apirig.service.BaseTestCase;
import io.mosip.testrig.apirig.testrunner.HealthChecker;
import io.restassured.response.Response;

Expand Down Expand Up @@ -78,6 +79,13 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad
if (HealthChecker.signalTerminateExecution) {
throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS);
}

if (testCaseDTO.getTestCaseName().contains("vid") || testCaseDTO.getTestCaseName().contains("VID")) {
if (!BaseTestCase.getSupportedIdTypesValueFromActuator().contains("VID")
&& !BaseTestCase.getSupportedIdTypesValueFromActuator().contains("vid")) {
throw new SkipException("Idtype VID is not supported. Hence skipping the testcase");
}
}
JSONObject req = new JSONObject(testCaseDTO.getInput());
String otpRequest = null, sendOtpReqTemplate = null, sendOtpEndPoint = null;
if (req.has(GlobalConstants.SENDOTP)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import io.mosip.testrig.apirig.authentication.fw.util.OutputValidationUtil;
import io.mosip.testrig.apirig.authentication.fw.util.ReportUtil;
import io.mosip.testrig.apirig.kernel.util.ConfigManager;
import io.mosip.testrig.apirig.service.BaseTestCase;
import io.mosip.testrig.apirig.testrunner.HealthChecker;
import io.restassured.response.Response;

Expand Down Expand Up @@ -79,6 +80,13 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad
if (HealthChecker.signalTerminateExecution) {
throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS);
}

if (testCaseDTO.getTestCaseName().contains("vid") || testCaseDTO.getTestCaseName().contains("VID")) {
if (!BaseTestCase.getSupportedIdTypesValueFromActuator().contains("VID")
&& !BaseTestCase.getSupportedIdTypesValueFromActuator().contains("vid")) {
throw new SkipException("Idtype VID is not supported. Hence skipping the testcase");
}
}
String[] templateFields = testCaseDTO.getTemplateFields();

if (testCaseDTO.getTemplateFields() != null && templateFields.length > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ public void test(TestCaseDTO testCaseDTO) throws AdminTestException {
if (HealthChecker.signalTerminateExecution) {
throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS);
}

if (testCaseDTO.getTestCaseName().contains("vid") || testCaseDTO.getTestCaseName().contains("VID")) {
if (!BaseTestCase.getSupportedIdTypesValueFromActuator().contains("VID")
&& !BaseTestCase.getSupportedIdTypesValueFromActuator().contains("vid")) {
throw new SkipException("Idtype VID is not supported. Hence skipping the testcase");
}
}

testCaseDTO = AdminTestUtil.filterHbs(testCaseDTO);
String inputJson = filterInputHbs(testCaseDTO);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import io.mosip.testrig.apirig.authentication.fw.util.OutputValidationUtil;
import io.mosip.testrig.apirig.authentication.fw.util.ReportUtil;
import io.mosip.testrig.apirig.kernel.util.ConfigManager;
import io.mosip.testrig.apirig.service.BaseTestCase;
import io.mosip.testrig.apirig.testrunner.HealthChecker;
import io.restassured.response.Response;

Expand Down Expand Up @@ -80,6 +81,13 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad
if (HealthChecker.signalTerminateExecution) {
throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS);
}

if (testCaseDTO.getTestCaseName().contains("vid") || testCaseDTO.getTestCaseName().contains("VID")) {
if (!BaseTestCase.getSupportedIdTypesValueFromActuator().contains("VID")
&& !BaseTestCase.getSupportedIdTypesValueFromActuator().contains("vid")) {
throw new SkipException("Idtype VID is not supported. Hence skipping the testcase");
}
}
String[] templateFields = testCaseDTO.getTemplateFields();

if (testCaseDTO.getTemplateFields() != null && templateFields.length > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ public void test(TestCaseDTO testCaseDTO)
if (HealthChecker.signalTerminateExecution) {
throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS);
}

if (testCaseDTO.getTestCaseName().contains("vid") || testCaseDTO.getTestCaseName().contains("VID")) {
if (!BaseTestCase.getSupportedIdTypesValueFromActuator().contains("VID")
&& !BaseTestCase.getSupportedIdTypesValueFromActuator().contains("vid")) {
throw new SkipException("Idtype VID is not supported. Hence skipping the testcase");
}
}

if (!BaseTestCase.isTargetEnvLTS()) {
if ((BaseTestCase.currentModule.equals("auth")) && (testCaseName.startsWith("auth_GenerateVID_"))) {
throw new SkipException("Generating VID using IdRepo API on Pre LTS. Hence skipping this test case");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import io.mosip.testrig.apirig.authentication.fw.util.ReportUtil;
import io.mosip.testrig.apirig.global.utils.GlobalConstants;
import io.mosip.testrig.apirig.kernel.util.ConfigManager;
import io.mosip.testrig.apirig.service.BaseTestCase;
import io.mosip.testrig.apirig.testrunner.HealthChecker;
import io.restassured.response.Response;

Expand Down Expand Up @@ -82,6 +83,13 @@ public void test(TestCaseDTO testCaseDTO) throws AdminTestException {
if (HealthChecker.signalTerminateExecution) {
throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS);
}
if (testCaseDTO.getTestCaseName().contains("vid") || testCaseDTO.getTestCaseName().contains("VID")) {
if (!BaseTestCase.getSupportedIdTypesValueFromActuator().contains("VID")
&& !BaseTestCase.getSupportedIdTypesValueFromActuator().contains("vid")) {
throw new SkipException("Idtype VID is not supported. Hence skipping the testcase");
}
}

testCaseName = isTestCaseValidForExecution(testCaseDTO);
JSONObject req = new JSONObject(testCaseDTO.getInput());
String otpRequest = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad
if (HealthChecker.signalTerminateExecution) {
throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS);
}
if (testCaseDTO.getTestCaseName().contains("vid") || testCaseDTO.getTestCaseName().contains("VID")) {
if (!BaseTestCase.getSupportedIdTypesValueFromActuator().contains("VID")
&& !BaseTestCase.getSupportedIdTypesValueFromActuator().contains("vid")) {
throw new SkipException("Idtype VID is not supported. Hence skipping the testcase");
}
}

testCaseDTO = AdminTestUtil.filterHbs(testCaseDTO);
String inputJson = filterInputHbs(testCaseDTO);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import io.mosip.testrig.apirig.authentication.fw.util.ReportUtil;
import io.mosip.testrig.apirig.global.utils.GlobalConstants;
import io.mosip.testrig.apirig.kernel.util.ConfigManager;
import io.mosip.testrig.apirig.service.BaseTestCase;
import io.mosip.testrig.apirig.testrunner.HealthChecker;
import io.restassured.response.Response;

Expand Down Expand Up @@ -67,6 +68,13 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad
if (HealthChecker.signalTerminateExecution) {
throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS);
}

if (testCaseDTO.getTestCaseName().contains("vid") || testCaseDTO.getTestCaseName().contains("VID")) {
if (!BaseTestCase.getSupportedIdTypesValueFromActuator().contains("VID")
&& !BaseTestCase.getSupportedIdTypesValueFromActuator().contains("vid")) {
throw new SkipException("Idtype VID is not supported. Hence skipping the testcase");
}
}

if (testCaseName.contains("_AuthDemoUrl_")) {
String url = ConfigManager.getAuthDemoServiceUrl();
Expand Down
Loading

0 comments on commit baaaac4

Please sign in to comment.