Skip to content

Commit

Permalink
Merge pull request mosip#1059 from mohanachandran-s/develop_temp
Browse files Browse the repository at this point in the history
MOSIP-35082 - Fixing non English failure test cases
  • Loading branch information
ckm007 authored Aug 26, 2024
2 parents 938fc6f + a7407f8 commit 15bffd6
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class MosipTestRunner {

public static String jarUrl = MosipTestRunner.class.getProtectionDomain().getCodeSource().getLocation().getPath();
public static List<String> languageList = new ArrayList<>();
public static List<String> localLanguageList;

/**
* C Main method to start mosip test execution
Expand Down Expand Up @@ -83,7 +84,7 @@ public static void main(String[] arg) {
KeycloakUserManager.createUsers();
KeycloakUserManager.closeKeycloakInstance();

List<String> localLanguageList = new ArrayList<>(BaseTestCase.getLanguageList());
localLanguageList = new ArrayList<>(BaseTestCase.getLanguageList());
AdminTestUtil.getLocationData();

AdminTestUtil.getHierarchyZoneCode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@

import io.mosip.testrig.apirig.dto.OutputValidationDto;
import io.mosip.testrig.apirig.dto.TestCaseDTO;
import io.mosip.testrig.apirig.testrunner.BaseTestCase;
import io.mosip.testrig.apirig.testrunner.HealthChecker;
import io.mosip.testrig.apirig.testrunner.MosipTestRunner;
import io.mosip.testrig.apirig.utils.AdminTestException;
import io.mosip.testrig.apirig.utils.AdminTestUtil;
import io.mosip.testrig.apirig.utils.AuthenticationTestException;
Expand Down Expand Up @@ -94,9 +96,17 @@ public void test(TestCaseDTO testCaseDTO)
inputJson = getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate());

if (testCaseDTO.getTemplateFields() != null && templateFields.length > 0) {
if (testCaseName.contains("_WithMandatoryLanguage")
&& languageList.get(0) != MosipTestRunner.localLanguageList.get(0)) {
languageList.add(MosipTestRunner.localLanguageList.get(0));
}
ArrayList<JSONObject> inputtestCases = AdminTestUtil.getInputTestCase(testCaseDTO);
ArrayList<JSONObject> outputtestcase = AdminTestUtil.getOutputTestCase(testCaseDTO);
for (int i = 0; i < languageList.size(); i++) {
int languageListSize = languageList.size();
for (int i = languageListSize-1; i >= 0; i--) {
if (languageListSize > 1) {
currentLanguage = languageList.get(i);
}
response = postWithBodyAndCookieForAutoGeneratedId(ApplnURI + testCaseDTO.getEndPoint(),
getJsonFromTemplate(inputtestCases.get(i).toString(), testCaseDTO.getInputTemplate()),
COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName(), idKeyName);
Expand All @@ -114,6 +124,9 @@ public void test(TestCaseDTO testCaseDTO)
if (!OutputValidationUtil.publishOutputResult(ouputValid))
throw new AdminTestException("Failed at output validation");
}
if (languageListSize > 1) {
languageList.remove(MosipTestRunner.localLanguageList.get(0));
}
}
else{
response = postWithBodyAndCookieForAutoGeneratedId(ApplnURI + testCaseDTO.getEndPoint(), inputJson,
Expand Down
2 changes: 1 addition & 1 deletion apitest/src/main/resources/config/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ authPolicyUrl=/v1/policymanager/policies
policyGroupUrl=/v1/policymanager/policies/group/new
publishPolicyurl=/v1/policymanager/policies/POLICYID/group/POLICYGROUPID/publish
clearCertificateURL=v1/identity/clearKeys?moduleName=$MODULENAME$&certsDir=$CERTSDIR$
fetchLocationData=/v1/masterdata/locations/all?pageNumber=0&pageSize=50&sortBy=createdDateTime&orderBy=desc
fetchLocationData=/v1/masterdata/locations/all?pageNumber=0&pageSize=100&sortBy=createdDateTime&orderBy=desc
fetchLocationLevel=/v1/masterdata/locations/level/
fetchTitle=/v1/masterdata/title
fetchZoneCode=/v1/masterdata/zones/hierarchy/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ FetchRegCent:
"registrationcenterid": "$REMOVE$",
"year": "$REMOVE$",
"id": "$REMOVE$",
"hierarchylevel": "$ID:CreateLocationData_All_Valid_Smoke_Sid_hierarchyLevel$",
"name": "$ID:CreateLocationData_All_Valid_Smoke_Sid_name$",
"hierarchylevel": "$ID:CreateLocationData_WithMandatoryLanguage_All_Valid_Smoke_Sid_hierarchyLevel$",
"name": "$ID:CreateLocationData_WithMandatoryLanguage_All_Valid_Smoke_Sid_name$",
"zonecode": "$REMOVE$",
"timestamp": "$REMOVE$"
}'
Expand Down Expand Up @@ -348,8 +348,8 @@ FetchRegCent:
"registrationcenterid": "$REMOVE$",
"year": "$REMOVE$",
"id": "$REMOVE$",
"hierarchylevel": "$ID:CreateLocationData_All_Valid_Smoke_Sid_hierarchyLevel$",
"name": "$ID:CreateLocationData_All_Valid_Smoke_Sid_name$",
"hierarchylevel": "$ID:CreateLocationData_WithMandatoryLanguage_All_Valid_Smoke_Sid_hierarchyLevel$",
"name": "$ID:CreateLocationData_WithMandatoryLanguage_All_Valid_Smoke_Sid_name$",
"zonecode": "$REMOVE$",
"timestamp": "$REMOVE$"
}'
Expand Down Expand Up @@ -511,8 +511,8 @@ FetchRegCent:
"registrationcenterid": "$REMOVE$",
"year": "$REMOVE$",
"id": "$REMOVE$",
"hierarchylevel": "$ID:CreateLocationData_All_Valid_Smoke_Sid_hierarchyLevel$",
"name": "$ID:CreateLocationData_All_Valid_Smoke_Sid_name$",
"hierarchylevel": "$ID:CreateLocationData_WithMandatoryLanguage_All_Valid_Smoke_Sid_hierarchyLevel$",
"name": "$ID:CreateLocationData_WithMandatoryLanguage_All_Valid_Smoke_Sid_name$",
"zonecode": "$REMOVE$",
"timestamp": "$REMOVE$"
}'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
CreateLocationData:
MasterData_CreateLocationData_All_Valid_Smoke_Sid:
MasterData_CreateLocationData_WithMandatoryLanguage_All_Valid_Smoke_Sid:
endPoint: /v1/masterdata/locations
description: Creating location data with valid details
role: admin
checkErrorsOnlyInResponse: true
templateFields: ["name","langCode"]
templateFields: ["name"]
restMethod: post
inputTemplate: masterdata/LocationController/locationData
outputTemplate: masterdata/LocationController/locationDataResult
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ UpdateLocationData:
inputTemplate: masterdata/LocationController/locationData
outputTemplate: masterdata/LocationController/locationDataResult
input: '{
"code": "$ID:CreateLocationData_All_Valid_Smoke_Sid_code$",
"code": "$ID:CreateLocationData_WithMandatoryLanguage_All_Valid_Smoke_Sid_code$",
"name": "Test_Loc_A_updated_",
"hierarchyLevel": "$HIERARCHYLEVEL$",
"hierarchyName": "$HIERARCHYNAME$",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ CreateRegistrationCenter:
"holidayLocationCode":"$LOCATIONCODE$",
"langCode":"hin",
"latitude":"78.5478",
"locationCode":"$ID:CreateLocationData_All_Valid_Smoke_Sid_code$",
"locationCode":"$ID:CreateLocationData_WithMandatoryLanguage_All_Valid_Smoke_Sid_code$",
"longitude":"45.2456",
"lunchEndTime":"00:00:00",
"lunchStartTime":"00:00:00",
"name":"$ID:CreateLocationData_All_Valid_Smoke_Sid_name$",
"name":"$ID:CreateLocationData_WithMandatoryLanguage_All_Valid_Smoke_Sid_name$",
"perKioskProcessTime":"00:30:00",
"timeZone":"(GTM+01:00) CENTRAL EUROPEAN TIME",
"workingHours":3.5,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ UpdateRegistrationCenter:
"isActive": true,
"langCode": "eng",
"latitude":"78.5478",
"locationCode":"$ID:CreateLocationData_All_Valid_Smoke_Sid_code$",
"locationCode":"$ID:CreateLocationData_WithMandatoryLanguage_All_Valid_Smoke_Sid_code$",
"longitude":"45.2456",
"lunchEndTime":"00:00:00",
"lunchStartTime":"00:00:00",
Expand Down Expand Up @@ -62,7 +62,7 @@ UpdateRegistrationCenter:
"isActive": true,
"langCode": "eng",
"latitude":"78.5478",
"locationCode":"$ID:CreateLocationData_All_Valid_Smoke_Sid_code$",
"locationCode":"$ID:CreateLocationData_WithMandatoryLanguage_All_Valid_Smoke_Sid_code$",
"longitude":"45.2456",
"lunchEndTime":"00:00:00",
"lunchStartTime":"00:00:00",
Expand Down Expand Up @@ -102,7 +102,7 @@ UpdateRegistrationCenter:
"isActive": true,
"langCode": "eng",
"latitude": "33.995612",
"locationCode": "$ID:CreateLocationData_All_Valid_Smoke_Sid_code$",
"locationCode": "$ID:CreateLocationData_WithMandatoryLanguage_All_Valid_Smoke_Sid_code$",
"longitude": "-6.815281",
"lunchEndTime": "14:00:00",
"lunchStartTime": "13:00:00",
Expand Down Expand Up @@ -147,7 +147,7 @@ UpdateRegistrationCenter:
"isActive": true,
"langCode": "eng",
"latitude": "",
"locationCode": "$ID:CreateLocationData_All_Valid_Smoke_Sid_code$",
"locationCode": "$ID:CreateLocationData_WithMandatoryLanguage_All_Valid_Smoke_Sid_code$",
"longitude": "-6.815281",
"lunchEndTime": "14:00:00",
"lunchStartTime": "13:00:00",
Expand Down Expand Up @@ -191,7 +191,7 @@ UpdateRegistrationCenter:
"isActive": true,
"langCode": "eng",
"latitude": "fbheafg",
"locationCode": "$ID:CreateLocationData_All_Valid_Smoke_Sid_code$",
"locationCode": "$ID:CreateLocationData_WithMandatoryLanguage_All_Valid_Smoke_Sid_code$",
"longitude": "-6.815281",
"lunchEndTime": "14:00:00",
"lunchStartTime": "13:00:00",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ UpdateLocationStatus:
inputTemplate: masterdata/UpdateLocationStatus/updateLocationStatus
outputTemplate: masterdata/UpdateLocationStatus/updateLocationStatusResult
input: '{
"code": "$ID:CreateLocationData_All_Valid_Smoke_Sid_code$",
"code": "$ID:CreateLocationData_WithMandatoryLanguage_All_Valid_Smoke_Sid_code$",
"isActive": "true"
}'
output: '{
Expand Down

0 comments on commit 15bffd6

Please sign in to comment.