Skip to content

Commit

Permalink
Merge remote-tracking branch 'mt-functional-repo5/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Saumya Saumya authored and Saumya Saumya committed Dec 12, 2019
2 parents 83cd877 + cd55e2b commit f43f431
Show file tree
Hide file tree
Showing 52 changed files with 318 additions and 7,108 deletions.
4 changes: 2 additions & 2 deletions authentication-partnerdemo-service/lib/Keystore/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Export Public Key:
keytool -export -alias mosip.io -keystore keystore.jks -file PublicKey.pem

Export Private Key:
keytool -importkeystore -srckeystore keystore.jks -srcstorepass Mosip@dev123 -srckeypass Mosip@dev123 -srcalias mosip.io -destalias mosip.io -destkeystore PrivateKey.p12 -deststoretype PKCS12 -deststorepass Mosip@dev123 -destkeypass Mosip@dev123
keytool -importkeystore -srckeystore keystore.jks -srcstorepass somepassword -srckeypass somepassword -srcalias mosip.io -destalias mosip.io -destkeystore PrivateKey.p12 -deststoretype PKCS12 -deststorepass somepassword -destkeypass somepassword

//Linux -- Not used
//openssl pkcs12 -in PrivateKey.p12 -nodes -nocerts -out PrivateKey.pem
Expand Down Expand Up @@ -69,4 +69,4 @@ javac ExportPrivateKey.java
java ExportPrivateKey <path_to_keystore> JCEKS <keystore_password> “<key_alias>” <key_password> <output_file_name>

Example:
java ExportPrivateKey keystore.jks PKCS12 Mosip@dev123 mosip.io Mosip@dev123 PrivateKey.pem
java ExportPrivateKey keystore.jks PKCS12 somepassword mosip.io somepassword PrivateKey.pem
2 changes: 1 addition & 1 deletion automationtests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>io.mosip</groupId>
<artifactId>mosip-parent</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<properties>
<!-- kernel versions -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public void verifyAuthTypeStatusForUin() throws AuthenticationTestException {
else {
uinKey.add("UIN.demo.true");
uinKey.add("UIN.bio.IIR.true");
uinKey.add("UIN.bio.FID.true");
uinKey.add("UIN.bio.FACE.true");
uinKey.add("UIN.bio.FIR.true");
uinKey.add("UIN.otp.true");
String value = AuthTestsUtil.getValueFromPropertyFile(RunConfigUtil.getAuthTypeStatusPath(),
Expand All @@ -202,7 +202,7 @@ public void verifyAuthTypeStatusForVid() throws AuthenticationTestException {
else {
vidKey.add("VID.demo.true");
vidKey.add("VID.bio.IIR.true");
vidKey.add("VID.bio.FID.true");
vidKey.add("VID.bio.FACE.true");
vidKey.add("VID.bio.FIR.true");
vidKey.add("VID.otp.true");
String value = AuthTestsUtil.getValueFromPropertyFile(RunConfigUtil.getAuthTypeStatusPath(),
Expand Down Expand Up @@ -274,17 +274,28 @@ private Map<String, List<OutputValidationDto>> verifyAuthTypeStatusAgainstDB(Aut
return OutputValidationUtil.compareActuExpValue(actual, expected, testCaseName);
}

private String getAuthTypeStatusQuery(String uin) {
/*private String getAuthTypeStatusQuery(String uin) {
return "select * from ida.uin_auth_lock where lock_request_datetime in ((select lock_request_datetime from ida.uin_auth_lock where uin = '"
+ uin + "' and auth_type_code = 'demo' order by cr_dtimes desc limit 1),"
+ " (select lock_request_datetime from ida.uin_auth_lock where uin = '" + uin
+ "' and auth_type_code = 'otp' order by cr_dtimes desc limit 1),"
+ " (select lock_request_datetime from ida.uin_auth_lock where uin = '" + uin
+ "' and auth_type_code = 'bio-FID' order by cr_dtimes desc limit 1),"
+ "' and auth_type_code = 'bio-FACE' order by cr_dtimes desc limit 1),"
+ " (select lock_request_datetime from ida.uin_auth_lock where uin = '" + uin
+ "' and auth_type_code = 'bio-FIR' order by cr_dtimes desc limit 1),"
+ " (select lock_request_datetime from ida.uin_auth_lock where uin = '" + uin
+ "' and auth_type_code = 'bio-IIR' order by cr_dtimes desc limit 1)" + ") order by cr_dtimes";
+ "' and auth_type_code = 'bio-IIR' order by cr_dtimes desc limit 1)" + ") order by cr_dtimes desc";
}*/

private String getAuthTypeStatusQuery(String uin) {
return "select t.* " +
"from ida.uin_auth_lock t " +
"inner join ( " +
" select auth_type_code, MAX(cr_dtimes) as crd " +
" from ida.uin_auth_lock " +
" group by uin_hash, auth_type_code " +
") tm on t.auth_type_code = tm.auth_type_code and t.cr_dtimes = tm.crd " +
"where t.uin ='"+uin+"'";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,20 @@ public boolean printAndPost(String regId) {
}
return false;
}

public String getRef_Id(String regId) {
String refId="";
Session session=getCurrentSession();
Transaction t=session.beginTransaction();
String queryString="Select bio_ref_id "+
" FROM regprc.reg_bio_ref where regprc.reg_bio_ref.reg_id= :regId ";
Query<String> query=session.createSQLQuery(queryString);
query.setParameter("regId", regId);
List<String> list=query.getResultList();
for(String id: list) {
refId=id;
}
return refId;

}

}
80 changes: 80 additions & 0 deletions automationtests/src/main/java/io/mosip/dbdto/AbisDeleteDto.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package io.mosip.dbdto;

public class AbisDeleteDto {
private String irisThreshold;

private String request_type;

private String maxResults;

private String encounter_id;

private String faceThreshold;

private Long tid;

private String fingerThreshold;

@Override
public String toString() {
return "AbisDeleteDto [irisThreshold=" + irisThreshold + ", request_type=" + request_type + ", maxResults="
+ maxResults + ", encounter_id=" + encounter_id + ", faceThreshold=" + faceThreshold + ", tid="
+ tid + ", fingerThreshold=" + fingerThreshold + "]";
}

public String getIrisThreshold() {
return irisThreshold;
}

public void setIrisThreshold(String irisThreshold) {
this.irisThreshold = irisThreshold;
}

public String getRequest_type() {
return request_type;
}

public void setRequest_type(String request_type) {
this.request_type = request_type;
}

public String getMaxResults() {
return maxResults;
}

public void setMaxResults(String maxResults) {
this.maxResults = maxResults;
}

public String getEncounter_id() {
return encounter_id;
}

public void setEncounter_id(String encounter_id) {
this.encounter_id = encounter_id;
}

public String getFaceThreshold() {
return faceThreshold;
}

public void setFaceThreshold(String faceThreshold) {
this.faceThreshold = faceThreshold;
}

public Long getTid() {
return tid;
}

public void setTid(Long tid) {
this.tid = tid;
}

public String getFingerThreshold() {
return fingerThreshold;
}

public void setFingerThreshold(String fingerThreshold) {
this.fingerThreshold = fingerThreshold;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public void createAppDiscardUploadDoc() {
response = lib.documentUpload(response,individualToken);

String errMessage = lib.getErrorMessage(response);
lib.compareValues(errMessage, "Demographic record failed to fetch expected");
lib.compareValues(errMessage, "Demographic record failed to fetch");

}

Expand Down Expand Up @@ -985,7 +985,7 @@ public void uploadDocumentForDiscardedApplication() {
Response documentResponse = lib.documentUpload(createResponse,individualToken);
String errorCode = documentResponse.jsonPath().get("errors[0].errorCode").toString();
String message = documentResponse.jsonPath().get("errors[0].message").toString();
lib.compareValues(message, "Demographic record failed to fetch expected");
lib.compareValues(message, "Demographic record failed to fetch");
lib.compareValues(errorCode, "PRG_PAM_DOC_020");

}
Expand Down Expand Up @@ -1459,7 +1459,7 @@ public void delDocByDocIdForDiscardedApplication() {
String docId = uploadDoc.jsonPath().get("response.docId").toString();
Response discardApp = lib.discardApplication(preRegID, individualToken);
Response delDocumentByDocId = lib.deleteAllDocumentByDocId(docId, preRegID, individualToken);
lib.compareValues(lib.getErrorCode(delDocumentByDocId), "PRG_PAM_DOC_020 ");
lib.compareValues(lib.getErrorCode(delDocumentByDocId), "PRG_PAM_DOC_020");
lib.compareValues(lib.getErrorMessage(delDocumentByDocId),
"Demographic record failed to fetch");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.Properties;

import org.json.simple.parser.ParseException;
import org.junit.Assert;
import org.testng.ITest;
import org.testng.ITestContext;
import org.testng.ITestResult;
Expand Down Expand Up @@ -181,27 +182,33 @@ public void packetValidatorStage(File[] listOfInvpackets) {
}
}
}

try {
Thread.sleep(3000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
dbList=transaction.readStatus(regID);
regID="";
logger.info("User list :: "+ userList);
logger.info("Db list :: "+ dbList);
boolean listStatus=false;
for(int i=0;i<3;i++) {
for(int i=0;i<dbList.size();i++) {
if(dbList .get(i).equals("ERROR"))
dbList.add(i, "FAILED");

}
for(int i=0;i<3;i++) {
for(int i=0;i<dbList.size();i++) {
if(dbList.get(i).equals(userList.get(i)))
listStatus=true;
else
listStatus=false;
}
softAssert.assertTrue(listStatus);
//softAssert.assertTrue(listStatus);
Assert.assertTrue(listStatus);
userList.clear();
dbList.clear();
softAssert.assertAll();
//softAssert.assertAll();
//cleanUp.prepareQueryList(regID);
regID="";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,26 @@
import static io.restassured.RestAssured.given;

import java.io.File;
import java.sql.Time;
import java.text.SimpleDateFormat;
import java.time.Clock;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.ws.rs.core.MediaType;

import org.apache.hadoop.yarn.webapp.hamlet.HamletSpec.MAP;
import org.apache.log4j.Logger;
import org.json.simple.JSONObject;

import com.fasterxml.jackson.databind.ObjectMapper;

import io.mosip.dbaccess.RegProcTransactionDb;
import io.mosip.dbdto.AbisDeleteDto;
import io.mosip.service.BaseTestCase;
import io.mosip.testrunner.MosipTestRunner;
import io.restassured.http.Cookie;
Expand Down Expand Up @@ -258,4 +267,28 @@ public Object getCurrentTime() {


}
}
public JSONObject getAbisDeleteRequest(String rid) {
RegProcTransactionDb transaction=new RegProcTransactionDb();
Date date=new Date();
AbisDeleteDto deleteDto=new AbisDeleteDto();
deleteDto.setEncounter_id(transaction.getRef_Id(rid));
deleteDto.setTid(date.getTime());
deleteDto.setFaceThreshold("0.0");
deleteDto.setFingerThreshold("0.0");
deleteDto.setMaxResults("0");
deleteDto.setIrisThreshold("0.0");
deleteDto.setRequest_type("Delete");
JSONObject deleteRequest=new JSONObject();
ObjectMapper mapper=new ObjectMapper();
Map deleteMap=mapper.convertValue(deleteDto, Map.class);
deleteRequest.putAll(deleteMap);
return deleteRequest;

}
public void deleteFromAbis(JSONObject deleteRequest) {
String url="https://qa.mosip.io/T5CloudService/1.0/processRequest";
Response getResponse = given().relaxedHTTPSValidation().body(deleteRequest).contentType(MediaType.APPLICATION_JSON).log()
.all().when().post(url);
System.out.println(getResponse.asString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ testdata:
otpReq.phone: PHONE
otpReq.requestTime: $TIMESTAMP$
otpReq.transactionID: $RANDOM:N:10$
otpReq.version: $TestData:id_version_invalid$
otpReq.version: $version$
input.otp-auth-request:
AuthReq.individualId: $input.otp-generate:otpReq.individualId$
AuthReq.requestTime: $TIMESTAMP$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ testdata:
output.output-1-expected-y-res:
output.1.y.res.resTime: $TIMESTAMP$
output.1.y.res.txnID: $input.otp-generate-request:otpReq.transactionID$
output.1.y.res.maskedEmail: $REGEXP:XX.*XX.*$
output.1.y.res.maskedEmail: $REGEXP:.*X.*$
output.1.y.res.maskedMobile: $REGEXP:XX.*XX.*$
output.1.y.res.id: $TestData:id_internal_otp_valid$
#output.1.y.res.ver: $version$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ testdata:

InternalAuthentication_unlockUIN_for_bio_Face_Pos:
input.request:
individualId: $UIN.bio.FID.true$
individualId: $UIN.bio.FACE.true$
individualIdType: $TestData:indvId_Uin_valid$
authTyperequest: bio
authSubTyperequest: $TestData:bio_face_type$
Expand All @@ -109,7 +109,7 @@ testdata:

InternalAuthentication_UnlockVID_for_bio_Face_Pos:
input.request:
individualId: $VID.bio.FID.true$
individualId: $VID.bio.FACE.true$
individualIdType: $TestData:indvId_Vid_valid$
authTyperequest: bio
authSubTyperequest: $TestData:bio_face_type$
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#Wed Nov 13 15:14:16 IST 2019
VID.bio.IIR.true=3493018978513840
UIN.bio.IIR.true=5097231084
UIN.demo.true=3602780923
VID.demo.true=3493018978513840
VID.otp.true=5315921763875420
VID.bio.FIR.true=6427198390761250
VID.bio.FACE.true=2158043628148637
UIN.otp.true=5097231084
UIN.bio.FIR.true=3602780923
UIN.bio.FACE.true=4580610541
#Tue Dec 10 15:41:24 IST 2019
VID.bio.IIR.true=3691684639478379
UIN.bio.IIR.true=2549530793
UIN.demo.true=6194165205
VID.demo.true=2793295043053173
VID.otp.true=2819657927340762
VID.bio.FIR.true=6081270289649035
VID.bio.FACE.true=3691684639478379
UIN.otp.true=2836817908
UIN.bio.FIR.true=5816274852
UIN.bio.FACE.true=3902754670
Loading

0 comments on commit f43f431

Please sign in to comment.