-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #108 from neeharikatech/develop
Develop - user creation and issues fixed
- Loading branch information
Showing
14 changed files
with
343 additions
and
32 deletions.
There are no files selected for viewing
148 changes: 148 additions & 0 deletions
148
...vv-orchestrator/src/main/java/io/mosip/ivv/e2e/methods/OperatorOnboardAuthentication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
package io.mosip.ivv.e2e.methods; | ||
|
||
import static io.restassured.RestAssured.given; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.Properties; | ||
|
||
import javax.ws.rs.core.MediaType; | ||
|
||
import org.apache.commons.lang.StringUtils; | ||
import org.apache.log4j.Logger; | ||
import org.json.JSONArray; | ||
import org.json.JSONObject; | ||
import org.testng.Reporter; | ||
|
||
import io.mosip.admin.fw.util.AdminTestException; | ||
import io.mosip.admin.fw.util.AdminTestUtil; | ||
import io.mosip.admin.fw.util.TestCaseDTO; | ||
import io.mosip.authentication.fw.precon.JsonPrecondtion; | ||
import io.mosip.authentication.fw.util.AuthPartnerProcessor; | ||
import io.mosip.authentication.fw.util.AuthenticationTestException; | ||
import io.mosip.ivv.core.base.StepInterface; | ||
import io.mosip.ivv.core.exceptions.RigInternalError; | ||
import io.mosip.ivv.e2e.constant.E2EConstants; | ||
import io.mosip.ivv.orchestrator.BaseTestCaseUtil; | ||
import io.mosip.ivv.orchestrator.TestRunner; | ||
import io.mosip.testscripts.BioAuth; | ||
import io.restassured.response.Response; | ||
|
||
public class OperatorOnboardAuthentication extends BaseTestCaseUtil implements StepInterface { | ||
static Logger logger = Logger.getLogger(OperatorOnboardAuthentication.class); | ||
private static final String BIOMETRIC_FACE = "regproc/OperatorOnboardAuth/operatorOnboardAuth.yml"; | ||
Properties deviceProp =null; | ||
Properties uinResidentDataPathFinalProps = new Properties(); | ||
BioAuth bioAuth = new BioAuth(); | ||
String bioResponse = null; | ||
|
||
@Override | ||
public void run() throws RigInternalError { | ||
AuthPartnerProcessor.startProcess(); | ||
//uinPersonaProp.put("8497438207", "C:\\Users\\NEEHAR~1.GAR\\AppData\\Local\\Temp\\residents_11835704006002908658\\5645168410.json"); | ||
List<String> modalityList = new ArrayList<>(); | ||
String personFilePathvalue = null; | ||
String deviceInfoFilePath = null; | ||
String uins = null; | ||
List<String> uinList = null; | ||
if (step.getParameters() == null || step.getParameters().isEmpty() || step.getParameters().size() < 1) { | ||
logger.error("Parameter is missing from DSL step"); | ||
throw new RigInternalError("Modality paramter is missing in step: " + step.getName()); | ||
} else { | ||
deviceInfoFilePath = step.getParameters().get(0); | ||
if (!StringUtils.isBlank(deviceInfoFilePath)) { | ||
deviceInfoFilePath = TestRunner.getExternalResourcePath() | ||
+ props.getProperty("ivv.path.deviceinfo.folder") + deviceInfoFilePath + ".properties"; | ||
deviceProp = AdminTestUtil.getproperty(deviceInfoFilePath); | ||
} else | ||
throw new RigInternalError("deviceInfo file path Parameter is missing from DSL step"); | ||
} | ||
if (step.getParameters().size() == 2) { | ||
uins = step.getParameters().get(1); | ||
if (!StringUtils.isBlank(uins)) | ||
uinList = new ArrayList<>(Arrays.asList(uins.split("@@"))); | ||
} else if (step.getParameters().size() == 3) { // e2e_bioAuthentication(faceDevice,$$uin,$$personaFilePath) | ||
uins = step.getParameters().get(1); | ||
String _personaFilePath = step.getParameters().get(2); | ||
if (uins.startsWith("$$") && _personaFilePath.startsWith("$$")) { | ||
uins = step.getScenario().getVariables().get(uins); | ||
_personaFilePath = step.getScenario().getVariables().get(_personaFilePath); | ||
uinList = new ArrayList<>(); | ||
uinList.add(uins); | ||
uinPersonaProp.put(uins, _personaFilePath); | ||
} | ||
} | ||
else | ||
uinList = new ArrayList<>(uinPersonaProp.stringPropertyNames()); | ||
|
||
for (String uin : uinList) { | ||
|
||
|
||
|
||
if (uinPersonaProp.containsKey(uin)) | ||
personFilePathvalue = uinPersonaProp.getProperty(uin); | ||
else | ||
throw new RigInternalError("Persona doesn't exist for the given UIN " + uin); | ||
|
||
String bioType=null, bioSubType=null; | ||
|
||
String modalityToLog = null; | ||
String modalityKeyTogetBioValue = null; | ||
if(deviceProp != null) { | ||
bioType= deviceProp.getProperty("bioType"); | ||
|
||
bioSubType= deviceProp.getProperty("bioSubType"); | ||
switch(bioType) { | ||
case E2EConstants.FACEBIOTYPE: | ||
modalityList.add(E2EConstants.FACEFETCH); | ||
modalityToLog = bioType; | ||
modalityKeyTogetBioValue = E2EConstants.FACEFETCH; | ||
break; | ||
case E2EConstants.IRISBIOTYPE: | ||
modalityList.add(E2EConstants.IRISFETCH); | ||
modalityToLog = bioSubType+"_"+bioType; | ||
modalityKeyTogetBioValue = (bioSubType.equalsIgnoreCase("left"))? E2EConstants.LEFT_EYE:E2EConstants.RIGHT_EYE; | ||
break; | ||
case E2EConstants.FINGERBIOTYPE: | ||
modalityList.add(E2EConstants.FINGERFETCH); | ||
modalityToLog = bioSubType; | ||
modalityKeyTogetBioValue = bioSubType; | ||
break; | ||
default: | ||
throw new RigInternalError("Given BIO Type in device property file is not valid"); | ||
} | ||
} | ||
|
||
/* | ||
deviceInfoFilePath = TestRunner.getExternalResourcePath() | ||
+ props.getProperty("ivv.path.deviceinfo.folder") + "faceDevice" + ".properties"; | ||
deviceProp = AdminTestUtil.getproperty(deviceInfoFilePath); | ||
String uin="8497438207"; | ||
personFilePathvalue = uinPersonaProp.getProperty(uin); | ||
String modalityToLog = null; | ||
String modalityKeyTogetBioValue = null; | ||
modalityList.add(E2EConstants.FACEFETCH); | ||
modalityToLog = "FACE"; | ||
modalityKeyTogetBioValue = "face_encrypted"; | ||
*/ | ||
bioResponse = packetUtility.retrieveBiometric(personFilePathvalue, modalityList); | ||
|
||
String fileName = BIOMETRIC_FACE; | ||
bioAuth.isInternal = false; | ||
Object[] casesList = bioAuth.getYmlTestData(fileName); | ||
|
||
if (bioResponse != null && !bioResponse.isEmpty() && modalityKeyTogetBioValue!= null) { | ||
String bioValue = JsonPrecondtion.getValueFromJson(bioResponse, modalityKeyTogetBioValue); | ||
if(bioValue== null || bioValue.length()<100) | ||
throw new RigInternalError("Not able to get the bio value for field "+modalityToLog+" from persona"); | ||
for (Object object : casesList) { | ||
TestCaseDTO test = (TestCaseDTO) object; | ||
packetUtility.operatorOnboardAuth(modalityToLog, bioValue, "dsl1", test, bioAuth,"USERID",deviceProp); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.