diff --git a/.github/workflows/apitest-push-trigger.yml b/.github/workflows/apitest-push-trigger.yml index 1a18bd92f5..d705909de1 100644 --- a/.github/workflows/apitest-push-trigger.yml +++ b/.github/workflows/apitest-push-trigger.yml @@ -24,7 +24,7 @@ on: jobs: build-maven-apitest-commons: - uses: mosip/kattu/.github/workflows/maven-build.yml@master + uses: mosip/kattu/.github/workflows/maven-build.yml@master-java21 with: SERVICE_LOCATION: ./apitest-commons BUILD_ARTIFACT: apitest-commons @@ -38,7 +38,7 @@ jobs: publish_to_nexus: 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-commons - uses: mosip/kattu/.github/workflows/maven-publish-to-nexus.yml@master + uses: mosip/kattu/.github/workflows/maven-publish-to-nexus.yml@master-java21 with: SERVICE_LOCATION: ./apitest-commons secrets: @@ -49,23 +49,22 @@ jobs: GPG_SECRET: ${{ secrets.GPG_SECRET }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} -# api test commons is not migrated to java 21 so commenting out for now so that auth demo service sonar will work. - -# sonar_analysis: -# needs: build-maven-apitest-commons -# if: "${{ github.event_name != 'pull_request' }}" -# uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master -# with: -# SERVICE_LOCATION: ./apitest-commons -# secrets: -# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} -# ORG_KEY: ${{ secrets.ORG_KEY }} -# OSSRH_USER: ${{ secrets.OSSRH_USER }} -# OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }} -# OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} -# GPG_SECRET: ${{ secrets.GPG_SECRET }} -# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} + sonar_analysis: + needs: build-maven-apitest-commons + if: "${{ github.event_name != 'pull_request' }}" + uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master-java21 + with: + SERVICE_LOCATION: ./apitest-commons + secrets: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + ORG_KEY: ${{ secrets.ORG_KEY }} + OSSRH_USER: ${{ secrets.OSSRH_USER }} + OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }} + OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} + GPG_SECRET: ${{ secrets.GPG_SECRET }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} + build-maven-authentication-demo-service: uses: mosip/kattu/.github/workflows/maven-build.yml@master-java21 with: @@ -91,4 +90,4 @@ jobs: OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }} OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} GPG_SECRET: ${{ secrets.GPG_SECRET }} - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} \ No newline at end of file diff --git a/apitest-commons/pom.xml b/apitest-commons/pom.xml index de8143482a..c164141095 100644 --- a/apitest-commons/pom.xml +++ b/apitest-commons/pom.xml @@ -33,186 +33,66 @@ - - - UTF-8 - 1.2.0.1 + 1.2.1-SNAPSHOT - 11 - 11 - 3.7.0 + 21 + 21 + 3.8.0 3.0.2 3.1.0 - 2.9 - 0.8.1 - 3.2 - 3.0.1 - 2.3 - false 3.7.0.1746 - - 2.0.2.RELEASE - 2.0.7.RELEASE - 5.0.5.RELEASE - 2.0.0.RELEASE - - 2.0.7 - 1.5.20 - 2.9.2 - - 3.6.2 - 3.7.0 - - - - 1.2 - 3.0.0 - 1.3 - 2.2 - 2.0.1.Final - 2.2.6 - - - 1.4.197 - 5.1.46 - 42.2.2 - 2.5.0 - 6.0.12.Final - - - 1.10.19 - 1.7.4 - 2.0.0-beta.5 - - - 1.2.3 - 1.7.19 - 2.16.0 - 1.7.25 - - - 2.9.5 - 20180130 - 2.2.10 - 20180130 - 3.6.1 - 3.7 - 2.6 - 1.11 - 4.3 + 1.15 1.9.2 - 2.2 - 4.5.6 - 19.0 - 1.18.8 - 0.1.54 - 1.4.0 - 7.1.0 - 2.0.0 - 5.5.13 - 2.3.23 1.7 - 2.0 - 1.5.2 - 2.1.1 - 63.1 - 1.0.0 - 3.3.3 2.8.1 - 4.1.0-incubating 1.11.368 - 0.2.4 - 2.3.0 - 3.0.1 - 1.9.12 - 0.6.0 - 2.0.0.AM2 - - - - - - - - 0.8.2 - 2.2 - 3.2 - UTF-8 - 3.7.0 - 3.0.1 - - - 1.1.6 - 1.7.19 - 1.10.19 - - - 1.4.6 - - - 5.0.6.RELEASE - 5.4.2.Final - - - 2.1.1 - - - 10.13.1.1 - - - 3.4.0 - - - 1.3.5 - - - 0.3.12 - - - 0.3.0 + 6.5.2.Final 1.1.2-incubating - 1.2.0.1-B1 + 1.2.1-SNAPSHOT 0.4.7 3.0.0 2.41.2 - 2.4.0 3.3.9 - 3.0.7 6.11 1.13 apitest-commons-1.2.2-SNAPSHOT-jar-with-dependencies + + + junit + junit + test + com.opencsv opencsv 4.1 - - - - com.slack.api - slack-api-client - 1.6.1-RC1 - + + + com.slack.api + slack-api-client + 1.6.1-RC1 + com.ibm.icu icu4j - 68.1 + ${icu4j.version} org.keycloak @@ -223,7 +103,6 @@ org.javassist javassist - 3.25.0-GA - - com.fasterxml.jackson.core - jackson-databind - 2.12.1 - + + com.fasterxml.jackson.core + jackson-databind + com.fasterxml.jackson.core jackson-annotations - 2.12.1 com.fasterxml.jackson.dataformat jackson-dataformat-xml - ${jackson.version} org.json json - ${json.version} com.googlecode.json-simple json-simple - 1.1.1 com.google.code.gson gson - 2.8.4 org.apache.maven.plugins @@ -338,7 +206,6 @@ com.google.guava guava - ${guava.version} @@ -354,60 +221,46 @@ javax.validation validation-api - ${javax.validation-api.version} io.swagger swagger-annotations - ${swagger.annotations.version} com.fasterxml.jackson.datatype jackson-datatype-jsr310 - ${jackson.version} org.postgresql postgresql - ${postgresql.version} org.slf4j slf4j-log4j12 - 1.6.2 org.apache.logging.log4j log4j-api - 2.11.1 net.lingala.zip4j zip4j 1.3.2 - - com.ibm.icu - icu4j - ${icu4j.version} - + com.jamesmurty.utils java-xmlbuilder 1.1 - org.apache.httpcomponents httpclient - 4.5.14 - org.apache.httpcomponents - httpcore - 4.4.16 + org.apache.httpcomponents + httpcore - org.apache.hadoop hadoop-client @@ -420,19 +273,15 @@ - - commons-codec commons-codec - ${commons-codec} commons-io commons-io - ${commons-io} com.google.zxing @@ -468,47 +317,36 @@ itextpdf 5.5.13 - + - de.mkammerer - argon2-jvm - 2.9.1 - - - - com.github.mifmif - generex - 1.0.2 - + de.mkammerer + argon2-jvm + 2.9.1 + + + + com.github.mifmif + generex + 1.0.2 + javax.mail javax.mail-api 1.6.2 - - - io.mosip.kernel - kernel-core - ${kernel.version} - - - org.bouncycastle - bcprov-jdk15on - - - org.bouncycastle - bcpkix-jdk15on - - - + io.mosip.kernel kernel-registration-packet-manager 1.1.5.3 + + org.springframework + spring-expression + org.bouncycastle bcprov-jdk15on @@ -534,101 +372,109 @@ org.apache.activemq activemq-broker - 5.15.9 org.projectlombok lombok - 1.18.32 provided - - org.bouncycastle - bcprov-jdk15on - 1.70 - - - org.bouncycastle - bcpkix-jdk15on - 1.70 - + + org.springframework.boot + spring-boot-starter-batch + + + org.hibernate.validator + hibernate-validator + + + org.bouncycastle + bcprov-jdk15on + 1.70 + + + org.bouncycastle + bcpkix-jdk15on + 1.70 + io.mosip.mock.mds mock-mds - 1.2.0.2 + 1.2.1-SNAPSHOT + + + javax.xml.bind + jaxb-api + + + io.mosip.authentication + authentication-core + 1.2.0.1-B3 + + + commons-codec + commons-codec + + + + + + io.mosip.kernel + kernel-core + ${kernel.version} + + + org.springframework.boot + spring-boot-starter-security + + + commons-codec + commons-codec + + + org.bouncycastle + bcprov-jdk15on + + + org.bouncycastle + bcpkix-jdk15on + + + + + io.mosip.kernel + kernel-websubclient-api + ${kernel-websubclient-api.version} + + + + io.mosip.kernel + kernel-templatemanager-velocity + 1.2.1-SNAPSHOT + + + + io.mosip.kernel + kernel-keymanager-service + 1.2.1-SNAPSHOT + lib + + + org.springframework.boot + spring-boot-starter-security + + + org.bouncycastle + bcprov-jdk15on + + + org.bouncycastle + bcpkix-jdk15on + + - - - javax.xml.bind - jaxb-api - 2.3.1 - - - io.mosip.authentication - authentication-core - 1.2.0.1-B3 - - - commons-codec - commons-codec - - - - - - io.mosip.kernel - kernel-core - 1.2.0.1 - - - org.springframework.boot - - spring-boot-starter-security - - - - commons-codec - commons-codec - - - - - io.mosip.kernel - kernel-websubclient-api - ${kernel-websubclient-api.version} - - - - io.mosip.kernel - kernel-templatemanager-velocity - 1.2.0.1 - - - - io.mosip.kernel - kernel-keymanager-service - 1.2.0.1 - lib - - - org.springframework.boot - - spring-boot-starter-security - - - - org.bouncycastle - bcprov-jdk15on - - - org.bouncycastle - bcpkix-jdk15on - - - - + @@ -640,7 +486,14 @@ commons-codec commons-codec - 1.15 + ${commons-codec} + + + io.mosip.kernel + kernel-bom + 1.2.1-SNAPSHOT + pom + import @@ -648,14 +501,6 @@ - - org.apache.maven.plugins - maven-compiler-plugin - - 11 - 11 - - @@ -675,163 +520,167 @@ + org.apache.maven.plugins maven-compiler-plugin - 3.5.1 + ${maven.compiler.version} - 11 - 11 + ${maven.compiler.source} + ${maven.compiler.target} -Dfile.encoding=UTF-8 - - org.apache.maven.plugins - maven-javadoc-plugin - 3.2.0 - - none - - - pl.project13.maven - git-commit-id-plugin - 3.0.1 - - - populate-git-commit-information - - revision - - - true - MM/dd/yyyy HH:mm:ss Z - 8 - true - ${project.build.outputDirectory}/git.properties - - - - - ${project.basedir}/.git - - + org.apache.maven.plugins + maven-javadoc-plugin + 3.2.0 + + none + + + + pl.project13.maven + git-commit-id-plugin + 3.0.1 + + + populate-git-commit-information + + revision + + + true + MM/dd/yyyy HH:mm:ss Z + 8 + true + ${project.build.outputDirectory}/git.properties + + + + + ${project.basedir}/.git + + - org.apache.maven.plugins - maven-gpg-plugin - 1.5 - - - sign-artifacts - verify - - sign - - - - --pinentry-mode - loopback - - - - + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + --pinentry-mode + loopback + + + + - - org.apache.maven.plugins - maven-shade-plugin - 3.2.4 - - - - shade - - - ${fileName} - - - - - - io.mosip.testrig.apirig.testrunner.MosipTestRunner - - - - - - *:* - - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - ${maven.jar.plugin.version} - - - - true - true - - - ${project.name} - ${project.version} - ${user.name} - ${os.name} - ${maven.build.timestamp} - ${env.BUILD_NUMBER} - ${env.BUILD_ID} - ${env.BUILD_URL} - - - - - - org.apache.maven.plugins - maven-war-plugin - ${maven.war.plugin.version} - - - - true - true - - - ${project.name} - ${project.version} - ${user.name} - ${os.name} - ${maven.build.timestamp} - ${env.BUILD_NUMBER} - ${env.BUILD_ID} - ${env.BUILD_URL} - - - - - - org.apache.maven.plugins - maven-source-plugin - 2.2.1 - - - attach-sources - - jar-no-fork - - - - + + org.apache.maven.plugins + maven-shade-plugin + 3.2.4 + + + + shade + + + ${fileName} + + + + + + + io.mosip.testrig.apirig.testrunner.MosipTestRunner + + + + + + *:* + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + ${maven.jar.plugin.version} + + + + true + true + + + ${project.name} + ${project.version} + ${user.name} + ${os.name} + ${maven.build.timestamp} + ${env.BUILD_NUMBER} + ${env.BUILD_ID} + ${env.BUILD_URL} + + + + + + org.apache.maven.plugins + maven-war-plugin + ${maven.war.plugin.version} + + + + true + true + + + ${project.name} + ${project.version} + ${user.name} + ${os.name} + ${maven.build.timestamp} + ${env.BUILD_NUMBER} + ${env.BUILD_ID} + ${env.BUILD_URL} + + + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + org.apache.maven.plugins maven-antrun-plugin @@ -854,35 +703,35 @@ - - - sonar - - . - src/main/java/**,src/main/resources/** - ${sonar.coverage.exclusions} - https://sonarcloud.io - - - false - - - - - org.sonarsource.scanner.maven - sonar-maven-plugin - ${maven.sonar.plugin.version} - - - verify - - sonar - - - - - - - - - + + + sonar + + . + src/main/java/**,src/main/resources/** + ${sonar.coverage.exclusions} + https://sonarcloud.io + + + false + + + + + org.sonarsource.scanner.maven + sonar-maven-plugin + ${maven.sonar.plugin.version} + + + verify + + sonar + + + + + + + + + \ No newline at end of file diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/BiometricDataProvider.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/BiometricDataProvider.java index 461a6e57e8..871201572c 100644 --- a/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/BiometricDataProvider.java +++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/dataprovider/BiometricDataProvider.java @@ -45,11 +45,11 @@ import io.mosip.testrig.apirig.dataprovider.util.DataProviderConstants; import io.mosip.testrig.apirig.dataprovider.util.FPClassDistribution; import io.mosip.testrig.apirig.testrunner.BaseTestCase; +import io.mosip.testrig.apirig.testrunner.MosipTestRunner; import io.mosip.testrig.apirig.utils.RestClient; import io.restassured.response.Response; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.apache.log4j.Logger; import org.xml.sax.SAXException; import com.fasterxml.jackson.databind.JsonNode; @@ -64,7 +64,7 @@ public class BiometricDataProvider { public static HashMap portmap = new HashMap(); - private static final Logger logger = LoggerFactory.getLogger(BiometricDataProvider.class); + private static final Logger logger = Logger.getLogger(BiometricDataProvider.class); // String constants private static final String XMLNS = "xmlns"; @@ -134,7 +134,7 @@ public static String toBase64Url(String input) { public static Boolean generateBiometricTestData(String mdsMode) throws Exception { ResidentModel resident = new ResidentModel(); String cbeff = null; - MDSRCaptureModel capture = BiometricDataProvider.regenBiometricViaMDS(resident, mdsMode, "70"); + MDSRCaptureModel capture = BiometricDataProvider.regenBiometricViaMDS(resident, mdsMode, 70); if (capture == null) { logger.error("Failed to generate biometric via mds"); return false; @@ -203,7 +203,7 @@ static String buildBirIris(String irisInfo, String irisName, String jtwSign, Str .t("1").up().up().e(BIRINFO).e(INTEGRITY).t(FALSE).up().up().e(BDBINFO).e(FORMAT).e(ORGANIZATION) .t(MOSIP).up().e("Type").t("9").up().up().e(CREATIONDATE).t(today).up().e("Type").t("Iris").up() .e(SUBTYPE).t(irisName).up().e(LEVEL).t("Raw").up().e(PURPOSE).t(ENROLL).up().e(QUALITY).e(ALGORITHM) - .e(ORGANIZATION).t("HMAC").up().e("Type").t(SHA_256).up().up().e(SCORE).t(qualityScore).up().up().up() + .e(ORGANIZATION).t("HMAC").up().e("Type").t(SHA_256).up().up().e(SCORE).t((int) Math.round(Double.parseDouble(qualityScore)) + "").up().up().up() .e("BDB").t(getBase64EncodedStringFromBase64URL(irisInfo)).up().up(); if (jtwSign != null && payload != null) { jtwSign = Base64.getEncoder().encodeToString(jtwSign.getBytes()); @@ -235,7 +235,7 @@ static String buildBirFinger(String fingerInfo, String fingerName, String jtwSig .up().up().e(BIRINFO).e(INTEGRITY).t(FALSE).up().up().e(BDBINFO).e(FORMAT).e(ORGANIZATION).t(MOSIP).up() .e("Type").t("7").up().up().e(CREATIONDATE).t(today).up().e("Type").t("Finger").up().e(SUBTYPE) .t(fingerName).up().e(LEVEL).t("Raw").up().e(PURPOSE).t(ENROLL).up().e(QUALITY).e(ALGORITHM) - .e(ORGANIZATION).t("HMAC").up().e("Type").t(SHA_256).up().up().e(SCORE).t(qualityScore).up().up().up() + .e(ORGANIZATION).t("HMAC").up().e("Type").t(SHA_256).up().up().e(SCORE).t((int) Math.round(Double.parseDouble(qualityScore)) + "").up().up().up() .e(bdbKey).t(getBase64EncodedStringFromBase64URL(fingerInfo)).up().up(); if (jtwSign != null && payload != null) { jtwSign = Base64.getEncoder().encodeToString(jtwSign.getBytes()); @@ -257,7 +257,7 @@ static String buildBirFace(String faceInfo, String jtwSign, String payload, Stri .t("1").up().up().e(BIRINFO).e(INTEGRITY).t(FALSE).up().up().e(BDBINFO).e(FORMAT).e(ORGANIZATION) .t(MOSIP).up().e("Type").t("8").up().up().e(CREATIONDATE).t(today).up().e("Type").t("Face").up() .e(SUBTYPE).t("").up().e(LEVEL).t("Raw").up().e(PURPOSE).t(ENROLL).up().e(QUALITY).e(ALGORITHM) - .e(ORGANIZATION).t("HMAC").up().e("Type").t(SHA_256).up().up().e(SCORE).t(qualityScore).up().up().up() + .e(ORGANIZATION).t("HMAC").up().e("Type").t(SHA_256).up().up().e(SCORE).t((int) Math.round(Double.parseDouble(qualityScore)) + "").up().up().up() .e("BDB").t(getBase64EncodedStringFromBase64URL(faceInfo)).up().up(); if (jtwSign != null && payload != null) { jtwSign = Base64.getEncoder().encodeToString(jtwSign.getBytes()); @@ -280,7 +280,7 @@ static String buildBirExceptionPhoto(String faceInfo, String jtwSign, String pay .t("1").up().up().e(BIRINFO).e(INTEGRITY).t(FALSE).up().up().e(BDBINFO).e(FORMAT).e(ORGANIZATION) .t(MOSIP).up().e("Type").t("8").up().up().e(CREATIONDATE).t(today).up().e("Type").t("ExceptionPhoto") .up().e(SUBTYPE).t("").up().e(LEVEL).t("Raw").up().e(PURPOSE).t(ENROLL).up().e(QUALITY).e(ALGORITHM) - .e(ORGANIZATION).t("HMAC").up().e("Type").t(SHA_256).up().up().e(SCORE).t(qualityScore).up().up().up() + .e(ORGANIZATION).t("HMAC").up().e("Type").t(SHA_256).up().up().e(SCORE).t((int) Math.round(Double.parseDouble(qualityScore)) + "").up().up().up() .e("BDB").t(faceInfo).up().up(); if (jtwSign != null && payload != null) { jtwSign = Base64.getEncoder().encodeToString(jtwSign.getBytes()); @@ -305,7 +305,7 @@ public static List getModalitiesByType(List bioExcepti return lst; } - public static void setMDSscore(long port, String type, String qualityScore) { + public static void setMDSscore(long port, String type, int qualityScore) { try { String requestBody = "{\"type\":\"" + type + "\",\"qualityScore\":\"" + qualityScore @@ -344,7 +344,7 @@ public static String getKeysDirPath(String certsDir, String moduleName) { return certsTargetDir + File.separator + certsModuleName + "-IDA-" + System.getProperty("env.user")+ ".mosip.net"; } - public static MDSRCaptureModel regenBiometricViaMDS(ResidentModel resident, String mdsMode, String qualityScore) + public static MDSRCaptureModel regenBiometricViaMDS(ResidentModel resident, String mdsMode, int qualityScore) throws Exception { BiometricDataModel biodata = null; MDSRCaptureModel capture = null; @@ -373,7 +373,7 @@ public static MDSRCaptureModel regenBiometricViaMDS(ResidentModel resident, Stri logger.error("Exception occured during startSBI " + contextKey, e); } if (port != 0) { - logger.info(contextKey, "Found the port " + contextKey + " port number is: " + port); + logger.info(contextKey + ", Found the port " + contextKey + " port number is: " + port); break; } @@ -394,7 +394,7 @@ public static MDSRCaptureModel regenBiometricViaMDS(ResidentModel resident, Stri HashMap portAsPerKey = BiometricDataProvider.portmap; setMDSscore(portAsPerKey.get("port_"), "Biometric Device", qualityScore); - logger.info(contextKey, "mds score is changed to : " + qualityScore); + logger.info(contextKey + ", mds score is changed to : " + qualityScore); // biodata = resident.getBiometric(); // This condition will address those scenarios where we are not passing any biometrics 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 fcee1a42dc..36b9221714 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 @@ -1,8 +1,7 @@ package io.mosip.testrig.apirig.utils; import static io.restassured.RestAssured.given; -import de.mkammerer.argon2.Argon2; -import de.mkammerer.argon2.Argon2Factory; + import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.BufferedWriter; @@ -17,6 +16,7 @@ import java.io.OutputStreamWriter; import java.io.StringReader; import java.lang.reflect.Type; +import java.math.BigDecimal; import java.math.BigInteger; import java.net.URI; import java.net.URISyntaxException; @@ -33,8 +33,6 @@ import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; -import java.security.interfaces.RSAPrivateKey; -import java.security.interfaces.RSAPublicKey; import java.text.SimpleDateFormat; import java.time.Instant; import java.time.LocalDate; @@ -56,6 +54,8 @@ import java.util.Set; import java.util.TimeZone; import java.util.UUID; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import java.util.stream.Collectors; import javax.ws.rs.core.MediaType; @@ -79,9 +79,7 @@ import org.testng.SkipException; import org.yaml.snakeyaml.Yaml; -import java.lang.Double; import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.github.jknack.handlebars.Context; import com.github.jknack.handlebars.Handlebars; @@ -119,8 +117,6 @@ import io.restassured.RestAssured; import io.restassured.http.ContentType; import io.restassured.response.Response; -import java.util.regex.Matcher; -import java.util.regex.Pattern; /** * @author Ravi Kant @@ -2738,9 +2734,8 @@ public String getAutogenIdKeyName(String testCaseName, String fieldName) { return null; int indexof = testCaseName.indexOf("_"); String autogenIdKeyName = testCaseName.substring(indexof + 1); - if ((!BaseTestCase.isTargetEnvLTS() || isOTPEnabled().equals("false")) && fieldName.equals("VID") - && (BaseTestCase.currentModule.equals("auth") || BaseTestCase.currentModule.equals("esignet") - || BaseTestCase.currentModule.equals(GlobalConstants.MIMOTO))) + if ((!BaseTestCase.isTargetEnvLTS()) && fieldName.equals("VID") + && (BaseTestCase.currentModule.equals("auth") || BaseTestCase.currentModule.equals("esignet"))) autogenIdKeyName = autogenIdKeyName + "_" + fieldName.toLowerCase(); else autogenIdKeyName = autogenIdKeyName + "_" + fieldName; @@ -3398,10 +3393,6 @@ public String inputJsonKeyWordHandeler(String jsonString, String testCaseName) { jsonString = replaceKeywordWithValue(jsonString, "$DOB$", getValueFromActuator(GlobalConstants.RESIDENT_DEFAULT_PROPERTIES, "mosip.date-of-birth.pattern")); } - if (jsonString.contains("$GETCLIENTIDFROMMIMOTOACTUATOR$")) { - jsonString = replaceKeywordWithValue(jsonString, "$GETCLIENTIDFROMMIMOTOACTUATOR$", - getValueFromMimotoActuator("overrides", "mimoto.oidc.partner.clientid")); - } if (jsonString.contains("$IDPREDIRECTURI$")) { jsonString = replaceKeywordWithValue(jsonString, "$IDPREDIRECTURI$", ApplnURI.replace(GlobalConstants.API_INTERNAL, "healthservices") + "/userprofile"); @@ -5166,7 +5157,7 @@ else if (eachRequiredProp.equals("password")) { } } } - if (selectedHandles != null) { + if (selectedHandles != null && selectedHandles.size()>=1) { setfoundHandlesInIdSchema(true); identityJson.put("selectedHandles", selectedHandles); } @@ -5725,7 +5716,7 @@ public static String generateHbsForPrereg(boolean isItUpdate) { org.json.JSONObject responseJson = new org.json.JSONObject(response.asString()); org.json.JSONObject schemaData = (org.json.JSONObject) responseJson.get(GlobalConstants.RESPONSE); - Double schemaVersion = (Double) schemaData.get(GlobalConstants.ID_VERSION); + Double schemaVersion = ((BigDecimal) schemaData.get(GlobalConstants.ID_VERSION)).doubleValue(); logger.info(schemaVersion); String schemaJsonData = schemaData.getString(GlobalConstants.SCHEMA_JSON); @@ -6539,17 +6530,16 @@ public static String getValueFromActuator(String section, String key) { } public static JSONArray mimotoActuatorResponseArray = null; - private static String otpEnabled = "true"; - - public static String isOTPEnabled() { - String value = getValueFromMimotoActuator("/mimoto-default.properties", "mosip.otp.download.enable"); - if (value != null && !(value.isBlank())) - otpEnabled = value; - return otpEnabled; - } public static String getValueFromMimotoActuator(String section, String key) { String url = ApplnURI + propsKernel.getProperty("actuatorMimotoEndpoint"); + if (!(System.getenv("useOldContextURL") == null) + && !(System.getenv("useOldContextURL").isBlank()) + && System.getenv("useOldContextURL").equalsIgnoreCase("true")) { + if (url.contains("/v1/mimoto/")) { + url = url.replace("/v1/mimoto/", "/residentmobileapp/"); + } + } String actuatorCacheKey = url + section + key; String value = actuatorValueCache.get(actuatorCacheKey); if (value != null && !value.isEmpty()) @@ -6847,16 +6837,6 @@ else if (testCaseName.startsWith("IdRepository_") && testCaseName.contains("Inva && (!isElementPresent(new JSONArray(schemaRequiredField), individualBiometrics))) { throw new SkipException(GlobalConstants.FEATURE_NOT_SUPPORTED_MESSAGE); } - } else if (BaseTestCase.currentModule.equalsIgnoreCase(GlobalConstants.MIMOTO)) { - if (isOTPEnabled().equals("false") && (testCaseDTO.getEndPoint().contains(GlobalConstants.SEND_OTP_ENDPOINT) - || testCaseDTO.getInput().contains(GlobalConstants.SEND_OTP_ENDPOINT) - || testCaseName.startsWith(GlobalConstants.MIMOTO_CREDENTIAL_STATUS))) { - throw new SkipException(GlobalConstants.OTP_FEATURE_NOT_SUPPORTED); - } else if (isOTPEnabled().equals("true") - && testCaseDTO.getEndPoint().contains(GlobalConstants.CREATE_VID_ENDPOINT)) { - throw new SkipException( - GlobalConstants.VID_GENERATED_USING_RESIDENT_API_SO_FEATURE_NOT_SUPPORTED_OR_NEEDED_MESSAGE); - } } if ((ConfigManager.isInServiceNotDeployedList(GlobalConstants.ESIGNET)) diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/OutputValidationUtil.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/OutputValidationUtil.java index 6d9ee59985..82d3f6b839 100644 --- a/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/OutputValidationUtil.java +++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/OutputValidationUtil.java @@ -581,7 +581,8 @@ public static boolean doesResponseHasErrorCode(String responseString, String all public static void reportServerIssues(String responseString, TestCaseDTO testCaseDTO) throws AdminTestException { if (responseString.startsWith("") || responseString.startsWith(" - + \ No newline at end of file