-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #691 from jayesh12234/develop
MOSIP-38404- Added 2 new scenarios
- Loading branch information
Showing
2 changed files
with
478 additions
and
0 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
...v-orchestrator/src/main/java/io/mosip/testrig/dslrig/ivv/e2e/methods/CheckUpdatedUIN.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package io.mosip.testrig.dslrig.ivv.e2e.methods; | ||
|
||
import static org.testng.Assert.assertTrue; | ||
|
||
import org.apache.log4j.Level; | ||
import org.apache.log4j.Logger; | ||
import org.testng.Reporter; | ||
|
||
import io.mosip.testrig.dslrig.ivv.core.base.StepInterface; | ||
import io.mosip.testrig.dslrig.ivv.core.exceptions.RigInternalError; | ||
import io.mosip.testrig.dslrig.ivv.orchestrator.BaseTestCaseUtil; | ||
import io.mosip.testrig.dslrig.ivv.orchestrator.dslConfigManager; | ||
|
||
public class CheckUpdatedUIN extends BaseTestCaseUtil implements StepInterface { | ||
|
||
private static final Logger logger = Logger.getLogger(CheckUpdatedUIN.class); | ||
|
||
static { | ||
if (dslConfigManager.IsDebugEnabled()) { | ||
logger.setLevel(Level.ALL); | ||
} else { | ||
logger.setLevel(Level.ERROR); | ||
} | ||
} | ||
|
||
@Override | ||
public void run() throws RigInternalError { | ||
String uin1 = null; | ||
String uin2 = null; | ||
|
||
try { | ||
// Validate step parameters | ||
if (step.getParameters() == null || step.getParameters().isEmpty()) { | ||
logger.error("Parameters are missing from the DSL step."); | ||
assertTrue(false, "Parameters are missing in step: " + step.getName()); | ||
} else if (step.getParameters().size() == 2) { | ||
uin1 = step.getScenario().getVariables().get(step.getParameters().get(0)); | ||
uin2 = step.getScenario().getVariables().get(step.getParameters().get(1)); | ||
} else { | ||
logger.error("Incorrect number of parameters provided. Expected 2, found: " | ||
+ step.getParameters().size()); | ||
assertTrue(false, "Expected 2 parameters but found: " + step.getParameters().size()); | ||
} | ||
|
||
// Compare UINs | ||
if (uin1 == null || uin2 == null) { | ||
logger.error("One or both UINs are null. UIN1: " + uin1 + ", UIN2: " + uin2); | ||
throw new RigInternalError("One or both UINs are null."); | ||
} | ||
|
||
if (uin1.equals(uin2)) { | ||
logger.info("Updated UIN is the same as the previous UIN. UIN: " + uin1); | ||
Reporter.log("<b style=\"background-color: #0A0;\">Marking test case as passed. As Updated UIN is the same as the previous UIN. UIN: </b><br>\n" + uin1); | ||
} else { | ||
logger.error("Updated UIN is different from the previous UIN. Previous UIN: " | ||
+ uin1 + ", Updated UIN: " + uin2); | ||
this.hasError = true; | ||
throw new RigInternalError("Updated UIN is different from the previous UIN."); | ||
} | ||
} catch (RigInternalError e) { | ||
logger.error("RigInternalError occurred: " + e.getMessage(), e); | ||
throw e; // Re-throw after logging | ||
} catch (Exception e) { | ||
logger.error("An unexpected error occurred: " + e.getMessage(), e); | ||
throw new RigInternalError("Unexpected error occurred: " + e.getMessage()); | ||
} | ||
} | ||
} |
Oops, something went wrong.