Hi Stephane,
Below is the CASimulation class. I am trying to call Selection class of Gatling by passing an instance of Simulation class and other 2 parameters. But when I try to pass the Simulation, it always through error. I wanted to run Selection by passing parameters from Play framework. I have followed the steps attached in this mail thread.
class CASimulation extends Simulation {
var time1 :Long =0;
var time2 :Long =0;
val logger = org.slf4j.LoggerFactory.getLogger(“TEST”)
val httpConf = httpConfig.baseURL(“http://xx”).acceptHeader(“application/xml”)
.responseInfoExtractor { response =>
if (response.getStatusCode == 200) {
val extendedResponse = response.asInstanceOf[com.excilys.ebi.gatling.http.response.ExtendedResponse]
if(extendedResponse.getUri.toString.equals(“http://xx/xx/xx”)){
time1 = extendedResponse.responseReceivingStartDate
logger.info(“uri time {} : {}”,extendedResponse.getUri,time1)
logger.info(“time1&2 {} : {}”,time1,time2)
logger.info(“Latency : {}”,time1-time2)
}
}
Nil
}
val httpPEConf = httpConfig.baseURL(“http://xx”).acceptHeader(“application/xml”)
.responseInfoExtractor { response =>
if (response.getStatusCode == 200) {
val extendedResponse = response.asInstanceOf[com.excilys.ebi.gatling.http.response.ExtendedResponse]
time2 = extendedResponse.requestSendingEndDate
logger.info(“Time for PE : {}”,time2)
logger.info(“requst body {}”,extendedResponse.request.getStringData)
}
Nil
}
val headers_3 = Map(
“Connection” → “keep-alive”,
“Content-Type” → “application/x-www-form-urlencoded”,
“LoginToken” → “${logintoken}”)
val headers_4 = Map(
“Connection” → “keep-alive”,
“Content-Type” → “application/xml”)
val scn = scenario(“CometAdapter”)
.feed(csv(Console.readLine))
.exec(http(“CreateSession”)
.post("/CometAdapter/CreateSession")
.body(""“xxxxxx”"")
.headers(headers_3)
.check(status.is(200)))
.exec(
http(“LogClientInfo”)
.put("/xxx")
.check(status.is(200)))
.repeat(Console.readInt) {exec(
http(“GetNotifications”)
.get("/xx")
.check(status.is(200)))
}
setUp(
scn.users(1).protocolConfig(httpConf)
)
}