diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/admin/fw/util/AdminTestUtil.java b/automationtests/src/main/java/io/mosip/testrig/apirig/admin/fw/util/AdminTestUtil.java index 992b7762ba7..f052cb34d1a 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/admin/fw/util/AdminTestUtil.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/admin/fw/util/AdminTestUtil.java @@ -172,6 +172,8 @@ public class AdminTestUtil extends BaseTestCase { + Calendar.getInstance().getTimeInMillis(); public static final String RANDOM_ID_V2 = "mosip" + generateRandomNumberString(2) + Calendar.getInstance().getTimeInMillis(); + public static final String RANDOM_ID_V2_S2 = "mosip" + generateRandomNumberString(2) + + Calendar.getInstance().getTimeInMillis(); public static final String TRANSACTION_ID = generateRandomNumberString(10); public static final String AUTHORIZATHION_HEADERNAME = GlobalConstants.AUTHORIZATION; public static final String AUTH_HEADER_VALUE = "Some String"; @@ -427,7 +429,7 @@ protected Response postWithBodyAndCookie(String url, String jsonInput, boolean a } logger.info(GlobalConstants.POST_REQ_URL + url); - GlobalMethods.reportRequest(null, inputJson); + GlobalMethods.reportRequest(null, inputJson, url); try { if (bothAccessAndIdToken) { response = RestClient.postRequestWithCookie(url, inputJson, MediaType.APPLICATION_JSON, @@ -459,7 +461,7 @@ protected Response deleteWithBodyAndCookie(String url, String jsonInput, String url = uriKeyWordHandelerUri(url, testCaseName); token = kernelAuthLib.getTokenByRole(role); logger.info(GlobalConstants.POST_REQ_URL + url); - GlobalMethods.reportRequest(null, inputJson); + GlobalMethods.reportRequest(null, inputJson, url); try { response = RestClient.deleteRequestWithCookie(url, inputJson, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, cookieName, token); @@ -477,7 +479,7 @@ protected Response postWithBodyAndCookieWithText(String url, String jsonInput, S url = uriKeyWordHandelerUri(url, testCaseName); token = kernelAuthLib.getTokenByRole(role); logger.info(GlobalConstants.POST_REQ_URL + url); - GlobalMethods.reportRequest(null, inputJson); + GlobalMethods.reportRequest(null, inputJson, url); try { response = RestClient.postRequestWithCookie(url, inputJson, MediaType.APPLICATION_JSON, "*/*", cookieName, token); @@ -497,7 +499,7 @@ protected Response postWithBodyAndCookieWithoutBody(String url, String jsonInput url = uriKeyWordHandelerUri(url, testCaseName); token = kernelAuthLib.getTokenByRole(role); logger.info(GlobalConstants.POST_REQ_URL + url); - GlobalMethods.reportRequest(null, inputJson); + GlobalMethods.reportRequest(null, inputJson, url); try { response = RestClient.postRequestWithCookie(url, inputJson, MediaType.APPLICATION_JSON, "*/*", cookieName, token); @@ -548,7 +550,7 @@ protected Response postRequestWithCookieAuthHeaderAndXsrfToken(String url, Strin } token = properties.getProperty(GlobalConstants.XSRFTOKEN); logger.info(GlobalConstants.POST_REQ_URL + url); - GlobalMethods.reportRequest(headers.toString(), inputJson); + GlobalMethods.reportRequest(headers.toString(), inputJson, url); try { response = RestClient.postRequestWithMultipleHeadersAndCookies(url, inputJson, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, cookieName, token, headers); @@ -578,7 +580,7 @@ protected Response postWithBodyAndCookieAuthHeaderAndXsrfTokenForAutoGeneratedId token = properties.getProperty(GlobalConstants.XSRFTOKEN); logger.info(GlobalConstants.POST_REQ_URL + url); - GlobalMethods.reportRequest(headers.toString(), inputJson); + GlobalMethods.reportRequest(headers.toString(), inputJson, url); try { response = RestClient.postRequestWithMultipleHeadersAndCookies(url, inputJson, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, cookieName, token, headers); @@ -626,7 +628,7 @@ protected Response postRequestWithCookieAuthHeaderAndXsrfTokenForAutoGenId(Strin token = properties.getProperty(GlobalConstants.XSRFTOKEN); logger.info(GlobalConstants.POST_REQ_URL + url); - GlobalMethods.reportRequest(headers.toString(), inputJson); + GlobalMethods.reportRequest(headers.toString(), inputJson, url); try { response = RestClient.postRequestWithMultipleHeadersAndCookies(url, inputJson, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, cookieName, token, headers); @@ -663,7 +665,7 @@ protected Response postRequestWithCookieAuthHeaderForAutoGenId(String url, Strin inputJson = smtpOtpHandler(inputJson, testCaseName); } logger.info(GlobalConstants.POST_REQ_URL + url); - GlobalMethods.reportRequest(headers.toString(), inputJson); + GlobalMethods.reportRequest(headers.toString(), inputJson, url); try { response = RestClient.postRequestWithMultipleHeadersWithoutCookie(url, inputJson, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, headers); @@ -733,7 +735,7 @@ protected Response postRequestWithCookieAuthHeader(String url, String jsonInput, } logger.info(GlobalConstants.POST_REQ_URL + url); - GlobalMethods.reportRequest(headers.toString(), inputJson); + GlobalMethods.reportRequest(headers.toString(), inputJson, url); try { response = RestClient.postRequestWithMultipleHeadersWithoutCookie(url, inputJson, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, headers); @@ -752,7 +754,7 @@ protected Response postWithBodyAndCookieForKeyCloak(String url, String jsonInput url = uriKeyWordHandelerUri(url, testCaseName); token = kernelAuthLib.getTokenByRole(role); logger.info(GlobalConstants.POST_REQ_URL + url); - GlobalMethods.reportRequest(null, inputJson); + GlobalMethods.reportRequest(null, inputJson, url); try { response = RestClient.postRequestWithBearerToken(url, inputJson, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, cookieName, token); @@ -770,7 +772,7 @@ protected Response postWithBodyAcceptTextPlainAndCookie(String url, String jsonI String inputJson = inputJsonKeyWordHandeler(jsonInput, testCaseName); token = kernelAuthLib.getTokenByRole(role); logger.info(GlobalConstants.POST_REQ_URL + url); - GlobalMethods.reportRequest(null, inputJson); + GlobalMethods.reportRequest(null, inputJson, url); try { response = RestClient.postRequestWithCookie(url, inputJson, MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN, cookieName, token); @@ -797,7 +799,7 @@ protected Response postRequestWithCookieAuthHeaderAndSignature(String url, Strin token = kernelAuthLib.getTokenByRole(role); } logger.info(GlobalConstants.POST_REQ_URL + url); - GlobalMethods.reportRequest(headers.toString(), inputJson); + GlobalMethods.reportRequest(headers.toString(), inputJson, url); try { response = RestClient.postRequestWithMultipleHeaders(url, inputJson, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, cookieName, token, headers); @@ -815,7 +817,7 @@ protected Response postRequestWithAuthHeaderAndSignatureForOtp(String url, Strin String inputJson = inputJsonKeyWordHandeler(jsonInput, testCaseName); url = uriKeyWordHandelerUri(url, testCaseName); logger.info(GlobalConstants.POST_REQ_URL + url); - GlobalMethods.reportRequest(headers.toString(), inputJson); + GlobalMethods.reportRequest(headers.toString(), inputJson, url); try { response = RestClient.postRequestWithMultipleHeaders(url, inputJson, MediaType.APPLICATION_JSON, @@ -837,7 +839,7 @@ protected Response postRequestWithAuthHeaderAndSignatureForOtpAutoGenId(String u String inputJson = inputJsonKeyWordHandeler(jsonInput, testCaseName); url = uriKeyWordHandelerUri(url, testCaseName); logger.info(GlobalConstants.POST_REQ_URL + url); - GlobalMethods.reportRequest(headers.toString(), inputJson); + GlobalMethods.reportRequest(headers.toString(), inputJson, url); try { response = RestClient.postRequestWithMultipleHeaders(url, inputJson, MediaType.APPLICATION_JSON, @@ -863,7 +865,7 @@ protected Response patchRequestWithCookieAuthHeaderAndSignature(String url, Stri headers.put(SIGNATURE_HEADERNAME, generateSignatureWithRequest(inputJson, null)); token = kernelAuthLib.getTokenByRole(role); logger.info("******Patch request Json to EndPointUrl: " + url); - GlobalMethods.reportRequest(headers.toString(), inputJson); + GlobalMethods.reportRequest(headers.toString(), inputJson, url); try { response = RestClient.patchRequestWithMultipleHeaders(url, inputJson, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, cookieName, token, headers); @@ -890,7 +892,7 @@ protected Response postRequestWithAuthHeaderAndSignature(String url, String json } logger.info(GlobalConstants.POST_REQ_URL + url); - GlobalMethods.reportRequest(headers.toString(), inputJson); + GlobalMethods.reportRequest(headers.toString(), inputJson, url); try { response = RestClient.postRequestWithMultipleHeadersWithoutCookie(url, inputJson, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, headers); @@ -909,7 +911,7 @@ protected Response postRequestWithHeaderAndSignature(String url, String jsonInpu String inputJson = inputJsonKeyWordHandeler(jsonInput, testCaseName); headers.put(SIGNATURE_HEADERNAME, signature); logger.info(GlobalConstants.POST_REQ_URL + url); - GlobalMethods.reportRequest(headers.toString(), inputJson); + GlobalMethods.reportRequest(headers.toString(), inputJson, url); try { response = RestClient.postRequestWithMultipleHeadersWithoutCookie(url, inputJson, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, headers); @@ -943,7 +945,7 @@ protected Response postRequestWithCookieAndHeader(String url, String jsonInput, token = kernelAuthLib.getTokenByRole(role); } logger.info(GlobalConstants.POST_REQ_URL + url); - GlobalMethods.reportRequest(null, inputJson); + GlobalMethods.reportRequest(null, inputJson, url); try { if (bothAccessAndIdToken) { response = RestClient.postRequestWithCookieAndHeader(url, inputJson, MediaType.APPLICATION_JSON, @@ -972,7 +974,7 @@ protected Response patchRequestWithCookieAndHeader(String url, String jsonInput, } token = kernelAuthLib.getTokenByRole(role); logger.info(GlobalConstants.POST_REQ_URL + url); - GlobalMethods.reportRequest(null, inputJson); + GlobalMethods.reportRequest(null, inputJson, url); try { response = RestClient.patchRequestWithCookieAndHeader(url, inputJson, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, cookieName, token, AUTHORIZATHION_HEADERNAME, AUTH_HEADER_VALUE); @@ -1003,7 +1005,7 @@ protected Response patchWithBodyAndCookie(String url, String jsonInput, String c token = kernelAuthLib.getTokenByRole(role); } logger.info(GlobalConstants.POST_REQ_URL + url); - GlobalMethods.reportRequest(null, inputJson); + GlobalMethods.reportRequest(null, inputJson, url); try { if (bothAccessAndIdToken) { response = RestClient.patchRequestWithCookie(url, inputJson, MediaType.APPLICATION_JSON, @@ -1057,7 +1059,7 @@ protected Response postWithBodyAndCookieForAutoGeneratedId(String url, String js token = kernelAuthLib.getTokenByRole(role); } logger.info(GlobalConstants.POST_REQ_URL + url); - GlobalMethods.reportRequest(null, inputJson); + GlobalMethods.reportRequest(null, inputJson, url); try { if (bothAccessAndIdToken) { response = RestClient.postRequestWithCookie(url, inputJson, MediaType.APPLICATION_JSON, @@ -1093,7 +1095,7 @@ protected Response postWithBodyAndBearerTokenForAutoGeneratedId(String url, Stri token = kernelAuthLib.getTokenByRole(role); } logger.info(GlobalConstants.POST_REQ_URL + url); - GlobalMethods.reportRequest(null, inputJson); + GlobalMethods.reportRequest(null, inputJson, url); try { response = RestClient.postRequestWithBearerToken(url, inputJson, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, cookieName, token); @@ -1120,7 +1122,7 @@ protected Response postWithBodyAndCookieForAutoGeneratedIdForUrlEncoded(String u map = mapper.readValue(inputJson, Map.class); logger.info(GlobalConstants.POST_REQ_URL + url); logger.info(inputJson); - GlobalMethods.reportRequest(null, inputJson); + GlobalMethods.reportRequest(null, inputJson, url); response = RestAssured.given().contentType("application/x-www-form-urlencoded; charset=utf-8") .formParams(map).when().post(url); GlobalMethods.reportResponse(response.getHeaders().asList().toString(), url, response); @@ -1154,7 +1156,7 @@ protected Response patchWithBodyAndCookieWithAutoGeneratedId(String url, String String inputJson = inputJsonKeyWordHandeler(jsonInput, testCaseName); token = kernelAuthLib.getTokenByRole(role); logger.info(GlobalConstants.POST_REQ_URL + url); - GlobalMethods.reportRequest(null, inputJson); + GlobalMethods.reportRequest(null, inputJson, url); try { response = RestClient.patchRequestWithCookie(url, inputJson, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, cookieName, token); @@ -1175,7 +1177,7 @@ protected Response patchWithBodyAndCookieForAutoGeneratedId(String url, String j String inputJson = inputJsonKeyWordHandeler(jsonInput, testCaseName); token = kernelAuthLib.getTokenByRole(role); logger.info(GlobalConstants.POST_REQ_URL + url); - GlobalMethods.reportRequest(null, inputJson); + GlobalMethods.reportRequest(null, inputJson, url); try { response = RestClient.patchRequestWithCookie(url, inputJson, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, cookieName, token); @@ -1234,7 +1236,7 @@ protected Response getWithPathParamAndCookieForAutoGeneratedId(String url, Strin } logger.info(GlobalConstants.GET_REQ_STRING + url); - GlobalMethods.reportRequest(null, jsonInput); + GlobalMethods.reportRequest(null, jsonInput, url); try { if (url.contains("{") || url.contains("?")) { if (bothAccessAndIdToken) { @@ -1290,7 +1292,7 @@ protected Response getWithPathParamAndCookieForAutoGeneratedIdForKeyCloak(String token = kernelAuthLib.getTokenByRole(role); logger.info(GlobalConstants.GET_REQ_STRING + url); - GlobalMethods.reportRequest(null, jsonInput); + GlobalMethods.reportRequest(null, jsonInput, url); try { if (url.contains("{") || url.contains("?")) { response = RestClient.getRequestWithCookieAndPathParmForKeyCloak(url, map, MediaType.APPLICATION_JSON, @@ -1360,7 +1362,7 @@ protected Response postWithFormPathParamAndFile(String url, String jsonInput, St } token = kernelAuthLib.getTokenByRole(role); logger.info(GlobalConstants.POST_REQ_URL + url); - GlobalMethods.reportRequest(null, inputJson); + GlobalMethods.reportRequest(null, inputJson, url); try { response = RestClient.postWithFormPathParamAndFile(url, formParams, pathParams, filetoUpload, fileKeyName, MediaType.MULTIPART_FORM_DATA, token); @@ -1413,7 +1415,7 @@ protected Response postWithParamAndFile(String url, String jsonInput, String rol token = kernelAuthLib.getTokenByRole(role); } logger.info(GlobalConstants.POST_REQ_URL + url); - GlobalMethods.reportRequest(null, req.toString()); + GlobalMethods.reportRequest(null, req.toString(), url); try { if (bothAccessAndIdToken) { response = RestClient.postWithParamsAndFile(url, map, filetoUpload, fileKeyName, @@ -1453,7 +1455,7 @@ protected Response postWithFormDataAndFile(String url, String jsonInput, String } token = kernelAuthLib.getTokenByRole(role); logger.info(GlobalConstants.POST_REQ_URL + url); - GlobalMethods.reportRequest(null, inputJson); + GlobalMethods.reportRequest(null, inputJson, url); try { response = RestClient.postWithFormDataAndFile(url, formParams, absolueFilePath, MediaType.MULTIPART_FORM_DATA, token); @@ -1490,7 +1492,7 @@ else if (BaseTestCase.languageList.size() == 2) token = kernelAuthLib.getTokenByRole(role); logger.info(GlobalConstants.POST_REQ_URL + url); - GlobalMethods.reportRequest(null, jsonInput); + GlobalMethods.reportRequest(null, jsonInput, url); try { response = RestClient.postWithMultipartFormDataAndFile(url, formParams, MediaType.MULTIPART_FORM_DATA, @@ -1547,7 +1549,7 @@ protected Response postWithFormDataAndMultipleFile(String url, String jsonInput, } token = kernelAuthLib.getTokenByRole(role); logger.info(GlobalConstants.POST_REQ_URL + url); - GlobalMethods.reportRequest(null, inputJson); + GlobalMethods.reportRequest(null, inputJson, url); try { response = RestClient.postWithFormDataAndMultipleFile(url, formParams, listFiles, MediaType.MULTIPART_FORM_DATA, token); @@ -1641,7 +1643,7 @@ protected Response putWithBodyAndCookie(String url, String jsonInput, String coo token = kernelAuthLib.getTokenByRole(role); } logger.info(GlobalConstants.PUT_REQ_STRING + url); - GlobalMethods.reportRequest(null, inputJson); + GlobalMethods.reportRequest(null, inputJson, url); try { if (bothAccessAndIdToken) { response = RestClient.putRequestWithCookie(url, inputJson, MediaType.APPLICATION_JSON, @@ -1672,7 +1674,7 @@ protected Response putWithPathParamAndCookie(String url, String jsonInput, Strin } token = kernelAuthLib.getTokenByRole(role); logger.info(GlobalConstants.PUT_REQ_STRING + url); - GlobalMethods.reportRequest(null, inputJson); + GlobalMethods.reportRequest(null, inputJson, url); try { response = RestClient.putRequestWithParm(url, map, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, cookieName, token); @@ -1698,7 +1700,7 @@ protected Response patchWithPathParamAndCookie(String url, String jsonInput, Str } token = kernelAuthLib.getTokenByRole(role); logger.info(GlobalConstants.PUT_REQ_STRING + url); - GlobalMethods.reportRequest(null, inputJson); + GlobalMethods.reportRequest(null, inputJson, url); try { response = RestClient.patchRequestWithParm(url, map, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, cookieName, token); @@ -1731,7 +1733,7 @@ protected Response putWithPathParamsBodyAndCookie(String url, String jsonInput, token = kernelAuthLib.getTokenByRole(role); logger.info(GlobalConstants.PUT_REQ_STRING + url); - GlobalMethods.reportRequest(null, req.toString()); + GlobalMethods.reportRequest(null, req.toString(), url); try { if (testCaseName.toLowerCase().contains("dynamic")) pathParamsMap.put("id", idField); @@ -1769,7 +1771,7 @@ protected Response putWithPathParamsBodyAndBearerToken(String url, String jsonIn token = kernelAuthLib.getTokenByRole(role); } logger.info(GlobalConstants.PUT_REQ_STRING + url); - GlobalMethods.reportRequest(null, req.toString()); + GlobalMethods.reportRequest(null, req.toString(), url); try { if (testCaseName.toLowerCase().contains("dynamic")) pathParamsMap.put("id", idField); @@ -1801,7 +1803,7 @@ protected Response postWithPathParamsBodyAndCookie(String url, String jsonInput, token = kernelAuthLib.getTokenByRole(role); logger.info(GlobalConstants.POST_REQ_URL + url); - GlobalMethods.reportRequest(null, inputJson); + GlobalMethods.reportRequest(null, inputJson, url); try { response = RestClient.postWithPathParamsBodyAndCookie(url, pathParamsMap, req.toString(), MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, cookieName, token); @@ -1851,7 +1853,7 @@ protected Response postWithPathParamsBodyHeaderAndCookie(String url, String json token = kernelAuthLib.getTokenByRole(role); logger.info(GlobalConstants.POST_REQ_URL + url); - GlobalMethods.reportRequest(headers.toString(), req.toString()); + GlobalMethods.reportRequest(headers.toString(), req.toString(), url); try { response = RestClient.postWithPathParamsBodyHeadersAndCookie(url, pathParamsMap, inputJson, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, cookieName, token, headers); @@ -1881,7 +1883,7 @@ protected Response postWithQueryParamsBodyAndCookie(String url, String jsonInput token = kernelAuthLib.getTokenByRole(role); logger.info(GlobalConstants.POST_REQ_URL + url); - GlobalMethods.reportRequest(null, inputJson); + GlobalMethods.reportRequest(null, inputJson, url); try { response = RestClient.postWithQueryParamsBodyAndCookie(url, queryParamsMap, req.toString(), MediaType.APPLICATION_JSON, "*/*", cookieName, token); @@ -1913,7 +1915,7 @@ protected Response patchWithPathParamsBodyAndCookie(String url, String jsonInput token = kernelAuthLib.getTokenByRole(role); logger.info(GlobalConstants.PUT_REQ_STRING + url); - GlobalMethods.reportRequest(null, req.toString()); + GlobalMethods.reportRequest(null, req.toString(), url); try { response = RestClient.patchWithPathParamsBodyAndCookie(url, pathParamsMap, req.toString(), MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, cookieName, token); @@ -1970,7 +1972,7 @@ protected Response getWithPathParamAndCookie(String url, String jsonInput, boole token = kernelAuthLib.getTokenByRole(role); } logger.info(GlobalConstants.GET_REQ_STRING + url); - GlobalMethods.reportRequest(null, jsonInput); + GlobalMethods.reportRequest(null, jsonInput, url); try { if (url.contains("{") || url.contains("?")) { if (bothAccessAndIdToken) { @@ -2038,7 +2040,7 @@ protected Response deleteWithPathParamAndCookie(String url, String jsonInput, St token = kernelAuthLib.getTokenByRole(role); } logger.info(GlobalConstants.GET_REQ_STRING + url); - GlobalMethods.reportRequest(null, jsonInput); + GlobalMethods.reportRequest(null, jsonInput, url); try { if (bothAccessAndIdToken) { response = RestClient.deleteRequestWithCookieAndPathParm(url, map, MediaType.APPLICATION_JSON, @@ -2072,7 +2074,7 @@ protected Response deleteWithPathParamAndCookieForKeyCloak(String url, String js token = kernelAuthLib.getTokenByRole(role); logger.info(GlobalConstants.GET_REQ_STRING + url); - GlobalMethods.reportRequest(null, jsonInput); + GlobalMethods.reportRequest(null, jsonInput, url); try { response = RestClient.deleteRequestWithCookieAndPathParmForKeyCloak(url, map, MediaType.APPLICATION_JSON, @@ -2122,7 +2124,7 @@ protected byte[] getWithPathParamAndCookieForPdf(String url, String jsonInput, b token = kernelAuthLib.getTokenByRole(role); } logger.info(GlobalConstants.GET_REQ_STRING + url); - GlobalMethods.reportRequest(null, jsonInput); + GlobalMethods.reportRequest(null, jsonInput, url); try { if (bothAccessAndIdToken) { @@ -2165,7 +2167,7 @@ protected byte[] postWithBodyAndCookieForPdf(String url, String jsonInput, Strin token = kernelAuthLib.getTokenByRole(role); } logger.info("******post request to EndPointUrl: " + url); - GlobalMethods.reportRequest(null, jsonInput); + GlobalMethods.reportRequest(null, jsonInput, url); try { if (bothAccessAndIdToken) { pdf = RestClient.postWithBodyForPdf(url, jsonInput, MediaType.APPLICATION_JSON, @@ -2206,7 +2208,7 @@ protected byte[] getWithQueryParamAndCookieForPdf(String url, String jsonInput, token = kernelAuthLib.getTokenByRole(role); } logger.info(GlobalConstants.GET_REQ_STRING + url); - GlobalMethods.reportRequest(null, jsonInput); + GlobalMethods.reportRequest(null, jsonInput, url); try { if (bothAccessAndIdToken) { pdf = RestClient.getPdfWithQueryParm(url, map, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, @@ -2238,7 +2240,7 @@ protected Response getWithQueryParamAndCookie(String url, String jsonInput, Stri token = kernelAuthLib.getTokenByRole(role); logger.info(GlobalConstants.GET_REQ_STRING + url); - GlobalMethods.reportRequest(null, jsonInput); + GlobalMethods.reportRequest(null, jsonInput, url); try { response = RestClient.getRequestWithCookieAndQueryParm(url, map, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, cookieName, token); @@ -2265,7 +2267,7 @@ protected Response patchWithQueryParamAndCookie(String url, String jsonInput, St token = kernelAuthLib.getTokenByRole(role); logger.info(GlobalConstants.GET_REQ_STRING + url); - GlobalMethods.reportRequest(null, jsonInput); + GlobalMethods.reportRequest(null, jsonInput, url); try { response = RestClient.patchRequestWithCookieAndQueryParm(url, map, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, cookieName, token); @@ -3107,6 +3109,7 @@ public String inputJsonKeyWordHandeler(String jsonString, String testCaseName) { jsonString = replaceKeywordWithValue(jsonString, "$IDENTITYJSON$", generateIdentityJson(testCaseName)); } if (jsonString.contains("$RANDOMID$")) { + jsonString = replaceKeywordWithValue(jsonString, "$RANDOMID$V2S2", RANDOM_ID_V2_S2); jsonString = replaceKeywordWithValue(jsonString, "$RANDOMID$V2", RANDOM_ID_V2); jsonString = replaceKeywordWithValue(jsonString, "$RANDOMID$2", RANDOM_ID_2); jsonString = replaceKeywordWithValue(jsonString, "$RANDOMID$", RANDOM_ID); @@ -3722,9 +3725,11 @@ public OutputValidationDto customStatusCodeResponse(String responseStatusCode, S customResponse.setFieldName("status"); if (customResponse.getActualValue().equals(customResponse.getExpValue())) { customResponse.setStatus("PASS"); - } else { - customResponse.setStatus(GlobalConstants.FAIL_STRING); } + else if (Integer.parseInt(responseStatusCode) >= 200 && Integer.parseInt(responseStatusCode) < 300) + customResponse.setStatus(GlobalConstants.FAIL_STRING); + else + throw new SkipException("API endpoint is not valid. Response code: " + responseStatusCode); return customResponse; } @@ -3937,7 +3942,7 @@ protected Response postWithOnlyPathParamAndCookie(String url, String jsonInput, token = kernelAuthLib.getTokenByRole(role); } logger.info(GlobalConstants.GET_REQ_STRING + url); - GlobalMethods.reportRequest(null, jsonInput); + GlobalMethods.reportRequest(null, jsonInput, url); try { if (bothAccessAndIdToken) { response = RestClient.postRequestWithCookieAndOnlyPathParm(url, map, MediaType.APPLICATION_JSON, @@ -3969,7 +3974,7 @@ protected Response postWithOnlyQueryParamAndCookie(String url, String jsonInput, token = kernelAuthLib.getTokenByRole(role); logger.info(GlobalConstants.GET_REQ_STRING + url); - GlobalMethods.reportRequest(null, jsonInput); + GlobalMethods.reportRequest(null, jsonInput, url); try { response = RestClient.postRequestWithQueryParm(url, map, "*/*", "*/*", cookieName, token); GlobalMethods.reportResponse(response.getHeaders().asList().toString(), url, response); @@ -6451,7 +6456,7 @@ public static String ekycDataDecryptionForDemo(String url, JSONObject kycDataFor queryParamMap.put("keyFileNameByPartnerName", keyFileNameByPartnerName); - GlobalMethods.reportRequest(null, map.toString()); + GlobalMethods.reportRequest(null, map.toString(), url); Response response = RestClient.postRequestWithQueryParamsAndBody(url, map, queryParamMap, MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN); diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/authentication/fw/util/OutputValidationUtil.java b/automationtests/src/main/java/io/mosip/testrig/apirig/authentication/fw/util/OutputValidationUtil.java index 9bde775df6d..e726c71fc98 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/authentication/fw/util/OutputValidationUtil.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/authentication/fw/util/OutputValidationUtil.java @@ -37,19 +37,20 @@ * @author Vignesh * */ -public class OutputValidationUtil extends AuthTestsUtil{ +public class OutputValidationUtil extends AuthTestsUtil { private static final Logger OUTPUTVALIDATION_LOGGER = Logger.getLogger(OutputValidationUtil.class); - + public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) OUTPUTVALIDATION_LOGGER.setLevel(Level.ALL); else OUTPUTVALIDATION_LOGGER.setLevel(Level.ERROR); } - + /** - * The method will perform output validation by comparing expected and actual value + * The method will perform output validation by comparing expected and actual + * value * * @param actualOutputFile * @param expOutputFile @@ -71,7 +72,7 @@ public static void setLogLevel() { // return Collections.emptyMap(); // } // } - + /** * The method will compare expected and actual value * @@ -79,14 +80,14 @@ public static void setLogLevel() { * @param exp * @param actVsExp * @return map - * @throws JsonMappingException - * @throws JsonParseException + * @throws JsonMappingException + * @throws JsonParseException */ public static Map> compareActuExpValue(Map actual, Map exp, String actVsExp) { - if(actual == null || exp == null) + if (actual == null || exp == null) throw new SkipException("Marking testcase as Skipped, as no Output comparison done"); - + Map> objMap = new HashMap<>(); List objList = new ArrayList(); boolean comparisonDone = false; @@ -145,7 +146,8 @@ public static Map> compareActuExpValue(Map> compareActuExpValue(Map> compareActuExpValue(Map> compareActuExpValue(Map> OUTPUTVALIDATION_LOGGER.info(GlobalConstants.EXPECTED_VALUE_STRING + dto.getExpValue()); OUTPUTVALIDATION_LOGGER.info(GlobalConstants.ACTUAL_VALUE_STRING + dto.getActualValue()); OUTPUTVALIDATION_LOGGER.info(GlobalConstants.STATUS_STRING + dto.getStatus()); - }else if (dto.getStatus().equals("WARNING")) { + } else if (dto.getStatus().equals("WARNING")) { OUTPUTVALIDATION_LOGGER.info(GlobalConstants.JSONFIELD_PATH_STRING + dto.getFieldName()); OUTPUTVALIDATION_LOGGER.info(GlobalConstants.EXPECTED_VALUE_STRING + dto.getExpValue()); OUTPUTVALIDATION_LOGGER.info(GlobalConstants.ACTUAL_VALUE_STRING + dto.getActualValue()); OUTPUTVALIDATION_LOGGER.info(GlobalConstants.STATUS_STRING + dto.getStatus()); - }else if (dto.getStatus().equals(GlobalConstants.FAIL_STRING)) { + } else if (dto.getStatus().equals(GlobalConstants.FAIL_STRING)) { OUTPUTVALIDATION_LOGGER.error(GlobalConstants.JSONFIELD_PATH_STRING + dto.getFieldName()); OUTPUTVALIDATION_LOGGER.error(GlobalConstants.EXPECTED_VALUE_STRING + dto.getExpValue()); OUTPUTVALIDATION_LOGGER.error(GlobalConstants.ACTUAL_VALUE_STRING + dto.getActualValue()); @@ -403,7 +407,7 @@ public static boolean publishOutputResult(Map> "*******************************************************************************************************"); return outputStatus; } - + /** * The method will perform token id operation for uin * @@ -426,79 +430,85 @@ public static void performTokenIdOper(String uin, String tspId, String tokenId) generateMappingDic(file.getAbsolutePath(), map); } } - + public static boolean compareTwoKycMap(Map expMap, Map actualMap) { for (Entry entry : expMap.entrySet()) { if (actualMap.containsKey(entry.getKey())) { - - if(entry.getValue()==null || actualMap.get(entry.getKey())==null) + + if (entry.getValue() == null || actualMap.get(entry.getKey()) == null) continue; try { - if (actualMap.get(entry.getKey()).toString().contains(",") - && entry.getValue().toString().contains(",")) { - String[] value = entry.getValue().toString().split(Pattern.quote("}, {")); - for (int i = 0; i < value.length; i++) { - String normalise = value[i].replace("{", "").replace("[", "").replace("}", "") - .replace("]", ""); - if (!actualMap.get(entry.getKey()).toString().contains(normalise)) { - return false; + if (actualMap.get(entry.getKey()).toString().contains(",") + && entry.getValue().toString().contains(",")) { + String[] value = entry.getValue().toString().split(Pattern.quote("}, {")); + for (int i = 0; i < value.length; i++) { + String normalise = value[i].replace("{", "").replace("[", "").replace("}", "").replace("]", + ""); + if (!actualMap.get(entry.getKey()).toString().contains(normalise)) { + return false; + } } + } else if (!actualMap.get(entry.getKey()).equals(entry.getValue())) { + return false; } - } - else if (!actualMap.get(entry.getKey()).equals(entry.getValue())) { - return false; - } - }catch(Exception e) - { + } catch (Exception e) { OUTPUTVALIDATION_LOGGER.error(e.getMessage()); } } } return true; } - + public static Map> doJsonOutputValidation(String actualOutputJson, - String expOutputJson, boolean checkErrorsOnlyInResponse, String allowedErrorCode) throws AdminTestException { - return doJsonOutputValidation(actualOutputJson, - expOutputJson, checkErrorsOnlyInResponse, GlobalConstants.EXPECTED_VS_ACTUAL, doesResponseHasErrors(actualOutputJson), allowedErrorCode); + String expOutputJson, boolean checkErrorsOnlyInResponse, String allowedErrorCode, int responseStatusCode) + throws AdminTestException { + return doJsonOutputValidation(actualOutputJson, expOutputJson, checkErrorsOnlyInResponse, + GlobalConstants.EXPECTED_VS_ACTUAL, doesResponseHasErrors(actualOutputJson), allowedErrorCode, + responseStatusCode); } - + public static Map> doJsonOutputValidation(String actualOutputJson, - String expOutputJson, boolean checkErrorsOnlyInResponse) throws AdminTestException { - return doJsonOutputValidation(actualOutputJson, - expOutputJson, checkErrorsOnlyInResponse, GlobalConstants.EXPECTED_VS_ACTUAL, doesResponseHasErrors(actualOutputJson), null); + String expOutputJson, boolean checkErrorsOnlyInResponse, int responseStatusCode) throws AdminTestException { + return doJsonOutputValidation(actualOutputJson, expOutputJson, checkErrorsOnlyInResponse, + GlobalConstants.EXPECTED_VS_ACTUAL, doesResponseHasErrors(actualOutputJson), null, responseStatusCode); } - - + public static Map> doJsonOutputValidation(String actualOutputJson, - String expOutputJson, boolean checkErrorsOnlyInResponse, String context, boolean responseHasErrors, String allowedErrorCode) throws AdminTestException { + String expOutputJson, boolean checkErrorsOnlyInResponse, String context, boolean responseHasErrors, + String allowedErrorCode, int responseStatusCode) throws AdminTestException { if (doesResponseHasErrorCode(actualOutputJson, 500)) throw new AdminTestException("Internal Server Error. Hence marking the test case as failed"); else if (doesResponseHasErrorCode(actualOutputJson, 404)) - throw new AdminTestException("Page not found. Hence marking the test case as failed"); + throw new SkipException("API end point is not valid. Hence marking the test case as skipped"); + else if (!(responseStatusCode >= 200 && responseStatusCode < 300)) + throw new SkipException("API endpoint is not valid. Response code: " + responseStatusCode + " Hence marking the test case as skipped"); else if (doesResponseHasErrorCode(actualOutputJson, allowedErrorCode)) return Collections.emptyMap(); JsonPrecondtion jsonPrecondtion = new JsonPrecondtion(); - Map actual = jsonPrecondtion.retrieveMappingAndItsValueToPerformJsonOutputValidation(actualOutputJson); - Map exp = jsonPrecondtion.retrieveMappingAndItsValueToPerformJsonOutputValidation(expOutputJson); - - return doJsonOutputValidation(actual, exp, checkErrorsOnlyInResponse, context, responseHasErrors, allowedErrorCode); + Map actual = jsonPrecondtion + .retrieveMappingAndItsValueToPerformJsonOutputValidation(actualOutputJson); + Map exp = jsonPrecondtion + .retrieveMappingAndItsValueToPerformJsonOutputValidation(expOutputJson); + + return doJsonOutputValidation(actual, exp, checkErrorsOnlyInResponse, context, responseHasErrors, + allowedErrorCode, responseStatusCode); } - + public static Map> doJsonOutputValidation(Map actualOutput, - Map expOutput, boolean checkErrorsOnlyInResponse, String context, boolean responseHasErrors, String allowedErrorCode ) throws AdminTestException { + Map expOutput, boolean checkErrorsOnlyInResponse, String context, boolean responseHasErrors, + String allowedErrorCode, int responseStatusCode) throws AdminTestException { try { return compareActuExpValue(actualOutput, expOutput, context); - }catch (SkipException e) { - if (responseHasErrors) + } catch (SkipException e) { + if (responseHasErrors) throw new AdminTestException("Response has errors"); - else if(!checkErrorsOnlyInResponse) + else if (!checkErrorsOnlyInResponse) throw new SkipException(e.getMessage()); - else + else return Collections.emptyMap(); // No output validation required. Hence marking the test case as passed } } - + public static boolean doesResponseHasErrors(String responseString) { JSONObject responseJson = new JSONObject(responseString); boolean breturn = false; @@ -506,27 +516,26 @@ public static boolean doesResponseHasErrors(String responseString) { String error = null; if (responseJson.has("errors")) { errors = responseJson.optJSONArray("errors"); - } - else if (responseJson.has("error")) { + } else if (responseJson.has("error")) { error = responseJson.getString("error"); } if (errors != null) breturn = (errors.length() > 0); else if (error != null) breturn = true; - + return breturn; } - + public static boolean doesResponseHasErrorCode(String responseString, int errorCode) { JSONObject responseJson = new JSONObject(responseString); if (responseJson.has("status")) { return responseJson.getInt("status") == errorCode; } - + return false; } - + public static boolean doesResponseHasErrorCode(String responseString, String allowedErrorCode) { boolean responseHasAllowedErrorCode = false; if (allowedErrorCode != null) { @@ -540,5 +549,5 @@ public static boolean doesResponseHasErrorCode(String responseString, String all } return responseHasAllowedErrorCode; } - + } diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/global/utils/GlobalConstants.java b/automationtests/src/main/java/io/mosip/testrig/apirig/global/utils/GlobalConstants.java index 6de6751b538..34f58c318e3 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/global/utils/GlobalConstants.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/global/utils/GlobalConstants.java @@ -55,10 +55,11 @@ public class GlobalConstants { public static final String APIKEY = "apiKey"; public static final String PARTNER_APIKEY = "partnerApiKey"; public static final String PARTNERID = "partnerId"; - public static final String REPORT_RESPONSE_PREFIX = "Response: (End Point URL: "; + public static final String REPORT_RESPONSE_PREFIX = "Response: "; public static final String REPORT_RESPONSE_SUFFIX = ""; - public static final String REPORT_RESPONSE_BODY = ")
";
-	public static final String REPORT_REQUEST_PREFIX = "
";
+	public static final String REPORT_RESPONSE_BODY = "
";
+	public static final String REPORT_REQUEST_PREFIX = "Request: (End Point URL: ";
+	public static final String REPORT_REQUEST_BODY = ") 
";
 	public static final String REPORT_REQUEST_SUFFIX = "
"; public static final String EXCEPTION_STRING_1 = " Exception: "; public static final String EXCEPTION_STRING_2 = "Exception "; diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/global/utils/GlobalMethods.java b/automationtests/src/main/java/io/mosip/testrig/apirig/global/utils/GlobalMethods.java index b338fb95c68..7b71f4b545a 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/global/utils/GlobalMethods.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/global/utils/GlobalMethods.java @@ -17,27 +17,30 @@ public class GlobalMethods { private static final Logger logger = Logger.getLogger(GlobalMethods.class); public static void ReportRequestAndResponse(String reqHeader,String resHeader,String url, String requestBody, String response) { - reportRequest(reqHeader,requestBody); + reportRequest(reqHeader,requestBody, url); reportResponse(resHeader,url, response); } - public static void reportRequest(String requestHeader, String request) { + reportRequest(requestHeader, request, ""); + } + + public static void reportRequest(String requestHeader, String request, String url) { String formattedHeader = ReportUtil.getTextAreaForHeaders(requestHeader); if (request != null && !request.equals("{}")) - Reporter.log(GlobalConstants.REPORT_REQUEST_PREFIX + formattedHeader + ReportUtil.getTextAreaJsonMsgHtml(request) + Reporter.log(GlobalConstants.REPORT_REQUEST_PREFIX + url + GlobalConstants.REPORT_REQUEST_BODY + formattedHeader + ReportUtil.getTextAreaJsonMsgHtml(request) + GlobalConstants.REPORT_REQUEST_SUFFIX); else Reporter.log( - GlobalConstants.REPORT_REQUEST_PREFIX + formattedHeader + "No request body" + GlobalConstants.REPORT_REQUEST_SUFFIX); + GlobalConstants.REPORT_REQUEST_PREFIX + url + GlobalConstants.REPORT_REQUEST_BODY + formattedHeader + "No request body" + GlobalConstants.REPORT_REQUEST_SUFFIX); } public static void reportResponse(String responseHeader, String url, Response response) { String formattedHeader = ReportUtil.getTextAreaForHeaders(responseHeader); - Reporter.log(GlobalConstants.REPORT_RESPONSE_PREFIX + url + GlobalConstants.REPORT_RESPONSE_BODY + formattedHeader + Reporter.log(GlobalConstants.REPORT_RESPONSE_PREFIX + GlobalConstants.REPORT_RESPONSE_BODY + formattedHeader + ReportUtil.getTextAreaJsonMsgHtml(response.asString()) + GlobalConstants.REPORT_RESPONSE_SUFFIX); } @@ -49,10 +52,10 @@ public static void reportResponse(String responseHeader, String url, String resp String formattedHeader = ReportUtil.getTextAreaForHeaders(responseHeader); if (formatResponse) - Reporter.log(GlobalConstants.REPORT_RESPONSE_PREFIX + url + GlobalConstants.REPORT_RESPONSE_BODY + formattedHeader + Reporter.log(GlobalConstants.REPORT_RESPONSE_PREFIX + GlobalConstants.REPORT_RESPONSE_BODY + formattedHeader + ReportUtil.getTextAreaJsonMsgHtml(response) + GlobalConstants.REPORT_RESPONSE_SUFFIX); else - Reporter.log(GlobalConstants.REPORT_RESPONSE_PREFIX + url + GlobalConstants.REPORT_RESPONSE_BODY + responseHeader + response + Reporter.log(GlobalConstants.REPORT_RESPONSE_PREFIX + GlobalConstants.REPORT_RESPONSE_BODY + responseHeader + response + GlobalConstants.REPORT_RESPONSE_SUFFIX); } diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/AddIdentity.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/AddIdentity.java index 2752367d666..f8cc2353740 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/AddIdentity.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/AddIdentity.java @@ -53,9 +53,9 @@ public class AddIdentity extends AdminTestUtil implements ITest { @Override public String getTestName() { return testCaseName; - + } - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -75,7 +75,6 @@ public Object[] getTestCaseList(ITestContext context) { logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -85,7 +84,7 @@ public Object[] getTestCaseList(ITestContext context) { * @param testcaseName * @throws AuthenticationTestException * @throws AdminTestException - */ + */ @Test(dataProvider = "testcaselist") public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { testCaseName = testCaseDTO.getTestCaseName(); @@ -127,8 +126,6 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad String jsonInput = testCaseDTO.getInput(); - - String inputJson = getJsonFromTemplate(jsonInput, testCaseDTO.getInputTemplate(), false); inputJson = inputJson.replace("$UIN$", uin); @@ -138,7 +135,8 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); if (!OutputValidationUtil.publishOutputResult(ouputValid)) @@ -176,7 +174,8 @@ public void waittime() { try { if (BaseTestCase.currentModule.equals("auth")) { - logger.info("waiting for " + properties.getProperty("Delaytime") + " mili secs after UIN Generation In IDREPO"); // + logger.info("waiting for " + properties.getProperty("Delaytime") + + " mili secs after UIN Generation In IDREPO"); // Thread.sleep(Long.parseLong(properties.getProperty("Delaytime"))); } } catch (Exception e) { diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/BioAuth.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/BioAuth.java index 945ebd92e1b..e95370b0786 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/BioAuth.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/BioAuth.java @@ -185,8 +185,8 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad } } - Map> ouputValid = OutputValidationUtil - .doJsonOutputValidation(response.asString(), ActualOPJson, testCaseDTO.isCheckErrorsOnlyInResponse()); + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), ActualOPJson, testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); if (!OutputValidationUtil.publishOutputResult(ouputValid)) @@ -205,21 +205,21 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad JSONObject jsonObjectkycRes = new JSONObject(res); JSONObject jsonObjectFromKycData = new JSONObject(); JSONObject jsonObjectFromIdentityData = new JSONObject(); - //List myList =new ArrayList<>(); - + // List myList =new ArrayList<>(); + ArrayList names = new ArrayList<>(); ArrayList 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; - } - } - + 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( @@ -232,26 +232,24 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad JSONObject responseBody = new JSONObject(newResponse.getBody().asString()).getJSONObject("response") .getJSONObject("identity"); - - - for(int j=0;j> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); if (!OutputValidationUtil.publishOutputResult(ouputValid)) throw new AdminTestException("Failed at output validation"); - - if(testCaseName.toLowerCase().contains("kyc")) { + + if (testCaseName.toLowerCase().contains("kyc")) { JSONObject resJsonObject = new JSONObject(response.asString()); - String res=""; + String res = ""; try { res = resJsonObject.get("response").toString(); } catch (JSONException e) { logger.error(e.getMessage()); } Reporter.log("Request for decrypting kyc data"); - response = postWithBodyAcceptTextPlainAndCookie(EncryptionDecrptionUtil.getEncryptUtilBaseUrl()+properties.getProperty("decryptkycdataurl"), - res, COOKIENAME, testCaseDTO.getRole(), "decryptEkycData"); + response = postWithBodyAcceptTextPlainAndCookie( + EncryptionDecrptionUtil.getEncryptUtilBaseUrl() + properties.getProperty("decryptkycdataurl"), res, + COOKIENAME, testCaseDTO.getRole(), "decryptEkycData"); } - } - - /** * The method ser current test name to result * @@ -177,8 +174,7 @@ public void setResultTestName(ITestResult result) { } catch (Exception e) { Reporter.log("Exception : " + e.getMessage()); } - - + } @AfterClass diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/BookAppoinmentByPrid.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/BookAppoinmentByPrid.java index 4951b65759b..7e20d34835a 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/BookAppoinmentByPrid.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/BookAppoinmentByPrid.java @@ -38,7 +38,7 @@ public class BookAppoinmentByPrid extends AdminTestUtil implements ITest { private static final Logger logger = Logger.getLogger(BookAppoinmentByPrid.class); protected String testCaseName = ""; public Response response = null; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -46,7 +46,7 @@ public static void setLogLevel() { else logger.setLevel(Level.ERROR); } - + /** * get current testcaseName */ @@ -63,11 +63,9 @@ public String getTestName() { @DataProvider(name = "testcaselist") public Object[] getTestCaseList(ITestContext context) { String ymlFile = context.getCurrentXmlTest().getLocalParameters().get("ymlFile"); - logger.info("Started executing yml: "+ymlFile); + logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - - /** * Test method for OTP Generation execution @@ -79,18 +77,22 @@ public Object[] getTestCaseList(ITestContext context) { * @throws AdminTestException */ @Test(dataProvider = "testcaselist") - public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { + public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { String regCenterId = null; String appDate = null; String timeSlotFrom = null; String timeSlotTo = null; - testCaseName = testCaseDTO.getTestCaseName(); + testCaseName = testCaseDTO.getTestCaseName(); if (HealthChecker.signalTerminateExecution) { throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS); } - Response slotAvailabilityResponse=RestClient.getRequestWithCookie(ApplnURI+properties.getProperty("appointmentavailabilityurl")+properties.getProperty("regcentretobookappointment"), MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, COOKIENAME, new KernelAuthentication().getTokenByRole(testCaseDTO.getRole())); + Response slotAvailabilityResponse = RestClient.getRequestWithCookie( + ApplnURI + properties.getProperty("appointmentavailabilityurl") + + properties.getProperty("regcentretobookappointment"), + MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, COOKIENAME, + new KernelAuthentication().getTokenByRole(testCaseDTO.getRole())); List appointmentDetails = AdminTestUtil.getAppointmentDetails(slotAvailabilityResponse); - if(appointmentDetails.size()>=4) { + if (appointmentDetails.size() >= 4) { try { regCenterId = appointmentDetails.get(0); appDate = appointmentDetails.get(1); @@ -101,17 +103,19 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad Assert.fail("Centers unavailable"); } } - String inputJosn=getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()); - inputJosn=inputJosn.replace("$registration_center_id$", regCenterId); - inputJosn=inputJosn.replace("$appointment_date$", appDate); - inputJosn=inputJosn.replace("$time_slot_from$", timeSlotFrom); - inputJosn=inputJosn.replace("$time_slot_to$", timeSlotTo); - response = postWithBodyAndCookie(ApplnURI + testCaseDTO.getEndPoint(), inputJosn, COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); - - Map> ouputValid = OutputValidationUtil - .doJsonOutputValidation(response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + String inputJosn = getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()); + inputJosn = inputJosn.replace("$registration_center_id$", regCenterId); + inputJosn = inputJosn.replace("$appointment_date$", appDate); + inputJosn = inputJosn.replace("$time_slot_from$", timeSlotFrom); + inputJosn = inputJosn.replace("$time_slot_to$", timeSlotTo); + response = postWithBodyAndCookie(ApplnURI + testCaseDTO.getEndPoint(), inputJosn, COOKIENAME, + testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - + if (!OutputValidationUtil.publishOutputResult(ouputValid)) throw new AdminTestException("Failed at output validation"); @@ -136,5 +140,5 @@ public void setResultTestName(ITestResult result) { Reporter.log("Exception : " + e.getMessage()); } } - + } diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/CreatePreReg.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/CreatePreReg.java index 66f8224669a..961ed75eab4 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/CreatePreReg.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/CreatePreReg.java @@ -38,7 +38,7 @@ public class CreatePreReg extends AdminTestUtil implements ITest { protected String testCaseName = ""; public String idKeyName = null; public Response response = null; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -67,8 +67,6 @@ public Object[] getTestCaseList(ITestContext context) { logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - - /** * Test method for OTP Generation execution @@ -90,39 +88,39 @@ public void test(TestCaseDTO testCaseDTO) testCaseDTO.setInputTemplate(AdminTestUtil.generateHbsForPrereg(false)); String[] templateFields = testCaseDTO.getTemplateFields(); - - String jsonInput = testCaseDTO.getInput(); - + String inputJson = getJsonFromTemplate(jsonInput, testCaseDTO.getInputTemplate(), false); String outputJson = getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()); if (testCaseDTO.getTemplateFields() != null && templateFields.length > 0) { ArrayList inputtestCases = AdminTestUtil.getInputTestCase(testCaseDTO); ArrayList outputtestcase = AdminTestUtil.getOutputTestCase(testCaseDTO); - + languageList = new ArrayList<>(BaseTestCase.getLanguageList()); for (int i = 0; i < languageList.size(); i++) { - response = postWithBodyAndCookieForAutoGeneratedId(ApplnURI + testCaseDTO.getEndPoint(), - getJsonFromTemplate(inputtestCases.get(i).toString(), testCaseDTO.getInputTemplate()), - COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), idKeyName); + response = postWithBodyAndCookieForAutoGeneratedId(ApplnURI + testCaseDTO.getEndPoint(), + getJsonFromTemplate(inputtestCases.get(i).toString(), testCaseDTO.getInputTemplate()), + COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), idKeyName); - Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), - getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); - if (testCaseDTO.getTestCaseName().toLowerCase().contains("dynamic")) { - JSONObject json = new JSONObject(response.asString()); - idField = json.getJSONObject("response").get("id").toString(); - } - Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), + getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); + if (testCaseDTO.getTestCaseName().toLowerCase().contains("dynamic")) { + JSONObject json = new JSONObject(response.asString()); + idField = json.getJSONObject("response").get("id").toString(); + } + Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - if (!OutputValidationUtil.publishOutputResult(ouputValid)) - throw new AdminTestException("Failed at output validation"); + if (!OutputValidationUtil.publishOutputResult(ouputValid)) + throw new AdminTestException("Failed at output validation"); } } else { response = postWithBodyAndCookieForAutoGeneratedId(ApplnURI + testCaseDTO.getEndPoint(), inputJson, COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), idKeyName); - Map> ouputValid = OutputValidationUtil - .doJsonOutputValidation(response.asString(), outputJson, testCaseDTO.isCheckErrorsOnlyInResponse()); + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), outputJson, testCaseDTO.isCheckErrorsOnlyInResponse(), + response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); if (!OutputValidationUtil.publishOutputResult(ouputValid)) throw new AdminTestException("Failed at output validation"); diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/DeleteWithParam.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/DeleteWithParam.java index 89236ba7c1e..b2f84832bc5 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/DeleteWithParam.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/DeleteWithParam.java @@ -37,7 +37,7 @@ public class DeleteWithParam extends AdminTestUtil implements ITest { protected String testCaseName = ""; public Response response = null; public boolean sendEsignetToken = false; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -66,7 +66,6 @@ public Object[] getTestCaseList(ITestContext context) { logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -89,28 +88,30 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad if (testCaseDTO.getTemplateFields() != null && templateFields.length > 0) { ArrayList inputtestCases = AdminTestUtil.getInputTestCase(testCaseDTO); ArrayList outputtestcase = AdminTestUtil.getOutputTestCase(testCaseDTO); - - for (int i=0; i> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), - getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); - Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - - if (!OutputValidationUtil.publishOutputResult(ouputValid)) - throw new AdminTestException("Failed at output validation"); - } - } - + + for (int i = 0; i < languageList.size(); i++) { + response = deleteWithPathParamAndCookie(ApplnURI + testCaseDTO.getEndPoint(), + getJsonFromTemplate(inputtestCases.get(i).toString(), testCaseDTO.getInputTemplate()), + COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), + getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); + Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); + + if (!OutputValidationUtil.publishOutputResult(ouputValid)) + throw new AdminTestException("Failed at output validation"); + } + } + else { response = deleteWithPathParamAndCookie(ApplnURI + testCaseDTO.getEndPoint(), getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()), COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), sendEsignetToken); Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); if (!OutputValidationUtil.publishOutputResult(ouputValid)) throw new AdminTestException("Failed at output validation"); diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/DemoAuth.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/DemoAuth.java index c092905ce82..8582d8d4e62 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/DemoAuth.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/DemoAuth.java @@ -36,6 +36,7 @@ import io.mosip.testrig.apirig.service.BaseTestCase; import io.mosip.testrig.apirig.testrunner.HealthChecker; import io.restassured.response.Response; + public class DemoAuth extends AdminTestUtil implements ITest { private static final Logger logger = Logger.getLogger(DemoAuth.class); protected String testCaseName = ""; @@ -69,8 +70,6 @@ public Object[] getTestCaseList(ITestContext context) { logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - - /** * Test method for OTP Generation execution @@ -87,28 +86,28 @@ 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("uin") || testCaseDTO.getTestCaseName().contains("UIN")) { if (!BaseTestCase.getSupportedIdTypesValueFromActuator().contains("UIN") && !BaseTestCase.getSupportedIdTypesValueFromActuator().contains("uin")) { throw new SkipException("Idtype UIN is not supported. Hence skipping the testcase"); } } - + 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 (testCaseDTO.getEndPoint().contains("$partnerKeyURL$")) { testCaseDTO.setEndPoint( testCaseDTO.getEndPoint().replace("$partnerKeyURL$", PartnerRegistration.partnerKeyUrl)); } JSONObject request = new JSONObject(testCaseDTO.getInput()); String identityRequest = null; - String identityRequestTemplate = null; + String identityRequestTemplate = null; if (request.has(GlobalConstants.IDENTITYREQUEST)) { identityRequest = request.get(GlobalConstants.IDENTITYREQUEST).toString(); request.remove(GlobalConstants.IDENTITYREQUEST); @@ -160,8 +159,8 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad } } - Map> ouputValid = OutputValidationUtil - .doJsonOutputValidation(response.asString(), ActualOPJson, testCaseDTO.isCheckErrorsOnlyInResponse()); + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), ActualOPJson, testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); if (!OutputValidationUtil.publishOutputResult(ouputValid)) diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/DemoAuthSimplePostForAutoGenId.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/DemoAuthSimplePostForAutoGenId.java index 436516c7e0e..14e63181bb0 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/DemoAuthSimplePostForAutoGenId.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/DemoAuthSimplePostForAutoGenId.java @@ -49,8 +49,8 @@ public class DemoAuthSimplePostForAutoGenId extends AdminTestUtil implements ITe public String idKeyName = null; public Response response = null; public Response newResponse = null; - String url=""; - + String url = ""; + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -79,8 +79,6 @@ public Object[] getTestCaseList(ITestContext context) { logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - - /** * Test method for OTP Generation execution @@ -100,21 +98,21 @@ public void test(TestCaseDTO testCaseDTO) if (HealthChecker.signalTerminateExecution) { throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS); } - + if (testCaseDTO.getTestCaseName().contains("uin") || testCaseDTO.getTestCaseName().contains("UIN")) { if (!BaseTestCase.getSupportedIdTypesValueFromActuator().contains("UIN") && !BaseTestCase.getSupportedIdTypesValueFromActuator().contains("uin")) { throw new SkipException("Idtype UIN is not supported. Hence skipping the testcase"); } } - + 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 (testCaseDTO.getEndPoint().contains("$PartnerKeyURL$")) { testCaseDTO.setEndPoint( testCaseDTO.getEndPoint().replace("$PartnerKeyURL$", PartnerRegistration.partnerKeyUrl)); @@ -143,13 +141,11 @@ public void test(TestCaseDTO testCaseDTO) if (input.contains("$PRIMARYLANG$")) input = input.replace("$PRIMARYLANG$", BaseTestCase.languageList.get(0)); - - + if (input.contains("name") & testCaseDTO.getTestCaseName().contains("titleFromAdmin")) { input = AdminTestUtil.inputTitleHandler(input); } - - + if (input.contains("$NAMEPRIMARYLANG$")) { String name = ""; if (BaseTestCase.isTargetEnvLTS()) @@ -167,14 +163,14 @@ public void test(TestCaseDTO testCaseDTO) individualId = AdminTestUtil.getValueFromUrl(resolvedUri, "id"); String inputJson = getJsonFromTemplate(input, testCaseDTO.getInputTemplate()); - + String phone = getValueFromAuthActuator("json-property", "phone_number"); String result = phone.replaceAll("\\[\"|\"\\]", ""); String email = getValueFromAuthActuator("json-property", "emailId"); String emailResult = email.replaceAll("\\[\"|\"\\]", ""); inputJson = inputJson.replace("\"phone\":", "\"" + result + "\":"); inputJson = inputJson.replace("\"email\":", "\"" + emailResult + "\":"); - + String outputJson = getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()); if (testCaseDTO.getTemplateFields() != null && templateFields.length > 0) { @@ -182,31 +178,31 @@ public void test(TestCaseDTO testCaseDTO) ArrayList outputtestcase = AdminTestUtil.getOutputTestCase(testCaseDTO); languageList = Arrays.asList(System.getProperty("env.langcode").split(",")); for (int i = 0; i < languageList.size(); i++) { - response = postWithBodyAndCookieForAutoGeneratedId(ApplnURI + testCaseDTO.getEndPoint(), - getJsonFromTemplate(inputtestCases.get(i).toString(), testCaseDTO.getInputTemplate()), - COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), idKeyName); - - Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), - getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); - if (testCaseDTO.getTestCaseName().toLowerCase().contains("dynamic")) { - JSONObject json = new JSONObject(response.asString()); - idField = json.getJSONObject("response").get("id").toString(); - } - Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); + response = postWithBodyAndCookieForAutoGeneratedId(ApplnURI + testCaseDTO.getEndPoint(), + getJsonFromTemplate(inputtestCases.get(i).toString(), testCaseDTO.getInputTemplate()), + COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), idKeyName); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), + getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); + if (testCaseDTO.getTestCaseName().toLowerCase().contains("dynamic")) { + JSONObject json = new JSONObject(response.asString()); + idField = json.getJSONObject("response").get("id").toString(); + } + Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - if (!OutputValidationUtil.publishOutputResult(ouputValid)) - throw new AdminTestException("Failed at output validation"); + if (!OutputValidationUtil.publishOutputResult(ouputValid)) + throw new AdminTestException("Failed at output validation"); } } else { - if(testCaseName.contains("partnerDemoDown")){ - - url = ConfigManager.getAuthDemoServiceUrl()+"local"; - } - else { - url = ConfigManager.getAuthDemoServiceUrl(); + if (testCaseName.contains("partnerDemoDown")) { + + url = ConfigManager.getAuthDemoServiceUrl() + "local"; + } else { + url = ConfigManager.getAuthDemoServiceUrl(); } - + response = postWithBodyAndCookie(url + testCaseDTO.getEndPoint(), inputJson, COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); String ActualOPJson = getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()); @@ -239,13 +235,14 @@ public void test(TestCaseDTO testCaseDTO) } } - Map> ouputValid = OutputValidationUtil - .doJsonOutputValidation(response.asString(), ActualOPJson, testCaseDTO.isCheckErrorsOnlyInResponse()); + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), ActualOPJson, testCaseDTO.isCheckErrorsOnlyInResponse(), + 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 = ""; @@ -254,26 +251,27 @@ public void test(TestCaseDTO testCaseDTO) resJsonObject = new JSONObject(response.getBody().asString()).getJSONObject("authResponse") .getJSONObject("body").getJSONObject("response"); - res = AdminTestUtil.ekycDataDecryptionForDemo(url, resJsonObject, PartnerRegistration.ekycPartnerId, true); + res = AdminTestUtil.ekycDataDecryptionForDemo(url, resJsonObject, PartnerRegistration.ekycPartnerId, + true); JSONObject jsonObjectkycRes = new JSONObject(res); JSONObject jsonObjectFromKycData = new JSONObject(); JSONObject jsonObjectFromIdentityData = new JSONObject(); - //List myList =new ArrayList<>(); - + // List myList =new ArrayList<>(); + ArrayList names = new ArrayList<>(); ArrayList 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; - } - } - + 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( @@ -286,26 +284,24 @@ public void test(TestCaseDTO testCaseDTO) JSONObject responseBody = new JSONObject(newResponse.getBody().asString()).getJSONObject("response") .getJSONObject("identity"); - - - for(int j=0;j> ouputValidNew = OutputValidationUtil.doJsonOutputValidation(jsonObjectFromIdentityData.toString(), - jsonObjectFromKycData.toString(), testCaseDTO.isCheckErrorsOnlyInResponse()); + Map> ouputValidNew = OutputValidationUtil.doJsonOutputValidation( + jsonObjectFromIdentityData.toString(), jsonObjectFromKycData.toString(), + testCaseDTO.isCheckErrorsOnlyInResponse(), newResponse.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValidNew)); if (!OutputValidationUtil.publishOutputResult(ouputValidNew)) diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/EsignetBioAuth.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/EsignetBioAuth.java index b252a2c9709..358b24255c0 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/EsignetBioAuth.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/EsignetBioAuth.java @@ -69,7 +69,6 @@ public Object[] getTestCaseList(ITestContext context) { logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -87,21 +86,21 @@ 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("uin") || testCaseDTO.getTestCaseName().contains("UIN")) { if (!BaseTestCase.getSupportedIdTypesValueFromActuator().contains("UIN") && !BaseTestCase.getSupportedIdTypesValueFromActuator().contains("uin")) { throw new SkipException("Idtype UIN is not supported. Hence skipping the testcase"); } } - + 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 request = new JSONObject(testCaseDTO.getInput()); String identityRequest = null; String identityRequestTemplate = null; @@ -136,7 +135,6 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad logger.info(objIdentityRequest); JSONArray arrayBiometrics = objIdentityRequest.getJSONArray(GlobalConstants.BIOMETRICS); - String bioData = arrayBiometrics.toString(); logger.info(bioData); @@ -179,16 +177,16 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad } } - Map> ouputValid = OutputValidationUtil - .doJsonOutputValidation(response.asString(), ActualOPJson, testCaseDTO.isCheckErrorsOnlyInResponse()); + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), ActualOPJson, testCaseDTO.isCheckErrorsOnlyInResponse(), + response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); if (!OutputValidationUtil.publishOutputResult(ouputValid)) throw new AdminTestException("Failed at output validation"); } catch (SkipException e) { throw new SkipException(e.getMessage()); - } - catch (Exception e) { + } catch (Exception e) { logger.error(e.getMessage()); } diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/GetWithParam.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/GetWithParam.java index e2b7b33f5cb..cc5923b8304 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/GetWithParam.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/GetWithParam.java @@ -40,7 +40,7 @@ public class GetWithParam extends AdminTestUtil implements ITest { public Response response = null; public boolean sendEsignetToken = false; public boolean auditLogCheck = false; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -48,7 +48,7 @@ public static void setLogLevel() { else logger.setLevel(Level.ERROR); } - + /** * get current testcaseName */ @@ -69,8 +69,6 @@ public Object[] getTestCaseList(ITestContext context) { logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - - /** * Test method for OTP Generation execution @@ -90,60 +88,66 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad } auditLogCheck = testCaseDTO.isAuditLogCheck(); String[] templateFields = testCaseDTO.getTemplateFields(); - + if (testCaseDTO.getInputTemplate().contains(GlobalConstants.$PRIMARYLANG$)) - testCaseDTO.setInputTemplate( - testCaseDTO.getInputTemplate().replace(GlobalConstants.$PRIMARYLANG$, BaseTestCase.languageList.get(0))); + testCaseDTO.setInputTemplate(testCaseDTO.getInputTemplate().replace(GlobalConstants.$PRIMARYLANG$, + BaseTestCase.languageList.get(0))); if (testCaseDTO.getOutputTemplate().contains(GlobalConstants.$PRIMARYLANG$)) - testCaseDTO.setOutputTemplate( - testCaseDTO.getOutputTemplate().replace(GlobalConstants.$PRIMARYLANG$, BaseTestCase.languageList.get(0))); + testCaseDTO.setOutputTemplate(testCaseDTO.getOutputTemplate().replace(GlobalConstants.$PRIMARYLANG$, + BaseTestCase.languageList.get(0))); if (testCaseDTO.getInput().contains(GlobalConstants.$PRIMARYLANG$)) - testCaseDTO.setInput(testCaseDTO.getInput().replace(GlobalConstants.$PRIMARYLANG$, BaseTestCase.languageList.get(0))); + testCaseDTO.setInput( + testCaseDTO.getInput().replace(GlobalConstants.$PRIMARYLANG$, BaseTestCase.languageList.get(0))); if (testCaseDTO.getOutput().contains(GlobalConstants.$PRIMARYLANG$)) - testCaseDTO.setOutput(testCaseDTO.getOutput().replace(GlobalConstants.$PRIMARYLANG$, BaseTestCase.languageList.get(0))); + testCaseDTO.setOutput( + testCaseDTO.getOutput().replace(GlobalConstants.$PRIMARYLANG$, BaseTestCase.languageList.get(0))); if (testCaseDTO.getTemplateFields() != null && templateFields.length > 0) { ArrayList inputtestCases = AdminTestUtil.getInputTestCase(testCaseDTO); ArrayList outputtestcase = AdminTestUtil.getOutputTestCase(testCaseDTO); - for (int i=0; i> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), - getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse(), testCaseDTO.getAllowedErrorCodes()); - Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - - if (!OutputValidationUtil.publishOutputResult(ouputValid)) - throw new AdminTestException("Failed at output validation"); - } + for (int i = 0; i < languageList.size(); i++) { + response = getWithPathParamAndCookie(ApplnURI + testCaseDTO.getEndPoint(), + getJsonFromTemplate(inputtestCases.get(i).toString(), testCaseDTO.getInputTemplate()), + COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), + getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), testCaseDTO.getAllowedErrorCodes(), + response.getStatusCode()); + Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); + + if (!OutputValidationUtil.publishOutputResult(ouputValid)) + throw new AdminTestException("Failed at output validation"); + } } - + else { - if(testCaseName.contains("ESignet_")) { + if (testCaseName.contains("ESignet_")) { String tempUrl = ConfigManager.getEsignetBaseUrl(); response = getWithPathParamAndCookie(tempUrl + testCaseDTO.getEndPoint(), getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()), COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); - } - else { + } else { response = getWithPathParamAndCookie(ApplnURI + testCaseDTO.getEndPoint(), - getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()), auditLogCheck, COOKIENAME, - testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), sendEsignetToken); + getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()), auditLogCheck, + COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), sendEsignetToken); } Map> ouputValid = null; - if(testCaseName.contains("_StatusCode")) { - - OutputValidationDto customResponse = customStatusCodeResponse(String.valueOf(response.getStatusCode()), testCaseDTO.getOutput()); - + if (testCaseName.contains("_StatusCode")) { + + OutputValidationDto customResponse = customStatusCodeResponse(String.valueOf(response.getStatusCode()), + testCaseDTO.getOutput()); + ouputValid = new HashMap<>(); ouputValid.put(GlobalConstants.EXPECTED_VS_ACTUAL, List.of(customResponse)); - }else { - ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse(), testCaseDTO.getAllowedErrorCodes()); + } else { + ouputValid = OutputValidationUtil.doJsonOutputValidation(response.asString(), + getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), testCaseDTO.getAllowedErrorCodes(), + response.getStatusCode()); } - + Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); if (!OutputValidationUtil.publishOutputResult(ouputValid)) throw new AdminTestException("Failed at output validation"); diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/GetWithParamForAutoGenId.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/GetWithParamForAutoGenId.java index ee588b89f60..c421e1d2338 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/GetWithParamForAutoGenId.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/GetWithParamForAutoGenId.java @@ -40,7 +40,7 @@ public class GetWithParamForAutoGenId extends AdminTestUtil implements ITest { public Response response = null; public boolean sendEsignetToken = false; public boolean auditLogCheck = false; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -70,8 +70,6 @@ public Object[] getTestCaseList(ITestContext context) { logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - - /** * Test method for OTP Generation execution @@ -91,40 +89,42 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad } auditLogCheck = testCaseDTO.isAuditLogCheck(); String[] templateFields = testCaseDTO.getTemplateFields(); - + if (testCaseDTO.getTemplateFields() != null && templateFields.length > 0) { ArrayList inputtestCases = AdminTestUtil.getInputTestCase(testCaseDTO); ArrayList outputtestcase = AdminTestUtil.getOutputTestCase(testCaseDTO); - for (int i=0; i> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), - getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); - Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - - if (!OutputValidationUtil.publishOutputResult(ouputValid)) - throw new AdminTestException("Failed at output validation"); - } - } - else { + for (int i = 0; i < languageList.size(); i++) { + response = getWithPathParamAndCookieForAutoGeneratedId(ApplnURI + testCaseDTO.getEndPoint(), + getJsonFromTemplate(inputtestCases.get(i).toString(), testCaseDTO.getInputTemplate()), + COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), idKeyName); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), + getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); + Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); + + if (!OutputValidationUtil.publishOutputResult(ouputValid)) + throw new AdminTestException("Failed at output validation"); + } + } else { response = getWithPathParamAndCookieForAutoGeneratedId(ApplnURI + testCaseDTO.getEndPoint(), - getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()), auditLogCheck, COOKIENAME, - testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), idKeyName, sendEsignetToken); + getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()), auditLogCheck, + COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), idKeyName, sendEsignetToken); Map> ouputValid = null; - if(testCaseName.contains("_StatusCode")) { - - OutputValidationDto customResponse = customStatusCodeResponse(String.valueOf(response.getStatusCode()), testCaseDTO.getOutput()); - + if (testCaseName.contains("_StatusCode")) { + + OutputValidationDto customResponse = customStatusCodeResponse(String.valueOf(response.getStatusCode()), + testCaseDTO.getOutput()); + ouputValid = new HashMap<>(); ouputValid.put(GlobalConstants.EXPECTED_VS_ACTUAL, List.of(customResponse)); - }else { - ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + } else { + ouputValid = OutputValidationUtil.doJsonOutputValidation(response.asString(), + getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); } - + Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); if (!OutputValidationUtil.publishOutputResult(ouputValid)) throw new AdminTestException("Failed at output validation"); diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/GetWithParamForAutoGenIdForKeyCloak.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/GetWithParamForAutoGenIdForKeyCloak.java index 946c65c5eda..9242a007013 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/GetWithParamForAutoGenIdForKeyCloak.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/GetWithParamForAutoGenIdForKeyCloak.java @@ -35,7 +35,7 @@ public class GetWithParamForAutoGenIdForKeyCloak extends AdminTestUtil implement public String idKeyName = null; public String valueKeyName = null; public Response response = null; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -64,8 +64,6 @@ public Object[] getTestCaseList(ITestContext context) { logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - - /** * Test method for OTP Generation execution @@ -79,18 +77,18 @@ public Object[] getTestCaseList(ITestContext context) { @Test(dataProvider = "testcaselist") public void test(TestCaseDTO testCaseDTO) throws AdminTestException { testCaseName = testCaseDTO.getTestCaseName(); - + if (HealthChecker.signalTerminateExecution) { throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS); } - - - - response = getWithPathParamAndCookieForAutoGeneratedIdForKeyCloak(ApplnURIForKeyCloak + testCaseDTO.getEndPoint(), + + response = getWithPathParamAndCookieForAutoGeneratedIdForKeyCloak( + ApplnURIForKeyCloak + testCaseDTO.getEndPoint(), getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()), COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), idKeyName); Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); if (!OutputValidationUtil.publishOutputResult(ouputValid)) throw new AdminTestException("Failed at output validation"); diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/GetWithParamWithOtpGenerate.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/GetWithParamWithOtpGenerate.java index 5c4c85ab278..1fd05a6b4cf 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/GetWithParamWithOtpGenerate.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/GetWithParamWithOtpGenerate.java @@ -38,7 +38,7 @@ public class GetWithParamWithOtpGenerate extends AdminTestUtil implements ITest private static final Logger logger = Logger.getLogger(GetWithParamWithOtpGenerate.class); protected String testCaseName = ""; public Response response = null; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -66,8 +66,6 @@ public Object[] getTestCaseList(ITestContext context) { logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - - /** * Test method for OTP Generation execution @@ -84,12 +82,12 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad if (HealthChecker.signalTerminateExecution) { throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS); } - + JSONObject req = new JSONObject(testCaseDTO.getInput()); String otpRequest = null; String sendOtpReqTemplate = null; String sendOtpEndPoint = null; - if(req.has(GlobalConstants.SENDOTP)) { + if (req.has(GlobalConstants.SENDOTP)) { otpRequest = req.get(GlobalConstants.SENDOTP).toString(); req.remove(GlobalConstants.SENDOTP); } @@ -98,39 +96,41 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad otpReqJson.remove("sendOtpReqTemplate"); sendOtpEndPoint = otpReqJson.getString("sendOtpEndPoint"); otpReqJson.remove("sendOtpEndPoint"); - - - Response otpResponse = postWithBodyAndCookie(ApplnURI + sendOtpEndPoint, getJsonFromTemplate(otpReqJson.toString(), sendOtpReqTemplate), COOKIENAME,GlobalConstants.RESIDENT, testCaseDTO.getTestCaseName()); + Response otpResponse = postWithBodyAndCookie(ApplnURI + sendOtpEndPoint, + getJsonFromTemplate(otpReqJson.toString(), sendOtpReqTemplate), COOKIENAME, GlobalConstants.RESIDENT, + testCaseDTO.getTestCaseName()); JSONObject res = new JSONObject(testCaseDTO.getOutput()); String sendOtpResp = null; String sendOtpResTemplate = null; - if(res.has(GlobalConstants.SENDOTPRESP)) { + if (res.has(GlobalConstants.SENDOTPRESP)) { sendOtpResp = res.get(GlobalConstants.SENDOTPRESP).toString(); res.remove(GlobalConstants.SENDOTPRESP); } JSONObject sendOtpRespJson = new JSONObject(sendOtpResp); sendOtpResTemplate = sendOtpRespJson.getString("sendOtpResTemplate"); sendOtpRespJson.remove("sendOtpResTemplate"); - Map> ouputValidOtp = OutputValidationUtil - .doJsonOutputValidation(otpResponse.asString(), getJsonFromTemplate(sendOtpRespJson.toString(), sendOtpResTemplate), testCaseDTO.isCheckErrorsOnlyInResponse()); + Map> ouputValidOtp = OutputValidationUtil.doJsonOutputValidation( + otpResponse.asString(), getJsonFromTemplate(sendOtpRespJson.toString(), sendOtpResTemplate), + testCaseDTO.isCheckErrorsOnlyInResponse(), otpResponse.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValidOtp)); - + if (!OutputValidationUtil.publishOutputResult(ouputValidOtp)) { if (otpResponse.asString().contains("IDA-OTA-001")) - throw new AdminTestException("Exceeded number of OTP requests in a given time, Increase otp.request.flooding.max-count"); + throw new AdminTestException( + "Exceeded number of OTP requests in a given time, Increase otp.request.flooding.max-count"); else throw new AdminTestException("Failed at otp output validation"); } - + JSONObject reqvOtp = new JSONObject(testCaseDTO.getInput()); JSONObject reqvtOtp = (JSONObject) reqvOtp.get(GlobalConstants.SENDOTP); String otpValidationRequest = null; String validateOtpReqTemplate = null; String validateOtpEndPoint = null; - - if(!reqvtOtp.isNull(GlobalConstants.VALIDATEOTP)) { + + if (!reqvtOtp.isNull(GlobalConstants.VALIDATEOTP)) { otpValidationRequest = reqvtOtp.get(GlobalConstants.VALIDATEOTP).toString(); reqvOtp.remove(GlobalConstants.VALIDATEOTP); } @@ -139,53 +139,53 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad validateOtpReqJson.remove("validateOtpReqTemplate"); validateOtpEndPoint = validateOtpReqJson.getString("validateOtpEndPoint"); validateOtpReqJson.remove("validateOtpEndPoint"); - - Response validateOtpResponse = postWithBodyAndCookie(ApplnURI + validateOtpEndPoint, getJsonFromTemplate(validateOtpReqJson.toString(), validateOtpReqTemplate), COOKIENAME,GlobalConstants.RESIDENT, testCaseDTO.getTestCaseName()); + Response validateOtpResponse = postWithBodyAndCookie(ApplnURI + validateOtpEndPoint, + getJsonFromTemplate(validateOtpReqJson.toString(), validateOtpReqTemplate), COOKIENAME, + GlobalConstants.RESIDENT, testCaseDTO.getTestCaseName()); - - - - - String[] templateFields = testCaseDTO.getTemplateFields(); - + if (testCaseDTO.getInputTemplate().contains(GlobalConstants.$PRIMARYLANG$)) - testCaseDTO.setInputTemplate( - testCaseDTO.getInputTemplate().replace(GlobalConstants.$PRIMARYLANG$, BaseTestCase.languageList.get(0))); + testCaseDTO.setInputTemplate(testCaseDTO.getInputTemplate().replace(GlobalConstants.$PRIMARYLANG$, + BaseTestCase.languageList.get(0))); if (testCaseDTO.getOutputTemplate().contains(GlobalConstants.$PRIMARYLANG$)) - testCaseDTO.setOutputTemplate( - testCaseDTO.getOutputTemplate().replace(GlobalConstants.$PRIMARYLANG$, BaseTestCase.languageList.get(0))); + testCaseDTO.setOutputTemplate(testCaseDTO.getOutputTemplate().replace(GlobalConstants.$PRIMARYLANG$, + BaseTestCase.languageList.get(0))); if (testCaseDTO.getInput().contains(GlobalConstants.$PRIMARYLANG$)) - testCaseDTO.setInput(testCaseDTO.getInput().replace(GlobalConstants.$PRIMARYLANG$, BaseTestCase.languageList.get(0))); + testCaseDTO.setInput( + testCaseDTO.getInput().replace(GlobalConstants.$PRIMARYLANG$, BaseTestCase.languageList.get(0))); if (testCaseDTO.getOutput().contains(GlobalConstants.$PRIMARYLANG$)) - testCaseDTO.setOutput(testCaseDTO.getOutput().replace(GlobalConstants.$PRIMARYLANG$, BaseTestCase.languageList.get(0))); + testCaseDTO.setOutput( + testCaseDTO.getOutput().replace(GlobalConstants.$PRIMARYLANG$, BaseTestCase.languageList.get(0))); if (testCaseDTO.getTemplateFields() != null && templateFields.length > 0) { ArrayList inputtestCases = AdminTestUtil.getInputTestCase(testCaseDTO); ArrayList outputtestcase = AdminTestUtil.getOutputTestCase(testCaseDTO); - languageList =Arrays.asList(System.getProperty("env.langcode").split(",")); - for (int i=0; i> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), - getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); - Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - - if (!OutputValidationUtil.publishOutputResult(ouputValid)) - throw new AdminTestException("Failed at output validation"); - } + languageList = Arrays.asList(System.getProperty("env.langcode").split(",")); + for (int i = 0; i < languageList.size(); i++) { + response = getWithPathParamAndCookie(ApplnURI + testCaseDTO.getEndPoint(), + getJsonFromTemplate(inputtestCases.get(i).toString(), testCaseDTO.getInputTemplate()), + COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), + getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); + Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); + + if (!OutputValidationUtil.publishOutputResult(ouputValid)) + throw new AdminTestException("Failed at output validation"); + } } - + else { response = getWithPathParamAndCookie(ApplnURI + testCaseDTO.getEndPoint(), getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()), COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); if (!OutputValidationUtil.publishOutputResult(ouputValid)) throw new AdminTestException("Failed at output validation"); diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/GetWithQueryParam.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/GetWithQueryParam.java index a9ec32037c9..809b1114945 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/GetWithQueryParam.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/GetWithQueryParam.java @@ -38,7 +38,7 @@ public class GetWithQueryParam extends AdminTestUtil implements ITest { private static final Logger logger = Logger.getLogger(GetWithQueryParam.class); protected String testCaseName = ""; public Response response = null; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -66,8 +66,6 @@ public Object[] getTestCaseList(ITestContext context) { logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - - /** * Test method for OTP Generation execution @@ -81,7 +79,7 @@ public Object[] getTestCaseList(ITestContext context) { @Test(dataProvider = "testcaselist") public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { testCaseName = testCaseDTO.getTestCaseName(); - + if (HealthChecker.signalTerminateExecution) { throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS); } @@ -90,45 +88,47 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad if (testCaseDTO.getTemplateFields() != null && templateFields.length > 0) { ArrayList inputtestCases = AdminTestUtil.getInputTestCase(testCaseDTO); ArrayList outputtestcase = AdminTestUtil.getOutputTestCase(testCaseDTO); - for (int i=0; i> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), - getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); - Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - - if (!OutputValidationUtil.publishOutputResult(ouputValid)) - throw new AdminTestException("Failed at output validation"); - } - } - + for (int i = 0; i < languageList.size(); i++) { + response = getWithQueryParamAndCookie(ApplnURI + testCaseDTO.getEndPoint(), + getJsonFromTemplate(inputtestCases.get(i).toString(), testCaseDTO.getInputTemplate()), + COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), + getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); + Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); + + if (!OutputValidationUtil.publishOutputResult(ouputValid)) + throw new AdminTestException("Failed at output validation"); + } + } + else { - if(testCaseName.contains("ESignet_")) { + if (testCaseName.contains("ESignet_")) { String tempUrl = ConfigManager.getEsignetBaseUrl(); response = getWithQueryParamAndCookie(tempUrl + testCaseDTO.getEndPoint(), getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()), COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); - } - else { + } else { response = getWithQueryParamAndCookie(ApplnURI + testCaseDTO.getEndPoint(), getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()), COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); } Map> ouputValid = null; - if(testCaseName.contains("_StatusCode")) { - - OutputValidationDto customResponse = customStatusCodeResponse(String.valueOf(response.getStatusCode()), testCaseDTO.getOutput()); - + if (testCaseName.contains("_StatusCode")) { + + OutputValidationDto customResponse = customStatusCodeResponse(String.valueOf(response.getStatusCode()), + testCaseDTO.getOutput()); + ouputValid = new HashMap<>(); ouputValid.put(GlobalConstants.EXPECTED_VS_ACTUAL, List.of(customResponse)); - }else { - ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + } else { + ouputValid = OutputValidationUtil.doJsonOutputValidation(response.asString(), + getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); } - + Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); if (!OutputValidationUtil.publishOutputResult(ouputValid)) throw new AdminTestException("Failed at output validation"); diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/KycAuth.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/KycAuth.java index 1a4304726f7..6b91ad9f3b6 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/KycAuth.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/KycAuth.java @@ -67,8 +67,6 @@ public Object[] getTestCaseList(ITestContext context) { logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - - /** * Test method for OTP Generation execution @@ -92,44 +90,45 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad kycAuthEndPoint = request.get(GlobalConstants.KYCAUTHENDPOINT).toString(); request.remove(GlobalConstants.KYCAUTHENDPOINT); } - + String requestString = buildIdentityRequest(request.toString()); - + String input = getJsonFromTemplate(requestString, testCaseDTO.getInputTemplate()); - + String url = ConfigManager.getAuthDemoServiceUrl(); - + logger.info("******Post request Json to EndPointUrl: " + url + testCaseDTO.getEndPoint() + " *******"); - + Response authResponse = null; - - authResponse = postWithBodyAndCookieWithText(url + testCaseDTO.getEndPoint(), input, - COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); - + + authResponse = postWithBodyAndCookieWithText(url + testCaseDTO.getEndPoint(), input, COOKIENAME, + testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); + String signature = authResponse.getHeader("signature"); - + logger.info(signature); - + String authResBody = authResponse.getBody().asString(); - + logger.info(authResBody); - + JSONObject responseBody = new JSONObject(authResponse.getBody().asString()); - + String requestJson = null; HashMap headers = new HashMap<>(); headers.put(SIGNATURE_HEADERNAME, signature); String token = kernelAuthLib.getTokenByRole(testCaseDTO.getRole()); headers.put(COOKIENAME, token); - + logger.info("******Post request Json to EndPointUrl: " + ApplnURI + testCaseDTO.getEndPoint() + " *******"); - - response = postRequestWithAuthHeaderAndSignatureForOtp(ApplnURI + kycAuthEndPoint, authResBody, - COOKIENAME, token, headers, testCaseDTO.getTestCaseName()); + + response = postRequestWithAuthHeaderAndSignatureForOtp(ApplnURI + kycAuthEndPoint, authResBody, COOKIENAME, + token, headers, testCaseDTO.getTestCaseName()); Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); if (!OutputValidationUtil.publishOutputResult(ouputValid)) @@ -137,8 +136,6 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad } - - /** * The method ser current test name to result * @@ -157,8 +154,7 @@ public void setResultTestName(ITestResult result) { } catch (Exception e) { Reporter.log("Exception : " + e.getMessage()); } - - + } @AfterClass diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/MassUINGenerator.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/MassUINGenerator.java index 5034136b6b4..0db260be721 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/MassUINGenerator.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/MassUINGenerator.java @@ -46,7 +46,7 @@ public class MassUINGenerator extends AdminTestUtil implements ITest { private Map storeUinData = new HashMap<>(); private Map storeRidData = new HashMap<>(); private static long perTCUinCount; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -54,7 +54,7 @@ public static void setLogLevel() { else logger.setLevel(Level.ERROR); } - + /** * get current testcaseName */ @@ -72,10 +72,9 @@ public String getTestName() { public Object[] getTestCaseList(ITestContext context) { String ymlFile = context.getCurrentXmlTest().getLocalParameters().get("ymlFile"); perTCUinCount = Long.parseLong(context.getCurrentXmlTest().getLocalParameters().get("perTCUinCount")); - logger.info("Started executing yml: "+ymlFile); + logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -87,45 +86,52 @@ public Object[] getTestCaseList(ITestContext context) { * @throws AdminTestException */ @Test(dataProvider = "testcaselist") - public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { + public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { testCaseName = testCaseDTO.getTestCaseName(); if (HealthChecker.signalTerminateExecution) { throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS); } - for(int i=0; i> ouputValid = OutputValidationUtil - .doJsonOutputValidation(response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + Response response = postWithBodyAndCookie(ApplnURI + testCaseDTO.getEndPoint(), inputJson, COOKIENAME, + testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); boolean publishResult = OutputValidationUtil.publishOutputResult(ouputValid); if (!publishResult) throw new AdminTestException("Failed at output validation"); else { - storeUinData.put(testCaseName+"-"+count, uin); + storeUinData.put(testCaseName + "-" + count, uin); storeRidData.put(uin, genRid); } } - + public void writeUinRid(Map uinMap, Map ridMap, String testCaseName) { - AuthTestsUtil.generateMappingDic(RunConfigUtil.getResourcePath()+"idRepository/uinrids/"+testCaseName+"UIN.properties", uinMap); - AuthTestsUtil.generateMappingDic(RunConfigUtil.getResourcePath()+"idRepository/uinrids/"+testCaseName+"RID.properties", ridMap); + AuthTestsUtil.generateMappingDic( + RunConfigUtil.getResourcePath() + "idRepository/uinrids/" + testCaseName + "UIN.properties", uinMap); + AuthTestsUtil.generateMappingDic( + RunConfigUtil.getResourcePath() + "idRepository/uinrids/" + testCaseName + "RID.properties", ridMap); } /** @@ -151,5 +157,5 @@ public void setResultTestName(ITestResult result) { } catch (Exception e) { Reporter.log("Exception : " + e.getMessage()); } - } + } } diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/MultiFactorAuth.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/MultiFactorAuth.java index 33cd8f83188..1b457f7fa7e 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/MultiFactorAuth.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/MultiFactorAuth.java @@ -40,7 +40,7 @@ public class MultiFactorAuth extends AdminTestUtil implements ITest { private static final Logger logger = Logger.getLogger(MultiFactorAuth.class); protected String testCaseName = ""; public Response response = null; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -48,7 +48,7 @@ public static void setLogLevel() { else logger.setLevel(Level.ERROR); } - + /** * get current testcaseName */ @@ -65,10 +65,9 @@ public String getTestName() { @DataProvider(name = "testcaselist") public Object[] getTestCaseList(ITestContext context) { String ymlFile = context.getCurrentXmlTest().getLocalParameters().get("ymlFile"); - logger.info("Started executing yml: "+ymlFile); + logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -87,8 +86,8 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad } JSONObject req = new JSONObject(testCaseDTO.getInput()); if (testCaseDTO.getEndPoint().contains(GlobalConstants.$PARTNERKEYURL$)) { - testCaseDTO.setEndPoint( - testCaseDTO.getEndPoint().replace(GlobalConstants.$PARTNERKEYURL$, properties.getProperty("partnerKeyURL"))); + testCaseDTO.setEndPoint(testCaseDTO.getEndPoint().replace(GlobalConstants.$PARTNERKEYURL$, + properties.getProperty("partnerKeyURL"))); } if (testCaseDTO.getEndPoint().contains("$UpdatedPartnerKeyURL$")) { @@ -111,7 +110,8 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad otpReqJson.remove("sendOtpEndPoint"); if (sendOtpEndPoint.contains(GlobalConstants.$PARTNERKEYURL$)) { - sendOtpEndPoint = sendOtpEndPoint.replace(GlobalConstants.$PARTNERKEYURL$, properties.getProperty("partnerKeyURL")); + sendOtpEndPoint = sendOtpEndPoint.replace(GlobalConstants.$PARTNERKEYURL$, + properties.getProperty("partnerKeyURL")); } Response otpResponse = postRequestWithAuthHeaderAndSignature(ApplnURI + sendOtpEndPoint, @@ -128,7 +128,8 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad sendOtpResTemplate = sendOtpRespJson.getString("sendOtpResTemplate"); sendOtpRespJson.remove("sendOtpResTemplate"); Map> ouputValidOtp = OutputValidationUtil.doJsonOutputValidation( - otpResponse.asString(), getJsonFromTemplate(sendOtpRespJson.toString(), sendOtpResTemplate), testCaseDTO.isCheckErrorsOnlyInResponse()); + otpResponse.asString(), getJsonFromTemplate(sendOtpRespJson.toString(), sendOtpResTemplate), + testCaseDTO.isCheckErrorsOnlyInResponse(), otpResponse.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValidOtp)); OutputValidationUtil.publishOutputResult(ouputValidOtp); @@ -165,7 +166,8 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad if (jsonObject.has("key") && jsonObject.has(GlobalConstants.VALUE)) { JSONObject jsonHbs = new JSONObject(jsonBioHbs.get(GlobalConstants.IDENTITYREQUEST).toString()); encryptedIdentityReq = JsonPrecondtion.parseAndReturnJsonContent(encryptedIdentityReq, - jsonObject.get(GlobalConstants.VALUE).toString(), demographicsMapper + jsonObject.get("key").toString()); + jsonObject.get(GlobalConstants.VALUE).toString(), + demographicsMapper + jsonObject.get("key").toString()); } } @@ -187,7 +189,8 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); if (!OutputValidationUtil.publishOutputResult(ouputValid)) @@ -214,7 +217,7 @@ public void setResultTestName(ITestResult result) { Reporter.log("Exception : " + e.getMessage()); } } - + @AfterClass public static void authTestTearDown() { logger.info("Terminating authpartner demo application..."); diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/MultiFactorAuthNew.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/MultiFactorAuthNew.java index 37b56cf6120..7360edc56a2 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/MultiFactorAuthNew.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/MultiFactorAuthNew.java @@ -153,7 +153,7 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad sendOtpRespJson.remove("sendOtpResTemplate"); Map> ouputValidOtp = OutputValidationUtil.doJsonOutputValidation( otpRespon.asString(), getJsonFromTemplate(sendOtpRespJson.toString(), sendOtpResTemplate), - testCaseDTO.isCheckErrorsOnlyInResponse()); + testCaseDTO.isCheckErrorsOnlyInResponse(), otpRespon.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValidOtp)); if (!OutputValidationUtil.publishOutputResult(ouputValidOtp)) @@ -209,8 +209,8 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad } } - Map> ouputValid = OutputValidationUtil - .doJsonOutputValidation(response.asString(), ActualOPJson, testCaseDTO.isCheckErrorsOnlyInResponse()); + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), ActualOPJson, testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); if (!OutputValidationUtil.publishOutputResult(ouputValid)) diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/OtpAuth.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/OtpAuth.java index 19d8580d045..b1f4757fdc7 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/OtpAuth.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/OtpAuth.java @@ -42,7 +42,7 @@ public class OtpAuth extends AdminTestUtil implements ITest { protected String testCaseName = ""; public Response response = null; public boolean isInternal = false; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -50,7 +50,7 @@ public static void setLogLevel() { else logger.setLevel(Level.ERROR); } - + /** * get current testcaseName */ @@ -68,10 +68,9 @@ public String getTestName() { public Object[] getTestCaseList(ITestContext context) { String ymlFile = context.getCurrentXmlTest().getLocalParameters().get("ymlFile"); isInternal = Boolean.parseBoolean(context.getCurrentXmlTest().getLocalParameters().get("isInternal")); - logger.info("Started executing yml: "+ymlFile); + logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -83,14 +82,14 @@ public Object[] getTestCaseList(ITestContext context) { * @throws AdminTestException */ @Test(dataProvider = "testcaselist") - public void test(TestCaseDTO testCaseDTO) throws AdminTestException { - testCaseName = testCaseDTO.getTestCaseName(); + public void test(TestCaseDTO testCaseDTO) throws AdminTestException { + testCaseName = testCaseDTO.getTestCaseName(); if (HealthChecker.signalTerminateExecution) { throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS); } - if(testCaseDTO.getEndPoint().contains(GlobalConstants.$PARTNERKEYURL$)) - { - testCaseDTO.setEndPoint(testCaseDTO.getEndPoint().replace(GlobalConstants.$PARTNERKEYURL$, properties.getProperty("partnerKeyURL"))); + if (testCaseDTO.getEndPoint().contains(GlobalConstants.$PARTNERKEYURL$)) { + testCaseDTO.setEndPoint(testCaseDTO.getEndPoint().replace(GlobalConstants.$PARTNERKEYURL$, + properties.getProperty("partnerKeyURL"))); } if (testCaseDTO.getEndPoint().contains("$UpdatedPartnerKeyURL$")) { @@ -102,7 +101,7 @@ public void test(TestCaseDTO testCaseDTO) throws AdminTestException { String sendOtpReqTemplate = null; String sendOtpEndPoint = null; String otpIdentyEnryptRequestPath = null; - if(req.has(GlobalConstants.SENDOTP)) { + if (req.has(GlobalConstants.SENDOTP)) { otpRequest = req.get(GlobalConstants.SENDOTP).toString(); req.remove(GlobalConstants.SENDOTP); } @@ -110,84 +109,88 @@ public void test(TestCaseDTO testCaseDTO) throws AdminTestException { sendOtpReqTemplate = otpReqJson.getString("sendOtpReqTemplate"); otpReqJson.remove("sendOtpReqTemplate"); sendOtpEndPoint = otpReqJson.getString("sendOtpEndPoint"); - - + otpReqJson.remove("sendOtpEndPoint"); otpIdentyEnryptRequestPath = otpReqJson.getString("otpIdentyEnryptRequestPath"); otpReqJson.remove("otpIdentyEnryptRequestPath"); - - if(sendOtpEndPoint.contains(GlobalConstants.$PARTNERKEYURL$)) - { - sendOtpEndPoint= sendOtpEndPoint.replace(GlobalConstants.$PARTNERKEYURL$, properties.getProperty("partnerKeyURL")); + + if (sendOtpEndPoint.contains(GlobalConstants.$PARTNERKEYURL$)) { + sendOtpEndPoint = sendOtpEndPoint.replace(GlobalConstants.$PARTNERKEYURL$, + properties.getProperty("partnerKeyURL")); } - if(sendOtpEndPoint.contains("$UpdatedPartnerKeyURL$")) { sendOtpEndPoint= sendOtpEndPoint.replace("$UpdatedPartnerKeyURL$", PartnerRegistration.updatedpartnerKeyUrl); } - - Response otpResponse = null; - if(isInternal) - otpResponse = postRequestWithCookieAuthHeaderAndSignature(ApplnURI + sendOtpEndPoint, getJsonFromTemplate(otpReqJson.toString(), sendOtpReqTemplate), COOKIENAME, GlobalConstants.RESIDENT, testCaseDTO.getTestCaseName()); + if (isInternal) + otpResponse = postRequestWithCookieAuthHeaderAndSignature(ApplnURI + sendOtpEndPoint, + getJsonFromTemplate(otpReqJson.toString(), sendOtpReqTemplate), COOKIENAME, + GlobalConstants.RESIDENT, testCaseDTO.getTestCaseName()); else - otpResponse = postRequestWithAuthHeaderAndSignature(ApplnURI + sendOtpEndPoint, getJsonFromTemplate(otpReqJson.toString(), sendOtpReqTemplate), testCaseDTO.getTestCaseName()); - + otpResponse = postRequestWithAuthHeaderAndSignature(ApplnURI + sendOtpEndPoint, + getJsonFromTemplate(otpReqJson.toString(), sendOtpReqTemplate), testCaseDTO.getTestCaseName()); + JSONObject res = new JSONObject(testCaseDTO.getOutput()); String sendOtpResp = null, sendOtpResTemplate = null; - if(res.has(GlobalConstants.SENDOTPRESP)) { + if (res.has(GlobalConstants.SENDOTPRESP)) { sendOtpResp = res.get(GlobalConstants.SENDOTPRESP).toString(); res.remove(GlobalConstants.SENDOTPRESP); } JSONObject sendOtpRespJson = new JSONObject(sendOtpResp); sendOtpResTemplate = sendOtpRespJson.getString("sendOtpResTemplate"); sendOtpRespJson.remove("sendOtpResTemplate"); - Map> ouputValidOtp = OutputValidationUtil - .doJsonOutputValidation(otpResponse.asString(), getJsonFromTemplate(sendOtpRespJson.toString(), sendOtpResTemplate), testCaseDTO.isCheckErrorsOnlyInResponse()); + Map> ouputValidOtp = OutputValidationUtil.doJsonOutputValidation( + otpResponse.asString(), getJsonFromTemplate(sendOtpRespJson.toString(), sendOtpResTemplate), + testCaseDTO.isCheckErrorsOnlyInResponse(), otpResponse.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValidOtp)); - + if (!OutputValidationUtil.publishOutputResult(ouputValidOtp)) throw new AdminTestException("Failed at Send OTP output validation"); - - - String otpIdentyEnryptRequest = FileUtil.readInput(getResourcePath()+otpIdentyEnryptRequestPath); + + String otpIdentyEnryptRequest = FileUtil.readInput(getResourcePath() + otpIdentyEnryptRequestPath); otpIdentyEnryptRequest = updateTimestampOtp(otpIdentyEnryptRequest); - - Map bioAuthTempMap = (isInternal)? encryptDecryptUtil.getInternalEncryptSessionKeyValue(otpIdentyEnryptRequest) : encryptDecryptUtil.getEncryptSessionKeyValue(otpIdentyEnryptRequest); + + Map bioAuthTempMap = (isInternal) + ? encryptDecryptUtil.getInternalEncryptSessionKeyValue(otpIdentyEnryptRequest) + : encryptDecryptUtil.getEncryptSessionKeyValue(otpIdentyEnryptRequest); String authRequest = getJsonFromTemplate(req.toString(), testCaseDTO.getInputTemplate()); logger.info("************* Modification of OTP auth request ******************"); Reporter.log("Modification of otp auth request"); - authRequest = modifyRequest(authRequest, bioAuthTempMap, getResourcePath()+properties.getProperty("idaMappingPath")); + authRequest = modifyRequest(authRequest, bioAuthTempMap, + getResourcePath() + properties.getProperty("idaMappingPath")); JSONObject authRequestTemp = new JSONObject(authRequest); authRequestTemp.remove("env"); authRequestTemp.put("env", "Staging"); authRequest = authRequestTemp.toString(); testCaseDTO.setInput(authRequest); - - logger.info("******Post request Json to EndPointUrl: " + ApplnURI + testCaseDTO.getEndPoint() + " *******"); - - response = postRequestWithCookieAuthHeaderAndSignature(ApplnURI + testCaseDTO.getEndPoint(), authRequest, COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); - - Map> ouputValid = OutputValidationUtil - .doJsonOutputValidation(response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + + logger.info("******Post request Json to EndPointUrl: " + ApplnURI + testCaseDTO.getEndPoint() + " *******"); + + response = postRequestWithCookieAuthHeaderAndSignature(ApplnURI + testCaseDTO.getEndPoint(), authRequest, + COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - + if (!OutputValidationUtil.publishOutputResult(ouputValid)) throw new AdminTestException("Failed at output validation"); - - if(testCaseName.toLowerCase().contains("kyc")) { + + if (testCaseName.toLowerCase().contains("kyc")) { JSONObject resJsonObject = new JSONObject(response.asString()); - String resp=""; + String resp = ""; try { resp = resJsonObject.get("response").toString(); } catch (JSONException e) { logger.error(e.getMessage()); } Reporter.log("Request for decrypting kyc data"); - response = postWithBodyAcceptTextPlainAndCookie(EncryptionDecrptionUtil.getEncryptUtilBaseUrl()+properties.getProperty("decryptkycdataurl"), - resp, COOKIENAME, testCaseDTO.getRole(), "decryptEkycData"); + response = postWithBodyAcceptTextPlainAndCookie( + EncryptionDecrptionUtil.getEncryptUtilBaseUrl() + properties.getProperty("decryptkycdataurl"), resp, + COOKIENAME, testCaseDTO.getRole(), "decryptEkycData"); } - } @@ -210,7 +213,7 @@ public void setResultTestName(ITestResult result) { Reporter.log("Exception : " + e.getMessage()); } } - + @AfterClass public static void authTestTearDown() { logger.info("Terminating authpartner demo application..."); diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/OtpAuthNew.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/OtpAuthNew.java index 0d9237041bf..55b36c10d0c 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/OtpAuthNew.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/OtpAuthNew.java @@ -43,7 +43,7 @@ public class OtpAuthNew extends AdminTestUtil implements ITest { protected String testCaseName = ""; public Response response = null; public boolean isInternal = false; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -72,7 +72,6 @@ public Object[] getTestCaseList(ITestContext context) { logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -86,25 +85,25 @@ public Object[] getTestCaseList(ITestContext context) { @Test(dataProvider = "testcaselist") public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { testCaseName = testCaseDTO.getTestCaseName(); - + if (HealthChecker.signalTerminateExecution) { throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS); } - + if (testCaseDTO.getTestCaseName().contains("uin") || testCaseDTO.getTestCaseName().contains("UIN")) { if (!BaseTestCase.getSupportedIdTypesValueFromActuator().contains("UIN") && !BaseTestCase.getSupportedIdTypesValueFromActuator().contains("uin")) { throw new SkipException("Idtype UIN is not supported. Hence skipping the testcase"); } } - + 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 (testCaseDTO.getEndPoint().contains("$PartnerKeyURL$")) { testCaseDTO.setEndPoint( testCaseDTO.getEndPoint().replace("$PartnerKeyURL$", PartnerRegistration.partnerKeyUrl)); @@ -177,7 +176,8 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad sendOtpResTemplate = sendOtpRespJson.getString("sendOtpResTemplate"); sendOtpRespJson.remove("sendOtpResTemplate"); Map> ouputValidOtp = OutputValidationUtil.doJsonOutputValidation( - otpRespon.asString(), getJsonFromTemplate(sendOtpRespJson.toString(), sendOtpResTemplate), testCaseDTO.isCheckErrorsOnlyInResponse()); + otpRespon.asString(), getJsonFromTemplate(sendOtpRespJson.toString(), sendOtpResTemplate), + testCaseDTO.isCheckErrorsOnlyInResponse(), otpRespon.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValidOtp)); if (!OutputValidationUtil.publishOutputResult(ouputValidOtp)) @@ -192,21 +192,18 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad if (endPoint.contains("$PartnerName$")) { endPoint = endPoint.replace("$PartnerName$", PartnerRegistration.partnerId); } - + String authRequest = ""; - - if(!(BaseTestCase.certsForModule.equals("DSL-IDA"))){ - authRequest = getJsonFromTemplate(input.toString(), testCaseDTO.getInputTemplate()); - } - else { - authRequest = input.toString(); - } + if (!(BaseTestCase.certsForModule.equals("DSL-IDA"))) { + authRequest = getJsonFromTemplate(input.toString(), testCaseDTO.getInputTemplate()); + } else { + authRequest = input.toString(); + } logger.info("******Post request Json to EndPointUrl: " + url + endPoint + " *******"); - response = postWithBodyAndCookie(url + endPoint, authRequest, COOKIENAME, testCaseDTO.getRole(), - testCaseName); + response = postWithBodyAndCookie(url + endPoint, authRequest, COOKIENAME, testCaseDTO.getRole(), testCaseName); String ActualOPJson = getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()); @@ -237,8 +234,8 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad } } } - Map> ouputValid = OutputValidationUtil - .doJsonOutputValidation(response.asString(), ActualOPJson, testCaseDTO.isCheckErrorsOnlyInResponse()); + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), ActualOPJson, testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); if (!OutputValidationUtil.publishOutputResult(ouputValid)) @@ -254,7 +251,6 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad } } - } /** diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PatchWithBodyWithOtpGenerate.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PatchWithBodyWithOtpGenerate.java index 281e3b90ff3..a9372953b49 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PatchWithBodyWithOtpGenerate.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PatchWithBodyWithOtpGenerate.java @@ -34,7 +34,7 @@ public class PatchWithBodyWithOtpGenerate extends AdminTestUtil implements ITest { private static final Logger logger = Logger.getLogger(PatchWithBodyWithOtpGenerate.class); protected String testCaseName = ""; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -42,7 +42,7 @@ public static void setLogLevel() { else logger.setLevel(Level.ERROR); } - + /** * get current testcaseName */ @@ -59,10 +59,9 @@ public String getTestName() { @DataProvider(name = "testcaselist") public Object[] getTestCaseList(ITestContext context) { String ymlFile = context.getCurrentXmlTest().getLocalParameters().get("ymlFile"); - logger.info("Started executing yml: "+ymlFile); + logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -74,14 +73,14 @@ public Object[] getTestCaseList(ITestContext context) { * @throws AdminTestException */ @Test(dataProvider = "testcaselist") - public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { - testCaseName = testCaseDTO.getTestCaseName(); + public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { + testCaseName = testCaseDTO.getTestCaseName(); if (HealthChecker.signalTerminateExecution) { throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS); } JSONObject req = new JSONObject(testCaseDTO.getInput()); String otpRequest = null, sendOtpReqTemplate = null, sendOtpEndPoint = null; - if(req.has(GlobalConstants.SENDOTP)) { + if (req.has(GlobalConstants.SENDOTP)) { otpRequest = req.get(GlobalConstants.SENDOTP).toString(); req.remove(GlobalConstants.SENDOTP); } @@ -90,35 +89,42 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad otpReqJson.remove("sendOtpReqTemplate"); sendOtpEndPoint = otpReqJson.getString("sendOtpEndPoint"); otpReqJson.remove("sendOtpEndPoint"); - - Response otpResponse = postWithBodyAndCookie(ApplnURI + sendOtpEndPoint, getJsonFromTemplate(otpReqJson.toString(), sendOtpReqTemplate), COOKIENAME,GlobalConstants.RESIDENT, testCaseDTO.getTestCaseName()); - + + Response otpResponse = postWithBodyAndCookie(ApplnURI + sendOtpEndPoint, + getJsonFromTemplate(otpReqJson.toString(), sendOtpReqTemplate), COOKIENAME, GlobalConstants.RESIDENT, + testCaseDTO.getTestCaseName()); + JSONObject res = new JSONObject(testCaseDTO.getOutput()); String sendOtpResp = null, sendOtpResTemplate = null; - if(res.has(GlobalConstants.SENDOTPRESP)) { + if (res.has(GlobalConstants.SENDOTPRESP)) { sendOtpResp = res.get(GlobalConstants.SENDOTPRESP).toString(); res.remove(GlobalConstants.SENDOTPRESP); } JSONObject sendOtpRespJson = new JSONObject(sendOtpResp); sendOtpResTemplate = sendOtpRespJson.getString("sendOtpResTemplate"); sendOtpRespJson.remove("sendOtpResTemplate"); - Map> ouputValidOtp = OutputValidationUtil - .doJsonOutputValidation(otpResponse.asString(), getJsonFromTemplate(sendOtpRespJson.toString(), sendOtpResTemplate), testCaseDTO.isCheckErrorsOnlyInResponse()); + Map> ouputValidOtp = OutputValidationUtil.doJsonOutputValidation( + otpResponse.asString(), getJsonFromTemplate(sendOtpRespJson.toString(), sendOtpResTemplate), + testCaseDTO.isCheckErrorsOnlyInResponse(), otpResponse.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValidOtp)); - + if (!OutputValidationUtil.publishOutputResult(ouputValidOtp)) { if (otpResponse.asString().contains("IDA-OTA-001")) - throw new AdminTestException("Exceeded number of OTP requests in a given time, Increase otp.request.flooding.max-count"); + throw new AdminTestException( + "Exceeded number of OTP requests in a given time, Increase otp.request.flooding.max-count"); else throw new AdminTestException("Failed at otp output validation"); } - - Response response = patchRequestWithCookieAndHeader(ApplnURI + testCaseDTO.getEndPoint(), getJsonFromTemplate(req.toString(), testCaseDTO.getInputTemplate()), COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); - - Map> ouputValid = OutputValidationUtil - .doJsonOutputValidation(response.asString(), getJsonFromTemplate(res.toString(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + + Response response = patchRequestWithCookieAndHeader(ApplnURI + testCaseDTO.getEndPoint(), + getJsonFromTemplate(req.toString(), testCaseDTO.getInputTemplate()), COOKIENAME, testCaseDTO.getRole(), + testCaseDTO.getTestCaseName()); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), getJsonFromTemplate(res.toString(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - + if (!OutputValidationUtil.publishOutputResult(ouputValid)) throw new AdminTestException("Failed at output validation"); @@ -142,5 +148,5 @@ public void setResultTestName(ITestResult result) { } catch (Exception e) { Reporter.log("Exception : " + e.getMessage()); } - } + } } diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PatchWithPathParam.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PatchWithPathParam.java index 19ed3a2eb0e..b828ea9772b 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PatchWithPathParam.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PatchWithPathParam.java @@ -35,7 +35,7 @@ public class PatchWithPathParam extends AdminTestUtil implements ITest { private static final Logger logger = Logger.getLogger(PatchWithPathParam.class); protected String testCaseName = ""; public Response response = null; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -43,7 +43,7 @@ public static void setLogLevel() { else logger.setLevel(Level.ERROR); } - + /** * get current testcaseName */ @@ -60,10 +60,9 @@ public String getTestName() { @DataProvider(name = "testcaselist") public Object[] getTestCaseList(ITestContext context) { String ymlFile = context.getCurrentXmlTest().getLocalParameters().get("ymlFile"); - logger.info("Started executing yml: "+ymlFile); + logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -75,43 +74,46 @@ public Object[] getTestCaseList(ITestContext context) { * @throws AdminTestException */ @Test(dataProvider = "testcaselist") - public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { - testCaseName = testCaseDTO.getTestCaseName(); + public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { + testCaseName = testCaseDTO.getTestCaseName(); if (HealthChecker.signalTerminateExecution) { throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS); } String[] templateFields = testCaseDTO.getTemplateFields(); - + if (testCaseDTO.getTemplateFields() != null && templateFields.length > 0) { ArrayList inputtestCases = AdminTestUtil.getInputTestCase(testCaseDTO); ArrayList outputtestcase = AdminTestUtil.getOutputTestCase(testCaseDTO); - for (int i=0; i> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), - getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); - Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - - if (!OutputValidationUtil.publishOutputResult(ouputValid)) - throw new AdminTestException("Failed at output validation"); - } - } - + for (int i = 0; i < languageList.size(); i++) { + response = patchWithPathParamAndCookie(ApplnURI + testCaseDTO.getEndPoint(), + getJsonFromTemplate(inputtestCases.get(i).toString(), testCaseDTO.getInputTemplate()), + COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), + getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); + Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); + + if (!OutputValidationUtil.publishOutputResult(ouputValid)) + throw new AdminTestException("Failed at output validation"); + } + } + else { - response = patchWithPathParamAndCookie(ApplnURI + testCaseDTO.getEndPoint(), getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()), COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); - - Map> ouputValid = OutputValidationUtil - .doJsonOutputValidation(response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + response = patchWithPathParamAndCookie(ApplnURI + testCaseDTO.getEndPoint(), + getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()), COOKIENAME, + testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - + if (!OutputValidationUtil.publishOutputResult(ouputValid)) throw new AdminTestException("Failed at output validation"); } } - - - /** * The method ser current test name to result @@ -131,5 +133,5 @@ public void setResultTestName(ITestResult result) { } catch (Exception e) { Reporter.log("Exception : " + e.getMessage()); } - } + } } diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PatchWithPathParamsAndBody.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PatchWithPathParamsAndBody.java index 46305571d81..05fbd7d8615 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PatchWithPathParamsAndBody.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PatchWithPathParamsAndBody.java @@ -36,7 +36,7 @@ public class PatchWithPathParamsAndBody extends AdminTestUtil implements ITest { protected String testCaseName = ""; String pathParams = null; public Response response = null; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -44,7 +44,7 @@ public static void setLogLevel() { else logger.setLevel(Level.ERROR); } - + /** * get current testcaseName */ @@ -62,10 +62,9 @@ public String getTestName() { public Object[] getTestCaseList(ITestContext context) { String ymlFile = context.getCurrentXmlTest().getLocalParameters().get("ymlFile"); pathParams = context.getCurrentXmlTest().getLocalParameters().get("pathParams"); - logger.info("Started executing yml: "+ymlFile); + logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -77,27 +76,29 @@ public Object[] getTestCaseList(ITestContext context) { * @throws AdminTestException */ @Test(dataProvider = "testcaselist") - public void test(TestCaseDTO testCaseDTO) throws AdminTestException { - testCaseName = testCaseDTO.getTestCaseName(); - + public void test(TestCaseDTO testCaseDTO) throws AdminTestException { + testCaseName = testCaseDTO.getTestCaseName(); + if (HealthChecker.signalTerminateExecution) { throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS); } - - testCaseDTO=AdminTestUtil.filterHbs(testCaseDTO); + + testCaseDTO = AdminTestUtil.filterHbs(testCaseDTO); String inputJson = filterInputHbs(testCaseDTO); - - response = patchWithPathParamsBodyAndCookie(ApplnURI + testCaseDTO.getEndPoint(), inputJson, COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), pathParams); - - Map> ouputValid = OutputValidationUtil - .doJsonOutputValidation(response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + + response = patchWithPathParamsBodyAndCookie(ApplnURI + testCaseDTO.getEndPoint(), inputJson, COOKIENAME, + testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), pathParams); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - + if (!OutputValidationUtil.publishOutputResult(ouputValid)) throw new AdminTestException("Failed at output validation"); } - + private String filterInputHbs(TestCaseDTO testCaseDTO) { String inputJson = getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()); @@ -107,8 +108,7 @@ private String filterInputHbs(TestCaseDTO testCaseDTO) { inputJson = inputJson.replace(GlobalConstants.$2STLANG$, BaseTestCase.languageList.get(1)); if (inputJson.contains(GlobalConstants.$3STLANG$)) inputJson = inputJson.replace(GlobalConstants.$3STLANG$, BaseTestCase.languageList.get(2)); - - + return inputJson; } @@ -130,5 +130,5 @@ public void setResultTestName(ITestResult result) { } catch (Exception e) { Reporter.log("Exception : " + e.getMessage()); } - } + } } diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PatchWithQueryParam.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PatchWithQueryParam.java index 80830ba19d5..3a8e4dfd53d 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PatchWithQueryParam.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PatchWithQueryParam.java @@ -35,7 +35,7 @@ public class PatchWithQueryParam extends AdminTestUtil implements ITest { private static final Logger logger = Logger.getLogger(PatchWithQueryParam.class); protected String testCaseName = ""; public Response response = null; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -63,7 +63,6 @@ public Object[] getTestCaseList(ITestContext context) { logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -77,7 +76,7 @@ public Object[] getTestCaseList(ITestContext context) { @Test(dataProvider = "testcaselist") public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { testCaseName = testCaseDTO.getTestCaseName(); - + if (HealthChecker.signalTerminateExecution) { throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS); } @@ -86,29 +85,31 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad if (testCaseDTO.getTemplateFields() != null && templateFields.length > 0) { ArrayList inputtestCases = AdminTestUtil.getInputTestCase(testCaseDTO); ArrayList outputtestcase = AdminTestUtil.getOutputTestCase(testCaseDTO); - - for (int i=0; i> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), - getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); - Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - - if (!OutputValidationUtil.publishOutputResult(ouputValid)) - throw new AdminTestException("Failed at output validation"); - } - } - + + for (int i = 0; i < languageList.size(); i++) { + response = patchWithQueryParamAndCookie(ApplnURI + testCaseDTO.getEndPoint(), + getJsonFromTemplate(inputtestCases.get(i).toString(), testCaseDTO.getInputTemplate()), + COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), + getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); + Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); + + if (!OutputValidationUtil.publishOutputResult(ouputValid)) + throw new AdminTestException("Failed at output validation"); + } + } + else { response = patchWithQueryParamAndCookie(ApplnURI + testCaseDTO.getEndPoint(), getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()), COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); if (!OutputValidationUtil.publishOutputResult(ouputValid)) diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithAutogenIdWithOtpGenerate.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithAutogenIdWithOtpGenerate.java index fc272aa66c9..a33b4fce051 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithAutogenIdWithOtpGenerate.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithAutogenIdWithOtpGenerate.java @@ -39,7 +39,7 @@ public class PostWithAutogenIdWithOtpGenerate extends AdminTestUtil implements I public String idKeyName = null; public Response response = null; public boolean auditLogCheck = false; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -68,7 +68,6 @@ public Object[] getTestCaseList(ITestContext context) { logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -80,7 +79,7 @@ public Object[] getTestCaseList(ITestContext context) { * @throws AdminTestException * @throws InterruptedException * @throws NumberFormatException - */ + */ @Test(dataProvider = "testcaselist") public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException, NumberFormatException, InterruptedException { @@ -88,7 +87,8 @@ public void test(TestCaseDTO testCaseDTO) if (HealthChecker.signalTerminateExecution) { throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS); } - if ((!BaseTestCase.isTargetEnvLTS()) && BaseTestCase.currentModule.equals("auth") && testCaseName.startsWith("auth_GenerateVID_")) { + if ((!BaseTestCase.isTargetEnvLTS()) && BaseTestCase.currentModule.equals("auth") + && testCaseName.startsWith("auth_GenerateVID_")) { throw new SkipException("Generating VID using IdRepo API on Pre-LTS. Hence skipping this test case"); } testCaseName = isTestCaseValidForExecution(testCaseDTO); @@ -121,19 +121,19 @@ public void test(TestCaseDTO testCaseDTO) testCaseDTO.getTestCaseName()); } else { otpResponse = postWithBodyAndCookie(ApplnURI + sendOtpEndPoint, - getJsonFromTemplate(otpReqJson.toString(), sendOtpReqTemplate), COOKIENAME, GlobalConstants.RESIDENT, - testCaseDTO.getTestCaseName()); + getJsonFromTemplate(otpReqJson.toString(), sendOtpReqTemplate), COOKIENAME, + GlobalConstants.RESIDENT, testCaseDTO.getTestCaseName()); } if (otpResponse != null && otpResponse.asString().contains("IDA-MLC-018")) { - logger.info( - "waiting for: " + properties.getProperty("uinGenDelayTime") + " as UIN not available in database"); + logger.info("waiting for: " + properties.getProperty("uinGenDelayTime") + + " as UIN not available in database"); try { Thread.sleep(Long.parseLong(properties.getProperty("uinGenDelayTime"))); } catch (NumberFormatException | InterruptedException e) { logger.error(e.getMessage()); Thread.currentThread().interrupt(); - } + } } else { break; } @@ -142,8 +142,8 @@ public void test(TestCaseDTO testCaseDTO) } JSONObject res = new JSONObject(testCaseDTO.getOutput()); - String sendOtpResp = null; - String sendOtpResTemplate = null; + String sendOtpResp = null; + String sendOtpResTemplate = null; if (res.has(GlobalConstants.SENDOTPRESP)) { sendOtpResp = res.get(GlobalConstants.SENDOTPRESP).toString(); res.remove(GlobalConstants.SENDOTPRESP); @@ -153,23 +153,21 @@ public void test(TestCaseDTO testCaseDTO) sendOtpRespJson.remove("sendOtpResTemplate"); if (otpResponse != null) { Map> ouputValidOtp = OutputValidationUtil.doJsonOutputValidation( - otpResponse.asString(), getJsonFromTemplate(sendOtpRespJson.toString(), sendOtpResTemplate), testCaseDTO.isCheckErrorsOnlyInResponse()); + otpResponse.asString(), getJsonFromTemplate(sendOtpRespJson.toString(), sendOtpResTemplate), + testCaseDTO.isCheckErrorsOnlyInResponse(), otpResponse.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValidOtp)); - + if (!OutputValidationUtil.publishOutputResult(ouputValidOtp)) { if (otpResponse.asString().contains("IDA-OTA-001")) - throw new AdminTestException("Exceeded number of OTP requests in a given time, Increase otp.request.flooding.max-count"); + throw new AdminTestException( + "Exceeded number of OTP requests in a given time, Increase otp.request.flooding.max-count"); else throw new AdminTestException("Failed at otp output validation"); } - - } - else { + + } else { throw new AdminTestException("Invalid otp response"); } - - - if (testCaseName.contains(GlobalConstants.ESIGNET_)) { if (!ConfigManager.IseSignetDeployed()) { @@ -185,9 +183,9 @@ public void test(TestCaseDTO testCaseDTO) COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), idKeyName); } - Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), getJsonFromTemplate(res.toString(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + response.asString(), getJsonFromTemplate(res.toString(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); if (!OutputValidationUtil.publishOutputResult(ouputValid)) @@ -218,12 +216,13 @@ public void setResultTestName(ITestResult result) { @AfterClass(alwaysRun = true) public void waittime() { try { - if ((!testCaseName.contains(GlobalConstants.ESIGNET_)) && (!testCaseName.contains("Resident_CheckAidStatus"))) { + if ((!testCaseName.contains(GlobalConstants.ESIGNET_)) + && (!testCaseName.contains("Resident_CheckAidStatus"))) { long delayTime = Long.parseLong(properties.getProperty("Delaytime")); if (!BaseTestCase.isTargetEnvLTS()) - delayTime = Long.parseLong(properties.getProperty("uinGenDelayTime")) * Long.parseLong(properties.getProperty("uinGenMaxLoopCount")); - logger.info("waiting for " + delayTime - + " mili secs after VID Generation In RESIDENT SERVICES"); + delayTime = Long.parseLong(properties.getProperty("uinGenDelayTime")) + * Long.parseLong(properties.getProperty("uinGenMaxLoopCount")); + logger.info("waiting for " + delayTime + " mili secs after VID Generation In RESIDENT SERVICES"); Thread.sleep(delayTime); } } catch (Exception e) { diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithAutogenIdWithOtpGenerateForWla.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithAutogenIdWithOtpGenerateForWla.java index b74e13e868c..c616605908f 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithAutogenIdWithOtpGenerateForWla.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithAutogenIdWithOtpGenerateForWla.java @@ -37,7 +37,7 @@ public class PostWithAutogenIdWithOtpGenerateForWla extends AdminTestUtil implem protected String testCaseName = ""; public String idKeyName = null; public Response response = null; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -45,7 +45,7 @@ public static void setLogLevel() { else logger.setLevel(Level.ERROR); } - + /** * get current testcaseName */ @@ -63,10 +63,9 @@ public String getTestName() { public Object[] getTestCaseList(ITestContext context) { String ymlFile = context.getCurrentXmlTest().getLocalParameters().get("ymlFile"); idKeyName = context.getCurrentXmlTest().getLocalParameters().get("idKeyName"); - logger.info("Started executing yml: "+ymlFile); + logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -78,17 +77,17 @@ public Object[] getTestCaseList(ITestContext context) { * @throws AdminTestException */ @Test(dataProvider = "testcaselist") - public void test(TestCaseDTO testCaseDTO) throws AdminTestException { - testCaseName = testCaseDTO.getTestCaseName(); + public void test(TestCaseDTO testCaseDTO) throws AdminTestException { + testCaseName = testCaseDTO.getTestCaseName(); if (HealthChecker.signalTerminateExecution) { throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS); } testCaseName = isTestCaseValidForExecution(testCaseDTO); JSONObject req = new JSONObject(testCaseDTO.getInput()); - String otpRequest = null; + String otpRequest = null; String sendOtpReqTemplate = null; String sendOtpEndPoint = null; - if(req.has(GlobalConstants.SENDOTP)) { + if (req.has(GlobalConstants.SENDOTP)) { otpRequest = req.get(GlobalConstants.SENDOTP).toString(); req.remove(GlobalConstants.SENDOTP); } @@ -97,38 +96,42 @@ public void test(TestCaseDTO testCaseDTO) throws AdminTestException { otpReqJson.remove("sendOtpReqTemplate"); sendOtpEndPoint = otpReqJson.getString("sendOtpEndPoint"); otpReqJson.remove("sendOtpEndPoint"); - + Response otpResponse = null; - if(testCaseName.contains(GlobalConstants.ESIGNET_)) { + if (testCaseName.contains(GlobalConstants.ESIGNET_)) { String tempUrl = ConfigManager.getEsignetBaseUrl(); - otpResponse = postRequestWithCookieAuthHeaderForAutoGenId(tempUrl + sendOtpEndPoint, getJsonFromTemplate(otpReqJson.toString(), sendOtpReqTemplate), COOKIENAME, "mobileauth", testCaseDTO.getTestCaseName(), idKeyName); - } - else { - otpResponse = postWithBodyAndCookie(ApplnURI + sendOtpEndPoint, getJsonFromTemplate(otpReqJson.toString(), sendOtpReqTemplate), COOKIENAME,GlobalConstants.RESIDENT, testCaseDTO.getTestCaseName()); + otpResponse = postRequestWithCookieAuthHeaderForAutoGenId(tempUrl + sendOtpEndPoint, + getJsonFromTemplate(otpReqJson.toString(), sendOtpReqTemplate), COOKIENAME, "mobileauth", + testCaseDTO.getTestCaseName(), idKeyName); + } else { + otpResponse = postWithBodyAndCookie(ApplnURI + sendOtpEndPoint, + getJsonFromTemplate(otpReqJson.toString(), sendOtpReqTemplate), COOKIENAME, + GlobalConstants.RESIDENT, testCaseDTO.getTestCaseName()); } JSONObject res = new JSONObject(testCaseDTO.getOutput()); String sendOtpResp = null; - String sendOtpResTemplate = null; - if(res.has(GlobalConstants.SENDOTPRESP)) { + String sendOtpResTemplate = null; + if (res.has(GlobalConstants.SENDOTPRESP)) { sendOtpResp = res.get(GlobalConstants.SENDOTPRESP).toString(); res.remove(GlobalConstants.SENDOTPRESP); } JSONObject sendOtpRespJson = new JSONObject(sendOtpResp); sendOtpResTemplate = sendOtpRespJson.getString("sendOtpResTemplate"); sendOtpRespJson.remove("sendOtpResTemplate"); - Map> ouputValidOtp = OutputValidationUtil - .doJsonOutputValidation(otpResponse.asString(), getJsonFromTemplate(sendOtpRespJson.toString(), sendOtpResTemplate), testCaseDTO.isCheckErrorsOnlyInResponse()); + Map> ouputValidOtp = OutputValidationUtil.doJsonOutputValidation( + otpResponse.asString(), getJsonFromTemplate(sendOtpRespJson.toString(), sendOtpResTemplate), + testCaseDTO.isCheckErrorsOnlyInResponse(), otpResponse.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValidOtp)); - + if (!OutputValidationUtil.publishOutputResult(ouputValidOtp)) throw new AdminTestException("Failed at otp output validation"); - + String otpValidationRequest = null; - String validateOtpReqTemplate = null; - String validateOtpEndPoint = null; - - if(req.has(GlobalConstants.VALIDATEOTP)) { + String validateOtpReqTemplate = null; + String validateOtpEndPoint = null; + + if (req.has(GlobalConstants.VALIDATEOTP)) { otpValidationRequest = req.get(GlobalConstants.VALIDATEOTP).toString(); req.remove(GlobalConstants.VALIDATEOTP); } @@ -137,26 +140,32 @@ public void test(TestCaseDTO testCaseDTO) throws AdminTestException { validateOtpReqJson.remove("validateOtpReqTemplate"); validateOtpEndPoint = validateOtpReqJson.getString("validateOtpEndPoint"); validateOtpReqJson.remove("validateOtpEndPoint"); - Response validateOtpResponse; - if(testCaseName.contains(GlobalConstants.ESIGNET_)) { + if (testCaseName.contains(GlobalConstants.ESIGNET_)) { String tempUrl = ConfigManager.getEsignetBaseUrl(); - validateOtpResponse = postRequestWithCookieAuthHeaderForAutoGenId(tempUrl + validateOtpEndPoint, getJsonFromTemplate(validateOtpReqJson.toString(), validateOtpReqTemplate), COOKIENAME, "mobileauth", testCaseDTO.getTestCaseName(), idKeyName); + validateOtpResponse = postRequestWithCookieAuthHeaderForAutoGenId(tempUrl + validateOtpEndPoint, + getJsonFromTemplate(validateOtpReqJson.toString(), validateOtpReqTemplate), COOKIENAME, + "mobileauth", testCaseDTO.getTestCaseName(), idKeyName); } - - if(testCaseName.contains(GlobalConstants.ESIGNET_)) { + + if (testCaseName.contains(GlobalConstants.ESIGNET_)) { String tempUrl = ConfigManager.getEsignetBaseUrl(); - response = postWithBodyAndCookieAuthHeaderAndXsrfTokenForAutoGeneratedId(tempUrl + testCaseDTO.getEndPoint(), getJsonFromTemplate(req.toString(), testCaseDTO.getInputTemplate()), COOKIENAME, testCaseDTO.getTestCaseName(), idKeyName); - } - else { - response = postWithBodyAndCookieForAutoGeneratedId(ApplnURI + testCaseDTO.getEndPoint(), getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()), COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), idKeyName); + response = postWithBodyAndCookieAuthHeaderAndXsrfTokenForAutoGeneratedId( + tempUrl + testCaseDTO.getEndPoint(), + getJsonFromTemplate(req.toString(), testCaseDTO.getInputTemplate()), COOKIENAME, + testCaseDTO.getTestCaseName(), idKeyName); + } else { + response = postWithBodyAndCookieForAutoGeneratedId(ApplnURI + testCaseDTO.getEndPoint(), + getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()), COOKIENAME, + testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), idKeyName); } - - Map> ouputValid = OutputValidationUtil - .doJsonOutputValidation(response.asString(), getJsonFromTemplate(res.toString(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), getJsonFromTemplate(res.toString(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - + if (!OutputValidationUtil.publishOutputResult(ouputValid)) throw new AdminTestException("Failed at output validation"); @@ -181,11 +190,12 @@ public void setResultTestName(ITestResult result) { Reporter.log("Exception : " + e.getMessage()); } } - + @AfterClass(alwaysRun = true) public void waittime() { try { - if((!testCaseName.contains(GlobalConstants.ESIGNET_)) && (!testCaseName.contains("Resident_CheckAidStatus"))) { + if ((!testCaseName.contains(GlobalConstants.ESIGNET_)) + && (!testCaseName.contains("Resident_CheckAidStatus"))) { logger.info("waiting for" + properties.getProperty("Delaytime") + " mili secs after VID Generation In RESIDENT SERVICES"); Thread.sleep(Long.parseLong(properties.getProperty("Delaytime"))); diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithBodyAndPathParams.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithBodyAndPathParams.java index 5bff76b706f..533ca2e3a58 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithBodyAndPathParams.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithBodyAndPathParams.java @@ -39,7 +39,7 @@ public class PostWithBodyAndPathParams extends AdminTestUtil implements ITest { String pathParams = null; String headers = null; public Response response = null; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -47,7 +47,7 @@ public static void setLogLevel() { else logger.setLevel(Level.ERROR); } - + /** * get current testcaseName */ @@ -66,10 +66,9 @@ public Object[] getTestCaseList(ITestContext context) { String ymlFile = context.getCurrentXmlTest().getLocalParameters().get("ymlFile"); pathParams = context.getCurrentXmlTest().getLocalParameters().get("pathParams"); headers = context.getCurrentXmlTest().getLocalParameters().get("headers"); - logger.info("Started executing yml: "+ymlFile); + logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -81,51 +80,56 @@ public Object[] getTestCaseList(ITestContext context) { * @throws AdminTestException */ @Test(dataProvider = "testcaselist") - public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { + public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { testCaseName = testCaseDTO.getTestCaseName(); String[] templateFields = testCaseDTO.getTemplateFields(); - + if (HealthChecker.signalTerminateExecution) { throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS); } - - testCaseDTO=AdminTestUtil.filterHbs(testCaseDTO); + + testCaseDTO = AdminTestUtil.filterHbs(testCaseDTO); String inputJson = filterInputHbs(testCaseDTO); String outputJson = filterOutputHbs(testCaseDTO); - + if (testCaseDTO.getTemplateFields() != null && templateFields.length > 0) { ArrayList inputtestCases = AdminTestUtil.getInputTestCase(testCaseDTO); ArrayList outputtestcase = AdminTestUtil.getOutputTestCase(testCaseDTO); - for (int i=0; i> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), - getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); - Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - - if (!OutputValidationUtil.publishOutputResult(ouputValid)) - throw new AdminTestException("Failed at output validation"); - } - } - + for (int i = 0; i < languageList.size(); i++) { + response = postWithPathParamsBodyAndCookie(ApplnURI + testCaseDTO.getEndPoint(), + getJsonFromTemplate(inputtestCases.get(i).toString(), testCaseDTO.getInputTemplate()), + COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), pathParams); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), + getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); + Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); + + if (!OutputValidationUtil.publishOutputResult(ouputValid)) + throw new AdminTestException("Failed at output validation"); + } + } + else { if (testCaseName.contains("Esignet_KycDemoAuth")) { - response = postWithPathParamsBodyHeaderAndCookie(ApplnURI + testCaseDTO.getEndPoint(), inputJson, COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), pathParams); + response = postWithPathParamsBodyHeaderAndCookie(ApplnURI + testCaseDTO.getEndPoint(), inputJson, + COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), pathParams); + } else { + response = postWithPathParamsBodyAndCookie(ApplnURI + testCaseDTO.getEndPoint(), inputJson, COOKIENAME, + testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), pathParams); } - else { - response = postWithPathParamsBodyAndCookie(ApplnURI + testCaseDTO.getEndPoint(), inputJson, COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), pathParams); - } - Map> ouputValid = OutputValidationUtil - .doJsonOutputValidation(response.asString(), outputJson, testCaseDTO.isCheckErrorsOnlyInResponse()); + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), outputJson, testCaseDTO.isCheckErrorsOnlyInResponse(), + response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - + if (!OutputValidationUtil.publishOutputResult(ouputValid)) throw new AdminTestException("Failed at output validation"); } } - + private String filterOutputHbs(TestCaseDTO testCaseDTO) { String outputJson = getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()); @@ -147,13 +151,9 @@ private String filterInputHbs(TestCaseDTO testCaseDTO) { inputJson = inputJson.replace(GlobalConstants.$2STLANG$, BaseTestCase.languageList.get(1)); if (inputJson.contains(GlobalConstants.$3STLANG$)) inputJson = inputJson.replace(GlobalConstants.$3STLANG$, BaseTestCase.languageList.get(2)); - - + return inputJson; } - - - /** * The method ser current test name to result @@ -173,5 +173,5 @@ public void setResultTestName(ITestResult result) { } catch (Exception e) { Reporter.log("Exception : " + e.getMessage()); } - } + } } diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithBodyAndQueryParamsForAutoGenId.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithBodyAndQueryParamsForAutoGenId.java index 9935c66c3fb..947919b900b 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithBodyAndQueryParamsForAutoGenId.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithBodyAndQueryParamsForAutoGenId.java @@ -37,7 +37,7 @@ public class PostWithBodyAndQueryParamsForAutoGenId extends AdminTestUtil implem String queryParams = null; public String idKeyName = null; public Response response = null; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -45,66 +45,62 @@ public static void setLogLevel() { else logger.setLevel(Level.ERROR); } - + @Override public String getTestName() { return testCaseName; } - @DataProvider(name = "testcaselist") public Object[] getTestCaseList(ITestContext context) { String ymlFile = context.getCurrentXmlTest().getLocalParameters().get("ymlFile"); idKeyName = context.getCurrentXmlTest().getLocalParameters().get("idKeyName"); queryParams = context.getCurrentXmlTest().getLocalParameters().get("queryParams"); - logger.info("Started executing yml: "+ymlFile); + logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - - @Test(dataProvider = "testcaselist") - public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { + public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { testCaseName = testCaseDTO.getTestCaseName(); - + if (HealthChecker.signalTerminateExecution) { throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS); } - - if(testCaseName.contains("_AuthDemoUrl_")) { + + if (testCaseName.contains("_AuthDemoUrl_")) { String url = ConfigManager.getAuthDemoServiceUrl(); - + logger.info("******Post request Json to EndPointUrl: " + url + testCaseDTO.getEndPoint() + " *******"); - - response = postWithQueryParamsBodyAndCookie(url + testCaseDTO.getEndPoint(), getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()), COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), queryParams, idKeyName); - } - else { - logger.info("Not Getting"+GlobalConstants.POST_REQ_URL + testCaseDTO.getTestCaseName() + " *******"); + + response = postWithQueryParamsBodyAndCookie(url + testCaseDTO.getEndPoint(), + getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()), COOKIENAME, + testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), queryParams, idKeyName); + } else { + logger.info("Not Getting" + GlobalConstants.POST_REQ_URL + testCaseDTO.getTestCaseName() + " *******"); } - + Map> ouputValid = null; - if(testCaseName.contains("_StatusCode")) { - - OutputValidationDto customResponse = customStatusCodeResponse(String.valueOf(response.getStatusCode()), testCaseDTO.getOutput()); - + if (testCaseName.contains("_StatusCode")) { + + OutputValidationDto customResponse = customStatusCodeResponse(String.valueOf(response.getStatusCode()), + testCaseDTO.getOutput()); + ouputValid = new HashMap<>(); ouputValid.put(GlobalConstants.EXPECTED_VS_ACTUAL, List.of(customResponse)); - }else { - - ouputValid = OutputValidationUtil - .doJsonOutputValidation(response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + } else { + + ouputValid = OutputValidationUtil.doJsonOutputValidation(response.asString(), + getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); } Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - + if (!OutputValidationUtil.publishOutputResult(ouputValid)) throw new AdminTestException("Failed at output validation"); } - - - - @AfterMethod(alwaysRun = true) public void setResultTestName(ITestResult result) { try { @@ -118,5 +114,5 @@ public void setResultTestName(ITestResult result) { } catch (Exception e) { Reporter.log("Exception : " + e.getMessage()); } - } + } } diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithBodyWithOtpGenerate.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithBodyWithOtpGenerate.java index 62e7c2c3105..35d89795dd8 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithBodyWithOtpGenerate.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithBodyWithOtpGenerate.java @@ -37,7 +37,7 @@ public class PostWithBodyWithOtpGenerate extends AdminTestUtil implements ITest public Response response = null; public boolean sendEsignetToken = false; public boolean auditLogCheck = false; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -45,7 +45,7 @@ public static void setLogLevel() { else logger.setLevel(Level.ERROR); } - + /** * get current testcaseName */ @@ -63,10 +63,9 @@ public String getTestName() { public Object[] getTestCaseList(ITestContext context) { String ymlFile = context.getCurrentXmlTest().getLocalParameters().get("ymlFile"); sendEsignetToken = context.getCurrentXmlTest().getLocalParameters().containsKey("sendEsignetToken"); - logger.info("Started executing yml: "+ymlFile); + logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -90,7 +89,7 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad String otpRequest = null; String sendOtpReqTemplate = null; String sendOtpEndPoint = null; - if(req.has(GlobalConstants.SENDOTP)) { + if (req.has(GlobalConstants.SENDOTP)) { otpRequest = req.get(GlobalConstants.SENDOTP).toString(); req.remove(GlobalConstants.SENDOTP); } @@ -99,60 +98,71 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad otpReqJson.remove("sendOtpReqTemplate"); sendOtpEndPoint = otpReqJson.getString("sendOtpEndPoint"); otpReqJson.remove("sendOtpEndPoint"); - Response otpResponse =null; - if(testCaseDTO.getRole().equalsIgnoreCase(GlobalConstants.RESIDENTNEW)) { - otpResponse = postWithBodyAndCookie(ApplnURI + sendOtpEndPoint, getJsonFromTemplate(otpReqJson.toString(), sendOtpReqTemplate), auditLogCheck, COOKIENAME,GlobalConstants.RESIDENTNEW, testCaseDTO.getTestCaseName(), sendEsignetToken); - } - else if(testCaseDTO.getRole().equalsIgnoreCase("residentNewVid")) { - otpResponse = postWithBodyAndCookie(ApplnURI + sendOtpEndPoint, getJsonFromTemplate(otpReqJson.toString(), sendOtpReqTemplate), auditLogCheck, COOKIENAME,"residentNewVid", testCaseDTO.getTestCaseName(), sendEsignetToken); - } - else if(testCaseName.contains("ESignet_WalletBinding")) { - otpResponse = postRequestWithCookieAuthHeader(tempUrl + sendOtpEndPoint, getJsonFromTemplate(otpReqJson.toString(), sendOtpReqTemplate), COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); - } - else { - otpResponse = postWithBodyAndCookie(ApplnURI + sendOtpEndPoint, getJsonFromTemplate(otpReqJson.toString(), sendOtpReqTemplate), COOKIENAME,GlobalConstants.RESIDENT, testCaseDTO.getTestCaseName()); - } - + Response otpResponse = null; + if (testCaseDTO.getRole().equalsIgnoreCase(GlobalConstants.RESIDENTNEW)) { + otpResponse = postWithBodyAndCookie(ApplnURI + sendOtpEndPoint, + getJsonFromTemplate(otpReqJson.toString(), sendOtpReqTemplate), auditLogCheck, COOKIENAME, + GlobalConstants.RESIDENTNEW, testCaseDTO.getTestCaseName(), sendEsignetToken); + } else if (testCaseDTO.getRole().equalsIgnoreCase("residentNewVid")) { + otpResponse = postWithBodyAndCookie(ApplnURI + sendOtpEndPoint, + getJsonFromTemplate(otpReqJson.toString(), sendOtpReqTemplate), auditLogCheck, COOKIENAME, + "residentNewVid", testCaseDTO.getTestCaseName(), sendEsignetToken); + } else if (testCaseName.contains("ESignet_WalletBinding")) { + otpResponse = postRequestWithCookieAuthHeader(tempUrl + sendOtpEndPoint, + getJsonFromTemplate(otpReqJson.toString(), sendOtpReqTemplate), COOKIENAME, testCaseDTO.getRole(), + testCaseDTO.getTestCaseName()); + } else { + otpResponse = postWithBodyAndCookie(ApplnURI + sendOtpEndPoint, + getJsonFromTemplate(otpReqJson.toString(), sendOtpReqTemplate), COOKIENAME, + GlobalConstants.RESIDENT, testCaseDTO.getTestCaseName()); + } + JSONObject res = new JSONObject(testCaseDTO.getOutput()); String sendOtpResp = null, sendOtpResTemplate = null; - if(res.has(GlobalConstants.SENDOTPRESP)) { + if (res.has(GlobalConstants.SENDOTPRESP)) { sendOtpResp = res.get(GlobalConstants.SENDOTPRESP).toString(); res.remove(GlobalConstants.SENDOTPRESP); } JSONObject sendOtpRespJson = new JSONObject(sendOtpResp); sendOtpResTemplate = sendOtpRespJson.getString("sendOtpResTemplate"); sendOtpRespJson.remove("sendOtpResTemplate"); - Map> ouputValidOtp = OutputValidationUtil - .doJsonOutputValidation(otpResponse.asString(), getJsonFromTemplate(sendOtpRespJson.toString(), sendOtpResTemplate), testCaseDTO.isCheckErrorsOnlyInResponse()); + Map> ouputValidOtp = OutputValidationUtil.doJsonOutputValidation( + otpResponse.asString(), getJsonFromTemplate(sendOtpRespJson.toString(), sendOtpResTemplate), + testCaseDTO.isCheckErrorsOnlyInResponse(), otpResponse.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValidOtp)); - + if (!OutputValidationUtil.publishOutputResult(ouputValidOtp)) { if (otpResponse.asString().contains("IDA-OTA-001")) - throw new AdminTestException("Exceeded number of OTP requests in a given time, Increase otp.request.flooding.max-count"); + throw new AdminTestException( + "Exceeded number of OTP requests in a given time, Increase otp.request.flooding.max-count"); else throw new AdminTestException("Failed at otp output validation"); } - - if(testCaseName.contains("_eotp")) { + + if (testCaseName.contains("_eotp")) { try { logger.info("waiting for " + properties.getProperty("expireOtpTime") - + " mili secs to test expire otp case in RESIDENT Service"); + + " mili secs to test expire otp case in RESIDENT Service"); Thread.sleep(Long.parseLong(properties.getProperty("expireOtpTime"))); } catch (NumberFormatException | InterruptedException e) { logger.error(e.getMessage()); Thread.currentThread().interrupt(); } } - if(testCaseName.contains("ESignet_WalletBinding")) { - response = postRequestWithCookieAuthHeader(tempUrl + testCaseDTO.getEndPoint(), getJsonFromTemplate(req.toString(), testCaseDTO.getInputTemplate()), COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); - } - else { - response = postRequestWithCookieAndHeader(ApplnURI + testCaseDTO.getEndPoint(), getJsonFromTemplate(req.toString(), testCaseDTO.getInputTemplate()), COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), sendEsignetToken); + if (testCaseName.contains("ESignet_WalletBinding")) { + response = postRequestWithCookieAuthHeader(tempUrl + testCaseDTO.getEndPoint(), + getJsonFromTemplate(req.toString(), testCaseDTO.getInputTemplate()), COOKIENAME, + testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); + } else { + response = postRequestWithCookieAndHeader(ApplnURI + testCaseDTO.getEndPoint(), + getJsonFromTemplate(req.toString(), testCaseDTO.getInputTemplate()), COOKIENAME, + testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), sendEsignetToken); } - Map> ouputValid = OutputValidationUtil - .doJsonOutputValidation(response.asString(), getJsonFromTemplate(res.toString(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), getJsonFromTemplate(res.toString(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - + if (!OutputValidationUtil.publishOutputResult(ouputValid)) throw new AdminTestException("Failed at output validation"); @@ -176,5 +186,5 @@ public void setResultTestName(ITestResult result) { } catch (Exception e) { Reporter.log("Exception : " + e.getMessage()); } - } + } } diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithBodyWithOtpGenerateAndPdfDownload.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithBodyWithOtpGenerateAndPdfDownload.java index b47b9dda917..208bcce458e 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithBodyWithOtpGenerateAndPdfDownload.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithBodyWithOtpGenerateAndPdfDownload.java @@ -41,9 +41,9 @@ public class PostWithBodyWithOtpGenerateAndPdfDownload extends AdminTestUtil imp private static final Logger logger = Logger.getLogger(PostWithBodyWithOtpGenerateAndPdfDownload.class); protected String testCaseName = ""; public Response response = null; - public byte[] pdf=null; - public String pdfAsText =null; - + public byte[] pdf = null; + public String pdfAsText = null; + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -51,7 +51,7 @@ public static void setLogLevel() { else logger.setLevel(Level.ERROR); } - + /** * get current testcaseName */ @@ -68,10 +68,9 @@ public String getTestName() { @DataProvider(name = "testcaselist") public Object[] getTestCaseList(ITestContext context) { String ymlFile = context.getCurrentXmlTest().getLocalParameters().get("ymlFile"); - logger.info("Started executing yml: "+ymlFile); + logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -83,16 +82,16 @@ public Object[] getTestCaseList(ITestContext context) { * @throws AdminTestException */ @Test(dataProvider = "testcaselist") - public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { - testCaseName = testCaseDTO.getTestCaseName(); + public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { + testCaseName = testCaseDTO.getTestCaseName(); if (HealthChecker.signalTerminateExecution) { throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS); } JSONObject req = new JSONObject(testCaseDTO.getInput()); - String otpRequest = null; + String otpRequest = null; String sendOtpReqTemplate = null; - String sendOtpEndPoint = null; - if(req.has(GlobalConstants.SENDOTP)) { + String sendOtpEndPoint = null; + if (req.has(GlobalConstants.SENDOTP)) { otpRequest = req.get(GlobalConstants.SENDOTP).toString(); req.remove(GlobalConstants.SENDOTP); } @@ -101,41 +100,43 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad otpReqJson.remove("sendOtpReqTemplate"); sendOtpEndPoint = otpReqJson.getString("sendOtpEndPoint"); otpReqJson.remove("sendOtpEndPoint"); - - Response otpResponse = postWithBodyAndCookie(ApplnURI + sendOtpEndPoint, getJsonFromTemplate(otpReqJson.toString(), sendOtpReqTemplate), COOKIENAME,GlobalConstants.RESIDENT, testCaseDTO.getTestCaseName()); + Response otpResponse = postWithBodyAndCookie(ApplnURI + sendOtpEndPoint, + getJsonFromTemplate(otpReqJson.toString(), sendOtpReqTemplate), COOKIENAME, GlobalConstants.RESIDENT, + testCaseDTO.getTestCaseName()); - JSONObject res = new JSONObject(testCaseDTO.getOutput()); String sendOtpResp = null, sendOtpResTemplate = null; - if(res.has(GlobalConstants.SENDOTPRESP)) { + if (res.has(GlobalConstants.SENDOTPRESP)) { sendOtpResp = res.get(GlobalConstants.SENDOTPRESP).toString(); res.remove(GlobalConstants.SENDOTPRESP); } JSONObject sendOtpRespJson = new JSONObject(sendOtpResp); sendOtpResTemplate = sendOtpRespJson.getString("sendOtpResTemplate"); sendOtpRespJson.remove("sendOtpResTemplate"); - Map> ouputValidOtp = OutputValidationUtil - .doJsonOutputValidation(otpResponse.asString(), getJsonFromTemplate(sendOtpRespJson.toString(), sendOtpResTemplate), testCaseDTO.isCheckErrorsOnlyInResponse()); + Map> ouputValidOtp = OutputValidationUtil.doJsonOutputValidation( + otpResponse.asString(), getJsonFromTemplate(sendOtpRespJson.toString(), sendOtpResTemplate), + testCaseDTO.isCheckErrorsOnlyInResponse(), otpResponse.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValidOtp)); - + if (!OutputValidationUtil.publishOutputResult(ouputValidOtp)) throw new AdminTestException("Failed at otp output validation"); - - pdf = postWithBodyAndCookieForPdf(ApplnURI + testCaseDTO.getEndPoint(), getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()), COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); - try { - pdfAsText = PdfTextExtractor.getTextFromPage(new PdfReader(new ByteArrayInputStream(pdf)), 1); - } catch (IOException e) { - Reporter.log("Exception : " + e.getMessage()); - } - - if(pdf!=null && (new String(pdf).contains("errors")|| pdfAsText == null)) { - GlobalMethods.reportResponse(null, ApplnURI + testCaseDTO.getEndPoint(), "Not able to download UIN Card"); - } - else { - GlobalMethods.reportResponse(null, ApplnURI + testCaseDTO.getEndPoint(), pdfAsText); - } - + + pdf = postWithBodyAndCookieForPdf(ApplnURI + testCaseDTO.getEndPoint(), + getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()), COOKIENAME, + testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); + try { + pdfAsText = PdfTextExtractor.getTextFromPage(new PdfReader(new ByteArrayInputStream(pdf)), 1); + } catch (IOException e) { + Reporter.log("Exception : " + e.getMessage()); + } + + if (pdf != null && (new String(pdf).contains("errors") || pdfAsText == null)) { + GlobalMethods.reportResponse(null, ApplnURI + testCaseDTO.getEndPoint(), "Not able to download UIN Card"); + } else { + GlobalMethods.reportResponse(null, ApplnURI + testCaseDTO.getEndPoint(), pdfAsText); + } + } /** @@ -156,5 +157,5 @@ public void setResultTestName(ITestResult result) { } catch (Exception e) { Reporter.log("Exception : " + e.getMessage()); } - } + } } diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithFormDataAndFile.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithFormDataAndFile.java index ef7515c4f2b..1f21d7eff0b 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithFormDataAndFile.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithFormDataAndFile.java @@ -34,7 +34,7 @@ public class PostWithFormDataAndFile extends AdminTestUtil implements ITest { protected String testCaseName = ""; String idKeyName = null; public Response response = null; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -42,7 +42,7 @@ public static void setLogLevel() { else logger.setLevel(Level.ERROR); } - + /** * get current testcaseName */ @@ -60,10 +60,9 @@ public String getTestName() { public Object[] getTestCaseList(ITestContext context) { String ymlFile = context.getCurrentXmlTest().getLocalParameters().get("ymlFile"); idKeyName = context.getCurrentXmlTest().getLocalParameters().get("idKeyName"); - logger.info("Started executing yml: "+ymlFile); + logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -75,17 +74,20 @@ public Object[] getTestCaseList(ITestContext context) { * @throws AdminTestException */ @Test(dataProvider = "testcaselist") - public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { - testCaseName = testCaseDTO.getTestCaseName(); + public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { + testCaseName = testCaseDTO.getTestCaseName(); if (HealthChecker.signalTerminateExecution) { throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS); } - response = postWithFormDataAndMultipleFile(ApplnURI + testCaseDTO.getEndPoint(), getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()), testCaseDTO.getRole(), testCaseDTO.getTestCaseName(),idKeyName); - - Map> ouputValid = OutputValidationUtil - .doJsonOutputValidation(response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + response = postWithFormDataAndMultipleFile(ApplnURI + testCaseDTO.getEndPoint(), + getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()), testCaseDTO.getRole(), + testCaseDTO.getTestCaseName(), idKeyName); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - + if (!OutputValidationUtil.publishOutputResult(ouputValid)) throw new AdminTestException("Failed at output validation"); @@ -109,5 +111,5 @@ public void setResultTestName(ITestResult result) { } catch (Exception e) { Reporter.log("Exception : " + e.getMessage()); } - } + } } diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithFormDataAndFileForNotificationAPI.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithFormDataAndFileForNotificationAPI.java index 437c4299208..fa758ec7b15 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithFormDataAndFileForNotificationAPI.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithFormDataAndFileForNotificationAPI.java @@ -36,7 +36,7 @@ public class PostWithFormDataAndFileForNotificationAPI extends AdminTestUtil imp protected String testCaseName = ""; String idKeyName = null; public Response response = null; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -44,7 +44,7 @@ public static void setLogLevel() { else logger.setLevel(Level.ERROR); } - + /** * get current testcaseName */ @@ -62,10 +62,9 @@ public String getTestName() { public Object[] getTestCaseList(ITestContext context) { String ymlFile = context.getCurrentXmlTest().getLocalParameters().get("ymlFile"); idKeyName = context.getCurrentXmlTest().getLocalParameters().get("idKeyName"); - logger.info("Started executing yml: "+ymlFile); + logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -77,26 +76,26 @@ public Object[] getTestCaseList(ITestContext context) { * @throws AdminTestException */ @Test(dataProvider = "testcaselist") - public void test(TestCaseDTO testCaseDTO) throws AdminTestException { - testCaseName = testCaseDTO.getTestCaseName(); - testCaseDTO=AdminTestUtil.filterHbs(testCaseDTO); + public void test(TestCaseDTO testCaseDTO) throws AdminTestException { + testCaseName = testCaseDTO.getTestCaseName(); + testCaseDTO = AdminTestUtil.filterHbs(testCaseDTO); if (HealthChecker.signalTerminateExecution) { throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS); } String inputJson = filterInputHbs(testCaseDTO); - - response = postWithMultipartFormDataAndFile(ApplnURI + testCaseDTO.getEndPoint(), inputJson, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(),idKeyName); - - Map> ouputValid = OutputValidationUtil - .doJsonOutputValidation(response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + + response = postWithMultipartFormDataAndFile(ApplnURI + testCaseDTO.getEndPoint(), inputJson, + testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), idKeyName); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - + if (!OutputValidationUtil.publishOutputResult(ouputValid)) throw new AdminTestException("Failed at output validation"); } - - private String filterInputHbs(TestCaseDTO testCaseDTO) { String inputJson = getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()); @@ -107,8 +106,7 @@ private String filterInputHbs(TestCaseDTO testCaseDTO) { inputJson = inputJson.replace(GlobalConstants.$2STLANG$, BaseTestCase.languageList.get(1)); if (inputJson.contains(GlobalConstants.$3STLANG$)) inputJson = inputJson.replace(GlobalConstants.$3STLANG$, BaseTestCase.languageList.get(2)); - - + return inputJson; } @@ -130,5 +128,5 @@ public void setResultTestName(ITestResult result) { } catch (Exception e) { Reporter.log("Exception : " + e.getMessage()); } - } + } } diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithFormDataAndMultipleFile.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithFormDataAndMultipleFile.java index 5a1920cbe66..a08115789b9 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithFormDataAndMultipleFile.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithFormDataAndMultipleFile.java @@ -34,7 +34,7 @@ public class PostWithFormDataAndMultipleFile extends AdminTestUtil implements IT protected String testCaseName = ""; String idKeyName = null; public Response response = null; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -42,7 +42,7 @@ public static void setLogLevel() { else logger.setLevel(Level.ERROR); } - + /** * get current testcaseName */ @@ -60,10 +60,9 @@ public String getTestName() { public Object[] getTestCaseList(ITestContext context) { String ymlFile = context.getCurrentXmlTest().getLocalParameters().get("ymlFile"); idKeyName = context.getCurrentXmlTest().getLocalParameters().get("idKeyName"); - logger.info("Started executing yml: "+ymlFile); + logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -75,17 +74,20 @@ public Object[] getTestCaseList(ITestContext context) { * @throws AdminTestException */ @Test(dataProvider = "testcaselist") - public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { - testCaseName = testCaseDTO.getTestCaseName(); + public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { + testCaseName = testCaseDTO.getTestCaseName(); if (HealthChecker.signalTerminateExecution) { throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS); } - response = postWithFormDataAndMultipleFile(ApplnURI + testCaseDTO.getEndPoint(), getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()), testCaseDTO.getRole(), testCaseDTO.getTestCaseName(),idKeyName); - - Map> ouputValid = OutputValidationUtil - .doJsonOutputValidation(response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + response = postWithFormDataAndMultipleFile(ApplnURI + testCaseDTO.getEndPoint(), + getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()), testCaseDTO.getRole(), + testCaseDTO.getTestCaseName(), idKeyName); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - + if (!OutputValidationUtil.publishOutputResult(ouputValid)) throw new AdminTestException("Failed at output validation"); @@ -109,5 +111,5 @@ public void setResultTestName(ITestResult result) { } catch (Exception e) { Reporter.log("Exception : " + e.getMessage()); } - } + } } diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithFormPathParamAndFile.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithFormPathParamAndFile.java index 07116bc172e..68ba90ce4c8 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithFormPathParamAndFile.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithFormPathParamAndFile.java @@ -36,7 +36,7 @@ public class PostWithFormPathParamAndFile extends AdminTestUtil implements ITest protected String testCaseName = ""; public String idKeyName = null; public Response response = null; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -44,7 +44,7 @@ public static void setLogLevel() { else logger.setLevel(Level.ERROR); } - + /** * get current testcaseName */ @@ -62,11 +62,10 @@ public String getTestName() { public Object[] getTestCaseList(ITestContext context) { String ymlFile = context.getCurrentXmlTest().getLocalParameters().get("ymlFile"); idKeyName = context.getCurrentXmlTest().getLocalParameters().get("idKeyName"); - logger.info("Started executing yml: "+ymlFile); + logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - - + /** * Test method for OTP Generation execution * @@ -77,31 +76,32 @@ public Object[] getTestCaseList(ITestContext context) { * @throws AdminTestException */ @Test(dataProvider = "testcaselist") - public void test(TestCaseDTO testCaseDTO) throws AdminTestException { - testCaseName = testCaseDTO.getTestCaseName(); + public void test(TestCaseDTO testCaseDTO) throws AdminTestException { + testCaseName = testCaseDTO.getTestCaseName(); if (HealthChecker.signalTerminateExecution) { throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS); } String inputJson = getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()); - - - response = postWithFormPathParamAndFile(ApplnURI + testCaseDTO.getEndPoint(), inputJson, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), idKeyName); - + response = postWithFormPathParamAndFile(ApplnURI + testCaseDTO.getEndPoint(), inputJson, testCaseDTO.getRole(), + testCaseDTO.getTestCaseName(), idKeyName); + Map> ouputValid = null; - if(testCaseName.contains("_StatusCode")) { - - OutputValidationDto customResponse = customStatusCodeResponse(String.valueOf(response.getStatusCode()), testCaseDTO.getOutput()); - + if (testCaseName.contains("_StatusCode")) { + + OutputValidationDto customResponse = customStatusCodeResponse(String.valueOf(response.getStatusCode()), + testCaseDTO.getOutput()); + ouputValid = new HashMap<>(); ouputValid.put(GlobalConstants.EXPECTED_VS_ACTUAL, List.of(customResponse)); - }else { - ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + } else { + ouputValid = OutputValidationUtil.doJsonOutputValidation(response.asString(), + getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); } - + Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - + if (!OutputValidationUtil.publishOutputResult(ouputValid)) throw new AdminTestException("Failed at output validation"); @@ -125,5 +125,5 @@ public void setResultTestName(ITestResult result) { } catch (Exception e) { Reporter.log("Exception : " + e.getMessage()); } - } + } } diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithOnlyPathParam.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithOnlyPathParam.java index 70d8bba1434..d1c5d4c49a7 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithOnlyPathParam.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithOnlyPathParam.java @@ -38,7 +38,7 @@ public class PostWithOnlyPathParam extends AdminTestUtil implements ITest { protected String testCaseName = ""; public Response response = null; public boolean sendEsignetToken = false; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -46,7 +46,7 @@ public static void setLogLevel() { else logger.setLevel(Level.ERROR); } - + /** * get current testcaseName */ @@ -64,10 +64,9 @@ public String getTestName() { public Object[] getTestCaseList(ITestContext context) { String ymlFile = context.getCurrentXmlTest().getLocalParameters().get("ymlFile"); sendEsignetToken = context.getCurrentXmlTest().getLocalParameters().containsKey("sendEsignetToken"); - logger.info("Started executing yml: "+ymlFile); + logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -89,36 +88,43 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad if (testCaseDTO.getTemplateFields() != null && templateFields.length > 0) { ArrayList inputtestCases = AdminTestUtil.getInputTestCase(testCaseDTO); ArrayList outputtestcase = AdminTestUtil.getOutputTestCase(testCaseDTO); - for (int i=0; i> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), - getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); - Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - - if (!OutputValidationUtil.publishOutputResult(ouputValid)) - throw new AdminTestException("Failed at output validation"); - } + for (int i = 0; i < languageList.size(); i++) { + response = postWithOnlyPathParamAndCookie(ApplnURI + testCaseDTO.getEndPoint(), + getJsonFromTemplate(inputtestCases.get(i).toString(), testCaseDTO.getInputTemplate()), + COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), + getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); + Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); + + if (!OutputValidationUtil.publishOutputResult(ouputValid)) + throw new AdminTestException("Failed at output validation"); + } } - + else { - response = postWithOnlyPathParamAndCookie(ApplnURI + testCaseDTO.getEndPoint(), getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()), COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), sendEsignetToken); - + response = postWithOnlyPathParamAndCookie(ApplnURI + testCaseDTO.getEndPoint(), + getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()), COOKIENAME, + testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), sendEsignetToken); + Map> ouputValid = null; - if(testCaseName.contains("_StatusCode")) { - - OutputValidationDto customResponse = customStatusCodeResponse(String.valueOf(response.getStatusCode()), testCaseDTO.getOutput()); - + if (testCaseName.contains("_StatusCode")) { + + OutputValidationDto customResponse = customStatusCodeResponse(String.valueOf(response.getStatusCode()), + testCaseDTO.getOutput()); + ouputValid = new HashMap<>(); ouputValid.put(GlobalConstants.EXPECTED_VS_ACTUAL, List.of(customResponse)); - }else { - ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + } else { + ouputValid = OutputValidationUtil.doJsonOutputValidation(response.asString(), + getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); } - + Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - + if (!OutputValidationUtil.publishOutputResult(ouputValid)) throw new AdminTestException("Failed at output validation"); } @@ -142,5 +148,5 @@ public void setResultTestName(ITestResult result) { } catch (Exception e) { Reporter.log("Exception : " + e.getMessage()); } - } + } } diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithParamAndFile.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithParamAndFile.java index f4a484ee041..6191c337705 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithParamAndFile.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithParamAndFile.java @@ -38,7 +38,7 @@ public class PostWithParamAndFile extends AdminTestUtil implements ITest { public String idKeyName = null; public Response response = null; public boolean sendEsignetToken = false; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -46,7 +46,7 @@ public static void setLogLevel() { else logger.setLevel(Level.ERROR); } - + /** * get current testcaseName */ @@ -65,10 +65,9 @@ public Object[] getTestCaseList(ITestContext context) { String ymlFile = context.getCurrentXmlTest().getLocalParameters().get("ymlFile"); sendEsignetToken = context.getCurrentXmlTest().getLocalParameters().containsKey("sendEsignetToken"); idKeyName = context.getCurrentXmlTest().getLocalParameters().get("idKeyName"); - logger.info("Started executing yml: "+ymlFile); + logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -88,24 +87,25 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad } String inputJson = getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()); - - - response = postWithParamAndFile(ApplnURI + testCaseDTO.getEndPoint(), inputJson, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), idKeyName, sendEsignetToken); - + response = postWithParamAndFile(ApplnURI + testCaseDTO.getEndPoint(), inputJson, testCaseDTO.getRole(), + testCaseDTO.getTestCaseName(), idKeyName, sendEsignetToken); + Map> ouputValid = null; - if(testCaseName.contains("_StatusCode")) { - - OutputValidationDto customResponse = customStatusCodeResponse(String.valueOf(response.getStatusCode()), testCaseDTO.getOutput()); - + if (testCaseName.contains("_StatusCode")) { + + OutputValidationDto customResponse = customStatusCodeResponse(String.valueOf(response.getStatusCode()), + testCaseDTO.getOutput()); + ouputValid = new HashMap<>(); ouputValid.put(GlobalConstants.EXPECTED_VS_ACTUAL, List.of(customResponse)); - }else { - ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + } else { + ouputValid = OutputValidationUtil.doJsonOutputValidation(response.asString(), + getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); } - + Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - + if (!OutputValidationUtil.publishOutputResult(ouputValid)) throw new AdminTestException("Failed at output validation"); @@ -129,5 +129,5 @@ public void setResultTestName(ITestResult result) { } catch (Exception e) { Reporter.log("Exception : " + e.getMessage()); } - } + } } diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithPathParamsAndBody.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithPathParamsAndBody.java index 0c6f6f62704..8a49788b745 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithPathParamsAndBody.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithPathParamsAndBody.java @@ -38,7 +38,7 @@ public class PostWithPathParamsAndBody extends AdminTestUtil implements ITest { private static final Logger logger = Logger.getLogger(PostWithPathParamsAndBody.class); protected String testCaseName = ""; public String pathParams = null; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -46,7 +46,7 @@ public static void setLogLevel() { else logger.setLevel(Level.ERROR); } - + /** * get current testcaseName */ @@ -64,10 +64,9 @@ public String getTestName() { public Object[] getTestCaseList(ITestContext context) { String ymlFile = context.getCurrentXmlTest().getLocalParameters().get("ymlFile"); pathParams = context.getCurrentXmlTest().getLocalParameters().get("pathParams"); - logger.info("Started executing yml: "+ymlFile); + logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -79,7 +78,7 @@ public Object[] getTestCaseList(ITestContext context) { * @throws AdminTestException */ @Test(dataProvider = "testcaselist") - public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { + public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { String regCenterId = null; if (HealthChecker.signalTerminateExecution) { throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS); @@ -87,45 +86,53 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad String appDate = null; String timeSlotFrom = null; String timeSlotTo = null; - testCaseName = testCaseDTO.getTestCaseName(); - Response slotAvailabilityResponse=RestClient.getRequestWithCookie(ApplnURI+properties.getProperty("appointmentavailabilityurl")+properties.getProperty("regcentretobookappointment"), MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, COOKIENAME, new KernelAuthentication().getTokenByRole(testCaseDTO.getRole())); - - - if(testCaseName.endsWith("_holiday")) { - List appointmentDetails = AdminTestUtil.getAppointmentDetailsforHoliday(slotAvailabilityResponse); - if(appointmentDetails.size()>=4) { - try { - regCenterId = appointmentDetails.get(0); - appDate = appointmentDetails.get(1); - timeSlotFrom = appointmentDetails.get(2); - timeSlotTo = appointmentDetails.get(3); - } catch (IndexOutOfBoundsException e) { - logger.info("Center not available"); - Assert.fail("Centers unavailable"); + testCaseName = testCaseDTO.getTestCaseName(); + Response slotAvailabilityResponse = RestClient.getRequestWithCookie( + ApplnURI + properties.getProperty("appointmentavailabilityurl") + + properties.getProperty("regcentretobookappointment"), + MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, COOKIENAME, + new KernelAuthentication().getTokenByRole(testCaseDTO.getRole())); + + if (testCaseName.endsWith("_holiday")) { + List appointmentDetails = AdminTestUtil.getAppointmentDetailsforHoliday(slotAvailabilityResponse); + if (appointmentDetails.size() >= 4) { + try { + regCenterId = appointmentDetails.get(0); + appDate = appointmentDetails.get(1); + timeSlotFrom = appointmentDetails.get(2); + timeSlotTo = appointmentDetails.get(3); + } catch (IndexOutOfBoundsException e) { + logger.info("Center not available"); + Assert.fail("Centers unavailable"); + } } - }}else {List appointmentDetails = AdminTestUtil.getAppointmentDetails(slotAvailabilityResponse); - if(appointmentDetails.size()>=4) { - try { - regCenterId = appointmentDetails.get(0); - appDate = appointmentDetails.get(1); - timeSlotFrom = appointmentDetails.get(2); - timeSlotTo = appointmentDetails.get(3); - } catch (IndexOutOfBoundsException e) { - logger.info("Center not available"); - Assert.fail("Centers unavailable"); + } else { + List appointmentDetails = AdminTestUtil.getAppointmentDetails(slotAvailabilityResponse); + if (appointmentDetails.size() >= 4) { + try { + regCenterId = appointmentDetails.get(0); + appDate = appointmentDetails.get(1); + timeSlotFrom = appointmentDetails.get(2); + timeSlotTo = appointmentDetails.get(3); + } catch (IndexOutOfBoundsException e) { + logger.info("Center not available"); + Assert.fail("Centers unavailable"); + } } - }} - String inputJosn=getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()); - inputJosn=inputJosn.replace("$registration_center_id$", regCenterId); - inputJosn=inputJosn.replace("$appointment_date$", appDate); - inputJosn=inputJosn.replace("$time_slot_from$", timeSlotFrom); - inputJosn=inputJosn.replace("$time_slot_to$", timeSlotTo); - Response response = postWithPathParamsBodyAndCookie(ApplnURI + testCaseDTO.getEndPoint(), inputJosn, COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), pathParams); - - Map> ouputValid = OutputValidationUtil - .doJsonOutputValidation(response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + } + String inputJosn = getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()); + inputJosn = inputJosn.replace("$registration_center_id$", regCenterId); + inputJosn = inputJosn.replace("$appointment_date$", appDate); + inputJosn = inputJosn.replace("$time_slot_from$", timeSlotFrom); + inputJosn = inputJosn.replace("$time_slot_to$", timeSlotTo); + Response response = postWithPathParamsBodyAndCookie(ApplnURI + testCaseDTO.getEndPoint(), inputJosn, COOKIENAME, + testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), pathParams); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - + if (!OutputValidationUtil.publishOutputResult(ouputValid)) throw new AdminTestException("Failed at output validation"); @@ -150,5 +157,5 @@ public void setResultTestName(ITestResult result) { Reporter.log("Exception : " + e.getMessage()); } } - + } diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithPathParamsAndBodyForKeyCloak.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithPathParamsAndBodyForKeyCloak.java index e80200d8b02..0e0fa62fae5 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithPathParamsAndBodyForKeyCloak.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PostWithPathParamsAndBodyForKeyCloak.java @@ -33,7 +33,7 @@ public class PostWithPathParamsAndBodyForKeyCloak extends AdminTestUtil implemen private static final Logger logger = Logger.getLogger(PostWithPathParamsAndBodyForKeyCloak.class); protected String testCaseName = ""; public String pathParams = null; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -41,7 +41,7 @@ public static void setLogLevel() { else logger.setLevel(Level.ERROR); } - + /** * get current testcaseName */ @@ -59,10 +59,9 @@ public String getTestName() { public Object[] getTestCaseList(ITestContext context) { String ymlFile = context.getCurrentXmlTest().getLocalParameters().get("ymlFile"); pathParams = context.getCurrentXmlTest().getLocalParameters().get("pathParams"); - logger.info("Started executing yml: "+ymlFile); + logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -74,17 +73,19 @@ public Object[] getTestCaseList(ITestContext context) { * @throws AdminTestException */ @Test(dataProvider = "testcaselist") - public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { - testCaseName = testCaseDTO.getTestCaseName(); + public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { + testCaseName = testCaseDTO.getTestCaseName(); if (HealthChecker.signalTerminateExecution) { throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS); } - Response response = postWithPathParamsBodyAndCookie(ApplnURIForKeyCloak + testCaseDTO.getEndPoint(), testCaseDTO.getInput(), COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), pathParams); - - Map> ouputValid = OutputValidationUtil - .doJsonOutputValidation(response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + Response response = postWithPathParamsBodyAndCookie(ApplnURIForKeyCloak + testCaseDTO.getEndPoint(), + testCaseDTO.getInput(), COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), pathParams); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - + if (!OutputValidationUtil.publishOutputResult(ouputValid)) throw new AdminTestException("Failed at output validation"); @@ -109,5 +110,5 @@ public void setResultTestName(ITestResult result) { Reporter.log("Exception : " + e.getMessage()); } } - + } diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PutWithPathParam.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PutWithPathParam.java index 28de6167298..9dfefe4a66b 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PutWithPathParam.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PutWithPathParam.java @@ -35,7 +35,7 @@ public class PutWithPathParam extends AdminTestUtil implements ITest { private static final Logger logger = Logger.getLogger(PutWithPathParam.class); protected String testCaseName = ""; public Response response = null; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -63,7 +63,6 @@ public Object[] getTestCaseList(ITestContext context) { logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -84,28 +83,30 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad if (testCaseDTO.getTemplateFields() != null && templateFields.length > 0) { ArrayList inputtestCases = AdminTestUtil.getInputTestCase(testCaseDTO); ArrayList outputtestcase = AdminTestUtil.getOutputTestCase(testCaseDTO); - for (int i=0; i> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), - getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); - Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - - if (!OutputValidationUtil.publishOutputResult(ouputValid)) - throw new AdminTestException("Failed at output validation"); - } - } - + for (int i = 0; i < languageList.size(); i++) { + response = putWithPathParamAndCookie(ApplnURI + testCaseDTO.getEndPoint(), + getJsonFromTemplate(inputtestCases.get(i).toString(), testCaseDTO.getInputTemplate()), + COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), + getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); + Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); + + if (!OutputValidationUtil.publishOutputResult(ouputValid)) + throw new AdminTestException("Failed at output validation"); + } + } + else { response = putWithPathParamAndCookie(ApplnURI + testCaseDTO.getEndPoint(), getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()), COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); if (!OutputValidationUtil.publishOutputResult(ouputValid)) diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PutWithPathParamsAndBody.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PutWithPathParamsAndBody.java index efbc2a2188a..71553c66e29 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PutWithPathParamsAndBody.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/PutWithPathParamsAndBody.java @@ -39,7 +39,7 @@ public class PutWithPathParamsAndBody extends AdminTestUtil implements ITest { protected String testCaseName = ""; String pathParams = null; public Response response = null; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -47,7 +47,7 @@ public static void setLogLevel() { else logger.setLevel(Level.ERROR); } - + /** * get current testcaseName */ @@ -65,10 +65,9 @@ public String getTestName() { public Object[] getTestCaseList(ITestContext context) { String ymlFile = context.getCurrentXmlTest().getLocalParameters().get("ymlFile"); pathParams = context.getCurrentXmlTest().getLocalParameters().get("pathParams"); - logger.info("Started executing yml: "+ymlFile); + logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -80,58 +79,64 @@ public Object[] getTestCaseList(ITestContext context) { * @throws AdminTestException */ @Test(dataProvider = "testcaselist") - public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { + public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { testCaseName = testCaseDTO.getTestCaseName(); String[] templateFields = testCaseDTO.getTemplateFields(); if (HealthChecker.signalTerminateExecution) { throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS); } - testCaseDTO=AdminTestUtil.filterHbs(testCaseDTO); + testCaseDTO = AdminTestUtil.filterHbs(testCaseDTO); String inputJson = filterInputHbs(testCaseDTO); - + if (testCaseDTO.getTemplateFields() != null && templateFields.length > 0) { ArrayList inputtestCases = AdminTestUtil.getInputTestCase(testCaseDTO); ArrayList outputtestcase = AdminTestUtil.getOutputTestCase(testCaseDTO); - for (int i=0; i> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), - getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); - Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - - if (!OutputValidationUtil.publishOutputResult(ouputValid)) - throw new AdminTestException("Failed at output validation"); - } - } - + for (int i = 0; i < languageList.size(); i++) { + response = putWithPathParamsBodyAndCookie(ApplnURI + testCaseDTO.getEndPoint(), + getJsonFromTemplate(inputtestCases.get(i).toString(), testCaseDTO.getInputTemplate()), + COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), pathParams); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), + getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); + Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); + + if (!OutputValidationUtil.publishOutputResult(ouputValid)) + throw new AdminTestException("Failed at output validation"); + } + } + else { - if(testCaseName.contains("ESignet_")) { + if (testCaseName.contains("ESignet_")) { String tempUrl = ConfigManager.getEsignetBaseUrl(); - response = putWithPathParamsBodyAndBearerToken(tempUrl + testCaseDTO.getEndPoint(), inputJson, COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), pathParams); - } - else { - response = putWithPathParamsBodyAndCookie(ApplnURI + testCaseDTO.getEndPoint(), inputJson, COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), pathParams); + response = putWithPathParamsBodyAndBearerToken(tempUrl + testCaseDTO.getEndPoint(), inputJson, + COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), pathParams); + } else { + response = putWithPathParamsBodyAndCookie(ApplnURI + testCaseDTO.getEndPoint(), inputJson, COOKIENAME, + testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), pathParams); } Map> ouputValid = null; - if(testCaseName.contains("_StatusCode")) { - - OutputValidationDto customResponse = customStatusCodeResponse(String.valueOf(response.getStatusCode()), testCaseDTO.getOutput()); - + if (testCaseName.contains("_StatusCode")) { + + OutputValidationDto customResponse = customStatusCodeResponse(String.valueOf(response.getStatusCode()), + testCaseDTO.getOutput()); + ouputValid = new HashMap<>(); ouputValid.put(GlobalConstants.EXPECTED_VS_ACTUAL, List.of(customResponse)); - }else { - ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + } else { + ouputValid = OutputValidationUtil.doJsonOutputValidation(response.asString(), + getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); } Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - + if (!OutputValidationUtil.publishOutputResult(ouputValid)) throw new AdminTestException("Failed at output validation"); } } - + private String filterOutputHbs(TestCaseDTO testCaseDTO) { String outputJson = getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()); @@ -153,13 +158,9 @@ private String filterInputHbs(TestCaseDTO testCaseDTO) { inputJson = inputJson.replace(GlobalConstants.$2STLANG$, BaseTestCase.languageList.get(1)); if (inputJson.contains(GlobalConstants.$3STLANG$)) inputJson = inputJson.replace(GlobalConstants.$3STLANG$, BaseTestCase.languageList.get(2)); - - + return inputJson; } - - - /** * The method ser current test name to result @@ -179,5 +180,5 @@ public void setResultTestName(ITestResult result) { } catch (Exception e) { Reporter.log("Exception : " + e.getMessage()); } - } + } } diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimpleDelete.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimpleDelete.java index 16636995a13..36a3c26f5e8 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimpleDelete.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimpleDelete.java @@ -37,7 +37,7 @@ public class SimpleDelete extends AdminTestUtil implements ITest { private static final Logger logger = Logger.getLogger(SimpleDelete.class); protected String testCaseName = ""; public Response response = null; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -45,20 +45,19 @@ public static void setLogLevel() { else logger.setLevel(Level.ERROR); } - + @Override public String getTestName() { return testCaseName; } - @DataProvider(name = "testcaselist") public Object[] getTestCaseList(ITestContext context) { String ymlFile = context.getCurrentXmlTest().getLocalParameters().get("ymlFile"); logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - + @Test(dataProvider = "testcaselist") public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { testCaseName = testCaseDTO.getTestCaseName(); @@ -67,62 +66,62 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS); } String inputJson = getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()); - if(testCaseName.contains("CreateIdSchema")) { + if (testCaseName.contains("CreateIdSchema")) { inputJson = modifyIdSchemaInputJson(inputJson); } - - if(inputJson.contains(""")) { + if (inputJson.contains(""")) { inputJson = inputJson.replace(""", "\""); } - + if (testCaseDTO.getTemplateFields() != null && templateFields.length > 0) { ArrayList inputtestCases = AdminTestUtil.getInputTestCase(testCaseDTO); ArrayList outputtestcase = AdminTestUtil.getOutputTestCase(testCaseDTO); - for (int i=0; i> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), - getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); - Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - - if (!OutputValidationUtil.publishOutputResult(ouputValid)) - throw new AdminTestException("Failed at output validation"); - } + for (int i = 0; i < languageList.size(); i++) { + response = deleteWithBodyAndCookie(ApplnURI + testCaseDTO.getEndPoint(), + getJsonFromTemplate(inputtestCases.get(i).toString(), testCaseDTO.getInputTemplate()), + COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), + getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); + Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); + + if (!OutputValidationUtil.publishOutputResult(ouputValid)) + throw new AdminTestException("Failed at output validation"); + } } else { - if(testCaseName.contains("ESignet_")) { - if(testCaseName.contains("ESignet_SendBindingOtp")) { - response = postRequestWithCookieAuthHeader(ApplnURI + testCaseDTO.getEndPoint(), inputJson, COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); - } - else { + if (testCaseName.contains("ESignet_")) { + if (testCaseName.contains("ESignet_SendBindingOtp")) { + response = postRequestWithCookieAuthHeader(ApplnURI + testCaseDTO.getEndPoint(), inputJson, + COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); + } else { String tempUrl = ConfigManager.getEsignetBaseUrl(); response = postRequestWithCookieAuthHeaderAndXsrfToken(tempUrl + testCaseDTO.getEndPoint(), inputJson, COOKIENAME, testCaseDTO.getTestCaseName()); - + } - } - else { - response = deleteWithBodyAndCookie(ApplnURI + testCaseDTO.getEndPoint(), - inputJson, COOKIENAME, + } else { + response = deleteWithBodyAndCookie(ApplnURI + testCaseDTO.getEndPoint(), inputJson, COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); } Map> ouputValid = null; - if(testCaseName.contains("_StatusCode")) { - - OutputValidationDto customResponse = customStatusCodeResponse(String.valueOf(response.getStatusCode()), testCaseDTO.getOutput()); - + if (testCaseName.contains("_StatusCode")) { + + OutputValidationDto customResponse = customStatusCodeResponse(String.valueOf(response.getStatusCode()), + testCaseDTO.getOutput()); + ouputValid = new HashMap<>(); ouputValid.put(GlobalConstants.EXPECTED_VS_ACTUAL, List.of(customResponse)); - }else { - ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + } else { + ouputValid = OutputValidationUtil.doJsonOutputValidation(response.asString(), + getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); } - + Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); if (!OutputValidationUtil.publishOutputResult(ouputValid)) @@ -131,7 +130,6 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad } - @AfterMethod(alwaysRun = true) public void setResultTestName(ITestResult result) { try { diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePatch.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePatch.java index 9fa04b463b0..ad12e335253 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePatch.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePatch.java @@ -38,7 +38,7 @@ public class SimplePatch extends AdminTestUtil implements ITest { protected String testCaseName = ""; public Response response = null; public boolean sendEsignetToken = false; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -67,7 +67,6 @@ public Object[] getTestCaseList(ITestContext context) { logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -89,36 +88,39 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad if (testCaseDTO.getTemplateFields() != null && templateFields.length > 0) { ArrayList inputtestCases = AdminTestUtil.getInputTestCase(testCaseDTO); ArrayList outputtestcase = AdminTestUtil.getOutputTestCase(testCaseDTO); - for (int i=0; i> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), - getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); - Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - - if (!OutputValidationUtil.publishOutputResult(ouputValid)) - throw new AdminTestException("Failed at output validation"); - } + for (int i = 0; i < languageList.size(); i++) { + response = patchWithBodyAndCookie(ApplnURI + testCaseDTO.getEndPoint(), + getJsonFromTemplate(inputtestCases.get(i).toString(), testCaseDTO.getInputTemplate()), + COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), + getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); + Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); + + if (!OutputValidationUtil.publishOutputResult(ouputValid)) + throw new AdminTestException("Failed at output validation"); + } } - + else { response = patchWithBodyAndCookie(ApplnURI + testCaseDTO.getEndPoint(), getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()), COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), sendEsignetToken); Map> ouputValid = null; - if(testCaseName.contains("_StatusCode")) { - - OutputValidationDto customResponse = customStatusCodeResponse(String.valueOf(response.getStatusCode()), testCaseDTO.getOutput()); - + if (testCaseName.contains("_StatusCode")) { + + OutputValidationDto customResponse = customStatusCodeResponse(String.valueOf(response.getStatusCode()), + testCaseDTO.getOutput()); + ouputValid = new HashMap<>(); ouputValid.put(GlobalConstants.EXPECTED_VS_ACTUAL, List.of(customResponse)); - }else { - ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + } else { + ouputValid = OutputValidationUtil.doJsonOutputValidation(response.asString(), + getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); } Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePatchForAutoGenId.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePatchForAutoGenId.java index 37f8366f68d..cc9fb3aae8e 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePatchForAutoGenId.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePatchForAutoGenId.java @@ -36,7 +36,7 @@ public class SimplePatchForAutoGenId extends AdminTestUtil implements ITest { protected String testCaseName = ""; String idKeyName = null; public Response response = null; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -44,7 +44,7 @@ public static void setLogLevel() { else logger.setLevel(Level.ERROR); } - + /** * get current testcaseName */ @@ -62,10 +62,9 @@ public String getTestName() { public Object[] getTestCaseList(ITestContext context) { String ymlFile = context.getCurrentXmlTest().getLocalParameters().get("ymlFile"); idKeyName = context.getCurrentXmlTest().getLocalParameters().get("idKeyName"); - logger.info("Started executing yml: "+ymlFile); + logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -77,8 +76,8 @@ public Object[] getTestCaseList(ITestContext context) { * @throws AdminTestException */ @Test(dataProvider = "testcaselist") - public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { - testCaseName = testCaseDTO.getTestCaseName(); + public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { + testCaseName = testCaseDTO.getTestCaseName(); String[] templateFields = testCaseDTO.getTemplateFields(); if (HealthChecker.signalTerminateExecution) { throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS); @@ -86,35 +85,37 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad if (testCaseDTO.getTemplateFields() != null && templateFields.length > 0) { ArrayList inputtestCases = AdminTestUtil.getInputTestCase(testCaseDTO); ArrayList outputtestcase = AdminTestUtil.getOutputTestCase(testCaseDTO); - - for (int i=0; i> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), - getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); - Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - - if (!OutputValidationUtil.publishOutputResult(ouputValid)) - throw new AdminTestException("Failed at output validation"); - } + + for (int i = 0; i < languageList.size(); i++) { + response = patchWithBodyAndCookieWithAutoGeneratedId(ApplnURI + testCaseDTO.getEndPoint(), + getJsonFromTemplate(inputtestCases.get(i).toString(), testCaseDTO.getInputTemplate()), + COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), idKeyName); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), + getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); + Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); + + if (!OutputValidationUtil.publishOutputResult(ouputValid)) + throw new AdminTestException("Failed at output validation"); + } } - + else { response = patchWithBodyAndCookieWithAutoGeneratedId(ApplnURI + testCaseDTO.getEndPoint(), getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()), COOKIENAME, - testCaseDTO.getRole(), testCaseDTO.getTestCaseName(),idKeyName); + testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), idKeyName); Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); if (!OutputValidationUtil.publishOutputResult(ouputValid)) throw new AdminTestException("Failed at output validation"); } - + } /** @@ -135,5 +136,5 @@ public void setResultTestName(ITestResult result) { } catch (Exception e) { Reporter.log("Exception : " + e.getMessage()); } - } + } } diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePost.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePost.java index 7cdc626a12c..8a3ccaca37a 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePost.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePost.java @@ -39,7 +39,7 @@ public class SimplePost extends AdminTestUtil implements ITest { public Response response = null; public boolean sendEsignetToken = false; public boolean auditLogCheck = false; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -47,7 +47,7 @@ public static void setLogLevel() { else logger.setLevel(Level.ERROR); } - + /** * get current testcaseName */ @@ -68,7 +68,6 @@ public Object[] getTestCaseList(ITestContext context) { logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -89,67 +88,68 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS); } String inputJson = getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()); - if(testCaseName.contains("CreateIdSchema")) { + if (testCaseName.contains("CreateIdSchema")) { inputJson = modifyIdSchemaInputJson(inputJson); } - - if(inputJson.contains(""")) { + if (inputJson.contains(""")) { inputJson = inputJson.replace(""", "\""); } - + if (testCaseDTO.getTemplateFields() != null && templateFields.length > 0) { ArrayList inputtestCases = AdminTestUtil.getInputTestCase(testCaseDTO); ArrayList outputtestcase = AdminTestUtil.getOutputTestCase(testCaseDTO); - for (int i=0; i> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), - getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); - Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - - if (!OutputValidationUtil.publishOutputResult(ouputValid)) - throw new AdminTestException("Failed at output validation"); - } + for (int i = 0; i < languageList.size(); i++) { + response = postWithBodyAndCookie(ApplnURI + testCaseDTO.getEndPoint(), + getJsonFromTemplate(inputtestCases.get(i).toString(), testCaseDTO.getInputTemplate()), + COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), + getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); + Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); + + if (!OutputValidationUtil.publishOutputResult(ouputValid)) + throw new AdminTestException("Failed at output validation"); + } } else { String tempUrl = ConfigManager.getEsignetBaseUrl(); - if(testCaseName.contains("ESignet_")) { - if(testCaseName.contains("ESignet_SendBindingOtp")) { - response = postRequestWithCookieAuthHeader(tempUrl + testCaseDTO.getEndPoint(), inputJson, COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); - } - else { + if (testCaseName.contains("ESignet_")) { + if (testCaseName.contains("ESignet_SendBindingOtp")) { + response = postRequestWithCookieAuthHeader(tempUrl + testCaseDTO.getEndPoint(), inputJson, + COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); + } else { response = postRequestWithCookieAuthHeaderAndXsrfToken(tempUrl + testCaseDTO.getEndPoint(), inputJson, COOKIENAME, testCaseDTO.getTestCaseName()); - + } - } - else { - response = postWithBodyAndCookie(ApplnURI + testCaseDTO.getEndPoint(), - inputJson, auditLogCheck, COOKIENAME, - testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), sendEsignetToken); + } else { + response = postWithBodyAndCookie(ApplnURI + testCaseDTO.getEndPoint(), inputJson, auditLogCheck, + COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), sendEsignetToken); } Map> ouputValid = null; - if(testCaseName.contains("_StatusCode")) { - - OutputValidationDto customResponse = customStatusCodeResponse(String.valueOf(response.getStatusCode()), testCaseDTO.getOutput()); - + if (testCaseName.contains("_StatusCode")) { + + OutputValidationDto customResponse = customStatusCodeResponse(String.valueOf(response.getStatusCode()), + testCaseDTO.getOutput()); + ouputValid = new HashMap<>(); ouputValid.put(GlobalConstants.EXPECTED_VS_ACTUAL, List.of(customResponse)); - }else { - ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + } else { + ouputValid = OutputValidationUtil.doJsonOutputValidation(response.asString(), + getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); } - + Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); if (!OutputValidationUtil.publishOutputResult(ouputValid)) { if (response.asString().contains("IDA-OTA-001")) - throw new AdminTestException("Exceeded number of OTP requests in a given time, Increase otp.request.flooding.max-count"); + throw new AdminTestException( + "Exceeded number of OTP requests in a given time, Increase otp.request.flooding.max-count"); else throw new AdminTestException("Failed at otp output validation"); } diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePostForAutoGenId.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePostForAutoGenId.java index 5a2e4b4c484..84e5ec01487 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePostForAutoGenId.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePostForAutoGenId.java @@ -42,7 +42,7 @@ public class SimplePostForAutoGenId extends AdminTestUtil implements ITest { public Response response = null; public boolean sendEsignetToken = false; public boolean auditLogCheck = false; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -72,7 +72,6 @@ public Object[] getTestCaseList(ITestContext context) { logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -91,74 +90,77 @@ public void test(TestCaseDTO testCaseDTO) if (HealthChecker.signalTerminateExecution) { throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS); } - if (BaseTestCase.isTargetEnvLTS() && BaseTestCase.currentModule.equals("auth") && testCaseName.startsWith("auth_GenerateVID_")) { + if (BaseTestCase.isTargetEnvLTS() && BaseTestCase.currentModule.equals("auth") + && testCaseName.startsWith("auth_GenerateVID_")) { throw new SkipException("Generating VID using resident API on LTS. Hence skipping this test case"); } testCaseName = isTestCaseValidForExecution(testCaseDTO); String[] templateFields = testCaseDTO.getTemplateFields(); String inputJson = ""; - - if(!(BaseTestCase.certsForModule.equals("DSL-IDA")&& (testCaseName.startsWith("Esignet_CreateOIDCClient")))){ - inputJson = getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()); - } - else { - inputJson = testCaseDTO.getInput(); - - } - + if (!(BaseTestCase.certsForModule.equals("DSL-IDA") && (testCaseName.startsWith("Esignet_CreateOIDCClient")))) { + inputJson = getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()); + } else { + inputJson = testCaseDTO.getInput(); + + } + String outputJson = getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()); if (testCaseDTO.getTemplateFields() != null && templateFields.length > 0) { ArrayList inputtestCases = AdminTestUtil.getInputTestCase(testCaseDTO); ArrayList outputtestcase = AdminTestUtil.getOutputTestCase(testCaseDTO); for (int i = 0; i < languageList.size(); i++) { - response = postWithBodyAndCookieForAutoGeneratedId(ApplnURI + testCaseDTO.getEndPoint(), - getJsonFromTemplate(inputtestCases.get(i).toString(), testCaseDTO.getInputTemplate()), - COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), idKeyName); - - Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), - getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); - if (testCaseDTO.getTestCaseName().toLowerCase().contains("dynamic")) { - JSONObject json = new JSONObject(response.asString()); - idField = json.getJSONObject("response").get("id").toString(); - } - Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - - if (!OutputValidationUtil.publishOutputResult(ouputValid)) - throw new AdminTestException("Failed at output validation"); + response = postWithBodyAndCookieForAutoGeneratedId(ApplnURI + testCaseDTO.getEndPoint(), + getJsonFromTemplate(inputtestCases.get(i).toString(), testCaseDTO.getInputTemplate()), + COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), idKeyName); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), + getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); + if (testCaseDTO.getTestCaseName().toLowerCase().contains("dynamic")) { + JSONObject json = new JSONObject(response.asString()); + idField = json.getJSONObject("response").get("id").toString(); + } + Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); + + if (!OutputValidationUtil.publishOutputResult(ouputValid)) + throw new AdminTestException("Failed at output validation"); } } else { - if(testCaseName.contains("ESignet_")) { + if (testCaseName.contains("ESignet_")) { if (!ConfigManager.IseSignetDeployed()) { throw new SkipException("esignet is not deployed hence skipping the testcase"); } String tempUrl = ConfigManager.getEsignetBaseUrl(); - if(testCaseName.contains("_AuthorizationCode_")) { - response = postRequestWithCookieAuthHeaderAndXsrfTokenForAutoGenId(tempUrl + testCaseDTO.getEndPoint(), inputJson, - COOKIENAME, testCaseDTO.getTestCaseName(), idKeyName); - } - else { - response = postWithBodyAndBearerTokenForAutoGeneratedId(tempUrl + testCaseDTO.getEndPoint(), inputJson, - COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), idKeyName); + if (testCaseName.contains("_AuthorizationCode_")) { + response = postRequestWithCookieAuthHeaderAndXsrfTokenForAutoGenId( + tempUrl + testCaseDTO.getEndPoint(), inputJson, COOKIENAME, testCaseDTO.getTestCaseName(), + idKeyName); + } else { + response = postWithBodyAndBearerTokenForAutoGeneratedId(tempUrl + testCaseDTO.getEndPoint(), + inputJson, COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), idKeyName); } - } - else { - response = postWithBodyAndCookieForAutoGeneratedId(ApplnURI + testCaseDTO.getEndPoint(), inputJson, auditLogCheck, - COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), idKeyName, sendEsignetToken); + } else { + response = postWithBodyAndCookieForAutoGeneratedId(ApplnURI + testCaseDTO.getEndPoint(), inputJson, + auditLogCheck, COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), idKeyName, + sendEsignetToken); } Map> ouputValid = null; - if(testCaseName.contains("_StatusCode")) { - - OutputValidationDto customResponse = customStatusCodeResponse(String.valueOf(response.getStatusCode()), testCaseDTO.getOutput()); - + if (testCaseName.contains("_StatusCode")) { + + OutputValidationDto customResponse = customStatusCodeResponse(String.valueOf(response.getStatusCode()), + testCaseDTO.getOutput()); + ouputValid = new HashMap<>(); ouputValid.put(GlobalConstants.EXPECTED_VS_ACTUAL, List.of(customResponse)); - }else { - ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse(), testCaseDTO.getAllowedErrorCodes()); + } else { + ouputValid = OutputValidationUtil.doJsonOutputValidation(response.asString(), + getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), testCaseDTO.getAllowedErrorCodes(), + response.getStatusCode()); } Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); if (!OutputValidationUtil.publishOutputResult(ouputValid)) diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePostForAutoGenIdForUrlEncoded.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePostForAutoGenIdForUrlEncoded.java index 46bd7266fb1..c578189509d 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePostForAutoGenIdForUrlEncoded.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePostForAutoGenIdForUrlEncoded.java @@ -37,7 +37,7 @@ public class SimplePostForAutoGenIdForUrlEncoded extends AdminTestUtil implement protected String testCaseName = ""; public String idKeyName = null; public Response response = null; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -66,7 +66,6 @@ public Object[] getTestCaseList(ITestContext context) { logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -93,43 +92,44 @@ public void test(TestCaseDTO testCaseDTO) String inputJson = getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()); String outputJson = getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()); - + String jsonInput = inputJsonKeyWordHandeler(inputJson, testCaseName); if (testCaseDTO.getTemplateFields() != null && templateFields.length > 0) { ArrayList inputtestCases = AdminTestUtil.getInputTestCase(testCaseDTO); ArrayList outputtestcase = AdminTestUtil.getOutputTestCase(testCaseDTO); for (int i = 0; i < languageList.size(); i++) { - response = postWithBodyAndCookieForAutoGeneratedId(ApplnURI + testCaseDTO.getEndPoint(), - getJsonFromTemplate(inputtestCases.get(i).toString(), testCaseDTO.getInputTemplate()), - COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), idKeyName); - - Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), - getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); - if (testCaseDTO.getTestCaseName().toLowerCase().contains("dynamic")) { - JSONObject json = new JSONObject(response.asString()); - idField = json.getJSONObject("response").get("id").toString(); - } - Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - - if (!OutputValidationUtil.publishOutputResult(ouputValid)) - throw new AdminTestException("Failed at output validation"); + response = postWithBodyAndCookieForAutoGeneratedId(ApplnURI + testCaseDTO.getEndPoint(), + getJsonFromTemplate(inputtestCases.get(i).toString(), testCaseDTO.getInputTemplate()), + COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), idKeyName); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), + getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); + if (testCaseDTO.getTestCaseName().toLowerCase().contains("dynamic")) { + JSONObject json = new JSONObject(response.asString()); + idField = json.getJSONObject("response").get("id").toString(); + } + Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); + + if (!OutputValidationUtil.publishOutputResult(ouputValid)) + throw new AdminTestException("Failed at output validation"); } } else { - if(testCaseName.contains("ESignet_")) { + if (testCaseName.contains("ESignet_")) { String tempUrl = ConfigManager.getEsignetBaseUrl(); - response = postWithBodyAndCookieForAutoGeneratedIdForUrlEncoded(tempUrl + testCaseDTO.getEndPoint(), jsonInput, - testCaseDTO.getTestCaseName(), idKeyName); - - } - else { - response = postWithBodyAndCookieForAutoGeneratedIdForUrlEncoded(ApplnURI + testCaseDTO.getEndPoint(), jsonInput, - testCaseDTO.getTestCaseName(), idKeyName); + response = postWithBodyAndCookieForAutoGeneratedIdForUrlEncoded(tempUrl + testCaseDTO.getEndPoint(), + jsonInput, testCaseDTO.getTestCaseName(), idKeyName); + + } else { + response = postWithBodyAndCookieForAutoGeneratedIdForUrlEncoded(ApplnURI + testCaseDTO.getEndPoint(), + jsonInput, testCaseDTO.getTestCaseName(), idKeyName); } - Map> ouputValid = OutputValidationUtil - .doJsonOutputValidation(response.asString(), outputJson, testCaseDTO.isCheckErrorsOnlyInResponse()); + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), outputJson, testCaseDTO.isCheckErrorsOnlyInResponse(), + response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); if (!OutputValidationUtil.publishOutputResult(ouputValid)) throw new AdminTestException("Failed at output validation"); diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePostForDeRegisterDevice.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePostForDeRegisterDevice.java index cf5343923c5..2a72b8e28f0 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePostForDeRegisterDevice.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePostForDeRegisterDevice.java @@ -36,9 +36,9 @@ public class SimplePostForDeRegisterDevice extends AdminTestUtil implements ITest { private static final Logger logger = Logger.getLogger(SimplePostForDeRegisterDevice.class); protected String testCaseName = ""; - + Encoder encoder = java.util.Base64.getEncoder(); - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -46,7 +46,7 @@ public static void setLogLevel() { else logger.setLevel(Level.ERROR); } - + /** * get current testcaseName */ @@ -63,10 +63,9 @@ public String getTestName() { @DataProvider(name = "testcaselist") public Object[] getTestCaseList(ITestContext context) { String ymlFile = context.getCurrentXmlTest().getLocalParameters().get("ymlFile"); - logger.info("Started executing yml: "+ymlFile); + logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -84,30 +83,29 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS); } String inputJson = getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()); - inputJson = inputJson.replace("$DEVICE$", - encoder.encodeToString(creatingDataForDevice().getBytes())); + inputJson = inputJson.replace("$DEVICE$", encoder.encodeToString(creatingDataForDevice().getBytes())); Response response = postWithBodyAndCookie(ApplnURI + testCaseDTO.getEndPoint(), inputJson, COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); if (!OutputValidationUtil.publishOutputResult(ouputValid)) throw new AdminTestException("Failed at output validation"); } - + public static String creatingDataForDevice() { String payload = regDeviceResponse.split("\\.")[1]; - JSONObject jsonResponse=new JSONObject(new String(Base64.decodeBase64(payload))); + JSONObject jsonResponse = new JSONObject(new String(Base64.decodeBase64(payload))); JSONObject device = new JSONObject(); device.put("deviceCode", jsonResponse.get("deviceCode").toString()); device.put("env", jsonResponse.get("env").toString()); return device.toString(); } - - + /** * The method ser current test name to result * @@ -126,5 +124,5 @@ public void setResultTestName(ITestResult result) { } catch (Exception e) { Reporter.log("Exception : " + e.getMessage()); } - } + } } diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePostForRegisteredDevice.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePostForRegisteredDevice.java index 90f178ca924..510145e4939 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePostForRegisteredDevice.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePostForRegisteredDevice.java @@ -41,9 +41,9 @@ public class SimplePostForRegisteredDevice extends AdminTestUtil implements ITest { private static final Logger logger = Logger.getLogger(SimplePostForRegisteredDevice.class); protected String testCaseName = ""; - + Encoder encoder = Base64.getEncoder(); - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -51,7 +51,7 @@ public static void setLogLevel() { else logger.setLevel(Level.ERROR); } - + /** * get current testcaseName */ @@ -68,10 +68,9 @@ public String getTestName() { @DataProvider(name = "testcaselist") public Object[] getTestCaseList(ITestContext context) { String ymlFile = context.getCurrentXmlTest().getLocalParameters().get("ymlFile"); - logger.info("Started executing yml: "+ymlFile); + logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -83,30 +82,32 @@ public Object[] getTestCaseList(ITestContext context) { * @throws AdminTestException */ @Test(dataProvider = "testcaselist") - public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { - testCaseName = testCaseDTO.getTestCaseName(); - String inputJson = getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()); + public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { + testCaseName = testCaseDTO.getTestCaseName(); + String inputJson = getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()); if (HealthChecker.signalTerminateExecution) { throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS); } - inputJson = inputJson.replace("$DEVICEDATA$", encoder.encodeToString(creatingDeviceDataForDeviceData().getBytes())); - Response response = postWithBodyAndCookie(ApplnURI + testCaseDTO.getEndPoint(), inputJson, COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); - - ReadContext ctx = JsonPath.parse(response.getBody().asString()); + inputJson = inputJson.replace("$DEVICEDATA$", + encoder.encodeToString(creatingDeviceDataForDeviceData().getBytes())); + Response response = postWithBodyAndCookie(ApplnURI + testCaseDTO.getEndPoint(), inputJson, COOKIENAME, + testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); + + ReadContext ctx = JsonPath.parse(response.getBody().asString()); JSONArray arrayOfErrors = ctx.read("$.errors"); if (arrayOfErrors.isEmpty()) regDeviceResponse = (String) ctx.read("$.response"); - - Map> ouputValid = OutputValidationUtil - .doJsonOutputValidation(response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - + if (!OutputValidationUtil.publishOutputResult(ouputValid)) throw new AdminTestException("Failed at output validation"); } - - + public String creatingDeviceDataForDigitalId() { JSONObject digitalId = new JSONObject(); digitalId.put("serialNo", "TR001234567"); @@ -119,12 +120,11 @@ public String creatingDeviceDataForDigitalId() { digitalId.put("deviceSubType", "Slap"); return digitalId.toString(); } - - + public String creatingDeviceDataForDeviceInfo() { String digitalId = creatingDeviceDataForDigitalId(); JSONObject deviceInfo = new JSONObject(); - String[] deviceSubId = {"1","2"}; + String[] deviceSubId = { "1", "2" }; deviceInfo.put("deviceSubId", deviceSubId); deviceInfo.put("certification", "L0"); deviceInfo.put("digitalId", encoder.encodeToString(digitalId.getBytes())); @@ -142,12 +142,10 @@ public String creatingDeviceDataForDeviceData() { diviceData.put("deviceInfo", encoder.encodeToString(deviceInfo.getBytes())); return diviceData.toString(); } - + public static String getCurrentDateAndTimeForAPI() { - return javax.xml.bind.DatatypeConverter.printDateTime( - Calendar.getInstance(TimeZone.getTimeZone("UTC")) - ); - } + return javax.xml.bind.DatatypeConverter.printDateTime(Calendar.getInstance(TimeZone.getTimeZone("UTC"))); + } /** * The method ser current test name to result @@ -167,5 +165,5 @@ public void setResultTestName(ITestResult result) { } catch (Exception e) { Reporter.log("Exception : " + e.getMessage()); } - } + } } diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePut.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePut.java index 22ce7e4d1eb..e13a445a530 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePut.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/SimplePut.java @@ -39,7 +39,7 @@ public class SimplePut extends AdminTestUtil implements ITest { protected String testCaseName = ""; public Response response = null; public boolean sendEsignetToken = false; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -68,7 +68,6 @@ public Object[] getTestCaseList(ITestContext context) { logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -80,7 +79,7 @@ public Object[] getTestCaseList(ITestContext context) { * @throws AdminTestException */ @Test(dataProvider = "testcaselist") - public void test(TestCaseDTO testCaseDTO) throws AdminTestException { + public void test(TestCaseDTO testCaseDTO) throws AdminTestException { testCaseName = testCaseDTO.getTestCaseName(); if (HealthChecker.signalTerminateExecution) { throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS); @@ -91,40 +90,41 @@ public void test(TestCaseDTO testCaseDTO) throws AdminTestException { if (testCaseDTO.getTemplateFields() != null && templateFields.length > 0) { ArrayList inputtestCases = AdminTestUtil.getInputTestCase(testCaseDTO); ArrayList outputtestcase = AdminTestUtil.getOutputTestCase(testCaseDTO); - - - languageList =new ArrayList<>(BaseTestCase.languageList); - for (int i=0; i> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), - getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); - Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - - if (!OutputValidationUtil.publishOutputResult(ouputValid)) - throw new AdminTestException("Failed at output validation"); - } - } - else { + + languageList = new ArrayList<>(BaseTestCase.languageList); + for (int i = 0; i < languageList.size(); i++) { + response = putWithBodyAndCookie(ApplnURI + testCaseDTO.getEndPoint(), + getJsonFromTemplate(inputtestCases.get(i).toString(), testCaseDTO.getInputTemplate()), + COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), + getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); + Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); + + if (!OutputValidationUtil.publishOutputResult(ouputValid)) + throw new AdminTestException("Failed at output validation"); + } + } else { response = putWithBodyAndCookie(ApplnURI + testCaseDTO.getEndPoint(), getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()), COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), sendEsignetToken); Map> ouputValid = null; - if(testCaseName.contains("_StatusCode")) { - - OutputValidationDto customResponse = customStatusCodeResponse(String.valueOf(response.getStatusCode()), testCaseDTO.getOutput()); - + if (testCaseName.contains("_StatusCode")) { + + OutputValidationDto customResponse = customStatusCodeResponse(String.valueOf(response.getStatusCode()), + testCaseDTO.getOutput()); + ouputValid = new HashMap<>(); ouputValid.put(GlobalConstants.EXPECTED_VS_ACTUAL, List.of(customResponse)); - }else { - ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + } else { + ouputValid = OutputValidationUtil.doJsonOutputValidation(response.asString(), + getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); } - + Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); if (!OutputValidationUtil.publishOutputResult(ouputValid)) diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/UpdateDraft.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/UpdateDraft.java index bae4c923787..77396b46e6c 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/UpdateDraft.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/UpdateDraft.java @@ -36,7 +36,7 @@ public class UpdateDraft extends AdminTestUtil implements ITest { protected String testCaseName = ""; String pathParams = null; public Response response = null; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -65,7 +65,6 @@ public Object[] getTestCaseList(ITestContext context) { logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * @@ -125,7 +124,8 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), pathParams); Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); if (!OutputValidationUtil.publishOutputResult(ouputValid)) @@ -157,7 +157,8 @@ public void setResultTestName(ITestResult result) { public void waittime() { try { - logger.info("waiting for" + properties.getProperty("Delaytime") + " mili secs after UIN Generation In IDREPO"); + logger.info( + "waiting for" + properties.getProperty("Delaytime") + " mili secs after UIN Generation In IDREPO"); Thread.sleep(Long.parseLong(properties.getProperty("Delaytime"))); } catch (Exception e) { logger.error("Exception : " + e.getMessage()); diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/UpdateIdentity.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/UpdateIdentity.java index dfe9a404914..f61575a822a 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/UpdateIdentity.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/UpdateIdentity.java @@ -41,7 +41,7 @@ public class UpdateIdentity extends AdminTestUtil implements ITest { private static final Logger logger = Logger.getLogger(UpdateIdentity.class); protected String testCaseName = ""; private static String identity; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -77,7 +77,6 @@ public Object[] getTestCaseList(ITestContext context) { logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -94,7 +93,6 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad updateIdentity(testCaseDTO); } - public void updateIdentity(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { @@ -104,12 +102,10 @@ public void updateIdentity(TestCaseDTO testCaseDTO) throws AuthenticationTestExc } JSONObject req = new JSONObject(testCaseDTO.getInput()); - - - + JSONObject otpReqJson = null; - String otpRequest = null; - String sendOtpReqTemplate = null; + String otpRequest = null; + String sendOtpReqTemplate = null; String sendOtpEndPoint = null; if (req.has(GlobalConstants.SENDOTP)) { otpRequest = req.get(GlobalConstants.SENDOTP).toString(); @@ -124,8 +120,7 @@ public void updateIdentity(TestCaseDTO testCaseDTO) throws AuthenticationTestExc if (sendOtpEndPoint.contains("$partnerKeyURL$")) { sendOtpEndPoint = sendOtpEndPoint.replace("$partnerKeyURL$", PartnerRegistration.partnerKeyUrl); } - if(sendOtpEndPoint.contains("$PartnerName$")) - { + if (sendOtpEndPoint.contains("$PartnerName$")) { sendOtpEndPoint = sendOtpEndPoint.replace("$PartnerName$", PartnerRegistration.partnerId); } } @@ -144,19 +139,16 @@ public void updateIdentity(TestCaseDTO testCaseDTO) throws AuthenticationTestExc generatedRid = genRid; String inputJson = getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()); - - String phone = getValueFromAuthActuator("json-property", "phone_number"); String result = phone.replaceAll("\\[\"|\"\\]", ""); - + String email = getValueFromAuthActuator("json-property", "emailId"); String emailResult = email.replaceAll("\\[\"|\"\\]", ""); - - + inputJson = inputJson.replace("\"phone\":", "\"" + result + "\":"); inputJson = inputJson.replace("\"email\":", "\"" + emailResult + "\":"); - + inputJson = inputJson.replace("$RID$", genRid); if (inputJson.contains("$PRIMARYLANG$")) @@ -166,7 +158,8 @@ public void updateIdentity(TestCaseDTO testCaseDTO) throws AuthenticationTestExc testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); + response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); Assert.assertEquals(OutputValidationUtil.publishOutputResult(ouputValid), true); @@ -179,7 +172,8 @@ public void updateIdentity(TestCaseDTO testCaseDTO) throws AuthenticationTestExc sendOtpResTemplate = sendOtpRespJson.getString("sendOtpResTemplate"); sendOtpRespJson.remove("sendOtpResTemplate"); Map> ouputValidOtp = OutputValidationUtil.doJsonOutputValidation( - otpResponse.asString(), getJsonFromTemplate(sendOtpRespJson.toString(), sendOtpResTemplate), testCaseDTO.isCheckErrorsOnlyInResponse()); + otpResponse.asString(), getJsonFromTemplate(sendOtpRespJson.toString(), sendOtpResTemplate), + testCaseDTO.isCheckErrorsOnlyInResponse(), otpResponse.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValidOtp)); if (!OutputValidationUtil.publishOutputResult(ouputValidOtp)) diff --git a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/UpdatePrereg.java b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/UpdatePrereg.java index cdbb7322ff0..fe869049308 100644 --- a/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/UpdatePrereg.java +++ b/automationtests/src/main/java/io/mosip/testrig/apirig/testscripts/UpdatePrereg.java @@ -37,7 +37,7 @@ public class UpdatePrereg extends AdminTestUtil implements ITest { protected String testCaseName = ""; String pathParams = null; public Response response = null; - + @BeforeClass public static void setLogLevel() { if (ConfigManager.IsDebugEnabled()) @@ -45,7 +45,7 @@ public static void setLogLevel() { else logger.setLevel(Level.ERROR); } - + /** * get current testcaseName */ @@ -63,10 +63,9 @@ public String getTestName() { public Object[] getTestCaseList(ITestContext context) { String ymlFile = context.getCurrentXmlTest().getLocalParameters().get("ymlFile"); pathParams = context.getCurrentXmlTest().getLocalParameters().get("pathParams"); - logger.info("Started executing yml: "+ymlFile); + logger.info("Started executing yml: " + ymlFile); return getYmlTestData(ymlFile); } - /** * Test method for OTP Generation execution @@ -78,19 +77,20 @@ public Object[] getTestCaseList(ITestContext context) { * @throws AdminTestException */ @Test(dataProvider = "testcaselist") - public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { + public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { testCaseName = testCaseDTO.getTestCaseName(); testCaseDTO.setInputTemplate(AdminTestUtil.generateHbsForPrereg(true)); String[] templateFields = testCaseDTO.getTemplateFields(); if (HealthChecker.signalTerminateExecution) { throw new SkipException("Target env health check failed " + HealthChecker.healthCheckFailureMapS); } - + String outputJson = getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()); String inputJson = getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate(), false); if (BaseTestCase.getLanguageList().size() == 2) { inputJson = inputJson.replace(", { \"language\": \"$3RDLANG$\", \"value\": \"FR\" }", ""); - inputJson = inputJson.replace(", { \"language\": \"$3RDLANG$\", \"value\": \"Test Book appointment\" }", ""); + inputJson = inputJson.replace(", { \"language\": \"$3RDLANG$\", \"value\": \"Test Book appointment\" }", + ""); inputJson = inputJson.replace(", { \"language\": \"$3RDLANG$\", \"value\": \"MLE\" }", ""); inputJson = inputJson.replace(", { \"language\": \"$3RDLANG$\", \"value\": \"RSK\" }", ""); inputJson = inputJson.replace(", { \"language\": \"$3RDLANG$\", \"value\": \"KTA\" }", ""); @@ -123,41 +123,40 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad ", { \"language\": \"$2NDLANG$\", \"value\": \"BNMR\" }, { \"language\": \"$3RDLANG$\", \"value\": \"BNMR\" }", ""); } - - - + if (testCaseDTO.getTemplateFields() != null && templateFields.length > 0) { ArrayList inputtestCases = AdminTestUtil.getInputTestCase(testCaseDTO); ArrayList outputtestcase = AdminTestUtil.getOutputTestCase(testCaseDTO); - for (int i=0; i> ouputValid = OutputValidationUtil.doJsonOutputValidation( - response.asString(), - getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), testCaseDTO.isCheckErrorsOnlyInResponse()); - Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - - if (!OutputValidationUtil.publishOutputResult(ouputValid)) - throw new AdminTestException("Failed at output validation"); - } - } - + for (int i = 0; i < languageList.size(); i++) { + response = putWithPathParamsBodyAndCookie(ApplnURI + testCaseDTO.getEndPoint(), + getJsonFromTemplate(inputtestCases.get(i).toString(), testCaseDTO.getInputTemplate()), + COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), pathParams); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), + getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), + testCaseDTO.isCheckErrorsOnlyInResponse(), response.getStatusCode()); + Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); + + if (!OutputValidationUtil.publishOutputResult(ouputValid)) + throw new AdminTestException("Failed at output validation"); + } + } + else { - response = putWithPathParamsBodyAndCookie(ApplnURI + testCaseDTO.getEndPoint(), inputJson, COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), pathParams); - - Map> ouputValid = OutputValidationUtil - .doJsonOutputValidation(response.asString(), outputJson, testCaseDTO.isCheckErrorsOnlyInResponse()); + response = putWithPathParamsBodyAndCookie(ApplnURI + testCaseDTO.getEndPoint(), inputJson, COOKIENAME, + testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), pathParams); + + Map> ouputValid = OutputValidationUtil.doJsonOutputValidation( + response.asString(), outputJson, testCaseDTO.isCheckErrorsOnlyInResponse(), + response.getStatusCode()); Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); - + if (!OutputValidationUtil.publishOutputResult(ouputValid)) throw new AdminTestException("Failed at output validation"); } } - - - - /** * The method ser current test name to result @@ -177,5 +176,5 @@ public void setResultTestName(ITestResult result) { } catch (Exception e) { Reporter.log("Exception : " + e.getMessage()); } - } + } } diff --git a/automationtests/src/main/resources/esignet/CreateOIDCClientV2/CreateOIDCClient.yml b/automationtests/src/main/resources/esignet/CreateOIDCClientV2/CreateOIDCClient.yml index 2374f42cd66..45693e99535 100644 --- a/automationtests/src/main/resources/esignet/CreateOIDCClientV2/CreateOIDCClient.yml +++ b/automationtests/src/main/resources/esignet/CreateOIDCClientV2/CreateOIDCClient.yml @@ -1,6 +1,6 @@ CreateOIDCClientV2: ESignet_CreateOIDCClientV2_all_Valid_Smoke_sid: - endPoint: /v1/esignet/client-mgmt/v2/oidc-client + endPoint: /v1/esignet/client-mgmt/oauth-client role: partner restMethod: post inputTemplate: esignet/CreateOIDCClientV2/CreateOIDCClient @@ -30,7 +30,7 @@ CreateOIDCClientV2: }' ESignet_CreateOIDCClientV2_Invalid_langCode_Size_Neg: - endPoint: /v1/esignet/client-mgmt/v2/oidc-client + endPoint: /v1/esignet/client-mgmt/oauth-client role: partner restMethod: post inputTemplate: esignet/CreateOIDCClientV2/CreateOIDCClient @@ -63,14 +63,14 @@ CreateOIDCClientV2: }' ESignet_CreateOIDCClientV2_Invalid_langCode_Neg: - endPoint: /v1/esignet/client-mgmt/v2/oidc-client + endPoint: /v1/esignet/client-mgmt/oauth-client role: partner restMethod: post inputTemplate: esignet/CreateOIDCClientV2/CreateOIDCClient outputTemplate: esignet/error input: '{ "requestTime": "$TIMESTAMP$", - "clientId": "$RANDOMID$V2", + "clientId": "$RANDOMID$V2S2", "clientName": "MOSIP OIDC Client", "logoUri": "https://health-services.com/logo.png", "relyingPartyId": "Bharathi-Inc", @@ -96,7 +96,7 @@ CreateOIDCClientV2: }' ESignet_CreateOIDCClientV2_Invalid_clientNameLang_Neg: - endPoint: /v1/esignet/client-mgmt/v2/oidc-client + endPoint: /v1/esignet/client-mgmt/oauth-client role: partner restMethod: post inputTemplate: esignet/CreateOIDCClientV2/CreateOIDCClient @@ -129,7 +129,7 @@ CreateOIDCClientV2: }' ESignet_CreateOIDCClientV2_Missing_ClientNamelangMap_Value_Neg: - endPoint: /v1/esignet/client-mgmt/v2/oidc-client + endPoint: /v1/esignet/client-mgmt/oauth-client role: partner restMethod: post inputTemplate: esignet/CreateOIDCClientV2/CreateOIDCClientWOClientLangMapValue @@ -154,13 +154,13 @@ CreateOIDCClientV2: output: '{ "errors": [ { - "errorCode": "invalid_client_name_value" + "errorCode": "invalid_client_name" } ] }' ESignet_CreateOIDCClientV2_Missing_ClientNamelangMap_Neg: - endPoint: /v1/esignet/client-mgmt/v2/oidc-client + endPoint: /v1/esignet/client-mgmt/oauth-client role: partner restMethod: post inputTemplate: esignet/CreateOIDCClientV2/CreateOIDCClientWOClientLangMap @@ -185,7 +185,7 @@ CreateOIDCClientV2: output: '{ "errors": [ { - "errorCode": "invalid_client_name_value" + "errorCode": "invalid_client_name" } ] }' \ No newline at end of file diff --git a/automationtests/src/main/resources/esignet/UpdateOIDCClientV2/UpdateOIDCClient.yml b/automationtests/src/main/resources/esignet/UpdateOIDCClientV2/UpdateOIDCClient.yml index f1b65182b37..2e984aef18a 100644 --- a/automationtests/src/main/resources/esignet/UpdateOIDCClientV2/UpdateOIDCClient.yml +++ b/automationtests/src/main/resources/esignet/UpdateOIDCClientV2/UpdateOIDCClient.yml @@ -1,6 +1,6 @@ UpdateOIDCClientV2: ESignet_UpdateOIDCClientV2_all_Valid_Smoke: - endPoint: /v1/esignet/client-mgmt/v2/oidc-client/{clientId} + endPoint: /v1/esignet/client-mgmt/oauth-client/{clientId} role: partner restMethod: put inputTemplate: esignet/UpdateOIDCClientV2/UpdateOIDCClient @@ -29,7 +29,7 @@ UpdateOIDCClientV2: }' ESignet_UpdateOIDCClientV2_Invalid_clientNameLang_Neg: - endPoint: /v1/esignet/client-mgmt/v2/oidc-client/{clientId} + endPoint: /v1/esignet/client-mgmt/oauth-client/{clientId} role: partner restMethod: put inputTemplate: esignet/UpdateOIDCClientV2/UpdateOIDCClient @@ -61,7 +61,7 @@ UpdateOIDCClientV2: }' ESignet_UpdateOIDCClientV2_Invalid_langCode_Size_Neg: - endPoint: /v1/esignet/client-mgmt/v2/oidc-client/{clientId} + endPoint: /v1/esignet/client-mgmt/oauth-client/{clientId} role: partner restMethod: put inputTemplate: esignet/UpdateOIDCClientV2/UpdateOIDCClient @@ -93,7 +93,7 @@ UpdateOIDCClientV2: }' ESignet_UpdateOIDCClientV2_Invalid_langCode_Neg: - endPoint: /v1/esignet/client-mgmt/v2/oidc-client/{clientId} + endPoint: /v1/esignet/client-mgmt/oauth-client/{clientId} role: partner restMethod: put inputTemplate: esignet/UpdateOIDCClientV2/UpdateOIDCClient @@ -125,7 +125,7 @@ UpdateOIDCClientV2: }' ESignet_UpdateOIDCClientV2_Missing_ClientNamelangMap_Value_Neg: - endPoint: /v1/esignet/client-mgmt/v2/oidc-client/{clientId} + endPoint: /v1/esignet/client-mgmt/oauth-client/{clientId} role: partner restMethod: put inputTemplate: esignet/UpdateOIDCClientV2/UpdateOIDCClientWOClientNameMapValue @@ -149,13 +149,13 @@ UpdateOIDCClientV2: output: '{ "errors": [ { - "errorCode": "invalid_language_code" + "errorCode": "invalid_client_name" } ] }' ESignet_UpdateOIDCClientV2_Missing_ClientNamelangMap_Neg: - endPoint: /v1/esignet/client-mgmt/v2/oidc-client/{clientId} + endPoint: /v1/esignet/client-mgmt/oauth-client/{clientId} role: partner restMethod: put inputTemplate: esignet/UpdateOIDCClientV2/UpdateOIDCClientWOClientNameMap @@ -179,7 +179,7 @@ UpdateOIDCClientV2: output: '{ "errors": [ { - "errorCode": "invalid_language_code" + "errorCode": "invalid_client_name" } ] }' \ No newline at end of file