Skip to content

Commit

Permalink
MOSIP-27425
Browse files Browse the repository at this point in the history
Signed-off-by: Pankaj Godiyal <[email protected]>
  • Loading branch information
pg-techno123 committed Jan 17, 2024
1 parent 875770d commit 927555f
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public void run() throws RigInternalError {
boolean changeSupervisorNameToDiffCase = Boolean.FALSE;
String invalidEncryptedHashFlag = "";
String invalidCheckSum = "";
String invalidIdSchemaFlag = "";
// neeha scenario = step.getScenario().getId() + ":" +
// step.getScenario().getDescription();
HashMap<String, String> map = new HashMap<String, String>();
Expand Down Expand Up @@ -71,11 +72,16 @@ else if (value.startsWith("$$")) {

if (step.getParameters().size() > 4) // deactivate
status = step.getParameters().get(4);


if (step.getParameters().size() > 5) // for negative operator and supervisor
negative = step.getParameters().get(5);

if (step.getParameters().size() == 5 && step.getParameters().get(4).contains("true"))
invalidCertFlag = Boolean.parseBoolean(step.getParameters().get(4));

if (step.getParameters().size() == 5 && step.getParameters().get(4).contains("invalidIdSchema")) //invalidIdSchema
invalidIdSchemaFlag = step.getParameters().get(4);

// consent value either "yes" or "no"
if (step.getParameters().size() == 6
Expand All @@ -101,7 +107,7 @@ else if (value.startsWith("$$")) {
else if (map != null)
packetUtility.createContexts(negative, contextKeyValue, map, mosipVersion, generatePrivateKey, status,
BaseTestCase.ApplnURI + "/", step, invalidCertFlag, consent, changeSupervisorNameToDiffCase,
invalidEncryptedHashFlag, invalidCheckSum);
invalidEncryptedHashFlag, invalidCheckSum,invalidIdSchemaFlag);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public void run() throws RigInternalError {
String consent="";
boolean supervisorFlag=Boolean.FALSE;
String invalidEncryptedHashFlag = "";
String invalidCheckSum = "";
String invalidCheckSum = "";
String invalidIdSchemaFlag = "";
if (step.getParameters() == null || step.getParameters().isEmpty() || step.getParameters().size() < 1) {
logger.warn("SwitchContext Arugemnt is Missing : Please pass the argument from DSL sheet");
} else {
Expand All @@ -51,7 +52,7 @@ public void run() throws RigInternalError {
if (step.getParameters().size() > 3) // true/false (want to generate privatekey)
generatePrivateKey = Boolean.parseBoolean(step.getParameters().get(3));
if (map != null)
packetUtility.createContexts("",contextKeyValue, map, mosipVersion,generatePrivateKey,null,BaseTestCase.ApplnURI + "/",step,invalidCertFlag,consent,supervisorFlag,invalidEncryptedHashFlag,invalidCheckSum);
packetUtility.createContexts("",contextKeyValue, map, mosipVersion,generatePrivateKey,null,BaseTestCase.ApplnURI + "/",step,invalidCertFlag,consent,supervisorFlag,invalidEncryptedHashFlag,invalidCheckSum,invalidIdSchemaFlag);

else if (userAndMachineDetailParam != null)
packetUtility.createContexts(contextKeyValue, userAndMachineDetailParam, mosipVersion,generatePrivateKey,null,BaseTestCase.ApplnURI + "/",step);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ public String createContexts(String negative, String key, HashMap<String, String

Boolean generatePrivateKey, String status, String envbaseUrl, Scenario.Step step, boolean invalidCertFlag,
String consent, boolean changeSupervisorNameToDiffCase, String invalidEncryptedHashFlag,
String invalidCheckSum) throws RigInternalError {
String invalidCheckSum , String invalidIdSchemaFlag) throws RigInternalError {
String url = this.baseUrl + "/context/server"; // this.baseUrl + "/context/server/" + key?contextKey=Ckey
logger.info("packet utility base url : " + url);

Expand Down Expand Up @@ -769,6 +769,7 @@ public String createContexts(String negative, String key, HashMap<String, String
jsonReq.put("introducerRID", getValueFromIdJson("introducerRID"));
jsonReq.put("introducerName", getValueFromIdJson("introducerName"));
jsonReq.put("invalidCheckSum", invalidCheckSum);
jsonReq.put("invalidIdSchemaFlag", invalidIdSchemaFlag);
jsonReq.put("invalidEncryptedHashFlag", invalidEncryptedHashFlag);
jsonReq.put("changeSupervisorNameToDiffCase", changeSupervisorNameToDiffCase);
jsonReq.put("consent", consent);
Expand All @@ -790,6 +791,8 @@ public String createContexts(String negative, String key, HashMap<String, String
jsonReq.put("Female", "FLE");
jsonReq.put("Other", "OTH");
jsonReq.put("generatePrivateKey", generatePrivateKey);

jsonReq.put("langCode", BaseTestCase.languageCode);

jsonReq.put("validUIN", (map.get("$$uin") != null) ? map.get("$$uin") : "createnew");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18092,6 +18092,61 @@
"Action": "e2e_Center(DCOM,$$details8,8/*CENTER_INDEX*/)"
}
},
{
"Scenario": "159",
"Tag": "Negative_Test",
"Persona": "ResidentFemaleAdult",
"Group": "Adult_New",
"Description": "Resident walk-ins to registration center completes the process tries to get uin with invalid ID Schema version",
"Step-0": {
"Description": "Performs health check of given component",
"Input Parameters": "Keyword to check, only packetcreator is supported",
"Return Value": "NA",
"Action": "e2e_getPingHealth(packetcreator)"
},
"Step-1": {
"Description": "Reads the pre-requisite data at the given index",
"Input Parameters": "Details can be found in in-line comments on the parameters",
"Return Value": "pre-requiste details",
"Action": "$$details1=e2e_ReadPreReq(1/*PRE_REQUISITE_DATA_INDEX*/)"
},
"Step-2": {
"Description": "Sets the context for scenario execution",
"Input Parameters": "Enviornment and user details. Other prarameters details can be found in-line",
"Return Value": "NA",
"Action": "e2e_setContext(env_context,$$details1,1/*ADD_COMMMENT*/@@2/*ADD_COMMMENT*/,false/*GENERATE_PRIVATE_KEY*/,invalidIdSchema/*INVALID_SCHEMA_VERSION*/)"
},
"Step-3": {
"Description": "Performs health check of required server components to run end-to-end scenarios",
"Input Parameters": "NA",
"Return Value": "NA",
"Action": "e2e_getPingHealth()"
},
"Step-4": {
"Description": "Generates persona data",
"Input Parameters": "Details are in parameter in-line comments",
"Return Value": "Persona file path",
"Action": "$$personaFilePath=e2e_getResidentData(1,adult,false,Female)"
},
"Step-5": {
"Description": "Generates packet template based on the persona data",
"Input Parameters": "Process and persona file path",
"Return Value": "Generated Template file path",
"Action": "$$templatePath=e2e_getPacketTemplate(NEW,$$personaFilePath)"
},
"Step-6": {
"Description": "Genertes and uploads packet with given persona and packet template skipping pre-registration step",
"Input Parameters": "Persona file path and template file path",
"Return Value": "RID",
"Action": "$$rid=e2e_generateAndUploadPacketSkippingPrereg($$personaFilePath,$$templatePath)"
},
"Step-7": {
"Description": "Checks RID stage and stage status",
"Input Parameters": "RID, stage and stage status",
"Return Value": "NA",
"Action": "e2e_CheckRIDStage($$rid,VALIDATE_PACKET,REPROCESS)"
}
},
{
"Scenario": "AFTER_SUITE",
"Tag": "Postive_Test",
Expand All @@ -18105,102 +18160,96 @@
"Action": "e2e_WritePersonaData()"
},
"Step-1": {
"Description": "Resets the context data",
"Input Parameters": "NA",
"Return Value": "NA",
"Action": "e2e_ResetContextData()"
},
"Step-2": {
"Description": "Performs health check of given component",
"Input Parameters": "Keyword to check, only packetcreator is supported",
"Return Value": "NA",
"Action": "e2e_getPingHealth(packetcreator)"
},
"Step-3": {
"Step-2": {
"Description": "Reads the pre-requisite data at the given index",
"Input Parameters": "Index. Other parameter details can be found in parameter in-line comments",
"Return Value": "Pre-requiste details",
"Action": "$$details1=e2e_ReadPreReq(1/*PRE_REQUISITE_DATA_INDEX*/)"
},
"Step-4": {
"Step-3": {
"Description": "Sets the context for scenario execution",
"Input Parameters": "<<<Step inputs values details>>>",
"Return Value": "NA",
"Action": "e2e_setContext(env_context,$$details1,1/*ADD_COMMMENT*/@@2/*ADD_COMMMENT*/,false/*GENERATE_PRIVATE_KEY*/)"
},
"Step-5": {
"Step-4": {
"Description": "Performs health check of required server components to run end-to-end scenarios",
"Input Parameters": "NA",
"Return Value": "NA",
"Action": "e2e_getPingHealth()"
},
"Step-6": {
"Step-5": {
"Description": "Re-sets all expectations set on mocks for simulating the scenarios",
"Input Parameters": "NA",
"Return Value": "NA",
"Action": "e2e_DeleteMockExpect()"
},
"Step-7": {
"Step-6": {
"Description": "Decomissions the machine",
"Input Parameters": "Action and ceneter machine user details",
"Return Value": "NA",
"Action": "e2e_Machine(DCOM,$$details1)"
},
"Step-8": {
"Step-7": {
"Description": "Unmaps machine from the center",
"Input Parameters": "Action and CMD details",
"Return Value": "<<<Step output details>>>",
"Action": "$$details1=e2e_User(DELETE_CENTERMAPPING,1/*ADD_COMMMENT*/@@Techno@123/*PASSWORD*/,$$details1)"
},
"Step-9": {
"Step-8": {
"Description": "Decomissions the center",
"Input Parameters": "Action and ceneter machine user details",
"Return Value": "NA",
"Action": "e2e_Center(DCOM,$$details1,1/*CENTER_INDEX*/)"
},
"Step-10": {
"Step-9": {
"Description": "Reads the pre-requisite data at the given index",
"Input Parameters": "Index. Other parameter details can be found in parameter in-line comments",
"Return Value": "Pre-requiste details",
"Action": "$$details2=e2e_ReadPreReq(2/*PRE_REQUISITE_DATA_INDEX*/)"
},
"Step-11": {
"Step-10": {
"Description": "Decomissions the machine",
"Input Parameters": "Action and ceneter machine user details",
"Return Value": "NA",
"Action": "e2e_Machine(DCOM,$$details2)"
},
"Step-12": {
"Step-11": {
"Description": "<<<Step detailed description>>>",
"Input Parameters": "<<<Step inputs values details>>>",
"Return Value": "<<<Step output details>>>",
"Action": "$$details2=e2e_User(DELETE_CENTERMAPPING,2/*ADD_COMMMENT*/@@Techno@123/*PASSWORD*/,$$details2)"
},
"Step-13": {
"Step-12": {
"Description": "Decomissions the center",
"Input Parameters": "Action and ceneter machine user details",
"Return Value": "NA",
"Action": "e2e_Center(DCOM,$$details2,2/*CENTER_INDEX*/)"
},
"Step-14": {
"Step-13": {
"Description": "Reads the pre-requisite data at the given index",
"Input Parameters": "Index. Other parameter details can be found in parameter in-line comments",
"Return Value": "Pre-requiste details",
"Action": "$$details3=e2e_ReadPreReq(3/*PRE_REQUISITE_DATA_INDEX*/)"
},
"Step-15": {
"Step-14": {
"Description": "Decomissions the machine",
"Input Parameters": "Action and ceneter machine user details",
"Return Value": "NA",
"Action": "e2e_Machine(DCOM,$$details3)"
},
"Step-16": {
"Step-15": {
"Description": "<<<Step detailed description>>>",
"Input Parameters": "<<<Step inputs values details>>>",
"Return Value": "<<<Step output details>>>",
"Action": "$$details3=e2e_User(DELETE_CENTERMAPPING,3/*ADD_COMMMENT*/@@Techno@123/*PASSWORD*/,$$details3)"
},
"Step-17": {
"Step-16": {
"Description": "Decomissions the center",
"Input Parameters": "Action and ceneter machine user details",
"Return Value": "NA",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public class PacketTemplateProvider {
private static final String GENDER = "gender";
private static final String FULLNAME = "fullname";
private static final String FIRSTNAME = "firstname";
private static final double INVALID_SCHEMA = 2.5;
private static final String LASTNAME = "lastname";
private static final String MIDDLENAME = "middlename";
private static final String DATEOFBIRTH = "dateofbirth";
Expand Down Expand Up @@ -930,6 +931,12 @@ String generateIDJson(ResidentModel resident, HashMap<String, String[]> fileInfo
if (!s.getRequired() && !(s.getRequiredOn() != null && s.getRequiredOn().size() > 0)) {
continue;
}

if (VariableManager.getVariableValue(contextKey, "invalidIdSchemaFlag").toString().equals("invalidIdSchema")
&& s.getId().equals(VariableManager.getVariableValue(contextKey, "IDSchemaVersion"))) {
identity.put(s.getId(), Double.valueOf(INVALID_SCHEMA));
continue;
}

if (VariableManager.getVariableValue(contextKey, "IDSchemaVersion") != null
&& s.getId().equals(VariableManager.getVariableValue(contextKey, "IDSchemaVersion"))) {
Expand Down

0 comments on commit 927555f

Please sign in to comment.