Skip to content

Commit

Permalink
Mosip 35353 (#433)
Browse files Browse the repository at this point in the history
* [MOSIP-34934] Updated Values.yaml

Signed-off-by: shubham_G <[email protected]>

* [INJIWEB-721] : update snapshot version for release 14.x (#405)

Signed-off-by: Vijay <[email protected]>

* [INJIMOB-1854] add validation for issuer wellknown response

Signed-off-by: Abhishek Paul <[email protected]>

* INJIMOB-1592

Signed-off-by: Nandhukumar <[email protected]>

* INJIMOB-1592

Signed-off-by: Nandhukumar <[email protected]>

* INJIMOB-1592

Signed-off-by: Nandhukumar <[email protected]>

* INJIMOB-1592 (#409)

* INJIMOB-1592

Signed-off-by: Nandhukumar <[email protected]>

* INJIMOB-1592

Signed-off-by: Nandhukumar <[email protected]>

* INJIMOB-1592

Signed-off-by: Nandhukumar <[email protected]>

---------

Signed-off-by: Nandhukumar <[email protected]>

* INJIMOB-1592

Signed-off-by: Nandhukumar <[email protected]>

* MOSIP-35353

Signed-off-by: Nandhukumar <[email protected]>

---------

Signed-off-by: shubham_G <[email protected]>
Signed-off-by: Vijay <[email protected]>
Signed-off-by: Abhishek Paul <[email protected]>
Signed-off-by: Nandhukumar <[email protected]>
Co-authored-by: shubham_G <[email protected]>
Co-authored-by: Vijay Kumar S <[email protected]>
Co-authored-by: Chandra Keshav Mishra <[email protected]>
Co-authored-by: Abhishek Paul <[email protected]>
  • Loading branch information
5 people committed Sep 10, 2024
1 parent 449c728 commit 35c759f
Show file tree
Hide file tree
Showing 34 changed files with 542 additions and 172 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/push-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ jobs:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_INJI_TEAM }}

build-maven-apitest-mimoto:
uses: mosip/kattu/.github/workflows/maven-build.yml@master-java21
uses: mosip/kattu/.github/workflows/maven-build.yml@master
with:
SERVICE_LOCATION: ./apitest
BUILD_ARTIFACT: apitest-mimoto
Expand All @@ -137,7 +137,7 @@ jobs:
publish_to_nexus_apitest_mimoto:
if: "${{ !contains(github.ref, 'master') && github.event_name != 'pull_request' && github.event_name != 'release' && github.event_name != 'prerelease' && github.event_name != 'publish' }}"
needs: build-maven-apitest-mimoto
uses: mosip/kattu/.github/workflows/maven-publish-to-nexus.yml@master-java21
uses: mosip/kattu/.github/workflows/maven-publish-to-nexus.yml@master
with:
SERVICE_LOCATION: ./apitest
secrets:
Expand All @@ -157,12 +157,12 @@ jobs:
SERVICE_LOCATION: apitest
BUILD_ARTIFACT: apitest-mimoto-local
steps:
- uses: actions/checkout@v3
- name: Set up JDK 21
uses: actions/setup-java@v3
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
distribution: 'temurin'
java-version: '21'
ref: ${{ github.ref }}
java-version: 11
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Setup the settings file for ossrh server
Expand Down Expand Up @@ -205,7 +205,7 @@ jobs:
ONLY_DOCKER: true
fail-fast: false
name: ${{ matrix.SERVICE_NAME }}
uses: mosip/kattu/.github/workflows/docker-build.yml@master-java21
uses: mosip/kattu/.github/workflows/docker-build.yml@master
with:
SERVICE_LOCATION: ${{ matrix.SERVICE_LOCATION }}
SERVICE_NAME: ${{ matrix.SERVICE_NAME }}
Expand All @@ -217,10 +217,11 @@ jobs:
RELEASE_DOCKER_HUB: ${{ secrets.RELEASE_DOCKER_HUB }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_INJI_TEAM }}

# Commenting out sonar check for api test as it will not work on JDK-11
# sonar_analysis_apitest_mimoto:
# needs: build-maven-apitest-mimoto
# if: "${{ github.event_name != 'pull_request' }}"
# uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master-java21
# uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master
# with:
# SERVICE_LOCATION: ./apitest
# secrets:
Expand Down
33 changes: 16 additions & 17 deletions apitest/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mosipdev/openjdk-21-jre:latest
FROM openjdk:11

ARG SOURCE
ARG COMMIT_HASH
Expand All @@ -23,38 +23,37 @@ ARG container_user_gid=1001

ARG KUBECTL_VERSION=1.22.9

# set working directory for the user
WORKDIR /home/${container_user}

ENV work_dir=/home/${container_user}

# Combine all necessary files into a single COPY command
COPY ./apitest/target $work_dir/
COPY application.properties $work_dir/
COPY ["Biometric Devices", "$work_dir/Biometric Devices"]
COPY ["resource", "$work_dir/resource"]
COPY entrypoint.sh $work_dir

# install packages and create user
RUN apt-get -y update \
&& apt-get install -y unzip jq curl \
&& groupadd -g ${container_user_gid} ${container_user_group} \
&& useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/bash -m ${container_user} \
&& curl -LO "https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl" \
&& mkdir -p /home/${container_user} \
&& chmod +x kubectl $work_dir/entrypoint.sh \
&& mv kubectl /usr/local/bin/ \
&& chown -R ${container_user}:${container_user} /home/${container_user} /etc/ssl/certs/java/cacerts \
&& chmod 644 /etc/ssl/certs/java/cacerts

# select container user for all tasks
RUN apt-get -y update && \
apt-get install -y unzip jq && \
groupadd -g ${container_user_gid} ${container_user_group} && \
useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/sh -m ${container_user} && \
curl -LO "https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl" && \
chmod +x kubectl && \
mv kubectl /usr/local/bin/ && \
chown -R ${container_user}:${container_user} /home/${container_user} /usr/local/openjdk-11/lib/security/cacerts && \
chmod 644 /usr/local/openjdk-11/lib/security/cacerts && \
chmod +x $work_dir/entrypoint.sh


USER ${container_user_uid}:${container_user_gid}

WORKDIR ${work_dir}

EXPOSE 8083

ENV MODULES=
ENV ENV_USER=
ENV ENV_ENDPOINT=
ENV ENV_TESTLEVEL=smokeAndRegression

ENTRYPOINT ["./entrypoint.sh"]
ENTRYPOINT ["./entrypoint.sh"]
10 changes: 5 additions & 5 deletions apitest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<name>apitest-mimoto</name>
<description>Parent project of apitest-mimoto</description>
<url>https://github.com/mosip/mimoto</url>
<version>1.2.1-java21-SNAPSHOT</version>
<version>0.13.0-SNAPSHOT</version>

<licenses>
<license>
Expand Down Expand Up @@ -37,8 +37,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<!-- maven -->
<maven.compiler.target>21</maven.compiler.target>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.version>3.8.0</maven.compiler.version>
<maven.jar.plugin.version>3.0.2</maven.jar.plugin.version>
<maven.war.plugin.version>3.1.0</maven.war.plugin.version>
Expand All @@ -49,14 +49,14 @@
<maven.source.plugin.version>2.2.1</maven.source.plugin.version>

<git.commit.id.plugin.version>3.0.1</git.commit.id.plugin.version>
<fileName>apitest-mimoto-1.2.1-java21-SNAPSHOT-jar-with-dependencies</fileName>
<fileName>apitest-mimoto-0.13.0-SNAPSHOT-jar-with-dependencies</fileName>
</properties>

<dependencies>
<dependency>
<groupId>io.mosip.testrig.apirig.apitest.commons</groupId>
<artifactId>apitest-commons</artifactId>
<version>1.2.1-java21-SNAPSHOT</version>
<version>1.2.1</version>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import io.mosip.testrig.apirig.utils.ConfigManager;
import io.mosip.testrig.apirig.utils.GlobalConstants;
import io.mosip.testrig.apirig.utils.KernelAuthentication;
import io.mosip.testrig.apirig.utils.MimotoUtil;
import io.mosip.testrig.apirig.utils.OutputValidationUtil;
import io.mosip.testrig.apirig.utils.ReportUtil;
import io.mosip.testrig.apirig.utils.RestClient;
Expand Down Expand Up @@ -97,7 +98,7 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad
new KernelAuthentication().getTokenByRole(testCaseDTO.getRole())).asString(),
"response.uin");

testCaseName = isTestCaseValidForExecution(testCaseDTO);
testCaseName = MimotoUtil.isTestCaseValidForExecution(testCaseDTO);

DateFormat dateFormatter = new SimpleDateFormat("yyyyMMddHHmmss");
Calendar cal = Calendar.getInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import io.mosip.testrig.apirig.utils.AuthenticationTestException;
import io.mosip.testrig.apirig.utils.ConfigManager;
import io.mosip.testrig.apirig.utils.GlobalConstants;
import io.mosip.testrig.apirig.utils.MimotoUtil;
import io.mosip.testrig.apirig.utils.OutputValidationUtil;
import io.mosip.testrig.apirig.utils.ReportUtil;
import io.restassured.response.Response;
Expand Down Expand Up @@ -77,7 +78,7 @@ public Object[] getTestCaseList(ITestContext context) {
@Test(dataProvider = "testcaselist")
public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException {
testCaseName = testCaseDTO.getTestCaseName();
testCaseName = isTestCaseValidForExecution(testCaseDTO);
testCaseName = MimotoUtil.isTestCaseValidForExecution(testCaseDTO);
if (HealthChecker.signalTerminateExecution) {
throw new SkipException(
GlobalConstants.TARGET_ENV_HEALTH_CHECK_FAILED + HealthChecker.healthCheckFailureMapS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import io.mosip.testrig.apirig.utils.AuthenticationTestException;
import io.mosip.testrig.apirig.utils.ConfigManager;
import io.mosip.testrig.apirig.utils.GlobalConstants;
import io.mosip.testrig.apirig.utils.MimotoUtil;
import io.mosip.testrig.apirig.utils.OutputValidationUtil;
import io.mosip.testrig.apirig.utils.ReportUtil;
import io.restassured.response.Response;
Expand Down Expand Up @@ -82,7 +83,7 @@ public Object[] getTestCaseList(ITestContext context) {
@Test(dataProvider = "testcaselist")
public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException {
testCaseName = testCaseDTO.getTestCaseName();
testCaseName = isTestCaseValidForExecution(testCaseDTO);
testCaseName = MimotoUtil.isTestCaseValidForExecution(testCaseDTO);
if (HealthChecker.signalTerminateExecution) {
throw new SkipException(
GlobalConstants.TARGET_ENV_HEALTH_CHECK_FAILED + HealthChecker.healthCheckFailureMapS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import io.mosip.testrig.apirig.utils.AuthenticationTestException;
import io.mosip.testrig.apirig.utils.ConfigManager;
import io.mosip.testrig.apirig.utils.GlobalConstants;
import io.mosip.testrig.apirig.utils.MimotoUtil;
import io.mosip.testrig.apirig.utils.OutputValidationUtil;
import io.mosip.testrig.apirig.utils.ReportUtil;
import io.restassured.response.Response;
Expand Down Expand Up @@ -95,7 +96,7 @@ public void test(TestCaseDTO testCaseDTO)
throw new SkipException(GlobalConstants.VID_FEATURE_NOT_SUPPORTED);
}
}
testCaseName = isTestCaseValidForExecution(testCaseDTO);
testCaseName = MimotoUtil.isTestCaseValidForExecution(testCaseDTO);
JSONObject req = new JSONObject(testCaseDTO.getInput());

auditLogCheck = testCaseDTO.isAuditLogCheck();
Expand Down Expand Up @@ -184,8 +185,13 @@ public void test(TestCaseDTO testCaseDTO)
throw new SkipException("esignet is not deployed hence skipping the testcase");
}
String tempUrl = ConfigManager.getEsignetBaseUrl();
String inputJson = getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate());
inputJson = inputJsonKeyWordHandeler(inputJson, testCaseName);
inputJson = MimotoUtil.getOTPFromSMTP(inputJson, testCaseDTO);


response = postRequestWithCookieAuthHeaderAndXsrfTokenForAutoGenId(tempUrl + testCaseDTO.getEndPoint(),
getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()), COOKIENAME,
inputJson, COOKIENAME,
testCaseDTO.getTestCaseName(), idKeyName);
} else {
response = postWithBodyAndCookieForAutoGeneratedId(ApplnURI + testCaseDTO.getEndPoint(),
Expand Down Expand Up @@ -226,7 +232,7 @@ public void setResultTestName(ITestResult result) {
@AfterClass(alwaysRun = true)
public void waittime() {
if (!testCaseName.contains(GlobalConstants._AUTHENTICATEUSER)
&& isOTPEnabled().equals("true")) {
&& MimotoUtil.isOTPEnabled().equals("true")) {
try {
long delayTime = Long.parseLong(properties.getProperty("Delaytime"));
if (!BaseTestCase.isTargetEnvLTS())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import io.mosip.testrig.apirig.utils.AuthenticationTestException;
import io.mosip.testrig.apirig.utils.ConfigManager;
import io.mosip.testrig.apirig.utils.GlobalConstants;
import io.mosip.testrig.apirig.utils.MimotoUtil;
import io.mosip.testrig.apirig.utils.OutputValidationUtil;
import io.mosip.testrig.apirig.utils.ReportUtil;
import io.restassured.response.Response;
Expand Down Expand Up @@ -91,7 +92,7 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad
}
}

testCaseName = isTestCaseValidForExecution(testCaseDTO);
testCaseName = MimotoUtil.isTestCaseValidForExecution(testCaseDTO);
auditLogCheck = testCaseDTO.isAuditLogCheck();
String tempUrl = ConfigManager.getEsignetBaseUrl();
JSONObject req = new JSONObject(testCaseDTO.getInput());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import io.mosip.testrig.apirig.utils.ConfigManager;
import io.mosip.testrig.apirig.utils.GlobalConstants;
import io.mosip.testrig.apirig.utils.GlobalMethods;
import io.mosip.testrig.apirig.utils.MimotoUtil;
import io.restassured.response.Response;

public class PostWithFormDataBodyForPdfDownload extends AdminTestUtil implements ITest {
Expand Down Expand Up @@ -80,7 +81,7 @@ public Object[] getTestCaseList(ITestContext context) {
@Test(dataProvider = "testcaselist")
public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException {
testCaseName = testCaseDTO.getTestCaseName();
testCaseName = isTestCaseValidForExecution(testCaseDTO);
testCaseName = MimotoUtil.isTestCaseValidForExecution(testCaseDTO);
if (HealthChecker.signalTerminateExecution) {
throw new SkipException(GlobalConstants.TARGET_ENV_HEALTH_CHECK_FAILED + HealthChecker.healthCheckFailureMapS);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import io.mosip.testrig.apirig.utils.AuthenticationTestException;
import io.mosip.testrig.apirig.utils.ConfigManager;
import io.mosip.testrig.apirig.utils.GlobalConstants;
import io.mosip.testrig.apirig.utils.MimotoUtil;
import io.mosip.testrig.apirig.utils.OutputValidationUtil;
import io.mosip.testrig.apirig.utils.ReportUtil;
import io.restassured.response.Response;
Expand Down Expand Up @@ -82,7 +83,7 @@ public Object[] getTestCaseList(ITestContext context) {
@Test(dataProvider = "testcaselist")
public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException {
testCaseName = testCaseDTO.getTestCaseName();
testCaseName = isTestCaseValidForExecution(testCaseDTO);
testCaseName = MimotoUtil.isTestCaseValidForExecution(testCaseDTO);
auditLogCheck = testCaseDTO.isAuditLogCheck();
String[] templateFields = testCaseDTO.getTemplateFields();
if (HealthChecker.signalTerminateExecution) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import io.mosip.testrig.apirig.utils.AuthenticationTestException;
import io.mosip.testrig.apirig.utils.ConfigManager;
import io.mosip.testrig.apirig.utils.GlobalConstants;
import io.mosip.testrig.apirig.utils.MimotoUtil;
import io.mosip.testrig.apirig.utils.OutputValidationUtil;
import io.mosip.testrig.apirig.utils.ReportUtil;
import io.restassured.response.Response;
Expand Down Expand Up @@ -98,7 +99,7 @@ public void test(TestCaseDTO testCaseDTO)
}
}

testCaseName = isTestCaseValidForExecution(testCaseDTO);
testCaseName = MimotoUtil.isTestCaseValidForExecution(testCaseDTO);
String[] templateFields = testCaseDTO.getTemplateFields();
String inputJson = "";

Expand Down Expand Up @@ -153,6 +154,11 @@ public void test(TestCaseDTO testCaseDTO)
//tempUrl = ApplnURI.replace(GlobalConstants.API_INTERNAL, ConfigManager.getSunBirdBaseURL());
testCaseDTO.setEndPoint(testCaseDTO.getEndPoint().replace("$SUNBIRDBASEURL$", ""));
}

if (inputJson.contains("$GETCLIENTIDFROMMIMOTOACTUATOR$")) {
inputJson = replaceKeywordWithValue(inputJson, "$GETCLIENTIDFROMMIMOTOACTUATOR$",
getValueFromMimotoActuator("overrides", "mimoto.oidc.partner.clientid"));
}
if (testCaseName.contains("_AuthorizationCode_")) {
response = postRequestWithCookieAuthHeaderAndXsrfTokenForAutoGenId(
tempUrl + testCaseDTO.getEndPoint(), inputJson, COOKIENAME, testCaseDTO.getTestCaseName(),
Expand Down
Loading

0 comments on commit 35c759f

Please sign in to comment.