Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Sohandey committed Sep 18, 2024
2 parents 8b9fee2 + e9cdc1d commit 54ea1cb
Show file tree
Hide file tree
Showing 8 changed files with 198 additions and 31 deletions.
6 changes: 5 additions & 1 deletion apitest-commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<aws.javasdk.version>1.11.368</aws.javasdk.version>

<!-- Hibernate version -->
<hibernate.version>6.5.2.Final</hibernate.version>
<hibernate.version>5.2.17.Final</hibernate.version>

<!-- automationtests version -->
<wink-json4j-provider.version>1.1.2-incubating</wink-json4j-provider.version>
Expand Down Expand Up @@ -471,6 +471,10 @@
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
</exclusion>
<exclusion>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-core</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ private static SessionFactory getDataBaseConnectionSessionFactory(String dbName)
config.setProperty("hibernate.show_sql", propsKernel.getProperty("show_sql"));
config.setProperty("hibernate.current_session_context_class",
propsKernel.getProperty("current_session_context_class"));
config.addFile(new File(MosipTestRunner.getGlobalResourcePath() + "/dbFiles/dbConfig.xml"));
factory = config.buildSessionFactory();
} catch (HibernateException e) {
DBCONNECTION_LOGGER.error("Exception in Database Connection with following message: " + e.getMessage());
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public static void extractCommonResourceFromJar() {
getListOfFilesFromJarAndCopyToExternalResource("spring.properties");
getListOfFilesFromJarAndCopyToExternalResource("validations.properties");
getListOfFilesFromJarAndCopyToExternalResource("dbFiles/");
getListOfFilesFromJarAndCopyToExternalResource("testCaseSkippedList.txt");
}

public static void copyCommonResources(){
Expand All @@ -31,6 +32,7 @@ public static void copyCommonResources(){
copyCommonResources("spring.properties");
copyCommonResources("validations.properties");
copyCommonResources("dbFiles/");
copyCommonResources("testCaseSkippedList.txt");
}

public static void copyCommonResources(String moduleName){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3117,6 +3117,8 @@ public String inputJsonKeyWordHandeler(String jsonString, String testCaseName) {
}
if (jsonString.contains("$1STLANG$"))
jsonString = replaceKeywordWithValue(jsonString, "$1STLANG$", BaseTestCase.languageList.get(0));
if (jsonString.contains("$2NDLANG$"))
jsonString = replaceKeywordWithValue(jsonString, "$2NDLANG$", BaseTestCase.languageList.get(1));


if (jsonString.contains(GlobalConstants.KEYCLOAK_USER_1))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public class ConfigManager {
private static String PUSH_TO_S3 = "push-reports-to-s3";
private static String ENABLE_DEBUG = "enableDebug";
private static String REPORT_IGNORED_TEST_CASES = "reportIgnoredTestCases";
private static String REPORT_KNOWN_ISSUE_TEST_CASES = "reportKnownIssueTestCases";
private static String THREAD_COUNT = "threadCount";
private static String LANG_SELECT = "langselect";

Expand Down Expand Up @@ -202,6 +203,7 @@ public class ConfigManager {
private static String push_reports_to_s3;
private static String enableDebug;
private static String reportIgnoredTestCases;
private static String reportKnownIssueTestCases;
private static String threadCount;
private static String langselect;
private static String usePreConfiguredOtp;
Expand Down Expand Up @@ -399,6 +401,11 @@ public static void init() {
? propsKernel.getProperty(REPORT_IGNORED_TEST_CASES)
: System.getenv(REPORT_IGNORED_TEST_CASES);
propsKernel.setProperty(REPORT_IGNORED_TEST_CASES, reportIgnoredTestCases);

reportKnownIssueTestCases = System.getenv(REPORT_KNOWN_ISSUE_TEST_CASES) == null
? propsKernel.getProperty(REPORT_KNOWN_ISSUE_TEST_CASES)
: System.getenv(REPORT_KNOWN_ISSUE_TEST_CASES);
propsKernel.setProperty(REPORT_KNOWN_ISSUE_TEST_CASES, reportKnownIssueTestCases);

threadCount = System.getenv(THREAD_COUNT) == null ? propsKernel.getProperty(THREAD_COUNT)
: System.getenv(THREAD_COUNT);
Expand Down Expand Up @@ -578,6 +585,10 @@ public static Boolean IsDebugEnabled() {
public static Boolean reportIgnoredTestCases() {
return reportIgnoredTestCases.equalsIgnoreCase("yes");
}

public static Boolean reportKnownIssueTestCases() {
return reportKnownIssueTestCases.equalsIgnoreCase("yes");
}

public static String getReportExpirationInDays() {
return reportExpirationInDays;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,10 @@ public class GlobalConstants {
public static final String SERVICE_NOT_DEPLOYED_MESSAGE = "Service not deployed. Hence skipping the testcase";
public static final String FEATURE_NOT_SUPPORTED = "feature not supported";
public static final String SERVICE_NOT_DEPLOYED = "Service not deployed";
public static final String KNOWN_ISSUES_STRING = "known issue";
public static final String KNOWN_ISSUES = "known issue. Hence skipping the testcase";
public static final String IGNORED_SUBSET_STRING = "feature not supported;Service not deployed";
public static final String KNOWN_ISSUE_SUBSET_STRING = "known issue;";
public static final String SKIPPED = "Skipped";
public static final String TARGET_ENV_HEALTH_CHECK_FAILED = "Target env health check failed ";
public static final String HOTLIST = "hotlist";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package io.mosip.testrig.apirig.utils;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;

import io.mosip.testrig.apirig.testrunner.MosipTestRunner;

public class SkipTestCaseHandler {
private static final Logger logger = Logger.getLogger(SkipTestCaseHandler.class);
private static List<String> testcaseToBeSkippedList = new ArrayList<>();

public static void main(String[] args) {
String filePath = "C:\\Users\\sivan\\Downloads\\SynData\\testCaseSkippedList.txt"; // Replace with your file
// path

loadTestcaseToBeSkippedList(filePath);

// Example usage of the checkStringInList method
String searchString = "IdRepository_UpdateIdentity_handle_value_value_withupdatevalues";
boolean exists = isTestCaseInSkippedList(searchString);
logger.info("Does the string exist? " + exists);

searchString = "IdRepository_UpdateIdentity_handle_value_value_withupdatevalues";
exists = isTestCaseInSkippedList(searchString);
logger.info("Does the string exist? " + exists);

}

// load test cases to be skipped in the execution in the list
public static void loadTestcaseToBeSkippedList(String fileName) {
try (BufferedReader br = new BufferedReader(
new FileReader(MosipTestRunner.getGlobalResourcePath() + "/" + fileName))) {
String line;
while ((line = br.readLine()) != null) {
// Ignore lines starting with # as it is commented line
if (line.startsWith("#")) {
continue;
}

// Split the line by "------" and store the second part
if (line.contains("------")) {
String[] parts = line.split("------");
if (parts.length > 1) {
testcaseToBeSkippedList.add(parts[1].trim());
}
}
}
} catch (IOException e) {
e.printStackTrace();
}
}

// Method to check if a given test case exists in the list
public static boolean isTestCaseInSkippedList(String strTestCase) {
return testcaseToBeSkippedList.contains(strTestCase);
}
}

0 comments on commit 54ea1cb

Please sign in to comment.