forked from FIWARE/load-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEntityUpdateSimulation.scala
37 lines (32 loc) · 1.06 KB
/
EntityUpdateSimulation.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package simulations.nosec.ld
import java.util.UUID
import java.util.concurrent.TimeUnit
import io.gatling.core.Predef._
import io.gatling.core.structure.ScenarioBuilder
import scalaj.http.Http
import simulations.FiwareLDBaseSimulation
class EntityUpdateSimulation extends FiwareLDBaseSimulation {
override def getParallelRuns(): Int = {
testConfig.numEntities
}
override def getScenario(): ScenarioBuilder = {
scenario("Parallel entity updates")
.exec(session => session.set("entityId", UUID.randomUUID()))
.exec(
createEntityAction()
)
.pause(testConfig.updateDelay.toString, TimeUnit.SECONDS)
.repeat(testConfig.numUpdates) {
exec(
updateEntityAction("temperature")
)
// wait for the new values to be available
.pause(testConfig.updateDelay.toString, TimeUnit.SECONDS)
.exec(
updateEntityAction("humidity")
)
// wait for the new values to be available
.pause(testConfig.updateDelay.toString, TimeUnit.SECONDS)
}
}
}