forked from hgwz/class5
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPepperDemo.jmx
315 lines (310 loc) · 18.9 KB
/
PepperDemo.jmx
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.0 r1840935">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
<stringProp name="TestPlan.comments"></stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="TestPlan.user_define_classpath"></stringProp>
</TestPlan>
<hashTree>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">1</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">1</stringProp>
<stringProp name="ThreadGroup.ramp_time">1</stringProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp name="ThreadGroup.duration"></stringProp>
<stringProp name="ThreadGroup.delay"></stringProp>
</ThreadGroup>
<hashTree>
<com.gslab.pepper.config.plaintext.PlainTextConfigElement guiclass="TestBeanGUI" testclass="com.gslab.pepper.config.plaintext.PlainTextConfigElement" testname="Pepper-Box PlainText Config" enabled="true">
<stringProp name="jsonSchema">{
"messageId":{{SEQUENCE("messageId", 1, 1)}},
"messageBody":"{{RANDOM_ALPHA_NUMERIC("abcdefg",100)}}",
"messageCategory":"{{RANDOM_STRING("QA","DEV")}}",
"messageStatus":"{{RANDOM_STRING("Accepted","Pending","Processing","Rejected")}}",
"messageTime":{{TIMESTAMP()}}
}</stringProp>
<stringProp name="placeHolder">kafkaMsg</stringProp>
</com.gslab.pepper.config.plaintext.PlainTextConfigElement>
<hashTree/>
<JavaSampler guiclass="JavaTestSamplerGui" testclass="JavaSampler" testname="Java Request" enabled="true">
<elementProp name="arguments" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments">
<elementProp name="bootstrap.servers" elementType="Argument">
<stringProp name="Argument.name">bootstrap.servers</stringProp>
<stringProp name="Argument.value">localhost:9092</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="zookeeper.servers" elementType="Argument">
<stringProp name="Argument.name">zookeeper.servers</stringProp>
<stringProp name="Argument.value"><Zookeeper List></stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="kafka.topic.name" elementType="Argument">
<stringProp name="Argument.name">kafka.topic.name</stringProp>
<stringProp name="Argument.value">perf-in</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="key.serializer" elementType="Argument">
<stringProp name="Argument.name">key.serializer</stringProp>
<stringProp name="Argument.value">org.apache.kafka.common.serialization.StringSerializer</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="value.serializer" elementType="Argument">
<stringProp name="Argument.name">value.serializer</stringProp>
<stringProp name="Argument.value">org.apache.kafka.common.serialization.StringSerializer</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="compression.type" elementType="Argument">
<stringProp name="Argument.name">compression.type</stringProp>
<stringProp name="Argument.value">none</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="batch.size" elementType="Argument">
<stringProp name="Argument.name">batch.size</stringProp>
<stringProp name="Argument.value">16384</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="linger.ms" elementType="Argument">
<stringProp name="Argument.name">linger.ms</stringProp>
<stringProp name="Argument.value">0</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="buffer.memory" elementType="Argument">
<stringProp name="Argument.name">buffer.memory</stringProp>
<stringProp name="Argument.value">33554432</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="acks" elementType="Argument">
<stringProp name="Argument.name">acks</stringProp>
<stringProp name="Argument.value">1</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="send.buffer.bytes" elementType="Argument">
<stringProp name="Argument.name">send.buffer.bytes</stringProp>
<stringProp name="Argument.value">131072</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="receive.buffer.bytes" elementType="Argument">
<stringProp name="Argument.name">receive.buffer.bytes</stringProp>
<stringProp name="Argument.value">32768</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="security.protocol" elementType="Argument">
<stringProp name="Argument.name">security.protocol</stringProp>
<stringProp name="Argument.value">PLAINTEXT</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="keyed.message" elementType="Argument">
<stringProp name="Argument.name">keyed.message</stringProp>
<stringProp name="Argument.value">NO</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="message.key.placeholder" elementType="Argument">
<stringProp name="Argument.name">message.key.placeholder</stringProp>
<stringProp name="Argument.value">KEY</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="message.value.placeholder" elementType="Argument">
<stringProp name="Argument.name">message.value.placeholder</stringProp>
<stringProp name="Argument.value">kafkaMsg</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="kerberos.auth.enabled" elementType="Argument">
<stringProp name="Argument.name">kerberos.auth.enabled</stringProp>
<stringProp name="Argument.value">NO</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="java.security.auth.login.config" elementType="Argument">
<stringProp name="Argument.name">java.security.auth.login.config</stringProp>
<stringProp name="Argument.value"><JAAS File Location></stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="java.security.krb5.conf" elementType="Argument">
<stringProp name="Argument.name">java.security.krb5.conf</stringProp>
<stringProp name="Argument.value"><krb5.conf location></stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="sasl.kerberos.service.name" elementType="Argument">
<stringProp name="Argument.name">sasl.kerberos.service.name</stringProp>
<stringProp name="Argument.value">kafka</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="sasl.mechanism" elementType="Argument">
<stringProp name="Argument.name">sasl.mechanism</stringProp>
<stringProp name="Argument.value">GSSAPI</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="ssl.enabled" elementType="Argument">
<stringProp name="Argument.name">ssl.enabled</stringProp>
<stringProp name="Argument.value">NO</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="ssl.key.password" elementType="Argument">
<stringProp name="Argument.name">ssl.key.password</stringProp>
<stringProp name="Argument.value"><Key Password></stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="ssl.keystore.location" elementType="Argument">
<stringProp name="Argument.name">ssl.keystore.location</stringProp>
<stringProp name="Argument.value"><Keystore Location></stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="ssl.keystore.password" elementType="Argument">
<stringProp name="Argument.name">ssl.keystore.password</stringProp>
<stringProp name="Argument.value"><Keystore Password></stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="ssl.truststore.location" elementType="Argument">
<stringProp name="Argument.name">ssl.truststore.location</stringProp>
<stringProp name="Argument.value"><Truststore Location></stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="ssl.truststore.password" elementType="Argument">
<stringProp name="Argument.name">ssl.truststore.password</stringProp>
<stringProp name="Argument.value"><Truststore Password></stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
</collectionProp>
</elementProp>
<stringProp name="classname">com.gslab.pepper.sampler.PepperBoxKafkaSampler</stringProp>
</JavaSampler>
<hashTree/>
<com.gslab.pepper.config.serialized.SerializedConfigElement guiclass="TestBeanGUI" testclass="com.gslab.pepper.config.serialized.SerializedConfigElement" testname="Pepper-Box Serialized Config" enabled="false">
<stringProp name="className">com.gslab.pepper.util.Message</stringProp>
<collectionProp name="objProperties">
<elementProp name="" elementType="com.gslab.pepper.model.FieldExpressionMapping">
<stringProp name="fieldName">messageId</stringProp>
<stringProp name="fieldExpression">SEQUENCE("messageId", 1, 1)</stringProp>
</elementProp>
<elementProp name="" elementType="com.gslab.pepper.model.FieldExpressionMapping">
<stringProp name="fieldName">messageBody</stringProp>
<stringProp name="fieldExpression">RANDOM_ALPHA_NUMERIC("abcdefg",100)</stringProp>
</elementProp>
<elementProp name="" elementType="com.gslab.pepper.model.FieldExpressionMapping">
<stringProp name="fieldName">messageStatus</stringProp>
<stringProp name="fieldExpression">RANDOM_STRING("QA","DEV")</stringProp>
</elementProp>
<elementProp name="" elementType="com.gslab.pepper.model.FieldExpressionMapping">
<stringProp name="fieldName">messageCategory</stringProp>
<stringProp name="fieldExpression">RANDOM_STRING("Accepted","Pending","Processing","Rejected")</stringProp>
</elementProp>
<elementProp name="" elementType="com.gslab.pepper.model.FieldExpressionMapping">
<stringProp name="fieldName">messageTime</stringProp>
<stringProp name="fieldExpression">TIMESTAMP()</stringProp>
</elementProp>
</collectionProp>
<stringProp name="placeHolder">MESSAGE</stringProp>
</com.gslab.pepper.config.serialized.SerializedConfigElement>
<hashTree/>
<DebugSampler guiclass="TestBeanGUI" testclass="DebugSampler" testname="Debug Sampler" enabled="true">
<boolProp name="displayJMeterProperties">false</boolProp>
<boolProp name="displayJMeterVariables">true</boolProp>
<boolProp name="displaySystemProperties">false</boolProp>
</DebugSampler>
<hashTree/>
</hashTree>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">1</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">1</stringProp>
<stringProp name="ThreadGroup.ramp_time">1</stringProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp name="ThreadGroup.duration"></stringProp>
<stringProp name="ThreadGroup.delay"></stringProp>
</ThreadGroup>
<hashTree>
<JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="JSR223 Sampler" enabled="true">
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename"></stringProp>
<stringProp name="parameters"></stringProp>
<stringProp name="script">import java.util.Properties;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.consumer.ConsumerRecords;
import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.apache.kafka.common.serialization.StringDeserializer;
import java.io.FileOutputStream;
import java.io.PrintStream;
//Define the certain properties that need to be passed to the constructor of a KafkaConsumer
Properties props = new Properties();
props.put("bootstrap.servers","localhost:9092");
props.put("enable.auto.commit","true");
props.put("auto.commit.interval.ms","1000");
props.put("session.timeout.ms","30000");
props.put("key.deserializer","org.apache.kafka.common.serialization.StringDeserializer");
props.put("value.deserializer","org.apache.kafka.common.serialization.StringDeserializer");
props.put(ConsumerConfig.GROUP_ID_CONFIG, "test");
properties.put(ConsumerConfig.CLIENT_ID_CONFIG, "test");
// Create the consumer using props
KafkaConsumer < String, String > consumer = new KafkaConsumer<String, String> (props);
consumer.subscribe(Arrays.asList("perf-in"));
long t = System.currentTimeMillis();
long end = t + 50000;
FileOutputStream f = new FileOutputStream("/Users/xs/Desktop/TesterHome/Demo/5/data.csv", true);
PrintStream p = new PrintStream(f);
log.info("Consumer Start");
while (System.currentTimeMillis() < end) {
ConsumerRecords < String, String > records = consumer.poll(100);
for (ConsumerRecord < String, String > record: records) {
log.info("offset = " + record.offset() + " value = " + record.value());
p.println("offset = " + record.offset() + " value = " + record.value());
}
consumer.commitSync();
}</stringProp>
<stringProp name="scriptLanguage">groovy</stringProp>
</JSR223Sampler>
<hashTree/>
</hashTree>
<ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true">
<boolProp name="ResultCollector.error_logging">false</boolProp>
<objProp>
<name>saveConfig</name>
<value class="SampleSaveConfiguration">
<time>true</time>
<latency>true</latency>
<timestamp>true</timestamp>
<success>true</success>
<label>true</label>
<code>true</code>
<message>true</message>
<threadName>true</threadName>
<dataType>true</dataType>
<encoding>false</encoding>
<assertions>true</assertions>
<subresults>true</subresults>
<responseData>false</responseData>
<samplerData>false</samplerData>
<xml>false</xml>
<fieldNames>true</fieldNames>
<responseHeaders>false</responseHeaders>
<requestHeaders>false</requestHeaders>
<responseDataOnError>false</responseDataOnError>
<saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
<assertionsResultsToSave>0</assertionsResultsToSave>
<bytes>true</bytes>
<sentBytes>true</sentBytes>
<url>true</url>
<threadCounts>true</threadCounts>
<idleTime>true</idleTime>
<connectTime>true</connectTime>
</value>
</objProp>
<stringProp name="filename"></stringProp>
</ResultCollector>
<hashTree/>
</hashTree>
</hashTree>
</jmeterTestPlan>