package com.demo.simulations;

import com.demo.utils.ApplicationEndPoints;
import com.demo.utils.ConfigReader;
import io.gatling.javaapi.core.*;

import java.io.IOException;

import static io.gatling.javaapi.core.CoreDsl.*;
import static io.gatling.javaapi.http.HttpDsl.*;

public class ProductsPageSimulation extends Simulation {

    ScenarioBuilder productsPageScenario = scenario("Product Page Load Test Scenario")
            .exec(http("Product Page Request")
                    .get(ApplicationEndPoints.PRODUCTS_END_POINT)
                    .check(status().is(200)));

    {
        try {
            setUp(productsPageScenario.injectOpen(rampUsers(new ConfigReader().getRampUPCount()).during(new ConfigReader().getRampupDuration()))).protocols(new BaseSimulation().baseInitialization());
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

}
