diff --git a/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/BioEsignetAuthentication.java b/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/BioEsignetAuthentication.java index c22867bd0..fb1bdeccc 100644 --- a/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/BioEsignetAuthentication.java +++ b/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/BioEsignetAuthentication.java @@ -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); } @@ -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); } diff --git a/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/CheckMultipleRidStatus.java b/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/CheckMultipleRidStatus.java index 3a67b308c..e5e9629a9 100644 --- a/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/CheckMultipleRidStatus.java +++ b/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/CheckMultipleRidStatus.java @@ -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"); } diff --git a/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/CheckStatus.java b/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/CheckStatus.java index ef90db2bb..e36d5528c 100644 --- a/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/CheckStatus.java +++ b/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/CheckStatus.java @@ -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 @@ -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; diff --git a/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/ClonePersonaAndUpdate.java b/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/ClonePersonaAndUpdate.java index 2ce1b655d..17579112e 100644 --- a/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/ClonePersonaAndUpdate.java +++ b/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/ClonePersonaAndUpdate.java @@ -47,7 +47,7 @@ public void run() throws RigInternalError { File source = new File(originalPersonaPath); try { Map root = mapper.readValue(source, Map.class); - System.out.println(root); + logger.info(root); Map jsonNamefirstlang = (Map) root.get("name"); Map jsonNameseclang = (Map) root.get("name_seclang"); @@ -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()); diff --git a/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/ConfigureMockAbis.java b/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/ConfigureMockAbis.java index 7ec497bfa..c7cd97706 100644 --- a/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/ConfigureMockAbis.java +++ b/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/ConfigureMockAbis.java @@ -126,7 +126,7 @@ private JSONArray buildMockRequest(String personaPath, boolean duplicate, List 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; } diff --git a/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/OAuthDetailsRequest.java b/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/OAuthDetailsRequest.java index eb5f54cc8..dc8a0cda2 100644 --- a/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/OAuthDetailsRequest.java +++ b/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/OAuthDetailsRequest.java @@ -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(); @@ -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()" @@ -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()); } diff --git a/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/OidcClient.java b/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/OidcClient.java index 912dfd094..73953c828 100644 --- a/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/OidcClient.java +++ b/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/OidcClient.java @@ -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) { @@ -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) { diff --git a/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/OldGetResidentData.java b/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/OldGetResidentData.java index dafa5e2eb..00aa318db 100644 --- a/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/OldGetResidentData.java +++ b/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/OldGetResidentData.java @@ -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()); } } diff --git a/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/UserInfo.java b/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/UserInfo.java index a9307a1e4..3aadd5a4e 100644 --- a/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/UserInfo.java +++ b/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/UserInfo.java @@ -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); } @@ -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()); } @@ -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 // @@ -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; diff --git a/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/WritePersonaData.java b/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/WritePersonaData.java index 09cec42a4..463f274b9 100644 --- a/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/WritePersonaData.java +++ b/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/WritePersonaData.java @@ -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()); } diff --git a/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/orchestrator/Main.java b/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/orchestrator/Main.java index 349ad9d67..57f48ded2 100644 --- a/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/orchestrator/Main.java +++ b/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/orchestrator/Main.java @@ -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); @@ -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(); @@ -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); } } diff --git a/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/orchestrator/S3Adapter.java b/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/orchestrator/S3Adapter.java index 1956836a1..d43139c85 100644 --- a/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/orchestrator/S3Adapter.java +++ b/mosip-acceptance-tests/ivv-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/orchestrator/S3Adapter.java @@ -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; @@ -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; @@ -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()); @@ -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); } @@ -92,7 +93,7 @@ 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; @@ -100,7 +101,7 @@ public boolean putObject(String account, final String container, String source, 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); @@ -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()); diff --git a/mosip-packet-creator/.mvn/wrapper/MavenWrapperDownloader.java b/mosip-packet-creator/.mvn/wrapper/MavenWrapperDownloader.java index 7cb3a1336..5cf472b38 100644 --- a/mosip-packet-creator/.mvn/wrapper/MavenWrapperDownloader.java +++ b/mosip-packet-creator/.mvn/wrapper/MavenWrapperDownloader.java @@ -46,9 +46,9 @@ public class MavenWrapperDownloader { private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; public static void main(String args[]) { - System.out.println("- Downloader started"); + logger.info("- Downloader started"); File baseDirectory = new File(args[0]); - System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + logger.info("- Using base directory: " + baseDirectory.getAbsolutePath()); // If the maven-wrapper.properties exists, read it and check if it contains a custom // wrapperUrl parameter. @@ -62,7 +62,7 @@ public static void main(String args[]) { mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); } catch (IOException e) { - System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + logger.info("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); } finally { try { if(mavenWrapperPropertyFileInputStream != null) { @@ -73,22 +73,22 @@ public static void main(String args[]) { } } } - System.out.println("- Downloading from: " + url); + logger.info("- Downloading from: " + url); File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); if(!outputFile.getParentFile().exists()) { if(!outputFile.getParentFile().mkdirs()) { - System.out.println( + logger.info( "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); } } - System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + logger.info("- Downloading to: " + outputFile.getAbsolutePath()); try { downloadFileFromURL(url, outputFile); - System.out.println("Done"); + logger.info("Done"); System.exit(0); } catch (Throwable e) { - System.out.println("- Error downloading"); + logger.info("- Error downloading"); logger.error(e.getMessage()); System.exit(1); } diff --git a/mosip-packet-creator/src/main/java/io/mosip/testrig/dslrig/packetcreator/config/SecurityConfiguration.java b/mosip-packet-creator/src/main/java/io/mosip/testrig/dslrig/packetcreator/config/SecurityConfiguration.java index c6510f21b..acee8c776 100644 --- a/mosip-packet-creator/src/main/java/io/mosip/testrig/dslrig/packetcreator/config/SecurityConfiguration.java +++ b/mosip-packet-creator/src/main/java/io/mosip/testrig/dslrig/packetcreator/config/SecurityConfiguration.java @@ -26,8 +26,8 @@ public AuthenticationManager authenticationManagerBean() throws Exception { protected void configure(HttpSecurity httpSecurity) throws Exception { //httpSecurity.anonymous(); // httpSecurity.authorizeRequests().antMatchers("/").permitAll().and().anonymous(); - // httpSecurity.authorizeRequests().antMatchers("/delete/**").authenticated().and().httpBasic().and().csrf().disable(); - httpSecurity.csrf().disable(); + httpSecurity.authorizeRequests().antMatchers("/delete/**").authenticated().and().httpBasic().and().csrf().disable(); + // httpSecurity.csrf().disable(); } @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { diff --git a/mosip-packet-creator/src/main/java/io/mosip/testrig/dslrig/packetcreator/service/APIRequestUtil.java b/mosip-packet-creator/src/main/java/io/mosip/testrig/dslrig/packetcreator/service/APIRequestUtil.java index 328843201..941c5aba4 100644 --- a/mosip-packet-creator/src/main/java/io/mosip/testrig/dslrig/packetcreator/service/APIRequestUtil.java +++ b/mosip-packet-creator/src/main/java/io/mosip/testrig/dslrig/packetcreator/service/APIRequestUtil.java @@ -127,7 +127,7 @@ public void clearToken() { } public JSONObject get(String baseUrl,String url, JSONObject requestParams, JSONObject pathParam,String contextKey) throws Exception { this.baseUrl = baseUrl; - System.out.println(url); + logger.info(url); if (!isValidToken(contextKey)){ initToken(contextKey); } @@ -157,7 +157,7 @@ public JSONObject get(String baseUrl,String url, JSONObject requestParams, JSONO } public JSONObject getJsonObject(String baseUrl,String url, JSONObject requestParams, JSONObject pathParam,String contextKey) throws Exception { this.baseUrl = baseUrl; - System.out.println(url); + logger.info(url); if (!isValidToken(contextKey)){ initToken(contextKey); } diff --git a/mosip-packet-creator/src/main/java/io/mosip/testrig/dslrig/packetcreator/service/CommandsService.java b/mosip-packet-creator/src/main/java/io/mosip/testrig/dslrig/packetcreator/service/CommandsService.java index bae8b5c72..1de9b4921 100644 --- a/mosip-packet-creator/src/main/java/io/mosip/testrig/dslrig/packetcreator/service/CommandsService.java +++ b/mosip-packet-creator/src/main/java/io/mosip/testrig/dslrig/packetcreator/service/CommandsService.java @@ -223,7 +223,7 @@ public String generatekey(String contextKey,String machineId) { } private static void createKeyFile(final String fileName, final byte[] key) { - System.out.println("Creating file : " + fileName); + logger.info("Creating file : " + fileName); try { Throwable t = null; try { diff --git a/mosip-packet-creator/src/main/java/io/mosip/testrig/dslrig/packetcreator/service/ContextUtils.java b/mosip-packet-creator/src/main/java/io/mosip/testrig/dslrig/packetcreator/service/ContextUtils.java index d6339f08e..beb631294 100644 --- a/mosip-packet-creator/src/main/java/io/mosip/testrig/dslrig/packetcreator/service/ContextUtils.java +++ b/mosip-packet-creator/src/main/java/io/mosip/testrig/dslrig/packetcreator/service/ContextUtils.java @@ -33,7 +33,7 @@ public class ContextUtils { @Value("${mosip.test.persona.configpath}") private String personaConfigPath; - Logger logger = LoggerFactory.getLogger(ContextUtils.class); + static Logger logger = LoggerFactory.getLogger(ContextUtils.class); public Properties loadServerContext(String ctxName) { String filePath = personaConfigPath + "/server.context." + ctxName + ".properties"; @@ -167,7 +167,7 @@ public void generateKeyAndUpdateMachineDetail(Properties contextProperties, Stri + ".reg.key", keypair.getPrivate().getEncoded()); final String publicKey = java.util.Base64.getEncoder().encodeToString(keypair.getPublic().getEncoded()); - System.out.println("publicKey: " + publicKey); + logger.info("publicKey: " + publicKey); if (publicKey != null && !publicKey.isEmpty()) { List machines = null; String status = contextProperties.getProperty("machineStatus"); @@ -197,7 +197,7 @@ public void generateKeyAndUpdateMachineDetail(Properties contextProperties, Stri } private static void createKeyFile(final String fileName, final byte[] key) { - System.out.println("Creating file : " + fileName); + logger.info("Creating file : " + fileName); try (final FileOutputStream os = new FileOutputStream(fileName);) { Throwable t = null; try { diff --git a/mosip-packet-creator/src/main/java/io/mosip/testrig/dslrig/packetcreator/service/CryptoUtil.java b/mosip-packet-creator/src/main/java/io/mosip/testrig/dslrig/packetcreator/service/CryptoUtil.java index 3f19bfe5a..27c8266b8 100644 --- a/mosip-packet-creator/src/main/java/io/mosip/testrig/dslrig/packetcreator/service/CryptoUtil.java +++ b/mosip-packet-creator/src/main/java/io/mosip/testrig/dslrig/packetcreator/service/CryptoUtil.java @@ -449,7 +449,7 @@ private PrivateKey getMachinePrivateKey(String contextKey) throws Exception { //byte[] key = Files.readAllBytes(Path.of(KEY_PATH ,KEYS_DIR ,PRIVATE_KEY)); if(filePath==null ||filePath.isEmpty() ) throw new Exception("privatekey file not found"); - System.out.println("PRIVATEKEY FILE PATH::"+filePath); + logger.info("PRIVATEKEY FILE PATH::"+filePath); byte[] key = Files.readAllBytes(Path.of(filePath)); PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(key); KeyFactory kf = KeyFactory.getInstance("RSA"); diff --git a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/CSVHelper.java b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/CSVHelper.java index 928ca3d5b..814151262 100644 --- a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/CSVHelper.java +++ b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/CSVHelper.java @@ -114,24 +114,24 @@ public static void main(String[] args) { CSVHelper helper = new CSVHelper(VariableManager.getVariableValue("contextKey", "mountPath").toString() + VariableManager.getVariableValue("contextKey", "mosip.test.persona.namesdatapath").toString() + "/en/surnames.csv"); - System.out.println(helper.getRecordCount()); + logger.info(helper.getRecordCount()+""); helper.open(); List recs = helper.readRecords(new int[] { 0, 15, 10, 20, 12 }); for (String[] r : recs) { - System.out.println(CommonUtil.toCaptialize(r[0])); + logger.info(CommonUtil.toCaptialize(r[0])); } helper.close(); helper = new CSVHelper(VariableManager.getVariableValue("contextKey", "mountPath").toString() + VariableManager.getVariableValue("contextKey", "mosip.test.persona.namesdatapath").toString() + "/ara/boy_names.csv"); - System.out.println(helper.getRecordCount()); + logger.info(helper.getRecordCount()+""); helper.open(); recs = helper.readRecords(new int[] { 1, 15, 10, 20, 12 }); for (String[] r : recs) { - System.out.println(r[1]); + logger.info(r[1]); } helper.close(); } catch (IOException e) { diff --git a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/CountryProvider.java b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/CountryProvider.java index 3222cce13..d6757bc1d 100644 --- a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/CountryProvider.java +++ b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/CountryProvider.java @@ -156,11 +156,10 @@ public static void main(String[] args) { // } /* * c.load("IN"); CountryModel cm = c.getDetail(); - * System.out.println(cm.getObjectId() + " name:"+ cm.getName()); + * logger.info(cm.getObjectId() + " name:"+ cm.getName()); * * StateProvider stateProvider = new StateProvider(); stateProvider.load(cm); * List states = stateProvider.getDetail(); states.forEach((s) ->{ - * System.out.println(s.getName()); }); */ } } diff --git a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/PhotoProvider.java b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/PhotoProvider.java index a9d2c94fe..e4d6d3fa1 100644 --- a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/PhotoProvider.java +++ b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/PhotoProvider.java @@ -45,7 +45,7 @@ public boolean accept(File pathname) { }; File[] listDir = dir.listFiles(filter); int numberOfSubfolders = listDir.length; - System.out.println(listDir.length); + logger.info(listDir.length); int min = 1; int max = numberOfSubfolders; @@ -61,7 +61,7 @@ public boolean accept(File pathname) { // otherwise pick the impression of same of scenario number int impressionToPick = (currentScenarioNumber < numberOfSubfolders) ? currentScenarioNumber : randomNumber; - System.out.println("currentScenarioNumber=" + currentScenarioNumber + " numberOfSubfolders=" + logger.info("currentScenarioNumber=" + currentScenarioNumber + " numberOfSubfolders=" + numberOfSubfolders + " impressionToPick=" + impressionToPick); File file=new File(dirPath + String.format(Photo_File_Format, impressionToPick)); @@ -82,14 +82,14 @@ public boolean accept(File pathname) { else { img=ImageIO.read(file); - System.out.println("Image picked from this path="+ file); + logger.info("Image picked from this path="+ file); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); /*String [] names = ImageIO.getWriterFormatNames(); for(String s: names) - System.out.println(s); + logger.info(s); */ ImageIO.write(img, "jpg", baos); baos.flush(); @@ -195,7 +195,7 @@ public static void main(String [] args) throws IOException { //splitImages(); //byte[][] strImg = getPhoto(21,Gender.Male.name(),"contextKey"); //Files.write(strImg[0].getBytes(), new File( "c:\\temp\\photo.txt")); - //System.out.println(strImg); + //logger.info(strImg); } public static byte[][] loadPhoto(String faceFile) { diff --git a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/ResidentDataProvider.java b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/ResidentDataProvider.java index 0619daaba..ca369bba4 100644 --- a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/ResidentDataProvider.java +++ b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/ResidentDataProvider.java @@ -508,7 +508,7 @@ public static void main(String[] args) throws Exception { MDSClient cli = new MDSClient(0); for(ResidentModel r: lst) { - System.out.println(r.toJSONString()); + logger.info(r.toJSONString()); cli.createProfile("C:\\Mosip.io\\gitrepos\\mosip-mock-services\\MockMDS\\target\\Profile\\", "tst1", r,"contextKey","Registration"); diff --git a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/mds/MDSClient.java b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/mds/MDSClient.java index 9d689e66d..89f443377 100644 --- a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/mds/MDSClient.java +++ b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/mds/MDSClient.java @@ -122,7 +122,7 @@ public void createProfile(String profilePath,String profile, ResidentModel resid ///////// //reach cached finger prints from folder String dirPath = VariableManager.getVariableValue(contextKey,"mountPath").toString()+VariableManager.getVariableValue(contextKey,"mosip.test.persona.fingerprintdatapath").toString(); - System.out.println("createProfile dirPath " + dirPath); + logger.info("createProfile dirPath " + dirPath); Hashtable> tblFiles = new Hashtable>(); File dir = new File(dirPath); @@ -143,7 +143,7 @@ public void createProfile(String profilePath,String profile, ResidentModel resid // otherwise pick the impression of same of scenario number int impressionToPick = (currentScenarioNumber < numberOfSubfolders) ? currentScenarioNumber : randomNumber ; - System.out.println("createProfile currentScenarioNumber=" + currentScenarioNumber +" numberOfSubfolders=" + numberOfSubfolders + " impressionToPick=" + impressionToPick ); + logger.info("createProfile currentScenarioNumber=" + currentScenarioNumber +" numberOfSubfolders=" + numberOfSubfolders + " impressionToPick=" + impressionToPick ); List lst=new LinkedList(); for(int i=min; i <= max; i++) { @@ -153,7 +153,7 @@ public void createProfile(String profilePath,String profile, ResidentModel resid } List firstSet = tblFiles.get(impressionToPick); - System.out.println("createProfile Impression used "+ impressionToPick); + logger.info("createProfile Impression used "+ impressionToPick); /////////////// @@ -217,17 +217,17 @@ public void removeProfile(String profilePath,String profile,int port,String cont for(File file : files) { boolean isDeleted = file.delete(); if (!isDeleted) { - System.out.println("File Deleted successfully"); + logger.info("File Deleted successfully"); } isFileDeleted=file.delete(); if(!isFileDeleted) { - System.out.println("File Deleted successfully"); + logger.info("File Deleted successfully"); } } isProfDirDeleted=profDir.delete(); if(!isProfDirDeleted) { - System.out.println("File Deleted successfully"); + logger.info("File Deleted successfully"); } } @@ -240,14 +240,14 @@ public void setProfile(String profile,int port,String contextKey) { body.put("type", "Biometric Device"); try { - System.out.println("Inside Setprofile"); + logger.info("Inside Setprofile"); HttpRCapture capture = new HttpRCapture(url); capture.setMethod("POST"); String response = RestClient.rawHttp(capture, body.toString(),contextKey); JSONObject respObject = new JSONObject(response); }catch(Exception ex) { - System.out.println(ex.getMessage()); + logger.info(ex.getMessage()); logger.error(ex.getMessage()); } @@ -356,7 +356,7 @@ public MDSRCaptureModel captureFromRegDevice(MDSDevice device, HttpRCapture capture = new HttpRCapture(url); capture.setMethod("RCAPTURE"); String response = RestClient.rawHttp(capture, jsonReq.toString(),contextKey); - //System.out.println("MDS RESPONSE :"+ response); + //logger.info("MDS RESPONSE :"+ response); JSONObject respObject = new JSONObject(response); JSONArray bioArray = respObject.getJSONArray("biometrics"); List lstBiometrics = rCaptureModel.getLstBiometrics().get(type); @@ -447,7 +447,7 @@ public void setThresholdValue(String qualityScore) { .body(body.toString()) .post(url ); String resp = response.getBody().asString(); - System.out.println(resp); + logger.info(resp); } catch (Exception ex) { logger.error(ex.getMessage()); @@ -464,7 +464,7 @@ public static void main(String[] args) { //client.setProfile("Default",port); List d= client.getRegDeviceInfo("Iris"); d.forEach( dv-> { - System.out.println(dv.toJSONString()); + logger.info(dv.toJSONString()); }); @@ -472,18 +472,18 @@ public static void main(String[] args) { f.forEach( dv-> { - System.out.println(dv.toJSONString()); + logger.info(dv.toJSONString()); // MDSRCaptureModel r = client.captureFromRegDevice(dv, null, "Finger",null,60,"1",0); //MDSRCaptureModel r = client.captureFromRegDevice(d.get(0),null, "Iris",null,60,2); -// System.out.println( r.toJSONString()); +// logger.info( r.toJSONString()); }); //r = client.captureFromRegDevice(d.get(0),r, "Face",null,60,1); - //System.out.println( r.toJSONString()); + //logger.info( r.toJSONString()); } @Override diff --git a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/models/JWTTokenModel.java b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/models/JWTTokenModel.java index 5913333e3..30ea0efa3 100644 --- a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/models/JWTTokenModel.java +++ b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/models/JWTTokenModel.java @@ -3,11 +3,13 @@ import java.util.regex.Pattern; import org.json.JSONObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import lombok.Data; @Data public class JWTTokenModel { - + private static final Logger logger = LoggerFactory.getLogger(JWTTokenModel.class); //Map jsonHeader; // = new HashMap(); String jwtPayload; String jwtSign; @@ -15,7 +17,7 @@ public class JWTTokenModel { public static final String BIOMETRIC_SEPERATOR = "(?<=\\.)(.*)(?=\\.)"; public JWTTokenModel(String jwtToken) { - System.out.println(jwtToken); + logger.info(jwtToken); java.util.Base64.Decoder decoder = java.util.Base64.getUrlDecoder(); String[] parts = jwtToken.split("\\."); // split out the "parts" (header, payload and signature) @@ -45,6 +47,6 @@ public String toString() { public static void main(String[] args) { String jwtToken = ""; JWTTokenModel model = new JWTTokenModel(jwtToken); - System.out.println(model.toString()); + logger.info(model.toString()); } } diff --git a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/models/ResidentModel.java b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/models/ResidentModel.java index 273b7b68c..f089edfca 100644 --- a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/models/ResidentModel.java +++ b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/models/ResidentModel.java @@ -134,7 +134,7 @@ public static void main(String [] args) { Name name = new Name(); name.setFirstName("abcd ’'` efg"); model.setName(name); - System.out.println(model.toJSONString()); + logger.info(model.toJSONString()); try { Files.write(Paths.get("test.json"), model.toJSONString().getBytes()); @@ -147,7 +147,7 @@ public static void main(String [] args) { try { byte[] bytes = Files.readAllBytes(Paths.get("test.json")); ResidentModel m = mapper.readValue(model.toJSONString().getBytes(), ResidentModel.class); - System.out.println(m.getName().getFirstName()); + logger.info(m.getName().getFirstName()); } catch (IOException e) { logger.error(e.getMessage()); diff --git a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/preparation/MosipDataSetup.java b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/preparation/MosipDataSetup.java index f8e02859e..beb8a9aa5 100644 --- a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/preparation/MosipDataSetup.java +++ b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/preparation/MosipDataSetup.java @@ -204,7 +204,7 @@ public static void createRegCenterType(MosipRegistrationCenterTypeModel type,Str JSONObject resp = RestClient.post(url,jsonReqWrapper,contextKey); if(resp != null) { String r = resp.toString(); - System.out.println(r); + logger.info(r); } } catch (Exception e) { @@ -235,7 +235,7 @@ public static void createMachineType(MosipMachineTypeModel type,String contextKe JSONObject resp = RestClient.post(url,jsonReqWrapper,contextKey); if(resp != null) { String r = resp.toString(); - System.out.println(r); + logger.info(r); } } catch (Exception e) { @@ -324,7 +324,7 @@ public static void createMachineSpec(MosipMachineSpecModel spec,String contextKe JSONObject resp = RestClient.post(url,jsonReqWrapper,contextKey); if(resp != null) { String r = resp.toString(); - System.out.println(r); + logger.info(r); } } catch (Exception e) { logger.error(e.getMessage()); @@ -365,7 +365,7 @@ public static void createMachine(MosipMachineModel machine,String contextKey) { JSONObject resp = RestClient.post(url,jsonReqWrapper,contextKey); if(resp != null) { String r = resp.toString(); - System.out.println(r); + logger.info(r); } } catch (Exception e) { logger.error(e.getMessage()); @@ -412,7 +412,7 @@ public static void updateMachine(MosipMachineModel machine,String contextKey) { JSONObject resp = RestClient.put(url,jsonReqWrapper,contextKey); if(resp != null) { String r = resp.toString(); - System.out.println(r); + logger.info(r); } } catch (Exception e) { logger.error(e.getMessage()); @@ -435,7 +435,7 @@ public static String updatePreRegStatus(String preregId, String statusCode,Strin JSONObject resp = RestClient.putNoAuth(url, new JSONObject(),"prereg",contextKey); if (resp != null) { response = resp.getString("response"); - System.out.println(response); + logger.info(response); } } catch (Exception e) { logger.error(e.getMessage()); diff --git a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/preparation/MosipMasterData.java b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/preparation/MosipMasterData.java index 9f0962722..02ef6b306 100644 --- a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/preparation/MosipMasterData.java +++ b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/preparation/MosipMasterData.java @@ -250,7 +250,7 @@ public static LocationHierarchyModel[] getLocationHierarchy(String langCode,Stri try { JSONObject resp = RestClient.get(url+ langCode,new JSONObject() , new JSONObject(),contextKey); - // System.out.println(resp.toString()); + // logger.info(resp.toString()); if(resp != null) { JSONArray langArray = resp.getJSONArray("locationHierarchyLevels"); ObjectMapper objectMapper = new ObjectMapper(); @@ -473,7 +473,7 @@ public static Hashtable> getIDSchemaLatestVersion_de idSchema = resp.getJSONArray("schema"); String schemaJson = resp.getString("schemaJson"); - System.out.println(idSchema.toString()); + logger.info(idSchema.toString()); schemaVersion= resp.getDouble( "idVersion"); schemaTitle = resp.getString("title"); List listSchema = new ArrayList(); @@ -579,7 +579,7 @@ public static String getIDSchemaSchemaLatestVersion(String contextKey) { } public static void test1() { - System.out.println("Hello"); + logger.info("Hello"); } public static Hashtable getIDSchemaLatestVersion(String contextKey) { @@ -621,7 +621,7 @@ public static Hashtable getIDSchemaLatestVersion(String cont idSchema.putAll(screens.getJSONObject(i).getJSONArray("fields")); } - System.out.println(idSchema.toString()); + logger.info(idSchema.toString()); // CommonUtil.saveToTemp(idSchema.toString(), "uispec.json"); // CommonUtil.saveToTemp(resp.getString("schemaJson"), "schemaJson.json"); @@ -1284,13 +1284,13 @@ static void testSchemaRule(String contextKey) { List lstSchema = (List) schema.get( schemVersion).get("schemaList"); for( MosipIDSchema idschema:lstSchema ) { - //System.out.println(idschema.toJSONString()); + //logger.info(idschema.toJSONString()); List rule = idschema.getRequiredOn(); if(rule != null) { for(SchemaRule sr: rule) { - System.out.println("rule:" + sr); + logger.info("rule:" + sr); boolean bval = validateCondn(sr.getExpr(),r); - System.out.println("rule:result=" + bval); + logger.info("rule:result=" + bval); } } } @@ -1318,7 +1318,7 @@ public static JSONArray getUiSpecId(String contextKey) { array.put(identityJson.getString("id")); } } - System.out.println("printing Array : "+ array); + logger.info("printing Array : "+ array); setCache(url, array, contextKey); @@ -1349,21 +1349,21 @@ public static void main(String[] args) { Hashtable tbl1 = getIDSchemaLatestVersion(contextKey); double schemaId = tbl1.keys().nextElement(); - System.out.println(schemaId); + logger.info(schemaId); List lstSchema = (List) tbl1.get(schemaId).get("schemaList"); List reqdFields = (List) tbl1.get(schemaId).get("requiredAttributes"); List allg = MosipMasterData.getGenderTypes("eng",contextKey); allg.forEach( g-> { - System.out.println(g.getCode() +"\t" + g.getGenderName()); + logger.info(g.getCode() +"\t" + g.getGenderName()); }); testSchemaRule(contextKey); System.exit(1); ApplicationConfigIdSchema ss; try { ss = getPreregLocHierarchy("fra",1,contextKey); - System.out.println(ss.toJSONString()); + logger.info(ss.toJSONString()); } catch (Exception e) { logger.error(e.getMessage()); @@ -1373,7 +1373,7 @@ public static void main(String[] args) { //MosipPreRegLoginConfig c1 = MosipMasterData.getPreregLoginConfig(); //ApplicationConfigIdSchema idschma = MosipMasterData.getAppConfigIdSchema(); - //System.out.println(idschma.toJSONString()); + //logger.info(idschma.toJSONString()); @@ -1387,10 +1387,10 @@ public static void main(String[] args) { List bioTypes = getBiometricTypes(contextKey); for(MosipBiometricTypeModel bt: bioTypes) { - System.out.println(bt.toJSONString()); + logger.info(bt.toJSONString()); List bioAttrs = getBiometricAttrByTypes(bt.getCode(), bt.getLangCode(),contextKey); for(MosipBiometricAttributeModel bam: bioAttrs) { - System.out.println(bam.toJSONString()); + logger.info(bam.toJSONString()); } } @@ -1406,7 +1406,7 @@ public static void main(String[] args) { for(DynamicFieldModel dm: v) { - System.out.println(dm.getName() ); + logger.info(dm.getName() ); } @@ -1418,13 +1418,13 @@ public static void main(String[] args) { if(tbl != null) lst = (List) tbl.get( tbl.keys().nextElement()).get("schemaList"); lst.forEach( (sch)->{ - System.out.println(sch.getId() + " " + sch.getRequired()); + logger.info(sch.getId() + " " + sch.getRequired()); }); List langs = getConfiguredLanguages(contextKey); // getIDSchemaLatestVersion(); langs.forEach( (l) ->{ - System.out.println(l.getCode() + " "+ l.getName()); + logger.info(l.getCode() + " "+ l.getName()); //for(int level=0; level < 5; level++) //getRootLocations(l.getCode()); @@ -1441,7 +1441,7 @@ public static void main(String[] args) { for(int i=0; i < locHierachies.length; i++) { List list = getLocationsByLevel(locHierachies[i].getHierarchyLevelName(), contextKey); list.forEach((m) ->{ - System.out.println(m.getName()); + logger.info(m.getName()); }); } }); diff --git a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/test/CreatePersona.java b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/test/CreatePersona.java index 5b5772c9f..e2ec42230 100644 --- a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/test/CreatePersona.java +++ b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/test/CreatePersona.java @@ -340,7 +340,7 @@ public static JSONObject createIdentity(ResidentModel resident, DataCallback cb, JSONArray jsonArray = locaitonherirachyArray.getJSONArray(i); for (int j = 0; j < jsonArray.length(); j++) { String id = jsonArray.getString(j); - System.out.println(id); + logger.info(id); if (schemaItem.getId().toLowerCase().equals(id.toLowerCase())) { //String locLevel = (String) locationSet.toArray()[j]; @@ -556,7 +556,7 @@ public static JSONObject crateIdentityOld(ResidentModel resident) throws JSONExc Boolean bFound= false; for(MosipLocationModel locModel: locations) { - System.out.println("Schema.id="+ schema.getId() + "== locModel[" + locModel.getHierarchyLevel() + "]=" +locModel.getHierarchyName()); + logger.info("Schema.id="+ schema.getId() + "== locModel[" + locModel.getHierarchyLevel() + "]=" +locModel.getHierarchyName()); if(schema.getId().equalsIgnoreCase(locModel.getHierarchyName()) && schema.getRequired() ) { diff --git a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/test/ResidentPreRegistration.java b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/test/ResidentPreRegistration.java index f726cd66b..34038fe96 100644 --- a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/test/ResidentPreRegistration.java +++ b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/test/ResidentPreRegistration.java @@ -44,7 +44,7 @@ public ResidentPreRegistration(ResidentModel m) { @Given("^Adult \"(.*)\" from \"(.*)\"$") public void createPersonaAdult(String gender, String country, String contextKey) { - System.out.println(String.format("createPersonaAdult %s from %s", gender, country)); + logger.info(String.format("createPersonaAdult %s from %s", gender, country)); ResidentDataProvider provider = new ResidentDataProvider(); Gender enumGender = Gender.valueOf(gender); @@ -61,7 +61,7 @@ public void createPersonaAdult(String gender, String country, String contextKey) if (lst != null && !lst.isEmpty()) person = lst.get(0); - System.out.println(String.format("createPersonaAdult %s", person.getName().getFirstName())); + logger.info(String.format("createPersonaAdult %s", person.getName().getFirstName())); } @@ -74,7 +74,7 @@ public void sendOtp(String to, String contextKey) { public String sendOtpTo(String to, String contextKey) { - System.out.println(String.format("sendOtp %s ", to)); + logger.info(String.format("sendOtp %s ", to)); if (to.equals("phone")) otpTarget = person.getContact().getMobileNumber(); @@ -93,7 +93,7 @@ public String sendOtpTo(String to, String contextKey) { otpTarget = emailTo; String result = CreatePersona.sendOtpTo(otpTarget, person.getPrimaryLanguage(), contextKey); - System.out.println(String.format("sendOtp Result %s ", result)); + logger.info(String.format("sendOtp Result %s ", result)); return result; } @@ -184,11 +184,11 @@ public String verifyOtp(String to, String otp, String contextKey) { @And("^PreRegister him$") public void PreRegisterAdultMale(String contextKey) throws JSONException { - System.out.println("PreRegisterAdultMale"); + logger.info("PreRegisterAdultMale"); String result = PreRegistrationSteps.postApplication(person, null, contextKey); preRegID = result; - System.out.println(String.format("PreRegisterAdultMale Result %s ", result)); + logger.info(String.format("PreRegisterAdultMale Result %s ", result)); // assert(1 == 2); } @@ -197,7 +197,7 @@ public void PreRegisterAdultMale(String contextKey) throws JSONException { * @Then("^upload \"(POI|POD)\" document$") public void uploadProof(String * docCategory, String contextKey) throws JSONException { * - * System.out.println("uploadProof " + docCategory); int i = 0; for + * logger.info("uploadProof " + docCategory); int i = 0; for * (MosipDocument a : person.getDocuments()) { * PreRegistrationSteps.UploadDocument(a.getDocCategoryCode(), * a.getType().get(i).getCode(), a.getDocCategoryLang(), a.getDocs().get(i), diff --git a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/test/ResidentRegistration.java b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/test/ResidentRegistration.java index c9d67c87b..4c8ba31d8 100644 --- a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/test/ResidentRegistration.java +++ b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/test/ResidentRegistration.java @@ -28,7 +28,7 @@ public static void register(String contextKey) { } catch (Exception e) { logger.error(e.getMessage()); } - System.out.println(rid); + logger.info(rid); } @Then("^check registration status$") public static void checkRegistrationStatus(String contextKey) { diff --git a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/test/partnerManagement/CertificateUploader.java b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/test/partnerManagement/CertificateUploader.java index 2b169cff4..33a46262d 100644 --- a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/test/partnerManagement/CertificateUploader.java +++ b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/test/partnerManagement/CertificateUploader.java @@ -82,7 +82,7 @@ public static String uploadPartnerString(String certificateData, String orgName, public static void main(String[] args){ - System.out.println(uploadCACertificate("certificateData", "partnerDomain","contextKey")); + logger.info(uploadCACertificate("certificateData", "partnerDomain","contextKey")); } } diff --git a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/test/partnerManagement/PartnerRequest.java b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/test/partnerManagement/PartnerRequest.java index 01cf434c8..d10c11d4d 100644 --- a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/test/partnerManagement/PartnerRequest.java +++ b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/test/partnerManagement/PartnerRequest.java @@ -119,7 +119,7 @@ public static String updatePartnerStatus(String contextKey,String partnerId, Str updateStatusReq.put("requesttime", CommonUtil.getUTCDateTime(LocalDateTime.now())); updateStatusReq.put("version", "v1.0"); - System.out.print(updateStatusReq); + logger.info(updateStatusReq.toString()); try { diff --git a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/test/prereg/PreRegistrationSteps.java b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/test/prereg/PreRegistrationSteps.java index d5089dfa0..4fc105caf 100644 --- a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/test/prereg/PreRegistrationSteps.java +++ b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/test/prereg/PreRegistrationSteps.java @@ -190,7 +190,7 @@ public static String deleteApplication(String preregId,String contextKey) { String response = ""; String url = VariableManager.getVariableValue(contextKey,"urlBase").toString().trim()+ VariableManager.getVariableValue(VariableManager.NS_DEFAULT, "deleteApplication").toString().trim(); - System.out.println("url is:"); + logger.info("url is:"); url = url + "/" + preregId; try { JSONObject resp = RestClient.deleteNoAuth(url, new JSONObject(),contextKey); @@ -325,7 +325,7 @@ public static void main(String[] args) throws JSONException { //CreatePersona.sendOtpTo("sanath@mailinator.com"); CreatePersona.validateOTP("111111", "sanath@mailinator.com","contextKey"); AppointmentModel res = getAppointments("contextKey"); - System.out.println(res.getRegCenterId()); + logger.info(res.getRegCenterId()); for( CenterDetailsModel a: res.getAvailableDates()) { if(!a.getHoliday()) { for(AppointmentTimeSlotModel ts: a.getTimeslots()) { diff --git a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/test/registrationclient/RegistrationSteps.java b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/test/registrationclient/RegistrationSteps.java index 7be0efe08..7139a2aff 100644 --- a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/test/registrationclient/RegistrationSteps.java +++ b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/test/registrationclient/RegistrationSteps.java @@ -8,14 +8,18 @@ import java.time.LocalDateTime; import org.json.JSONObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import io.mosip.testrig.dslrig.dataprovider.models.ResidentModel; +import io.mosip.testrig.dslrig.dataprovider.test.CreatePersona; import io.mosip.testrig.dslrig.dataprovider.util.CommonUtil; import io.mosip.testrig.dslrig.dataprovider.util.RestClient; import io.mosip.testrig.dslrig.dataprovider.variables.VariableManager; import io.restassured.response.Response; public class RegistrationSteps { + private static final Logger logger = LoggerFactory.getLogger(RegistrationSteps.class); static LocalDateTime lastSyncTime; static String workDirectory; static String workPacketDirectory; @@ -146,12 +150,12 @@ public void setMDSscore(long port,String type, String qualityScore,String contex + "\",\"fromIso\":false}"; Response response = RestClient.post("http://127.0.0.1:"+port+"/admin/score",requestBody,contextKey);; - System.out.println(response.toString()); + logger.info(response.toString()); assertEquals(200, response.statusCode()); assertEquals("Success", response.jsonPath().getString("errorInfo")); } catch (Exception e) { - System.out.println("Issue with the Rest Assured MOCKMDS Score Request"+ e); + logger.info("Issue with the Rest Assured MOCKMDS Score Request"+ e); } } @@ -166,7 +170,7 @@ public void setMDSprofile(String type,String profile) { // assertEquals("Success", response.jsonPath().getString("errorInfo")); } catch (Exception e) { - System.out.println("Issue with the Rest Assured MOCKMDS Profile Request"+ e); + logger.info("Issue with the Rest Assured MOCKMDS Profile Request"+ e); } } @@ -176,7 +180,7 @@ public Response getStagesByRID(String rid, String contextKey) throws Exception { String uri= VariableManager.getVariableValue(contextKey,"ridStageStatus")+"?rid="+rid+"&langCode="+ VariableManager.getVariableValue(contextKey,"baselang"); String url = VariableManager.getVariableValue(contextKey,"urlBase").toString().trim() + uri ; Response response =RestClient.getAdmin(url,new JSONObject(),new JSONObject(),contextKey); - System.out.println(response); + logger.info(response); return response; } diff --git a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/util/CommonUtil.java b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/util/CommonUtil.java index 09e3724b6..a7598b4d1 100644 --- a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/util/CommonUtil.java +++ b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/util/CommonUtil.java @@ -95,7 +95,7 @@ public static String genStringAsperRegex(String regex) throws Exception { Generex generex = new Generex(regex); String randomStr = generex.random(); - System.out.println(randomStr); + logger.info(randomStr); // Generate all String that matches the given Regex. boolean bFound = false; do { diff --git a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/util/ReadEmail.java b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/util/ReadEmail.java index 9cf46492d..f93662251 100644 --- a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/util/ReadEmail.java +++ b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/util/ReadEmail.java @@ -45,12 +45,12 @@ public static List getOtps(){ List mails = receiveEmail(gmailPOPHost, mailStoreType, username, password); for(String s: mails) { - System.out.println("S==" +s); + logger.info("S==" +s); Pattern pattern = Pattern.compile(regexpattern); Matcher matcher = pattern.matcher(s); if (matcher.find()) { - System.out.println(matcher.group()); + logger.info(matcher.group()); otps.add(matcher.group()); } } @@ -67,10 +67,10 @@ public static List getadditionalInfoReqIds(){ List mails = receiveEmail(gmailPOPHost, mailStoreType, username, password); for (String s : mails) { - System.out.println("S==" + s); + logger.info("S==" + s); int position = s.indexOf(keyWord); String additionalInfoReqId = s.substring(position).split(" ")[1]; - System.out.println(additionalInfoReqId); + logger.info(additionalInfoReqId); additionalInfoReqIds.add(additionalInfoReqId); } return additionalInfoReqIds; @@ -106,13 +106,13 @@ public static List receiveEmail(String pop3Host, String storeType, Message message = messages[i]; if (!message.getSubject().toLowerCase().contains("uin")) continue; - System.out.println("---------------------------------"); - System.out.println("Email Number " + (i + 1)); - System.out.println("Subject: " + message.getSubject()); - System.out.println("From: " + message.getFrom()[0]); + logger.info("---------------------------------"); + logger.info("Email Number " + (i + 1)); + logger.info("Subject: " + message.getSubject()); + logger.info("From: " + message.getFrom()[0]); MimeMultipart content = (MimeMultipart) message.getContent(); String bodyMsg = getTextFromMimeMultipart(content); - System.out.println("Body Message: " + bodyMsg); + logger.info("Body Message: " + bodyMsg); if (message.getFrom()[0].toString().toLowerCase().contains("mosip")) { mailMessage.add(bodyMsg); message.setFlag(Flags.Flag.DELETED, true); @@ -133,7 +133,7 @@ public static void main(String[] args) { getadditionalInfoReqIds(); List otps = getOtps(); for(String ss: otps) { - System.out.println(ss); + logger.info(ss); } } private static String getTextFromMimeMultipart( MimeMultipart mimeMultipart) throws MessagingException, IOException{ diff --git a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/util/Translator.java b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/util/Translator.java index ec2a01fcf..393317570 100644 --- a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/util/Translator.java +++ b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/util/Translator.java @@ -18,7 +18,7 @@ public class Translator { public static void main(String[] args) { String text = "Mohandas Karamchand Ghandhi"; //Translated text: Hallo Welt! - System.out.println("Text:" + text + ",Translated text: " + translate( "heb", text,"contextKey")); + logger.info("Text:" + text + ",Translated text: " + translate( "heb", text,"contextKey")); } static String getLanguageID(String langIsoCode,String contextKey) { @@ -71,7 +71,7 @@ public static String translate(String toLanguageIsoCode, String text,String cont /* for( Iterator it = idSet.asIterator(); it.hasNext();) { String id = it.next(); - System.out.println(id); + logger.info(id); if(id.equals(lang_from_to)) { bFound = true; diff --git a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/variables/VariableManager.java b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/variables/VariableManager.java index e40199f28..6aca7bdd6 100644 --- a/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/variables/VariableManager.java +++ b/mosipTestDataProvider/src/io/mosip/testrig/dslrig/dataprovider/variables/VariableManager.java @@ -138,7 +138,7 @@ public static Boolean loadNamespaceFromPropertyFile(String propFile, String cont props.forEach((key, value) -> { setVariableValue(contextKey, key.toString(), value); - System.out.println(contextKey + "." + key.toString() + "=" + value.toString()); + logger.info(contextKey + "." + key.toString() + "=" + value.toString()); }); bRet = true;