Skip to content

Commit

Permalink
Merge pull request #1688 from Sohandey/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
mohanachandran-s authored Nov 29, 2024
2 parents 903a655 + 11d6d65 commit a72c026
Showing 1 changed file with 53 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import java.util.Map;
import java.util.Objects;
import java.util.Properties;
import java.util.Random;
import java.util.Set;
import java.util.TimeZone;
import java.util.UUID;
Expand Down Expand Up @@ -162,7 +163,6 @@ public class AdminTestUtil extends BaseTestCase {
String signupAutoGeneratedIdPropFileName = properties.getProperty("signupAutoGeneratedIdPropFileName");
String fullNameForSunBirdRC = properties.getProperty("fullNameForSunBirdRC");
String dobForSunBirdRC = properties.getProperty("dobForSunBirdRC");

public static String PASSWORD_FOR_ADDIDENTITY_AND_REGISTRATION = null;
public static String PASSWORD_TO_RESET = null;
public static final String RESOURCE_FOLDER_NAME = "MosipTemporaryTestResource";
Expand Down Expand Up @@ -3284,6 +3284,15 @@ public String inputJsonKeyWordHandeler(String jsonString, String testCaseName) {
}
jsonString = replaceKeywordWithValue(jsonString, "$PHONENUMBERFORIDENTITY$", phoneNumber);
}

if (jsonString.contains("$NRCID$")) {
String nrcId = (100000 + new Random().nextInt(900000)) + "/" + (10 + new Random().nextInt(90)) + "/" + (1 + new Random().nextInt(9));

jsonString = replaceKeywordWithValue(jsonString, "$NRCID$", nrcId);
}



if (jsonString.contains("$1STLANG$"))
jsonString = replaceKeywordWithValue(jsonString, "$1STLANG$", BaseTestCase.languageList.get(0));
if (jsonString.contains("$2NDLANG$"))
Expand Down Expand Up @@ -5321,6 +5330,8 @@ public static String modifySchemaGenerateHbs(boolean regenerateHbs) {

String phone = getValueFromAuthActuator("json-property", "phone_number");
String result = phone.replaceAll("\\[\"|\"\\]", "");



if (!isElementPresent(requiredPropsArray, result)) {
requiredPropsArray.put(result);
Expand Down Expand Up @@ -5380,7 +5391,15 @@ public static String modifySchemaGenerateHbs(boolean regenerateHbs) {
//"tags": ":["handle"]
eachValueJsonForHandles.put("tags", handleArray);
selectedHandles.add(result);
} else {
}

else if (eachRequiredProp.equals("nrcId")) {
eachValueJsonForHandles.put("value", "$NRCID$");
eachValueJsonForHandles.put("tags", handleArray);
selectedHandles.add("nrcId");
}

else {
eachValueJsonForHandles.put("value", "$FUNCTIONALID$");
eachValueJsonForHandles.put("tags", handleArray);
selectedHandles.add(eachRequiredProp);
Expand Down Expand Up @@ -5448,6 +5467,14 @@ else if (eachPropDataJson.has("$ref") && eachPropDataJson.get("$ref").toString()
identityJson.put(eachRequiredProp, "$EMAILVALUE$");
}

else if (eachRequiredProp.equals("nrcId")) {
String nrcID = "$NRCID$";
if(eachPropDataJson.has("handle")){
selectedHandles.add(eachRequiredProp);
}
identityJson.put(eachRequiredProp, nrcID);
}

else if (eachRequiredProp.equals("password")) {
identityJson.put(eachRequiredProp, new HashMap<>());
if (addIdentityPassword.isBlank() && addIdentitySalt.isBlank())
Expand Down Expand Up @@ -5605,11 +5632,21 @@ public static String updateIdentityHbs(boolean regenerateHbs) {
//"tags": ":["handle"]
eachValueJsonForHandles.put("tags", handleArray);
selectedHandles.add(result);
} else {
}

else if (eachRequiredProp.equals("nrcId")) {
eachValueJsonForHandles.put("value", "$NRCID$");
eachValueJsonForHandles.put("tags", handleArray);
selectedHandles.add("nrcId");
}

else {
eachValueJsonForHandles.put("value", "$FUNCTIONALID$");
eachValueJsonForHandles.put("tags", handleArray);
selectedHandles.add(eachRequiredProp);
}


eachPropDataArrayForHandles.put(eachValueJsonForHandles);
identityJson.put(eachRequiredProp, eachPropDataArrayForHandles);

Expand Down Expand Up @@ -5663,6 +5700,13 @@ else if (eachRequiredProp.equals(result)) {
}
identityJson.put(eachRequiredProp, "$PHONENUMBERFORIDENTITY$");
}
else if (eachRequiredProp.equals("nrcId")) {
String nrcID = "$NRCID$";
if(eachPropDataJson.has("handle")){
selectedHandles.add(eachRequiredProp);
}
identityJson.put(eachRequiredProp, nrcID);
}
else if (eachRequiredProp.equals("proofOfIdentity")) {
identityJson.remove("proofOfIdentity");
}
Expand Down Expand Up @@ -5795,6 +5839,11 @@ public static String generateHbsForUpdateDraft() {
identityJson.getJSONObject(eachRequiredProp).put("type", "DOC001");
identityJson.getJSONObject(eachRequiredProp).put("value", "fileReferenceID");
}

else if (eachRequiredProp.equals("nrcId")) {
String nrcID = "$NRCID$";
identityJson.put(eachRequiredProp, nrcID);
}

else if (eachRequiredProp.equals("individualBiometrics")) {
identityJson.put(eachRequiredProp, new HashMap<>());
Expand Down Expand Up @@ -7186,7 +7235,7 @@ else if (testCaseName.startsWith("Prereg_")
|| testCaseName.contains("_SpacialCharacter_PostalCode_"))
&& (globalRequiredFields != null && !globalRequiredFields.toList().contains(postalCodeArray))) {
throw new SkipException(GlobalConstants.FEATURE_NOT_SUPPORTED_MESSAGE);
}
}

// else if (BaseTestCase.currentModule.equalsIgnoreCase(GlobalConstants.ESIGNET)) {
// if ((testCaseName.startsWith("Esignet_") || testCaseName.startsWith("ESignet_"))
Expand Down

0 comments on commit a72c026

Please sign in to comment.