Skip to content

Commit

Permalink
Merge branch 'mosip:develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohanraj209 authored Oct 23, 2024
2 parents 3a93b87 + 505a102 commit 55c27d2
Show file tree
Hide file tree
Showing 203 changed files with 3,697 additions and 2,624 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/push-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ on:
- release*
- master
- 1.*
- develop
- develop*
- MOSIP*

jobs:
build-maven-authentication:
uses: mosip/kattu/.github/workflows/maven-build.yml@master
uses: mosip/kattu/.github/workflows/maven-build.yml@master-java21
with:
SERVICE_LOCATION: ./authentication
BUILD_ARTIFACT: authentication
Expand All @@ -37,7 +37,7 @@ jobs:
publish_to_nexus:
if: "${{ !contains(github.ref, 'master') && github.event_name != 'pull_request' }}"
needs: build-maven-authentication
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: ./authentication
secrets:
Expand All @@ -64,7 +64,7 @@ jobs:
BUILD_ARTIFACT: 'authentication'
fail-fast: false
name: ${{ matrix.SERVICE_NAME }}
uses: mosip/kattu/.github/workflows/docker-build.yml@master
uses: mosip/kattu/.github/workflows/docker-build.yml@master-java21
with:
SERVICE_LOCATION: ${{ matrix.SERVICE_LOCATION }}
SERVICE_NAME: ${{ matrix.SERVICE_NAME }}
Expand All @@ -78,7 +78,7 @@ jobs:
sonar_analysis:
needs: build-maven-authentication
if: "${{ github.event_name != 'pull_request' }}"
uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master
uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master-java21
with:
SERVICE_LOCATION: ./authentication
secrets:
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![Maven Package upon a push](https://github.com/mosip/id-authentication/actions/workflows/push_trigger.yml/badge.svg?branch=release-1.2.0.1)](https://github.com/mosip/id-authentication/actions/workflows/push_trigger.yml)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=mosip_id-authentication&id=mosip_id-authentication&branch=release-1.2.0.1&metric=alert_status)](https://sonarcloud.io/dashboard?id=mosip_id-authentication&branch=release-1.2.0.1)
[![Maven Package upon a push](https://github.com/mosip/id-authentication/actions/workflows/push-trigger.yml/badge.svg?branch=develop-java21)](https://github.com/mosip/id-authentication/actions/workflows/push-trigger.yml)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=mosip_id-authentication&id=mosip_id-authentication&branch=develop-java21&metric=alert_status)](https://sonarcloud.io/dashboard?id=mosip_id-authentication&branch=develop-java21)

# ID-Authentication

Expand All @@ -10,7 +10,7 @@ This repository contains source code and design documents for MOSIP ID Authentic
Refer to [SQL scripts](db_scripts).

## Build & run (for developers)
The project requires JDK 1.11.
The project requires JDK 1.21.
1. Build and install:
```
$ cd kernel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
import java.security.PublicKey;
import java.security.interfaces.RSAPublicKey;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Properties;

import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.bouncycastle.openssl.jcajce.JcaPEMWriter;
import org.testng.TestNG;
Expand All @@ -23,13 +25,13 @@

import io.mosip.testrig.apirig.dataprovider.BiometricDataProvider;
import io.mosip.testrig.apirig.dbaccess.DBManager;
import io.mosip.testrig.apirig.report.EmailableReport;
import io.mosip.testrig.apirig.utils.AdminTestUtil;
import io.mosip.testrig.apirig.utils.AuthTestsUtil;
import io.mosip.testrig.apirig.utils.CertificateGenerationUtil;
import io.mosip.testrig.apirig.utils.CertsUtil;
import io.mosip.testrig.apirig.utils.ConfigManager;
import io.mosip.testrig.apirig.utils.EncryptionDecrptionUtil;
import io.mosip.testrig.apirig.utils.GlobalConstants;
import io.mosip.testrig.apirig.utils.GlobalMethods;
import io.mosip.testrig.apirig.utils.IdAuthConfigManager;
import io.mosip.testrig.apirig.utils.JWKKeyUtil;
import io.mosip.testrig.apirig.utils.KeyCloakUserAndAPIKeyGeneration;
Expand All @@ -51,6 +53,7 @@ public class MosipTestRunner {

public static String jarUrl = MosipTestRunner.class.getProtectionDomain().getCodeSource().getLocation().getPath();
public static List<String> languageList = new ArrayList<>();
public static boolean skipAll = false;

/**
* C Main method to start mosip test execution
Expand All @@ -73,9 +76,9 @@ public static void main(String[] arg) {
} else {
ExtractResource.copyCommonResources();
}
AdminTestUtil.init();
IdAuthConfigManager.init();

BaseTestCase.suiteSetup(getRunType());
suiteSetup(getRunType());
SkipTestCaseHandler.loadTestcaseToBeSkippedList("testCaseSkippedList.txt");
setLogLevels();

Expand Down Expand Up @@ -125,6 +128,36 @@ public static void main(String[] arg) {
System.exit(0);

}

public static void suiteSetup(String runType) {
if (IdAuthConfigManager.IsDebugEnabled())
LOGGER.setLevel(Level.ALL);
else
LOGGER.info("Test Framework for Mosip api Initialized");
BaseTestCase.initialize();
LOGGER.info("Done with BeforeSuite and test case setup! su TEST EXECUTION!\n\n");

if (!runType.equalsIgnoreCase("JAR")) {
AuthTestsUtil.removeOldMosipTempTestResource();
}
BaseTestCase.currentModule = "auth";
BaseTestCase.certsForModule = "IDA";
DBManager.executeDBQueries(ConfigManager.getKMDbUrl(), ConfigManager.getKMDbUser(), ConfigManager.getKMDbPass(),
ConfigManager.getKMDbSchema(),
getGlobalResourcePath() + "/" + "config/keyManagerDataDeleteQueriesForEsignet.txt");
DBManager.executeDBQueries(ConfigManager.getIdaDbUrl(), ConfigManager.getIdaDbUser(),
ConfigManager.getPMSDbPass(), ConfigManager.getIdaDbSchema(),
getGlobalResourcePath() + "/" + "config/idaDeleteQueriesForEsignet.txt");

DBManager.executeDBQueries(ConfigManager.getMASTERDbUrl(), ConfigManager.getMasterDbUser(),
ConfigManager.getMasterDbPass(), ConfigManager.getMasterDbSchema(),
getGlobalResourcePath() + "/" + "config/masterDataDeleteQueriesForEsignet.txt");
AuthTestsUtil.initiateAuthTest();
BaseTestCase.otpListener = new OTPListener();
BaseTestCase.otpListener.run();
}



private static void setLogLevels() {
AdminTestUtil.setLogLevel();
Expand All @@ -143,9 +176,6 @@ private static void setLogLevels() {
*/
public static void startTestRunner() {
File homeDir = null;
TestNG runner = new TestNG();
List<String> suitefiles = new ArrayList<>();
List<String> modulesToRun = BaseTestCase.listOfModules;
String os = System.getProperty("os.name");
LOGGER.info(os);
if (getRunType().contains("IDE") || os.toLowerCase().contains("windows")) {
Expand All @@ -156,39 +186,46 @@ public static void startTestRunner() {
homeDir = new File(dir.getParent() + "/mosip/testNgXmlFiles");
LOGGER.info("ELSE :" + homeDir);
}
for (File file : homeDir.listFiles()) {
for (String fileName : modulesToRun) {
if (file.getName().toLowerCase().contains(fileName)) {
suitefiles.add(file.getAbsolutePath());
} else if (fileName.equals("all") && file.getName().toLowerCase().contains("testng")) {
// List and sort the files
File[] files = homeDir.listFiles();
if (files != null) {
Arrays.sort(files, (f1, f2) -> {
// Customize the comparison based on file names
if (f1.getName().contains("prerequisite")) {
return -1; // f1 should come before f2
} else if (f2.getName().contains("prerequisite")) {
return 1; // f2 should come after f1
}
return f1.getName().compareTo(f2.getName()); // default alphabetical order
});

for (File file : files) {
TestNG runner = new TestNG();
List<String> suitefiles = new ArrayList<>();

if (file.getName().toLowerCase().contains("auth")) {
if (file.getName().toLowerCase().contains("prerequisite")) {
BaseTestCase.setReportName("auth-prerequisite");
} else {
// Check if prerequisite suite failed or skipped
if (EmailableReport.getFailedCount() > 0 || EmailableReport.getSkippedCount() > 0) {
// skipAll = true;
}

BaseTestCase.setReportName("auth");
}
suitefiles.add(file.getAbsolutePath());
runner.setTestSuites(suitefiles);
System.getProperties().setProperty("testng.output.dir", "testng-report");
runner.setOutputDirectory("testng-report");
runner.run();
}
}
} else {
LOGGER.error("No files found in directory: " + homeDir);
}
runner.setTestSuites(suitefiles);
System.getProperties().setProperty("testng.outpur.dir", "testng-report");
runner.setOutputDirectory("testng-report");
runner.run();
}

/**
* The method to return class loader resource path
*
* @return String
* @throws IOException
*/
/*
* public static String getGlobalResourcePath() { if
* (getRunType().equalsIgnoreCase("JAR")) { return new
* File(jarUrl).getParentFile().getAbsolutePath() +
* "/MosipTestResource/MosipTemporaryTestResource"; } else if
* (getRunType().equalsIgnoreCase("IDE")) { String path = new
* File(MosipTestRunner.class.getClassLoader().getResource("").getPath()).
* getAbsolutePath() + "/MosipTestResource/MosipTemporaryTestResource"; if
* (path.contains(GlobalConstants.TESTCLASSES)) path =
* path.replace(GlobalConstants.TESTCLASSES, "classes"); return path; } return
* "Global Resource File Path Not Found"; }
*/
}

public static String getGlobalResourcePath() {
if (cachedPath != null) {
Expand All @@ -215,15 +252,6 @@ public static String getGlobalResourcePath() {

public static String getResourcePath() {
return getGlobalResourcePath();
// if (getRunType().equalsIgnoreCase("JAR")) {
// return new File(jarUrl).getParentFile().getAbsolutePath();
// } else if (getRunType().equalsIgnoreCase("IDE")) {
// String path = new File(MosipTestRunner.class.getClassLoader().getResource("").getPath()).getAbsolutePath();
// if (path.contains(GlobalConstants.TESTCLASSES))
// path = path.replace(GlobalConstants.TESTCLASSES, "classes");
// return path;
// }
// return "Global Resource File Path Not Found";
}

public static String generatePulicKey() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.json.JSONObject;
import org.springframework.stereotype.Component;
import org.testng.ITest;
import org.testng.ITestContext;
import org.testng.ITestResult;
Expand All @@ -26,15 +25,14 @@
import io.mosip.testrig.apirig.utils.AdminTestUtil;
import io.mosip.testrig.apirig.utils.AuthenticationTestException;
import io.mosip.testrig.apirig.utils.BioDataUtility;
import io.mosip.testrig.apirig.utils.IdAuthConfigManager;
import io.mosip.testrig.apirig.utils.EncryptionDecrptionUtil;
import io.mosip.testrig.apirig.utils.IdAuthConfigManager;
import io.mosip.testrig.apirig.utils.IdAuthenticationUtil;
import io.mosip.testrig.apirig.utils.OutputValidationUtil;
import io.mosip.testrig.apirig.utils.PartnerRegistration;
import io.mosip.testrig.apirig.utils.ReportUtil;
import io.restassured.response.Response;

@Component
public class BioAuth extends AdminTestUtil implements ITest {
private static final Logger logger = Logger.getLogger(BioAuth.class);
protected String testCaseName = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.json.JSONObject;
import org.springframework.stereotype.Component;
import org.testng.ITest;
import org.testng.ITestContext;
import org.testng.ITestResult;
Expand All @@ -28,14 +27,14 @@
import io.mosip.testrig.apirig.utils.AdminTestException;
import io.mosip.testrig.apirig.utils.AdminTestUtil;
import io.mosip.testrig.apirig.utils.AuthenticationTestException;
import io.mosip.testrig.apirig.utils.IdAuthConfigManager;
import io.mosip.testrig.apirig.utils.EncryptionDecrptionUtil;
import io.mosip.testrig.apirig.utils.IdAuthConfigManager;
import io.mosip.testrig.apirig.utils.IdAuthenticationUtil;
import io.mosip.testrig.apirig.utils.OutputValidationUtil;
import io.mosip.testrig.apirig.utils.PartnerRegistration;
import io.mosip.testrig.apirig.utils.ReportUtil;
import io.restassured.response.Response;
@Component

public class DemoAuth extends AdminTestUtil implements ITest {
private static final Logger logger = Logger.getLogger(DemoAuth.class);
protected String testCaseName = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
import io.mosip.testrig.apirig.utils.AdminTestException;
import io.mosip.testrig.apirig.utils.AdminTestUtil;
import io.mosip.testrig.apirig.utils.AuthenticationTestException;
import io.mosip.testrig.apirig.utils.IdAuthConfigManager;
import io.mosip.testrig.apirig.utils.GlobalConstants;
import io.mosip.testrig.apirig.utils.GlobalMethods;
import io.mosip.testrig.apirig.utils.IdAuthConfigManager;
import io.mosip.testrig.apirig.utils.IdAuthenticationUtil;
import io.mosip.testrig.apirig.utils.OutputValidationUtil;
import io.mosip.testrig.apirig.utils.PartnerRegistration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
import io.mosip.testrig.apirig.utils.AdminTestException;
import io.mosip.testrig.apirig.utils.AdminTestUtil;
import io.mosip.testrig.apirig.utils.AuthenticationTestException;
import io.mosip.testrig.apirig.utils.IdAuthConfigManager;
import io.mosip.testrig.apirig.utils.GlobalConstants;
import io.mosip.testrig.apirig.utils.IdAuthConfigManager;
import io.mosip.testrig.apirig.utils.IdAuthenticationUtil;
import io.mosip.testrig.apirig.utils.OutputValidationUtil;
import io.mosip.testrig.apirig.utils.ReportUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
import io.mosip.testrig.apirig.utils.AdminTestException;
import io.mosip.testrig.apirig.utils.AdminTestUtil;
import io.mosip.testrig.apirig.utils.AuthenticationTestException;
import io.mosip.testrig.apirig.utils.IdAuthConfigManager;
import io.mosip.testrig.apirig.utils.GlobalConstants;
import io.mosip.testrig.apirig.utils.IdAuthConfigManager;
import io.mosip.testrig.apirig.utils.IdAuthenticationUtil;
import io.mosip.testrig.apirig.utils.OutputValidationUtil;
import io.mosip.testrig.apirig.utils.ReportUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.json.JSONObject;
import org.springframework.stereotype.Component;
import org.testng.ITest;
import org.testng.ITestContext;
import org.testng.ITestResult;
Expand All @@ -28,14 +27,14 @@
import io.mosip.testrig.apirig.utils.AdminTestUtil;
import io.mosip.testrig.apirig.utils.AuthenticationTestException;
import io.mosip.testrig.apirig.utils.BioDataUtility;
import io.mosip.testrig.apirig.utils.IdAuthConfigManager;
import io.mosip.testrig.apirig.utils.EncryptionDecrptionUtil;
import io.mosip.testrig.apirig.utils.IdAuthConfigManager;
import io.mosip.testrig.apirig.utils.IdAuthenticationUtil;
import io.mosip.testrig.apirig.utils.OutputValidationUtil;
import io.mosip.testrig.apirig.utils.PartnerRegistration;
import io.mosip.testrig.apirig.utils.ReportUtil;
import io.restassured.response.Response;
@Component

public class MultiFactorAuthNew extends AdminTestUtil implements ITest {
private static final Logger logger = Logger.getLogger(MultiFactorAuthNew.class);
protected String testCaseName = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.json.JSONObject;
import org.springframework.stereotype.Component;
import org.testng.ITest;
import org.testng.ITestContext;
import org.testng.ITestResult;
Expand All @@ -26,16 +25,15 @@
import io.mosip.testrig.apirig.utils.AdminTestException;
import io.mosip.testrig.apirig.utils.AdminTestUtil;
import io.mosip.testrig.apirig.utils.AuthenticationTestException;
import io.mosip.testrig.apirig.utils.IdAuthConfigManager;
import io.mosip.testrig.apirig.utils.EncryptionDecrptionUtil;
import io.mosip.testrig.apirig.utils.FileUtil;
import io.mosip.testrig.apirig.utils.IdAuthConfigManager;
import io.mosip.testrig.apirig.utils.IdAuthenticationUtil;
import io.mosip.testrig.apirig.utils.OutputValidationUtil;
import io.mosip.testrig.apirig.utils.PartnerRegistration;
import io.mosip.testrig.apirig.utils.ReportUtil;
import io.restassured.response.Response;

@Component
public class OtpAuthNew extends AdminTestUtil implements ITest {
private static final Logger logger = Logger.getLogger(OtpAuthNew.class);
protected String testCaseName = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
import io.mosip.testrig.apirig.utils.AdminTestException;
import io.mosip.testrig.apirig.utils.AdminTestUtil;
import io.mosip.testrig.apirig.utils.AuthenticationTestException;
import io.mosip.testrig.apirig.utils.IdAuthConfigManager;
import io.mosip.testrig.apirig.utils.GlobalConstants;
import io.mosip.testrig.apirig.utils.IdAuthConfigManager;
import io.mosip.testrig.apirig.utils.IdAuthenticationUtil;
import io.mosip.testrig.apirig.utils.OutputValidationUtil;
import io.mosip.testrig.apirig.utils.ReportUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
import io.mosip.testrig.apirig.utils.AdminTestException;
import io.mosip.testrig.apirig.utils.AdminTestUtil;
import io.mosip.testrig.apirig.utils.AuthenticationTestException;
import io.mosip.testrig.apirig.utils.IdAuthConfigManager;
import io.mosip.testrig.apirig.utils.GlobalConstants;
import io.mosip.testrig.apirig.utils.IdAuthConfigManager;
import io.mosip.testrig.apirig.utils.IdAuthenticationUtil;
import io.mosip.testrig.apirig.utils.OutputValidationUtil;
import io.mosip.testrig.apirig.utils.ReportUtil;
Expand Down
Loading

0 comments on commit 55c27d2

Please sign in to comment.