Skip to content

Commit

Permalink
Merge pull request #798 from nandhu-kumar/MOSIP-35404-Commons-Cleanup
Browse files Browse the repository at this point in the history
Mosip 35404 commons cleanup
  • Loading branch information
ckm007 authored Jan 8, 2025
2 parents 7d953e8 + 3651f37 commit 0c6a646
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 7 deletions.
4 changes: 2 additions & 2 deletions api-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ public void test(TestCaseDTO testCaseDTO)
String[] templateFields = testCaseDTO.getTemplateFields();

String jsonInput = testCaseDTO.getInput();
testCaseName = isTestCaseValidForExecution(testCaseDTO);
String inputJson = getJsonFromTemplate(jsonInput, testCaseDTO.getInputTemplate(), false);
String outputJson = getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate());
if (testCaseDTO.getTemplateFields() != null && templateFields.length > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ public Object[] getTestCaseList(ITestContext context) {
public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException {
testCaseName = testCaseDTO.getTestCaseName();
testCaseName = PreRegUtil.isTestCaseValidForExecution(testCaseDTO);
testCaseName = 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 @@ -81,7 +81,6 @@ public Object[] getTestCaseList(ITestContext context) {
public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException {
testCaseName = testCaseDTO.getTestCaseName();
testCaseName = PreRegUtil.isTestCaseValidForExecution(testCaseDTO);
testCaseName = 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 @@ -83,7 +83,6 @@ public Object[] getTestCaseList(ITestContext context) {
public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException {
testCaseName = testCaseDTO.getTestCaseName();
testCaseName = PreRegUtil.isTestCaseValidForExecution(testCaseDTO);
testCaseName = 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 @@ -81,7 +81,6 @@ public Object[] getTestCaseList(ITestContext context) {
public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException {
testCaseName = testCaseDTO.getTestCaseName();
testCaseName = PreRegUtil.isTestCaseValidForExecution(testCaseDTO);
testCaseName = isTestCaseValidForExecution(testCaseDTO);
auditLogCheck = testCaseDTO.isAuditLogCheck();
String[] templateFields = testCaseDTO.getTemplateFields();
if (HealthChecker.signalTerminateExecution) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.mosip.testrig.apirig.prereg.utils;

import org.apache.log4j.Logger;
import org.json.JSONArray;
import org.testng.SkipException;

import io.mosip.testrig.apirig.dto.TestCaseDTO;
Expand All @@ -15,9 +16,24 @@ public class PreRegUtil extends AdminTestUtil {
public static String isTestCaseValidForExecution(TestCaseDTO testCaseDTO) {
String testCaseName = testCaseDTO.getTestCaseName();

int indexof = testCaseName.indexOf("_");
String modifiedTestCaseName = testCaseName.substring(indexof + 1);

addTestCaseDetailsToMap(modifiedTestCaseName, testCaseDTO.getUniqueIdentifier());

if (SkipTestCaseHandler.isTestCaseInSkippedList(testCaseName)) {
throw new SkipException(GlobalConstants.KNOWN_ISSUES);
}

JSONArray postalCodeArray = new JSONArray(getValueFromAuthActuator("json-property", "postal_code"));

if (testCaseName.startsWith("Prereg_")
&& (testCaseName.contains("_Invalid_PostalCode_")
|| testCaseName.contains("_SpacialCharacter_PostalCode_"))
&& (globalRequiredFields != null && !globalRequiredFields.toList().contains(postalCodeArray))) {
throw new SkipException(GlobalConstants.FEATURE_NOT_SUPPORTED_MESSAGE);
}

return testCaseName;
}

Expand Down

0 comments on commit 0c6a646

Please sign in to comment.