1
|
1
|
/**
|
|
2
|
+ * Copyright © 2016 The Thingsboard Authors
|
|
3
|
+ *
|
|
4
|
+ * Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+ * you may not use this file except in compliance with the License.
|
|
6
|
+ * You may obtain a copy of the License at
|
|
7
|
+ *
|
|
8
|
+ * http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+ *
|
|
10
|
+ * Unless required by applicable law or agreed to in writing, software
|
|
11
|
+ * distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+ * See the License for the specific language governing permissions and
|
|
14
|
+ * limitations under the License.
|
|
15
|
+ */
|
|
16
|
+/**
|
2
|
17
|
* Copyright © 2016 The Thingsboard Authors
|
3
|
18
|
*
|
4
|
19
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
...
|
...
|
@@ -27,14 +42,21 @@ class MqttSimulation extends Simulation { |
27
|
42
|
.host("tcp://localhost:1883")
|
28
|
43
|
.userName("${deviceCredentialsId}")
|
29
|
44
|
|
30
|
|
- val scn = scenario("MQTT Test")
|
31
|
|
- .feed(csv("/tmp/mqtt.csv").circular)
|
32
|
|
- .exec(mqtt("request")
|
|
45
|
+ val connect = exec(mqtt("connect")
|
|
46
|
+ .connect())
|
|
47
|
+
|
|
48
|
+ val publish = repeat(400) {
|
|
49
|
+ exec(mqtt("publish")
|
33
|
50
|
.publish("v1/devices/me/telemetry", "{\"key1\":\"value1\", \"key2\":\"value2\"}", QoS.AT_LEAST_ONCE, retain = false))
|
|
51
|
+ }
|
|
52
|
+
|
|
53
|
+ val scn = scenario("Scenario Name")
|
|
54
|
+ .feed(csv("/tmp/mqtt.csv").circular)
|
|
55
|
+ .exec(connect, publish)
|
34
|
56
|
|
35
|
57
|
setUp(
|
36
|
58
|
scn
|
37
|
|
- .inject(constantUsersPerSec(1000) during (5 seconds))
|
|
59
|
+ .inject(constantUsersPerSec(25) during (1 seconds))
|
38
|
60
|
).protocols(mqttConf)
|
39
|
61
|
|
40
|
62
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|