forked from FIWARE/load-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEntityUpdateWithSubscriptionSimulation.scala
40 lines (36 loc) · 1.16 KB
/
EntityUpdateWithSubscriptionSimulation.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
38
39
40
package simulations.nosec.ld
import java.util.UUID
import java.util.concurrent.TimeUnit
import io.gatling.core.Predef._
import io.gatling.core.structure.ScenarioBuilder
class EntityUpdateWithSubscriptionSimulation extends EntityUpdateSimulation {
override def getScenario(): ScenarioBuilder = {
val notificationServerUrl = testConfig.notificationServerUrl
scenario("Parallel entity updates with subscription")
.exec(session => session.set("entityId", UUID.randomUUID()))
.exec(
createEntityAction()
)
.pause(updateDelay.toString, TimeUnit.SECONDS)
.exec(
createSubscriptionAction(notificationServerUrl)
)
.pause(updateDelay.toString, TimeUnit.SECONDS)
.repeat(numberOfUpdatesToSimulate) {
exec(
updateEntityAction("temperature")
)
// wait for the new values to be available
.pause("1", TimeUnit.SECONDS)
.exec(
updateEntityAction("humidity")
)
// wait for the new values to be available
.pause(updateDelay.toString, TimeUnit.SECONDS)
}
// cleanup
.exec(
deleteEntityAction()
)
}
}