Skip to content

Commit

Permalink
MOSIP-28575
Browse files Browse the repository at this point in the history
Signed-off-by: Jayesh Kharode <[email protected]>
  • Loading branch information
Jayesh Kharode committed Dec 4, 2023
1 parent 35cfa33 commit 71ef9a1
Show file tree
Hide file tree
Showing 45 changed files with 160 additions and 152 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public void run() throws RigInternalError, FeatureNotSupportedError {
transactionId1 = (String) step.getScenario().getOidcClientProp().get("transactionId1");
// transactionId1 = step.getParameters().get(3);
// transactionId1 = step.getScenario().getVariables().get(transactionId1);
System.out.println(transactionId1);
logger.info(transactionId1);

}

Expand All @@ -124,7 +124,7 @@ public void run() throws RigInternalError, FeatureNotSupportedError {
transactionId2 = (String) step.getScenario().getOidcClientProp().get("transactionId2");
// transactionId2 = step.getParameters().get(5);
// transactionId2 = step.getScenario().getVariables().get(transactionId2);
System.out.println(transactionId2);
logger.info(transactionId2);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public void checkStatus(String status_param) throws RigInternalError {
assertTrue(false, "Testcase is failed");
}
else {
System.out.println("tempPridAndRid is Null");
logger.info("tempPridAndRid is Null");
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void run() throws RigInternalError {
if (_rid.startsWith("$$")) {
_rid = step.getScenario().getVariables().get(_rid); // 11000000101010101000000000
if (_rid == null)
System.out.println("neeha");
logger.info("RID is null");
if (tempPridAndRid == null) {
tempPridAndRid = new HashMap<>();
tempPridAndRid.put("rid", _rid); // 11000000101010101000000000
Expand Down Expand Up @@ -92,7 +92,7 @@ public void checkStatus(String _ridStatusParam, String _expectedRidProcessed, Sc
logger.info(this.getClass().getSimpleName() + " starts at..." + startTime + " MilliSec");
logger.info(this.getClass().getSimpleName() + " Rid :" + rid);
if (rid == null)
System.out.println("NEeha");
logger.info("RID is null");
Response response = getRequest(baseUrl + getRidStatusUrl + rid, "Check rid status: " + rid, step);
long stopTime = System.currentTimeMillis();
long elapsedTime = stopTime - startTime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void run() throws RigInternalError {
File source = new File(originalPersonaPath);
try {
Map<String,Object> root = mapper.readValue(source, Map.class);
System.out.println(root);
logger.info(root);
Map<String, String> jsonNamefirstlang = (Map<String, String>) root.get("name");

Map<String, String> jsonNameseclang = (Map<String, String>) root.get("name_seclang");
Expand All @@ -73,7 +73,7 @@ public void run() throws RigInternalError {
String serializedJsonString = mapper.writeValueAsString(root);
file.write(serializedJsonString);
file.flush();
System.out.println("Successfully updated json object to file...!!");
logger.info("Successfully updated json object to file...!!");
}
} catch (JsonParseException e) {
logger.error(e.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private JSONArray buildMockRequest(String personaPath, boolean duplicate, List<S
String _hashValue = step.getParameters().get(5);
if (_hashValue.startsWith("$$"))
_hashValue = step.getScenario().getVariables().get(_hashValue);
System.out.println(_hashValue);
logger.info(_hashValue);
String[] keyValue = _hashValue.split(",");
if (keyValue != null) {
for (String s : keyValue) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void run() throws RigInternalError {
map.put("preRegistrationId", prid);
//Response response =deleteRequestWithoutStep(url, "Discard booking");
Response response =deleteRequest(url, "Discard booking",step);
System.out.println(response.toString());
logger.info(response.toString());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void run() throws RigInternalError, FeatureNotSupportedError {
throw new RigInternalError("transactionId paramter is missing in step: " + step.getName());
} else {
transactionId1 = (String) step.getScenario().getOidcClientProp().get("transactionId1");
System.out.println(transactionId1);
logger.info(transactionId1);

}

Expand All @@ -89,7 +89,7 @@ public void run() throws RigInternalError, FeatureNotSupportedError {
"transactionId parameter is missingctionId paramter is missing in step: " + step.getName());
} else {
transactionId2 = (String) step.getScenario().getOidcClientProp().get("transactionId2");
System.out.println(transactionId2);
logger.info(transactionId2);

}
if (step.getParameters().size() == 6 && step.getParameters().get(1).startsWith("$$")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ public void run() throws RigInternalError {
partnerKeyUrl= PartnerRegistration.partnerKeyUrl;
String uriParts[] = PartnerRegistration.partnerKeyUrl.split("/");
partnerId = uriParts[uriParts.length - 2];
System.out.println(partnerKeyUrl);
logger.info(partnerKeyUrl);
BaseTestCaseUtil.partnerKeyUrl=partnerKeyUrl;
System.out.println(partnerKeyUrl);
logger.info(partnerKeyUrl);


}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public void run() throws RigInternalError {
else
step.getScenario().getVidPersonaProp().put(vid, uin);

System.out.println(step.getScenario().getVidPersonaProp());
logger.info(step.getScenario().getVidPersonaProp());
}

} catch (AuthenticationTestException | AdminTestException e) {
Expand Down Expand Up @@ -144,7 +144,7 @@ public void run() throws RigInternalError {
else
step.getScenario().getVidPersonaProp().put(vid, uin);

System.out.println(step.getScenario().getVidPersonaProp());
logger.info(step.getScenario().getVidPersonaProp());
}

} catch (AuthenticationTestException | AdminTestException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void run() throws RigInternalError {
else
step.getScenario().getVidPersonaProp().put(vid, uin);

System.out.println(step.getScenario().getVidPersonaProp());
logger.info(step.getScenario().getVidPersonaProp());
}

} catch (AuthenticationTestException | AdminTestException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void run() throws RigInternalError {
}
if (step.getOutVarName() != null) {
step.getScenario().getVariables().put(step.getOutVarName(), modalityHashValueMap.toString());
System.out.println(step.getScenario().getVariables().get(modalityHashValueMap.toString()));
logger.info(step.getScenario().getVariables().get(modalityHashValueMap.toString()));
} else {
hashtable.put(personaId, modalityHashValueMap);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,16 +376,16 @@ private TestCaseDTO bioAuthE2eTest(List<String> bioAuthList, String uin, TestCas
}

multiFactorResponse = packetUtility.retrieveBiometric(personFilePathvalue, modalityList,step);
System.out.println("saddjha");
logger.info("saddjha");
if (multiFactorResponse != null && !multiFactorResponse.isEmpty() && modalityKeyTogetBioValue != null) {
String bioValue = JsonPrecondtion.getValueFromJson(multiFactorResponse, modalityKeyTogetBioValue);
byte[] decodedBioMetricValue = Base64.getUrlDecoder().decode(bioValue);
bioValue = Base64.getEncoder().encodeToString(decodedBioMetricValue);
test = bioAuth(modalityToLog, bioValue, uin, deviceProp, test, this.bioAuth);
System.out.println(test);
logger.info(test);
}
}
System.out.println(test);
logger.info(test);
return test;

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void run() throws RigInternalError, FeatureNotSupportedError {
else {
clientId = step.getParameters().get(0);
}
System.out.println(clientId);
logger.info(clientId);
}

String input = test.getInput();
Expand Down Expand Up @@ -91,7 +91,7 @@ public void run() throws RigInternalError, FeatureNotSupportedError {
byte[] hash = digest.digest(responseJsonString.getBytes(StandardCharsets.UTF_8));
String urlEncodedResp = Base64.getUrlEncoder().withoutPadding().encodeToString(hash);
step.getScenario().getOidcClientProp().put("urlEncodedResp1", urlEncodedResp);
System.out.println(step.getScenario().getOidcClientProp());
logger.info(step.getScenario().getOidcClientProp());
} else if (step.getParameters().get(1).contains("transactionId2")) {

step.getScenario().getOidcClientProp().put("transactionId2", transactionId); // "$$clientId=e2e_OidcClient()"
Expand All @@ -103,7 +103,7 @@ public void run() throws RigInternalError, FeatureNotSupportedError {
byte[] hash = digest.digest(responseJsonString.getBytes(StandardCharsets.UTF_8));
String urlEncodedResp = Base64.getUrlEncoder().withoutPadding().encodeToString(hash);
step.getScenario().getOidcClientProp().put("urlEncodedResp2", urlEncodedResp);
System.out.println(step.getScenario().getOidcClientProp());
logger.info(step.getScenario().getOidcClientProp());

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void run() throws RigInternalError, FeatureNotSupportedError {
step.getScenario().getOidcPmsProp().put("name", name);
step.getScenario().getOidcPmsProp().put("policygroupId", policygroupId);

System.out.println(name);
logger.info(name);
}

} catch (AuthenticationTestException | AdminTestException e) {
Expand Down Expand Up @@ -125,7 +125,7 @@ public void run() throws RigInternalError, FeatureNotSupportedError {
policyName = jsonResp.getJSONObject("response").getString("name");
step.getScenario().getOidcPmsProp().put("policyId", policyId); // "$$clientId=e2e_OidcClient()"

System.out.println(policyId);
logger.info(policyId);
}

} catch (AuthenticationTestException | AdminTestException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void run() {
String resFilePath = obj.get("path").toString();
step.getScenario().getResidentTemplatePaths().put(resFilePath, null);
}
System.out.println("RESIDENTTEMPLATEPATHS: " + step.getScenario().getResidentTemplatePaths());
logger.info("RESIDENTTEMPLATEPATHS: " + step.getScenario().getResidentTemplatePaths());

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,19 @@ public void run() throws RigInternalError, FeatureNotSupportedError {
if (idType.contains("VID") || idType.contains("vid")) {
transactionId2 = (String) step.getScenario().getOidcClientProp().get("transactionId2");
urlEncodedResp2 = (String) step.getScenario().getOidcClientProp().get("urlEncodedResp2");
System.out.println(transactionId2);
logger.info(transactionId2);
}

else if (idType.contains("UIN") || idType.contains("uin")) {
transactionId1 = (String) step.getScenario().getOidcClientProp().get("transactionId1");
urlEncodedResp1 = (String) step.getScenario().getOidcClientProp().get("urlEncodedResp1");
System.out.println(transactionId1);
logger.info(transactionId1);
}

else {

transactionId2 = (String) step.getScenario().getOidcClientProp().get("transactionId2");
System.out.println(transactionId2);
logger.info(transactionId2);

}

Expand Down Expand Up @@ -176,12 +176,12 @@ else if (idType.contains("UIN") || idType.contains("uin")) {

String oidcJWKKeyString = oidcJwkKey;
// String oidcJWKKeyString = props.getProperty("privateKey");
System.out.println("oidcJWKKeyString =" + oidcJWKKeyString);
logger.info("oidcJWKKeyString =" + oidcJWKKeyString);
RSAKey oidcJWKKey1;
try {
oidcJWKKey1 = RSAKey.parse(oidcJWKKeyString);
data = PacketUtility.signJWKKey(clientId, oidcJWKKey1);
System.out.println("oidcJWKKey1 =" + oidcJWKKey1);
logger.info("oidcJWKKey1 =" + oidcJWKKey1);
} catch (java.text.ParseException e) {
logger.error(e.getMessage());
}
Expand All @@ -201,7 +201,7 @@ else if (idType.contains("UIN") || idType.contains("uin")) {
if (response != null) {
JSONObject jsonResp = new JSONObject(response.getBody().asString());
esignetAccessToken = jsonResp.get("access_token").toString();
System.out.println(jsonResp.toString());
logger.info(jsonResp.toString());
}

// User Info API CALL //
Expand All @@ -217,7 +217,7 @@ else if (idType.contains("UIN") || idType.contains("uin")) {
getUserInfo.test(testGetUserInfo);

Response response2 = getUserInfo.response;
System.out.println(response2.toString());
logger.info(response2.toString());

} catch (AuthenticationTestException | AdminTestException e) {
this.hasError = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private static void writeJSONArrayToFile(JSONArray jsonArray, String filePath) {
// Convert the JSONArray to a string and write it to the file
String jsonString = jsonArray.toString();
fileWriter.write(jsonString);
System.out.println("JSONArray has been written to the file.");
logger.info("JSONArray has been written to the file.");
} catch (IOException e) {
logger.error(e.getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
import java.net.http.WebSocket;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.CountDownLatch;

import org.apache.log4j.Logger;

public class Main {
public static Logger logger = Logger.getLogger(Main.class);
public static void main(String[] args) throws Exception {
CountDownLatch latch = new CountDownLatch(10);

Expand All @@ -25,13 +27,13 @@ private static class WebSocketClient implements WebSocket.Listener {

@Override
public void onOpen(WebSocket webSocket) {
System.out.println("onOpen using subprotocol " + webSocket.getSubprotocol());
logger.info("onOpen using subprotocol " + webSocket.getSubprotocol());
WebSocket.Listener.super.onOpen(webSocket);
}

@Override
public CompletionStage<?> onText(WebSocket webSocket, CharSequence data, boolean last) {
System.out.println("onText received " + data);
logger.info("onText received " + data);


latch.countDown();
Expand All @@ -40,7 +42,7 @@ public CompletionStage<?> onText(WebSocket webSocket, CharSequence data, boolean

@Override
public void onError(WebSocket webSocket, Throwable error) {
System.out.println("Bad day! " + webSocket.toString());
logger.info("Bad day! " + webSocket.toString());
WebSocket.Listener.super.onError(webSocket, error);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;
import org.joda.time.DateTime;

import com.amazonaws.ClientConfiguration;
Expand All @@ -20,7 +21,7 @@
import io.mosip.testrig.apirig.kernel.util.ConfigManager;

public class S3Adapter {

public static Logger logger = Logger.getLogger(S3Adapter.class);
private AmazonS3 connection = null;

private int maxRetry = 20;
Expand All @@ -39,10 +40,10 @@ private AmazonS3 getConnection(String bucketName) {
if (connection != null)
return connection;

System.out.println("ConfigManager.getS3UserKey() :: "+ConfigManager.getS3UserKey());
System.out.println("ConfigManager.getS3Host() :: "+ConfigManager.getS3Host());
System.out.println("ConfigManager.getS3Region() :: "+ConfigManager.getS3Region());
System.out.println("ConfigManager.getS3SecretKey() :: "+ConfigManager.getS3SecretKey());
logger.info("ConfigManager.getS3UserKey() :: "+ConfigManager.getS3UserKey());
logger.info("ConfigManager.getS3Host() :: "+ConfigManager.getS3Host());
logger.info("ConfigManager.getS3Region() :: "+ConfigManager.getS3Region());
logger.info("ConfigManager.getS3SecretKey() :: "+ConfigManager.getS3SecretKey());
try {
AWSCredentials awsCredentials = new BasicAWSCredentials(ConfigManager.getS3UserKey(),
ConfigManager.getS3SecretKey());
Expand Down Expand Up @@ -77,11 +78,11 @@ private AmazonS3 getConnection(String bucketName) {
* public boolean putObject(String account, final String container, String
* source, String process, String objectName, File file) { String
* finalObjectName = null; String bucketName = null;
* System.out.println("useAccountAsBucketname:: "+useAccountAsBucketname); if
*logger.info("useAccountAsBucketname:: "+useAccountAsBucketname); if
* (useAccountAsBucketname) { finalObjectName = getName(container, source,
* process, objectName); bucketName = account; } else { finalObjectName =
* getName(source, process, objectName); bucketName = container; }
* System.out.println("bucketName :: "+bucketName); AmazonS3 connection =
*logger.info("bucketName :: "+bucketName); AmazonS3 connection =
* getConnection(bucketName); if (!doesBucketExists(bucketName)) {
* connection.createBucket(bucketName); if (useAccountAsBucketname)
* existingBuckets.add(bucketName); }
Expand All @@ -92,15 +93,15 @@ private AmazonS3 getConnection(String bucketName) {
public boolean putObject(String account, final String container, String source, String process, String objectName, File file) {
String finalObjectName = null;
String bucketName = null;
System.out.println("useAccountAsBucketname:: "+useAccountAsBucketname);
logger.info("useAccountAsBucketname:: "+useAccountAsBucketname);
if (useAccountAsBucketname) {
finalObjectName = getName(container, source, process, objectName);
bucketName = account;
} else {
finalObjectName = getName(source, process, objectName);
bucketName = container;
}
System.out.println("bucketName :: "+bucketName);
logger.info("bucketName :: "+bucketName);
AmazonS3 connection = getConnection(bucketName);
if (!doesBucketExists(bucketName)) {
connection.createBucket(bucketName);
Expand Down Expand Up @@ -133,7 +134,7 @@ else if (useAccountAsBucketname && !existingBuckets.contains(bucketName)) {
/*
* public boolean reportRetentionPolicy(String bucketName) {
*
* ObjectMetadata metadata = new ObjectMetadata(); System.out.println("size:" +
* ObjectMetadata metadata = new ObjectMetadata();logger.info("size:" +
* bytes.length); metadata.setContentLength(bytes.length);
* metadata.setContentType(contentType); Date expirationTime = new Date(2025, 5,
* 10); metadata.setExpirationTime(DateTime.now().toDate());
Expand Down
Loading

0 comments on commit 71ef9a1

Please sign in to comment.