Skip to content

Commit

Permalink
MOSIP-34512
Browse files Browse the repository at this point in the history
Signed-off-by: Pankaj Godiyal <[email protected]>
  • Loading branch information
pg-techno123 committed Jul 25, 2024
1 parent dd7ceca commit d58d55d
Show file tree
Hide file tree
Showing 14 changed files with 1,032 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import io.mosip.testrig.apirig.utils.AdminTestUtil;
import io.mosip.testrig.apirig.testscripts.BioAuth;
import io.mosip.testrig.apirig.testscripts.DemoAuth;
import io.mosip.testrig.apirig.testscripts.DemoAuthSimplePostForAutoGenId;
import io.mosip.testrig.apirig.testscripts.MultiFactorAuthNew;
import io.mosip.testrig.apirig.testscripts.OtpAuthNew;
import io.mosip.testrig.dslrig.ivv.core.base.StepInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public void run() throws RigInternalError {
String skipBiometricClassificationFlag = "";
String skipApplicantDocumentsFlag = "";
String invalidDateFlag = "";
String invalidOfficerIDFlag = "";

HashMap<String, String> map = new HashMap<String, String>();
HashMap<String, String> dummyholder = new HashMap<String, String>();
Expand Down Expand Up @@ -90,6 +91,9 @@ else if (value.startsWith("$$")) {

if (step.getParameters().size() == 4 && step.getParameters().get(3).contains("invalidCreationDate")) //Invalid packet creation date
invalidDateFlag = step.getParameters().get(3);

if (step.getParameters().size() == 4 && step.getParameters().get(3).contains("invalidOfficerID")) //Invalid Officer ID
invalidOfficerIDFlag = step.getParameters().get(3);

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

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public void run() throws RigInternalError {
String skipBiometricClassificationFlag = "";
String skipApplicantDocumentsFlag = "";
String invalidDateFlag = "";
String invalidOfficerIDFlag = "";
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 @@ -54,7 +55,7 @@ public void run() throws RigInternalError {
if (step.getParameters().size() > 2) // true/false (want to generate privatekey)
generatePrivateKey = Boolean.parseBoolean(step.getParameters().get(2));
if (map != null)
packetUtility.createContexts("",contextKeyValue, map, generatePrivateKey,null,BaseTestCase.ApplnURI + "/",step,invalidCertFlag,consent,supervisorFlag,invalidEncryptedHashFlag,invalidCheckSum,invalidIdSchemaFlag,skipBiometricClassificationFlag,skipApplicantDocumentsFlag,invalidDateFlag);
packetUtility.createContexts("",contextKeyValue, map, generatePrivateKey,null,BaseTestCase.ApplnURI + "/",step,invalidCertFlag,consent,supervisorFlag,invalidEncryptedHashFlag,invalidCheckSum,invalidIdSchemaFlag,skipBiometricClassificationFlag,skipApplicantDocumentsFlag,invalidDateFlag,invalidOfficerIDFlag);

else if (userAndMachineDetailParam != null)
packetUtility.createContexts(contextKeyValue, userAndMachineDetailParam, generatePrivateKey,null,BaseTestCase.ApplnURI + "/",step);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public void run() throws RigInternalError {
String missFields = null;
String updateAttribute = null;
String blocklistedWord = null;
String testPersona = null;
if (step.getParameters() == null || step.getParameters().isEmpty()) {
logger.error("Parameter is missing from DSL step");
this.hasError = true;
Expand Down Expand Up @@ -59,9 +60,15 @@ public void run() throws RigInternalError {

if (!step.getParameters().isEmpty() && step.getParameters().size() > 3) { // "var1=e2e_updateDemoOrBioDetails(0,0,0,$$personaPath)"
String personaFilePath = step.getParameters().get(3);

if(step.getParameters().size() == 5) {
testPersona = step.getParameters().get(4);
testPersona = step.getScenario().getVariables().get(testPersona);
}

if (personaFilePath.startsWith("$$")) {
personaFilePath = step.getScenario().getVariables().get(personaFilePath);
packetUtility.updateDemoOrBioDetail(personaFilePath,
packetUtility.updateDemoOrBioDetail(personaFilePath, testPersona ,
(regenAttributeList.get(0).equalsIgnoreCase("0")) ? null : regenAttributeList,
(missFieldsAttributeList.get(0).equalsIgnoreCase("0")) ? new ArrayList<>()
: missFieldsAttributeList,
Expand All @@ -70,7 +77,7 @@ public void run() throws RigInternalError {
}
} else {
for (String resDataPath : step.getScenario().getResidentTemplatePaths().keySet()) {
packetUtility.updateDemoOrBioDetail(resDataPath,
packetUtility.updateDemoOrBioDetail(resDataPath,testPersona ,
(regenAttributeList.get(0).equalsIgnoreCase("0")) ? null : regenAttributeList,
(missFieldsAttributeList.get(0).equalsIgnoreCase("0")) ? new ArrayList<>()
: missFieldsAttributeList,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,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 , String invalidIdSchemaFlag ,String skipBiometricClassification,String skipApplicantDocuments, String invalidDateFlag) throws RigInternalError {
String invalidCheckSum , String invalidIdSchemaFlag ,String skipBiometricClassification,String skipApplicantDocuments, String invalidDateFlag, String invalidOfficerIDFlag) 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 @@ -812,6 +812,7 @@ public String createContexts(String negative, String key, HashMap<String, String
jsonReq.put("skipBiometricClassificationFlag", skipBiometricClassification);
jsonReq.put("skipApplicantDocumentsFlag", skipApplicantDocuments);
jsonReq.put("invalidDateFlag", invalidDateFlag);
jsonReq.put("invalidOfficerIDFlag", invalidOfficerIDFlag);
jsonReq.put("invalidEncryptedHashFlag", invalidEncryptedHashFlag);
jsonReq.put("changeSupervisorNameToDiffCase", changeSupervisorNameToDiffCase);
jsonReq.put("consent", consent);
Expand Down Expand Up @@ -971,14 +972,15 @@ private JSONObject createPayload(String publicKey, String machineId) {
return jsonMachine;
}

public String updateDemoOrBioDetail(String resFilePath, List<String> attributeList, List<String> missAttributeList,
public String updateDemoOrBioDetail(String resFilePath, String testPersona, List<String> attributeList, List<String> missAttributeList,
List<String> updateAttributeList, Scenario.Step step) throws RigInternalError {
String url = baseUrl + props.getProperty("updatePersonaData");
JSONObject jsonReqInner = new JSONObject();
JSONObject updateAttribute = new JSONObject();
if (missAttributeList != null)
jsonReqInner.put("missAttributeList", missAttributeList);
jsonReqInner.put(PERSONAFILEPATH, resFilePath);
jsonReqInner.put("testPersonaPath", testPersona);
if (attributeList != null && !(attributeList.isEmpty()))
jsonReqInner.put("regenAttributeList", attributeList);
if (updateAttributeList != null && !(updateAttributeList.isEmpty())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,4 +297,5 @@ resident_esignet=v1/esignet/actuator/health
esignetMockBaseURL=esignet-insurance.
slack-webhook-url=
serverErrorsToMonitor=
regprocActuatorEndpoint=/registrationprocessor/v1/registrationtransaction/actuator/env
regprocActuatorEndpoint=/registrationprocessor/v1/registrationtransaction/actuator/env
sunBirdBaseURL=
Loading

0 comments on commit d58d55d

Please sign in to comment.