From c8050a2e323271f4378eeed363275c07fb209ee2 Mon Sep 17 00:00:00 2001 From: bhumi46 Date: Fri, 15 Nov 2024 13:23:31 +0530 Subject: [PATCH 01/19] [MOSIP-37447] added helm changes and install.sh changes for pushing reports to nfs Signed-off-by: bhumi46 --- deploy/apitestrig/install.sh | 103 ++++++++++++++++++------- helm/apitestrig/templates/cronjob.yaml | 11 +++ helm/apitestrig/templates/pv.yaml | 23 ++++++ helm/apitestrig/templates/pvc.yaml | 23 ++++++ helm/apitestrig/templates/secrets.yaml | 2 +- helm/apitestrig/values.yaml | 36 ++++++--- 6 files changed, 160 insertions(+), 38 deletions(-) create mode 100644 helm/apitestrig/templates/pv.yaml create mode 100644 helm/apitestrig/templates/pvc.yaml diff --git a/deploy/apitestrig/install.sh b/deploy/apitestrig/install.sh index cd6d4783af..554b4d63c6 100755 --- a/deploy/apitestrig/install.sh +++ b/deploy/apitestrig/install.sh @@ -17,10 +17,10 @@ function installing_apitestrig() { kubectl label ns $NS istio-injection=disabled --overwrite helm repo update - echo Copy configmaps + echo Copy Configmaps ./copy_cm.sh - echo Copy secrets + echo echo Copy Secrtes ./copy_secrets.sh echo "Delete s3, db, & apitestrig configmap if exists" @@ -90,29 +90,80 @@ function installing_apitestrig() { else echo "eSignet service is not deployed. hence will be skipping esignet related test-cases..." fi - - echo Installing apitestrig - helm -n $NS install apitestrig mosip/apitestrig \ - --set crontime="0 $time * * *" \ - -f values.yaml \ - --version $CHART_VERSION \ - --set apitestrig.configmaps.s3.s3-host='http://minio.minio:9000' \ - --set apitestrig.configmaps.s3.s3-user-key='admin' \ - --set apitestrig.configmaps.s3.s3-region='' \ - --set apitestrig.configmaps.db.db-server="$DB_HOST" \ - --set apitestrig.configmaps.db.db-su-user="postgres" \ - --set apitestrig.configmaps.db.db-port="5432" \ - --set apitestrig.configmaps.apitestrig.ENV_USER="$ENV_USER" \ - --set apitestrig.configmaps.apitestrig.ENV_ENDPOINT="https://$API_INTERNAL_HOST" \ - --set apitestrig.configmaps.apitestrig.ENV_TESTLEVEL="smokeAndRegression" \ - --set apitestrig.configmaps.apitestrig.reportExpirationInDays="$reportExpirationInDays" \ - --set apitestrig.configmaps.apitestrig.slack-webhook-url="$slackWebhookUrl" \ - --set apitestrig.configmaps.apitestrig.eSignetDeployed="$eSignetDeployed" \ - --set apitestrig.configmaps.apitestrig.NS="$NS" \ - $ENABLE_INSECURE - - echo Installed apitestrig. - return 0 + read -p "Is values.yaml for onboarder chart set correctly as part of pre-requisites? (Y/n) : " yn; + if [[ $yn = "Y" ]] || [[ $yn = "y" ]] ; then + NFS_OPTION='' + S3_OPTION='' + config_complete=false # flag to check if S3 or NFS is configured + while [ "$config_complete" = false ]; do + read -p "Do you have S3 details for storing Onboarder reports? (Y/n) : " ans + if [[ "$ans" == "y" || "$ans" == "Y" ]]; then + read -p "Please provide S3 host: " s3_host + if [[ -z $s3_host ]]; then + echo "S3 host not provided; EXITING;" + exit 1; + fi + read -p "Please provide S3 region: " s3_region + if [[ $s3_region == *[' !@#$%^&*()+']* ]]; then + echo "S3 region should not contain spaces or special characters; EXITING;" + exit 1; + fi + + read -p "Please provide S3 access key: " s3_user_key + if [[ -z $s3_user_key ]]; then + echo "S3 access key not provided; EXITING;" + exit 1; + fi + S3_OPTION="--set apitestrig.configmaps.s3.s3-host=$s3_host --set apitestrig.configmaps.s3.s3-user-key=$s3_user_key --set apitestrig.configmaps.s3.s3-region=$s3_region" + push_reports_to_s3="yes" + config_complete=true + elif [[ "$ans" == "n" || "$ans" == "N" ]]; then + push_reports_to_s3="no" + read -p "Since S3 details are not available, do you want to use NFS directory mount for storing reports? (y/n) : " answer + if [[ $answer == "Y" ]] || [[ $answer == "y" ]]; then + read -p "Please provide NFS Server IP: " nfs_server + if [[ -z $nfs_server ]]; then + echo "NFS server not provided; EXITING." + exit 1; + fi + read -p "Please provide NFS directory to store reports from NFS server (e.g. /srv/nfs//onboarder/), make sure permission is 777 for the folder: " nfs_path + if [[ -z $nfs_path ]]; then + echo "NFS Path not provided; EXITING." + exit 1; + fi + NFS_OPTION="--set apitestrig.volumes.reports.nfs.server=$nfs_server --set apitestrig.volumes.reports.nfs.path=$nfs_path" + config_complete=true + else + echo "Please rerun the script with either S3 or NFS server details." + exit 1; + fi + else + echo "Invalid input. Please respond with Y (yes) or N (no)." + fi + done + echo Installing apitestrig + helm -n $NS install apitestrig mosip/apitestrig \ + --set crontime="0 $time * * *" \ + -f values.yaml \ + --version $CHART_VERSION \ + $NFS_OPTION \ + $S3_OPTION \ + --set apitestrig.variables.push_reports_to_s3=$push_reports_to_s3 \ + --set apitestrig.configmaps.db.db-server="$DB_HOST" \ + --set apitestrig.configmaps.db.db-su-user="postgres" \ + --set apitestrig.configmaps.db.db-port="5432" \ + --set apitestrig.configmaps.apitestrig.ENV_USER="$ENV_USER" \ + --set apitestrig.configmaps.apitestrig.ENV_ENDPOINT="https://$API_INTERNAL_HOST" \ + --set apitestrig.configmaps.apitestrig.ENV_TESTLEVEL="smokeAndRegression" \ + --set apitestrig.configmaps.apitestrig.reportExpirationInDays="$reportExpirationInDays" \ + --set apitestrig.configmaps.apitestrig.slack-webhook-url="$slackWebhookUrl" \ + --set apitestrig.configmaps.apitestrig.eSignetDeployed="$eSignetDeployed" \ + --set apitestrig.configmaps.apitestrig.NS="$NS" \ + $ENABLE_INSECURE + + echo Installed apitestrig. + return 0 + fi } # set commands for error handling. @@ -121,4 +172,4 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true set -o nounset ## set -u : exit the script if you try to use an uninitialised variable set -o errtrace # trace ERR through 'time command' and other functions set -o pipefail # trace ERR through pipes -installing_apitestrig # calling function \ No newline at end of file +installing_apitestrig # calling function diff --git a/helm/apitestrig/templates/cronjob.yaml b/helm/apitestrig/templates/cronjob.yaml index cb3ce9a2cc..9a87054da8 100644 --- a/helm/apitestrig/templates/cronjob.yaml +++ b/helm/apitestrig/templates/cronjob.yaml @@ -60,6 +60,8 @@ spec: value: {{ $.Values.additionalResources.javaOpts }} - name: MODULES value: {{ $modulename }} + - name: push-reports-to-s3 + value: {{ quote $.Values.apitestrig.variables.push_reports_to_s3 }} {{- if $.Values.extraEnvVars }} {{- include "common.tpvalues.render" (dict "value" $.Values.extraEnvVars "context" $) | nindent 12 }} {{- end }} @@ -91,6 +93,10 @@ spec: mountPath: {{ $volume_value.volumeMounts.mountPath }} {{- end }} {{- end }} + {{- if eq $.Values.apitestrig.variables.push_reports_to_s3 "no" }} + - name: {{ $.Values.apitestrig.volumes.reports.name }} + mountPath: /home/mosip/testrig/report + {{- end }} volumes: {{- if $.Values.enable_insecure }} - name: cacerts @@ -104,5 +110,10 @@ spec: name: {{ $volume_name }} {{- end }} {{- end }} + {{- if eq $.Values.apitestrig.variables.push_reports_to_s3 "no" }} + - name: {{ $.Values.apitestrig.volumes.reports.name }} + persistentVolumeClaim: + claimName: {{ $.Values.apitestrig.volumes.reports.name }}-{{ $.Release.Namespace }}-{{ $modulename }}-pvc + {{- end }} {{- end }} {{- end }} diff --git a/helm/apitestrig/templates/pv.yaml b/helm/apitestrig/templates/pv.yaml new file mode 100644 index 0000000000..0ae1e54727 --- /dev/null +++ b/helm/apitestrig/templates/pv.yaml @@ -0,0 +1,23 @@ +{{- range $modulename, $module := $.Values.modules }} +{{- if $module.enabled }} +{{- if eq $.Values.apitestrig.variables.push_reports_to_s3 "no" }} +apiVersion: v1 +kind: PersistentVolume +metadata: + name: {{ $.Values.apitestrig.volumes.reports.name }}-{{ $.Release.Namespace }}-{{ $modulename }}-pvc + labels: + name: {{ $.Values.apitestrig.volumes.reports.name }} +spec: + storageClassName: {{ $.Values.apitestrig.volumes.reports.storageClass }} + capacity: + storage: {{ $.Values.apitestrig.volumes.reports.size }} + accessModes: + {{- range $.Values.apitestrig.volumes.reports.accessModes }} + - {{ . }} + {{- end }} + nfs: + server: {{ $.Values.apitestrig.volumes.reports.nfs.server }} + path: {{ $.Values.apitestrig.volumes.reports.nfs.path }} +{{- end }} +{{- end }} +{{- end }} diff --git a/helm/apitestrig/templates/pvc.yaml b/helm/apitestrig/templates/pvc.yaml new file mode 100644 index 0000000000..605375b0cd --- /dev/null +++ b/helm/apitestrig/templates/pvc.yaml @@ -0,0 +1,23 @@ +{{- range $modulename, $module := $.Values.modules }} +{{- if $module.enabled }} +{{- if eq $.Values.apitestrig.variables.push_reports_to_s3 "no" }} +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ $.Values.apitestrig.volumes.reports.name }}-{{ $.Release.Namespace }}-{{ $modulename }}-pvc + namespace: {{ $.Release.Namespace | quote }} +spec: + storageClassName: {{ $.Values.apitestrig.volumes.reports.storageClass }} + accessModes: + {{- range $.Values.apitestrig.volumes.reports.accessModes }} + - {{ . }} + {{- end }} + resources: + requests: + storage: {{ $.Values.apitestrig.volumes.reports.size }} + selector: + matchLabels: + name: {{ $.Values.apitestrig.volumes.reports.name }} +{{- end }} +{{- end }} +{{- end }} diff --git a/helm/apitestrig/templates/secrets.yaml b/helm/apitestrig/templates/secrets.yaml index 1ef8dc9893..a3b9561dcd 100644 --- a/helm/apitestrig/templates/secrets.yaml +++ b/helm/apitestrig/templates/secrets.yaml @@ -4,7 +4,7 @@ apiVersion: v1 kind: Secret metadata: - name: {{ $secret_name }} + name: {{ $secret_name }}-{{ $.Release.Name }} namespace: {{ $.Release.Namespace }} labels: {{- include "common.labels.standard" $ | nindent 8 }} {{- if $.Values.commonLabels }} diff --git a/helm/apitestrig/values.yaml b/helm/apitestrig/values.yaml index 8b5beb6f8f..7c22d0a0a9 100644 --- a/helm/apitestrig/values.yaml +++ b/helm/apitestrig/values.yaml @@ -441,55 +441,55 @@ istio: modules: prereg: - enabled: true + enabled: false image: repository: mosipqa/apitest-prereg tag: develop pullPolicy: Always masterdata: - enabled: true + enabled: false image: repository: mosipqa/apitest-masterdata tag: develop pullPolicy: Always idrepo: - enabled: true + enabled: false image: repository: mosipqa/apitest-idrepo tag: develop pullPolicy: Always partner: - enabled: true + enabled: false image: repository: mosipqa/apitest-pms tag: develop pullPolicy: Always pms: - enabled: true + enabled: false image: repository: mosipdev/apitest-pms tag: develop pullPolicy: Always resident: - enabled: true + enabled: false image: repository: mosipqa/apitest-resident tag: develop pullPolicy: Always auth: - enabled: true + enabled: false image: repository: mosipqa/apitest-auth tag: develop pullPolicy: Always esignet: - enabled: true + enabled: false image: repository: mosipqa/apitest-esignet tag: develop pullPolicy: Always mimoto: - enabled: true + enabled: false image: repository: mosipqa/apitest-mimoto tag: develop @@ -514,7 +514,6 @@ apitestrig: authDemoServiceBaseURL: http://authdemo.authdemo authDemoServicePort: 80 eSignetDeployed: yes or no - push-reports-to-s3: 'yes' authCertsPath: '/home/mosip/authcerts' scripts: fetch_docker_image_hash_ids.sh: | @@ -534,6 +533,8 @@ apitestrig: cd /home/${container_user}/ bash ./entrypoint.sh secrets: + s3: + s3-user-secret: 'password' apitestrig: volumes: configmaps: @@ -541,5 +542,18 @@ apitestrig: defaultMode: 0777 volumeMounts: mountPath: '/home/mosip/scripts/' - + reports: + name: apitestrig-reports + storageClass: nfs-client + accessModes: + - ReadWriteMany + size: 10Mi + existingClaim: + # Dir where config and keys are written inside container + mountDir: /home/mosip/testrig/report + nfs: + path: "/srv/nfs/sandbox/onboarding" # Dir within the nfs server where config repo is cloned/maintained locally. + server: "nfs-server" # Ip address of nfs server. + variables: + push_reports_to_s3: "no" enable_insecure: false From ed7579bfa1ef26e016b6df772b77c623af23a694 Mon Sep 17 00:00:00 2001 From: bhumi46 Date: Fri, 15 Nov 2024 15:21:42 +0530 Subject: [PATCH 02/19] [MOSIP-37447] added helm changes and install.sh changes for pushing reports to nfs Signed-off-by: bhumi46 --- deploy/apitestrig/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/apitestrig/install.sh b/deploy/apitestrig/install.sh index 554b4d63c6..6519a22972 100755 --- a/deploy/apitestrig/install.sh +++ b/deploy/apitestrig/install.sh @@ -20,7 +20,7 @@ function installing_apitestrig() { echo Copy Configmaps ./copy_cm.sh - echo echo Copy Secrtes + echo Copy Secrtes ./copy_secrets.sh echo "Delete s3, db, & apitestrig configmap if exists" From 7135c949ec04cc04961fddd7f965ee3c23fe1bd9 Mon Sep 17 00:00:00 2001 From: bhumi46 Date: Fri, 15 Nov 2024 16:55:21 +0530 Subject: [PATCH 03/19] [MOSIP-37447] added helm changes and install.sh changes for pushing reports to nfs Signed-off-by: bhumi46 --- helm/apitestrig/values.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/helm/apitestrig/values.yaml b/helm/apitestrig/values.yaml index 7c22d0a0a9..e673288b37 100644 --- a/helm/apitestrig/values.yaml +++ b/helm/apitestrig/values.yaml @@ -441,55 +441,55 @@ istio: modules: prereg: - enabled: false + enabled: true image: repository: mosipqa/apitest-prereg tag: develop pullPolicy: Always masterdata: - enabled: false + enabled: true image: repository: mosipqa/apitest-masterdata tag: develop pullPolicy: Always idrepo: - enabled: false + enabled: true image: repository: mosipqa/apitest-idrepo tag: develop pullPolicy: Always partner: - enabled: false + enabled: true image: repository: mosipqa/apitest-pms tag: develop pullPolicy: Always pms: - enabled: false + enabled: true image: repository: mosipdev/apitest-pms tag: develop pullPolicy: Always resident: - enabled: false + enabled: true image: repository: mosipqa/apitest-resident tag: develop pullPolicy: Always auth: - enabled: false + enabled: true image: repository: mosipqa/apitest-auth tag: develop pullPolicy: Always esignet: - enabled: false + enabled: true image: repository: mosipqa/apitest-esignet tag: develop pullPolicy: Always mimoto: - enabled: false + enabled: true image: repository: mosipqa/apitest-mimoto tag: develop From 4909c535b7116e8ec51abe00cb90093d08429a59 Mon Sep 17 00:00:00 2001 From: Mohanachandran S Date: Mon, 18 Nov 2024 14:54:27 +0530 Subject: [PATCH 04/19] MOSIP-37213 Signed-off-by: Mohanachandran S --- apitest-commons/pom.xml | 5 + .../testrig/apirig/utils/AdminTestUtil.java | 30 ++- .../testrig/apirig/utils/GlobalConstants.java | 2 + .../apirig/utils/WebSocketClientUtil.java | 174 ++++++++++++++++++ 4 files changed, 208 insertions(+), 3 deletions(-) create mode 100644 apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/WebSocketClientUtil.java diff --git a/apitest-commons/pom.xml b/apitest-commons/pom.xml index e8b2d9cef0..8eb688b12e 100644 --- a/apitest-commons/pom.xml +++ b/apitest-commons/pom.xml @@ -388,6 +388,11 @@ java-jwt 4.4.0 + + org.glassfish.tyrus.bundles + tyrus-standalone-client + 1.13.1 + io.mosip.authentication authentication-core diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/AdminTestUtil.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/AdminTestUtil.java index 5556314604..2375b3ac7f 100644 --- a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/AdminTestUtil.java +++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/AdminTestUtil.java @@ -664,13 +664,16 @@ public void getvalueFromResponseHeader(Response response, String testCaseName) { if (eachSetCookieValue.trim().startsWith("IDV_TRANSACTION_ID")) { getCookieAndWriteAutoGenId(eachSetCookieValue, "idvTransactionID", testCaseName); } + if (eachSetCookieValue.trim().startsWith("IDV_SLOT_ALLOTTED")) { + getCookieAndWriteAutoGenId(eachSetCookieValue, "idvSlotAllotted", testCaseName); + } } } } } protected void getCookieAndWriteAutoGenId(String cookieValue, String key, String testCaseName) { - if (!cookieValue.split("=")[1].isBlank()) { + if (cookieValue.split("=").length > 1 && !cookieValue.split("=")[1].isBlank()) { String value = cookieValue.split("=")[1]; writeAutoGeneratedId(testCaseName, key, value); } @@ -719,8 +722,11 @@ protected Response postRequestWithCookieAuthHeaderAndXsrfTokenForAutoGenId(Strin JSONObject request = new JSONObject(inputJson); String encodedResp = null; String transactionId = null; + String headerTransactionID = ""; String pathFragmentCookie = null; String pathFragmentCookieTransactionId = null; + Map cookiesMap = new HashMap<>(); + if (request.has(GlobalConstants.ENCODEDHASH)) { encodedResp = request.get(GlobalConstants.ENCODEDHASH).toString(); request.remove(GlobalConstants.ENCODEDHASH); @@ -741,7 +747,7 @@ protected Response postRequestWithCookieAuthHeaderAndXsrfTokenForAutoGenId(Strin request.remove(GlobalConstants.PATH_FRAGMENT_COOKIE_TRANSACTIONID); request.remove(GlobalConstants.PATH_FRAGMENT_COOKIE); } - + inputJson = request.toString(); if (BaseTestCase.currentModule.equals(GlobalConstants.MIMOTO) || BaseTestCase.currentModule.equals("auth") || BaseTestCase.currentModule.equals(GlobalConstants.ESIGNET) @@ -750,12 +756,24 @@ protected Response postRequestWithCookieAuthHeaderAndXsrfTokenForAutoGenId(Strin } token = properties.getProperty(GlobalConstants.XSRFTOKEN); + + if (request.has(GlobalConstants.IDV_TRANSACTION_ID)) { + headerTransactionID = request.get(GlobalConstants.IDV_TRANSACTION_ID).toString(); + headers.put(GlobalConstants.IDV_TRANSACTION_ID_KEY, headerTransactionID); + cookiesMap.put(GlobalConstants.IDV_TRANSACTION_ID_KEY, headerTransactionID); + cookiesMap.put(GlobalConstants.XSRF_TOKEN, token); + request.remove(GlobalConstants.IDV_TRANSACTION_ID); + } + logger.info(GlobalConstants.POST_REQ_URL + url); GlobalMethods.reportRequest(headers.toString(), inputJson, url); try { if (pathFragmentCookie!=null) { response = RestClient.postRequestWithMultipleHeadersAndMultipleCookies(url, inputJson, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, pathFragmentCookieTransactionId, pathFragmentCookie, headers); + } else if (cookiesMap.containsKey(GlobalConstants.IDV_TRANSACTION_ID_KEY)) { + response = RestClient.postRequestWithMultipleHeadersAndCookies(url, inputJson, + MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, cookiesMap, headers); } else { response = RestClient.postRequestWithMultipleHeadersAndCookies(url, inputJson, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, cookieName, token, headers); @@ -793,8 +811,14 @@ protected Response getRequestWithCookieAuthHeaderAndXsrfToken(String url, String headers.put(XSRF_HEADERNAME, properties.getProperty(GlobalConstants.XSRFTOKEN)); headers.put(OAUTH_HASH_HEADERNAME, encodedResp); headers.put(OAUTH_TRANSID_HEADERNAME, transactionId); - + token = null; + + if (request.has(GlobalConstants.IDV_SLOT_ALLOTED)) { + token = request.get(GlobalConstants.IDV_SLOT_ALLOTED).toString(); + cookieName = "IDV_SLOT_ALLOTTED"; + request.remove(GlobalConstants.IDV_SLOT_ALLOTED); + } logger.info(GlobalConstants.GET_REQ_STRING + url); GlobalMethods.reportRequest(headers.toString(), null, url); try { diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/GlobalConstants.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/GlobalConstants.java index 0d76ed45b4..27fa513cf4 100644 --- a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/GlobalConstants.java +++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/GlobalConstants.java @@ -239,4 +239,6 @@ public class GlobalConstants { public static final String PATH_FRAGMENT_COOKIE_TRANSACTIONID = "pathFragmentCookieTransactionId"; public static final String IDV_TRANSACTION_ID = "idvTransactionID"; public static final String IDV_TRANSACTION_ID_KEY = "IDV_TRANSACTION_ID"; + public static final String IDV_SLOT_ALLOTED = "idvSlotAllotted"; + public static final String IDV_SLOT_ALLOTED_KEY = "IDV_SLOT_ALLOTTED="; } diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/WebSocketClientUtil.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/WebSocketClientUtil.java new file mode 100644 index 0000000000..74790ce9c1 --- /dev/null +++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/WebSocketClientUtil.java @@ -0,0 +1,174 @@ +package io.mosip.testrig.apirig.utils; + +import javax.websocket.*; +import org.apache.log4j.Logger; +import java.net.URI; +import java.util.Collections; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ConcurrentHashMap; + +@ClientEndpoint +public class WebSocketClientUtil extends Endpoint { + + private static final Logger logger = Logger.getLogger(WebSocketClientUtil.class); + private Session session; + private CountDownLatch latch; + private String cookie; + private String subscribeDestination; + private String sendDestination; + + + // Global map to store received messages, keyed by message ID or custom key + private static final Map messageStore = new ConcurrentHashMap<>(); + + public WebSocketClientUtil(String cookie, String subscribeDestination, String sendDestination) { + this.cookie = cookie; + this.subscribeDestination = subscribeDestination; + this.sendDestination = sendDestination; + latch = new CountDownLatch(1); // Initially, latch is set to 1 + } + + @Override + public void onOpen(Session session, EndpointConfig config) { + this.session = session; + logger.info("WebSocket opened"); + + // Add message handler + session.addMessageHandler(String.class, this::onMessage); + + try { + // Send CONNECT frame to initiate WebSocket handshake + String connectFrame = "CONNECT\naccept-version:1.2\n\n\u0000"; + session.getBasicRemote().sendText(connectFrame); + logger.info("Sent CONNECT frame: " + connectFrame); + + // Send SUBSCRIBE frame to subscribe to destination + String subscribeFrame = String.format("SUBSCRIBE\nid:sub-0\ndestination:%s\n\n\u0000", subscribeDestination); + session.getBasicRemote().sendText(subscribeFrame); + logger.info("Sent SUBSCRIBE frame: " + subscribeFrame); + + } catch (Exception e) { + logger.error("Error during connection setup", e); + latch.countDown(); + } + } + + public void connect(String uri) { + WebSocketContainer container = ContainerProvider.getWebSocketContainer(); + + ClientEndpointConfig config = ClientEndpointConfig.Builder.create() + .configurator(new ClientEndpointConfig.Configurator() { + @Override + public void beforeRequest(Map> headers) { + headers.put("Cookie", Collections.singletonList(cookie)); + logger.info("Request headers: " + headers); + } + }).build(); + + try { + logger.info("Attempting to connect to: " + uri); + container.connectToServer(this, config, new URI(uri)); + + logger.info("Successfully connected to the WebSocket server."); + + } catch (Exception e) { + logger.error("Connection failed: ", e); + } + } + + @OnMessage + public void onMessage(String message) { + logger.info("Received message: " + message); + + // Store the received message in the global map (keyed by message ID or custom identifier) + // Assuming the message contains a message-id field + String messageId = extractMessageId(message); + if (messageId != null) { + messageStore.put(messageId, message); + logger.info("Stored message with ID: " + messageId); + } else { + logger.warn("Received message without a valid message ID: " + message); + } + } + + @OnClose + public void onClose(Session session, CloseReason closeReason) { + if (closeReason != null) { + logger.info("Connection closed: " + closeReason.getCloseCode() + " (" + closeReason.getReasonPhrase() + ")"); + } else { + logger.info("Connection closed with no specific reason."); + } + latch.countDown(); + } + + @OnError + public void onError(Session session, Throwable throwable) { + logger.error("Error occurred: ", throwable); + if (session != null && session.isOpen()) { + try { + // Attempting to reconnect if needed + logger.info("Attempting to reconnect..."); + connect("wss://your-websocket-url"); + } catch (Exception e) { + logger.error("Error reconnecting: ", e); + } + } + latch.countDown(); + } + + + public void sendMessage(String messageContent) { + if (session != null && session.isOpen()) { + try { + String sendFrame = String.format("SEND\ndestination:%s\ncontent-type:application/json\n\n%s\u0000", sendDestination, messageContent); + session.getBasicRemote().sendText(sendFrame); + logger.info("Sent message: " + sendFrame); + } catch (Exception e) { + logger.error("Error sending message: ", e); + } + } else { + logger.warn("Connection is not open. Unable to send message."); + session = null; + } + } + + public void closeConnection() { + try { + if (session != null && session.isOpen()) { + session.close(); + logger.info("WebSocket connection closed."); + } + } catch (Exception e) { + logger.error("Error closing connection", e); + } + } + + // Method to extract the message ID from the received message (this is a placeholder) + private String extractMessageId(String message) { + try { + if (message.contains("message-id")) { + String[] parts = message.split("message-id:"); + if (parts.length > 1) { + String messageId = parts[1].split("-")[0].trim(); // Adjust extraction logic as needed + return messageId; + } + } + } catch (Exception e) { + logger.error("Error extracting message ID", e); + } + return null; + } + + public static Map getMessageStore() { + return messageStore; + } + + public Session getSession() { + return session; + } + + public CountDownLatch getLatch() { + return latch; + } +} \ No newline at end of file From 740fad7c3fbbca28871b2130dadf13fdff28d0ad Mon Sep 17 00:00:00 2001 From: Nandhukumar Date: Wed, 20 Nov 2024 12:31:05 +0530 Subject: [PATCH 05/19] MOSIP-37606 Signed-off-by: Nandhukumar --- .../java/io/mosip/testrig/apirig/utils/ConfigManager.java | 8 ++++++++ .../src/main/resources/config/Kernel.properties | 1 + 2 files changed, 9 insertions(+) diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/ConfigManager.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/ConfigManager.java index 30b85f2bf4..e5145bffee 100644 --- a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/ConfigManager.java +++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/ConfigManager.java @@ -69,6 +69,14 @@ public static void getValueForKeyAddToPropertiesMap(Properties props, String key value = System.getProperty("env.endpoint").replace("api-internal", "signup"); } propertiesMap.put(key, value); + } else if (key.equalsIgnoreCase("injiCertifyBaseURL")){ + String value = null; + if (System.getenv("injiCertifyBaseURL") != null) { + value = System.getenv("injiCertifyBaseURL"); + } else { + value = System.getProperty("env.endpoint").replace("api-internal", "injicertify"); + } + propertiesMap.put(key, value); } else if (key.equalsIgnoreCase("mosip_components_base_urls")){ String components_base_urls = System.getenv("mosip_components_base_urls") == null ? props.getProperty("mosip_components_base_urls") diff --git a/apitest-commons/src/main/resources/config/Kernel.properties b/apitest-commons/src/main/resources/config/Kernel.properties index 33d7614c7b..b88adfcf24 100644 --- a/apitest-commons/src/main/resources/config/Kernel.properties +++ b/apitest-commons/src/main/resources/config/Kernel.properties @@ -104,6 +104,7 @@ signupSettingsEndPoint=/v1/signup/settings esignetActuatorPropertySection=esignet-default.properties eSignetbaseurl= signupBaseUrl= +injiCertifyBaseURL= From 92a99450bfb0c84204fec8d5eb524aec2e0eca63 Mon Sep 17 00:00:00 2001 From: bhumi46 Date: Wed, 20 Nov 2024 18:25:13 +0530 Subject: [PATCH 06/19] [MOSIP-37447] added helm changes and install.sh Signed-off-by: bhumi46 --- deploy/apitestrig/install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/deploy/apitestrig/install.sh b/deploy/apitestrig/install.sh index 6519a22972..2a6fa6bbe1 100755 --- a/deploy/apitestrig/install.sh +++ b/deploy/apitestrig/install.sh @@ -90,13 +90,13 @@ function installing_apitestrig() { else echo "eSignet service is not deployed. hence will be skipping esignet related test-cases..." fi - read -p "Is values.yaml for onboarder chart set correctly as part of pre-requisites? (Y/n) : " yn; + read -p "Is values.yaml for apitestrig chart set correctly as part of pre-requisites? (Y/n) : " yn; if [[ $yn = "Y" ]] || [[ $yn = "y" ]] ; then NFS_OPTION='' S3_OPTION='' config_complete=false # flag to check if S3 or NFS is configured while [ "$config_complete" = false ]; do - read -p "Do you have S3 details for storing Onboarder reports? (Y/n) : " ans + read -p "Do you have S3 details for storing apitestrig reports? (Y/n) : " ans if [[ "$ans" == "y" || "$ans" == "Y" ]]; then read -p "Please provide S3 host: " s3_host if [[ -z $s3_host ]]; then @@ -126,7 +126,7 @@ function installing_apitestrig() { echo "NFS server not provided; EXITING." exit 1; fi - read -p "Please provide NFS directory to store reports from NFS server (e.g. /srv/nfs//onboarder/), make sure permission is 777 for the folder: " nfs_path + read -p "Please provide NFS directory to store reports from NFS server (e.g. /srv/nfs//apitestrig/), make sure permission is 777 for the folder: " nfs_path if [[ -z $nfs_path ]]; then echo "NFS Path not provided; EXITING." exit 1; From 13f79fce3c277d62fefdf8c2333044136da4eabb Mon Sep 17 00:00:00 2001 From: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com> Date: Tue, 26 Nov 2024 10:32:07 +0530 Subject: [PATCH 07/19] MOSIP-37793 - Update the Readme file Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com> --- apitest-commons/README.md | 67 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 2 deletions(-) diff --git a/apitest-commons/README.md b/apitest-commons/README.md index 51b6226796..113a321d17 100644 --- a/apitest-commons/README.md +++ b/apitest-commons/README.md @@ -1,3 +1,66 @@ -# Automation test +# API Test Commons -All automation test code. +## Overview + +The API Test Commons is a shared codebase used for executing module-wise automation API tests. It utilizes Java REST Assured and TestNG frameworks to automate testing for various modules, including: +- Pre-registration +- Masterdata +- Partner Management +- PMS +- ID Repository +- IDA +- Resident +- ESignet +- ESignet-signup +- Mimoto +- Inji-Certify + +## Pre-requisites + +Ensure the following software is installed on the machine from where the automation tests will be executed: + +- Java 21 +- Maven 3.9.6 or higher +- Lombok (Refer to [Lombok Project](https://projectlombok.org/)) + +### For Windows + +- Git Bash 2.18.0 or higher +- `settings.xml` needs to be present in the `.m2` folder. + +### For Linux + +- `settings.xml` file needs to be present in two places: + - Regular Maven conf folder + - Copy the same `settings.xml` under `/usr/local/maven/conf` + +## Access Test Automation Code + +### From Browser + +1. Clone or download the repository as a zip file from [GitHub](https://github.com/mosip/mosip-functional-tests). +2. Unzip the contents. +3. Continue with the steps below from a terminal (Linux) or command prompt (Windows). + +### From Git Bash + +1. Copy the git link: `https://github.com/mosip/mosip-functional-tests` +2. Open Git Bash at your desired location on your local systemn. +3. Run the following command to clone the repository: + ```sh + git clone https://github.com/mosip/mosip-functional-tests + +## Update the property file +1. Navigate to the kernel.properties file located at: +`mosip-functional-tests\apitest-commons\src\main\resources\config\kernel.properties` +3. Open the file in your preferred editor +4. Update the client secret values and other required credentials as per your environment + +## Build Test Automation Code +1. Navigate to the apitest-commons directory: +2. `cd mosip-functional-tests/apitest-commons/` +3. Run the following Maven command: +4. `mvn clean install -Dgpg.skip=true -Dmaven.gitcommitid.skip=true` + +## License +This project is licensed under the terms of [Mozilla Public License 2.0](https://github.com/mosip/mosip-platform/blob/master/LICENSE) From 8d8d88e43d83e2bc4d5de5709c6672126e577154 Mon Sep 17 00:00:00 2001 From: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com> Date: Tue, 26 Nov 2024 10:33:40 +0530 Subject: [PATCH 08/19] MOSIP-37793 - Update the Readme file Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com> --- apitest-commons/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/apitest-commons/README.md b/apitest-commons/README.md index 113a321d17..962d6f2106 100644 --- a/apitest-commons/README.md +++ b/apitest-commons/README.md @@ -52,6 +52,7 @@ Ensure the following software is installed on the machine from where the automat ## Update the property file 1. Navigate to the kernel.properties file located at: +```sh `mosip-functional-tests\apitest-commons\src\main\resources\config\kernel.properties` 3. Open the file in your preferred editor 4. Update the client secret values and other required credentials as per your environment From e3b396fe93b64033ec251e0f53e4acdfbabde446 Mon Sep 17 00:00:00 2001 From: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com> Date: Tue, 26 Nov 2024 10:34:31 +0530 Subject: [PATCH 09/19] MOSIP-37793 - Update the Readme file Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com> --- apitest-commons/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apitest-commons/README.md b/apitest-commons/README.md index 962d6f2106..5bdf09ffae 100644 --- a/apitest-commons/README.md +++ b/apitest-commons/README.md @@ -52,10 +52,10 @@ Ensure the following software is installed on the machine from where the automat ## Update the property file 1. Navigate to the kernel.properties file located at: -```sh -`mosip-functional-tests\apitest-commons\src\main\resources\config\kernel.properties` -3. Open the file in your preferred editor -4. Update the client secret values and other required credentials as per your environment + ```sh + `mosip-functional-tests\apitest-commons\src\main\resources\config\kernel.properties` +2. Open the file in your preferred editor +3. Update the client secret values and other required credentials as per your environment ## Build Test Automation Code 1. Navigate to the apitest-commons directory: From cb2237883d623b90e7785cd13e7e39ae47e800fa Mon Sep 17 00:00:00 2001 From: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com> Date: Tue, 26 Nov 2024 10:36:12 +0530 Subject: [PATCH 10/19] MOSIP-37793 - Update the Readme file Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com> --- apitest-commons/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apitest-commons/README.md b/apitest-commons/README.md index 5bdf09ffae..7db79cce81 100644 --- a/apitest-commons/README.md +++ b/apitest-commons/README.md @@ -52,7 +52,7 @@ Ensure the following software is installed on the machine from where the automat ## Update the property file 1. Navigate to the kernel.properties file located at: - ```sh + sh `mosip-functional-tests\apitest-commons\src\main\resources\config\kernel.properties` 2. Open the file in your preferred editor 3. Update the client secret values and other required credentials as per your environment From 4fa44d0633a0da7f2475a5575c7fe06392443f29 Mon Sep 17 00:00:00 2001 From: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com> Date: Tue, 26 Nov 2024 10:37:33 +0530 Subject: [PATCH 11/19] MOSIP-37793 - Update the Readme file Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com> --- apitest-commons/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apitest-commons/README.md b/apitest-commons/README.md index 7db79cce81..8997541b1a 100644 --- a/apitest-commons/README.md +++ b/apitest-commons/README.md @@ -52,8 +52,7 @@ Ensure the following software is installed on the machine from where the automat ## Update the property file 1. Navigate to the kernel.properties file located at: - sh - `mosip-functional-tests\apitest-commons\src\main\resources\config\kernel.properties` + `sh mosip-functional-tests\apitest-commons\src\main\resources\config\kernel.properties` 2. Open the file in your preferred editor 3. Update the client secret values and other required credentials as per your environment From c54734abb51e9617ed0d6f4813ef7aa92efbbaf0 Mon Sep 17 00:00:00 2001 From: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com> Date: Tue, 26 Nov 2024 10:43:33 +0530 Subject: [PATCH 12/19] MOSIP-37793 - Update the Readme file Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com> --- apitest-commons/README.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/apitest-commons/README.md b/apitest-commons/README.md index 8997541b1a..3dc59e5e91 100644 --- a/apitest-commons/README.md +++ b/apitest-commons/README.md @@ -52,15 +52,18 @@ Ensure the following software is installed on the machine from where the automat ## Update the property file 1. Navigate to the kernel.properties file located at: - `sh mosip-functional-tests\apitest-commons\src\main\resources\config\kernel.properties` + ```sh + mosip-functional-tests\apitest-commons\src\main\resources\config\kernel.properties 2. Open the file in your preferred editor 3. Update the client secret values and other required credentials as per your environment ## Build Test Automation Code 1. Navigate to the apitest-commons directory: -2. `cd mosip-functional-tests/apitest-commons/` -3. Run the following Maven command: -4. `mvn clean install -Dgpg.skip=true -Dmaven.gitcommitid.skip=true` + ```sh + cd mosip-functional-tests/apitest-commons/ +2. Run the following Maven command: + ```sh + mvn clean install -Dgpg.skip=true -Dmaven.gitcommitid.skip=true ## License This project is licensed under the terms of [Mozilla Public License 2.0](https://github.com/mosip/mosip-platform/blob/master/LICENSE) From 47471a282724d12f38d70cc93f4618ed12b68e52 Mon Sep 17 00:00:00 2001 From: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com> Date: Tue, 26 Nov 2024 10:45:06 +0530 Subject: [PATCH 13/19] MOSIP-37793 - Update the Readme file Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com> --- apitest-commons/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apitest-commons/README.md b/apitest-commons/README.md index 3dc59e5e91..12e5048546 100644 --- a/apitest-commons/README.md +++ b/apitest-commons/README.md @@ -58,7 +58,7 @@ Ensure the following software is installed on the machine from where the automat 3. Update the client secret values and other required credentials as per your environment ## Build Test Automation Code -1. Navigate to the apitest-commons directory: +1. From the already opened Git Bash, navigate to the apitest-commons directory: ```sh cd mosip-functional-tests/apitest-commons/ 2. Run the following Maven command: From 8b1fa4db507aecf8d94540ffcb0fe4caa3faa0e4 Mon Sep 17 00:00:00 2001 From: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com> Date: Tue, 26 Nov 2024 11:26:34 +0530 Subject: [PATCH 14/19] MOSIP-37793 - Update the Readme file Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com> --- README.md | 58 ++++++++++++++++++++++++++----------------------------- 1 file changed, 27 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index aceaa9cb93..657c019d17 100644 --- a/README.md +++ b/README.md @@ -1,47 +1,43 @@ # MOSIP Functional Tests -## Overview +The **`mosip-functional-tests`** repository contains the reusable **`apitest-commons`** library, which simplifies API testing with pre-built utilities and helpers. The **`apitest-commons`** can be used as a dependency in POM files for MOSIP testrigs of all the modules and can consume the reusable codes. -The API Test Rig Commons is a shared code base that is used for the execution of module-wise automation API tests. This uses Java REST Assured and TestNG frameworks to automate testing for different modules like Pre-registration, Masterdata, Partner Management, PMS, ID Repository, IDA, Resident, E-Signet, and Mimoto. +--- -## Pre-requisites +## Repository Structure -Ensure the following software is installed on the machine from where the automation tests will be executed: +This repository consists of: +1. **`apitest-commons`**: + - A reusable library for API testing. + - Released independently to [Maven Central](https://search.maven.org/) under the artifact ID `apitest-commons`. + - Includes its own [README](apitest-commons/README.md) for detailed instructions on setup and usage. -- Java 21 -- Maven 3.9.6 or higher -- Lombok (Refer to [Lombok Project](https://projectlombok.org/)) +--- -### For Windows +## Prerequisites -- Git Bash 2.18.0 or higher -- `settings.xml` needs to be present in the `.m2` folder. +To use this repository, ensure you have: +- **Java 21** or later installed ([download here](https://jdk.java.net/)). +- **Maven** ([installation guide](https://maven.apache.org/install.html)). +- Access to necessary MOSIP services or mocked test environments. -### For Linux +--- -- `settings.xml` file needs to be present in two places: - - Regular Maven conf folder - - Copy the same `settings.xml` under `/usr/local/maven/conf` +## Apitest Commons -## Access Test Automation Code +### Setting Up and Building the Project +- Refer to the ReadMe file [README](apitest-commons/README.md) -### From Browser +### Using it as dependency in the Project +- Add the following dependency in the POM of required project + ```sh + + org.mosip + apitest-commons + 1.3.0 + -1. Clone or download the repository as a zip file from [GitHub](https://github.com/mosip/mosip-functional-tests). -2. Unzip the contents. -3. Continue with the steps below from a terminal (Linux) or command prompt (Windows). - -### From Git Bash - -1. Copy the git link: `https://github.com/mosip/mosip-functional-tests` -2. On your local system, open Git Bash at any location. -3. Run the following command: - ```sh - git clone https://github.com/mosip/mosip-functional-tests - -## Build Test Automation Code -1. cd ../apitest-commons -2. `mvn clean install -Dgpg.skip=true -Dmaven.gitcommitid.skip=true` +--- ## License This project is licensed under the terms of [Mozilla Public License 2.0](https://github.com/mosip/mosip-platform/blob/master/LICENSE) From 959e44c2da69e816c22b545d63741bcbbc817886 Mon Sep 17 00:00:00 2001 From: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com> Date: Tue, 26 Nov 2024 11:59:31 +0530 Subject: [PATCH 15/19] MOSIP-37793 - Update the Readme file Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com> --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 657c019d17..eee49919d7 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,8 @@ This repository consists of: ## Prerequisites To use this repository, ensure you have: -- **Java 21** or later installed ([download here](https://jdk.java.net/)). -- **Maven** ([installation guide](https://maven.apache.org/install.html)). +- **Java 21** ([download here](https://jdk.java.net/)). +- **Maven 3.9.6** or higher ([installation guide](https://maven.apache.org/install.html)). - Access to necessary MOSIP services or mocked test environments. --- @@ -32,7 +32,7 @@ To use this repository, ensure you have: - Add the following dependency in the POM of required project ```sh - org.mosip + io.mosip.testrig.apirig.apitest.commons apitest-commons 1.3.0 From 3c8e1fbd15b1b610fd04e480de992db861585b05 Mon Sep 17 00:00:00 2001 From: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com> Date: Tue, 26 Nov 2024 11:59:48 +0530 Subject: [PATCH 16/19] MOSIP-37793 - Update the Readme file Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com> --- apitest-commons/README.md | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/apitest-commons/README.md b/apitest-commons/README.md index 12e5048546..60537aa052 100644 --- a/apitest-commons/README.md +++ b/apitest-commons/README.md @@ -15,13 +15,17 @@ The API Test Commons is a shared codebase used for executing module-wise automat - Mimoto - Inji-Certify +--- + ## Pre-requisites Ensure the following software is installed on the machine from where the automation tests will be executed: -- Java 21 -- Maven 3.9.6 or higher -- Lombok (Refer to [Lombok Project](https://projectlombok.org/)) +- **Java 21** ([download here](https://jdk.java.net/)). +- **Maven 3.9.6** or higher ([installation guide](https://maven.apache.org/install.html)). +- **Lombok** (Refer to [Lombok Project](https://projectlombok.org/)) + +--- ### For Windows @@ -34,6 +38,8 @@ Ensure the following software is installed on the machine from where the automat - Regular Maven conf folder - Copy the same `settings.xml` under `/usr/local/maven/conf` +--- + ## Access Test Automation Code ### From Browser @@ -50,6 +56,8 @@ Ensure the following software is installed on the machine from where the automat ```sh git clone https://github.com/mosip/mosip-functional-tests +--- + ## Update the property file 1. Navigate to the kernel.properties file located at: ```sh @@ -57,6 +65,8 @@ Ensure the following software is installed on the machine from where the automat 2. Open the file in your preferred editor 3. Update the client secret values and other required credentials as per your environment +--- + ## Build Test Automation Code 1. From the already opened Git Bash, navigate to the apitest-commons directory: ```sh @@ -65,5 +75,18 @@ Ensure the following software is installed on the machine from where the automat ```sh mvn clean install -Dgpg.skip=true -Dmaven.gitcommitid.skip=true +--- + +## Using Apitest Commons as a dependency in the Project +- Add the following dependency in the POM of required project + ```sh + + io.mosip.testrig.apirig.apitest.commons + apitest-commons + 1.3.0 + + +--- + ## License This project is licensed under the terms of [Mozilla Public License 2.0](https://github.com/mosip/mosip-platform/blob/master/LICENSE) From 61b8727272c6ed1440da237d01142ac40e1f4290 Mon Sep 17 00:00:00 2001 From: Nandhukumar Date: Tue, 26 Nov 2024 13:11:26 +0530 Subject: [PATCH 17/19] DSD-6075 Signed-off-by: Nandhukumar --- .../java/io/mosip/testrig/apirig/testrunner/HealthChecker.java | 1 + 1 file changed, 1 insertion(+) diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/testrunner/HealthChecker.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/testrunner/HealthChecker.java index 662af9fff3..8cfcafbb86 100644 --- a/apitest-commons/src/main/java/io/mosip/testrig/apirig/testrunner/HealthChecker.java +++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/testrunner/HealthChecker.java @@ -119,6 +119,7 @@ public void run() { public static String checkActuatorNoAuth(String actuatorURL) { Response response = null; + actuatorURL = GlobalMethods.addToServerEndPointMap(actuatorURL); response = given().contentType(ContentType.JSON).get(actuatorURL); if (response != null && response.getStatusCode() == 200) { logger.info(response.getBody().asString()); From 37cc4a03f8c6d745c26814b3d1cb16373941244b Mon Sep 17 00:00:00 2001 From: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com> Date: Tue, 26 Nov 2024 17:36:16 +0530 Subject: [PATCH 18/19] MOSIP-37793 - Update the Readme file Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com> --- apitest-commons/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/apitest-commons/README.md b/apitest-commons/README.md index 60537aa052..5f3324c2e0 100644 --- a/apitest-commons/README.md +++ b/apitest-commons/README.md @@ -24,6 +24,7 @@ Ensure the following software is installed on the machine from where the automat - **Java 21** ([download here](https://jdk.java.net/)). - **Maven 3.9.6** or higher ([installation guide](https://maven.apache.org/install.html)). - **Lombok** (Refer to [Lombok Project](https://projectlombok.org/)) +- **setting.xml** ([download here](https://github.com/mosip/mosip-functional-tests/blob/master/settings.xml)) --- From f117b855f5e675971a53522b129a8f20a869603a Mon Sep 17 00:00:00 2001 From: Nandhukumar Date: Thu, 28 Nov 2024 13:39:24 +0530 Subject: [PATCH 19/19] MOSIP-35404 Signed-off-by: Nandhukumar --- .../java/io/mosip/testrig/apirig/utils/GlobalMethods.java | 2 +- apitest-commons/src/main/resources/config/Kernel.properties | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/GlobalMethods.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/GlobalMethods.java index 4c03bea8b8..13d4a6c9a9 100644 --- a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/GlobalMethods.java +++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/GlobalMethods.java @@ -26,7 +26,7 @@ public class GlobalMethods { public static Set serverEndpoints = new HashSet<>(); // Define the regex pattern to extract the domain and the path after the domain - private static final String module_name = "(mimoto|partnermanager|preregistration|resident|residentmobileapp|masterdata|esignet|idgenerator|policymanager|idauthentication|idrepository|auditmanager|authmanager)"; + private static final String module_name = "(mimoto|certify|signup|partnermanager|preregistration|resident|residentmobileapp|masterdata|esignet|idgenerator|policymanager|idauthentication|idrepository|auditmanager|authmanager)"; private static final String regex_1 = "https://([^/]+)/(v[0-9]+)?/" + module_name + "/([^,]+)"; private static final String regex_2 = "https://([^/]+)/" + module_name + "/(v[0-9]+)/([^,]+)"; diff --git a/apitest-commons/src/main/resources/config/Kernel.properties b/apitest-commons/src/main/resources/config/Kernel.properties index b88adfcf24..d508aa1ae8 100644 --- a/apitest-commons/src/main/resources/config/Kernel.properties +++ b/apitest-commons/src/main/resources/config/Kernel.properties @@ -226,8 +226,8 @@ usePreConfiguredOtp=false # supported values yes or no. Assume that by Default e-signet is deployed eSignetDeployed=yes partnerUrlSuffix=oYf63Lax0DY2QkYMRHnrmDqhmO3RMWQagwm0ftgLlkuin1KOND/666/576732 -reportIgnoredTestCases=no -reportKnownIssueTestCases=no +reportIgnoredTestCases=yes +reportKnownIssueTestCases=yes servicesNotDeployed= esignetMockBaseURL=esignet-insurance. sunBirdBaseURL=registry