Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MOSIP-35871 #656

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@
import io.mosip.testrig.dslrig.ivv.dg.DataGenerator;
import io.mosip.testrig.dslrig.ivv.parser.Parser;


@ContextConfiguration(classes = {BeanConfig.class})
@ContextConfiguration(classes = { BeanConfig.class })
public class Orchestrator extends AbstractTestNGSpringContextTests {
private static Logger logger = Logger.getLogger(Orchestrator.class);
String message = null;
Expand All @@ -80,10 +79,9 @@ public class Orchestrator extends AbstractTestNGSpringContextTests {
public static long suiteStartTime = System.currentTimeMillis();
public static long suiteMaxTimeInMillis = 7200000; // 2 hour in milliseconds
static AtomicInteger counterLock = new AtomicInteger(0); // enable fairness policy



@Autowired
private ApplicationContext appContext;
private ApplicationContext context;

private HashMap<String, String> packages = new HashMap<String, String>() {
{
Expand Down Expand Up @@ -217,8 +215,8 @@ public void beforeMethod(Method method) {

}

private synchronized void updateRunStatistics(Scenario scenario)
throws ClassNotFoundException, IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException {
private synchronized void updateRunStatistics(Scenario scenario) throws ClassNotFoundException,
IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException {
logger.info("Updating statistics for scenario: " + scenario.getId() + " -- updating the executed count to: "
+ counterLock.getAndIncrement());
if (scenario.getId().equalsIgnoreCase("0")) {
Expand Down Expand Up @@ -340,11 +338,10 @@ private void run(int i, Scenario scenario, HashMap<String, String> configs, Hash
store.setRegistrationUsers(scenario.getRegistrationUsers());
store.setPartners(scenario.getPartners());
store.setProperties(this.properties);

Reporter.log(
"<div class='box black-bg left-aligned' style='max-width: 100%; word-wrap: break-word;'><b><u>Scenario_"
+ scenario.getId() + ": " + scenario.getDescription() + "</u></b></div>"
);
"<div class='box black-bg left-aligned' style='max-width: 100%; word-wrap: break-word;'><b><u>Scenario_"
+ scenario.getId() + ": " + scenario.getDescription() + "</u></b></div>");

// for (Scenario.Step step : scenario.getSteps()) {
int jumpBackIndex = 0;
Expand Down Expand Up @@ -378,11 +375,11 @@ private void run(int i, Scenario scenario, HashMap<String, String> configs, Hash
String stepParams[] = getStepDetails("S_" + step.getScenario().getId() + stepAction);

if (!step.getName().contains("loopWindow")) {


StringBuilder sb = new StringBuilder();

sb.append("<div style='padding: 0; margin: 0;'><textarea style='border: solid 1px gray; background-color: lightgray; width: 100%; padding: 0; margin: 0;' name='headers' rows='3' readonly='true'>");
sb.append(
"<div style='padding: 0; margin: 0;'><textarea style='border: solid 1px gray; background-color: lightgray; width: 100%; padding: 0; margin: 0;' name='headers' rows='3' readonly='true'>");
sb.append("Step Name: " + step.getName() + "\n");
sb.append("Step Description: " + stepParams[0] + "\n");
sb.append("Step Parameters: " + stepParams[1]);
Expand All @@ -392,8 +389,11 @@ private void run(int i, Scenario scenario, HashMap<String, String> configs, Hash

}

// Steps can be added in scenario sheet as: ---- e2e_loopWindow(START /*LOOP_WINDOW_MARKER*/) ----e2e_loopWindow(END/*LOOP_WINDOW_MARKER*/,loopCount/* LOOP_COUNT*/)
// Add step/steps to be repeated for a given loopCount in between the above mentioned steps in the scenario sheet
// Steps can be added in scenario sheet as: ---- e2e_loopWindow(START
// /*LOOP_WINDOW_MARKER*/)
// ----e2e_loopWindow(END/*LOOP_WINDOW_MARKER*/,loopCount/* LOOP_COUNT*/)
// Add step/steps to be repeated for a given loopCount in between the above
// mentioned steps in the scenario sheet
if (step.getName().contains("loopWindow")) {

if (step.getParameters().get(0).contains("START")) {
Expand Down Expand Up @@ -508,7 +508,6 @@ public void publishResult() {
return;
}


/*
* public StepInterface getInstanceOf(Scenario.Step step) throws
* ClassNotFoundException, IllegalAccessException, InstantiationException {
Expand All @@ -517,16 +516,16 @@ public void publishResult() {
* Class.forName(className).newInstance(); return (StepInterface)
* appContext.getBean(Class.forName(className)); }
*/

@SuppressWarnings("deprecation")
public StepInterface getInstanceOf(Scenario.Step step)
throws ClassNotFoundException, IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException {
String className = getPackage(step) + "." + step.getName().substring(0, 1).toUpperCase()
+ step.getName().substring(1);
// Load the class
Class<?> clazz = Class.forName(className);
// Use the new approach to create an instance
return (StepInterface) clazz.getDeclaredConstructor().newInstance();
public StepInterface getInstanceOf(Scenario.Step step) throws ClassNotFoundException, NoSuchMethodException,
InvocationTargetException, InstantiationException, IllegalAccessException {
String className = getPackage(step) + "." + step.getName().substring(0, 1).toUpperCase()
+ step.getName().substring(1);
// Load the class
Class<?> clazz = Class.forName(className);
// Retrieve the bean from the Spring application context
return (StepInterface) context.getBean(clazz);
}

private void configToSystemProperties() {
Expand Down
Loading