Skip to content

Commit 09ee14b

Browse files
author
elyran
committed
update jetty version
1 parent 6cc6ede commit 09ee14b

File tree

2 files changed

+67
-27
lines changed

2 files changed

+67
-27
lines changed

pom.xml

Lines changed: 57 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010

1111
<name>JMeterWebSocketSampler</name>
1212
<url>http://maven.apache.org</url>
13+
<properties>
14+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15+
<jetty.version>9.2.9.v20150224</jetty.version>
16+
<jMeter.version>2.13</jMeter.version>
17+
</properties>
1318
<build>
1419
<plugins>
1520
<plugin>
@@ -20,8 +25,8 @@
2025
<source>1.7</source>
2126
<target>1.7</target>
2227
<excludes>
23-
<exclude>**\JMeter\plugins\controler\websocketapp\**</exclude>
24-
</excludes>
28+
<exclude>**\JMeter\plugins\controler\websocketapp\**</exclude>
29+
</excludes>
2530
</configuration>
2631
</plugin>
2732
<plugin>
@@ -43,9 +48,6 @@
4348
</plugins>
4449
</build>
4550

46-
<properties>
47-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
48-
</properties>
4951

5052
<dependencies>
5153
<dependency>
@@ -58,30 +60,75 @@
5860
<dependency>
5961
<groupId>org.eclipse.jetty.websocket</groupId>
6062
<artifactId>websocket-client</artifactId>
61-
<version>9.1.1.v20140108</version>
62-
<classifier>hybrid</classifier>
63+
<version>${jetty.version}</version>
64+
<classifier>hybrid</classifier>
6365
<type>jar</type>
6466
</dependency>
6567
<dependency>
6668
<groupId>org.apache.jmeter</groupId>
6769
<artifactId>ApacheJMeter</artifactId>
68-
<version>2.10</version>
70+
<version>${jMeter.version}</version>
6971
<type>jar</type>
7072
<scope>provided</scope>
73+
<!--for some reason those jars are missing, and failing the package. since it is provided anyway - there is no implication for excluding them-->
74+
<exclusions>
75+
<exclusion>
76+
<artifactId>commons-math3</artifactId>
77+
<groupId>commons-math3</groupId>
78+
</exclusion>
79+
<exclusion>
80+
<artifactId>commons-pool2</artifactId>
81+
<groupId>commons-pool2</groupId>
82+
</exclusion>
83+
<exclusion>
84+
<artifactId>d-haven-managed-pool</artifactId>
85+
<groupId>d-haven-managed-pool</groupId>
86+
</exclusion>
87+
</exclusions>
7188
</dependency>
7289
<dependency>
7390
<groupId>org.apache.jmeter</groupId>
7491
<artifactId>ApacheJMeter_core</artifactId>
75-
<version>2.10</version>
92+
<version>${jMeter.version}</version>
7693
<type>jar</type>
7794
<scope>provided</scope>
95+
<!--for some reason those jars are missing, and failing the package. since it is provided anyway - there is no implication for excluding them-->
96+
<exclusions>
97+
<exclusion>
98+
<artifactId>commons-math3</artifactId>
99+
<groupId>commons-math3</groupId>
100+
</exclusion>
101+
<exclusion>
102+
<artifactId>commons-pool2</artifactId>
103+
<groupId>commons-pool2</groupId>
104+
</exclusion>
105+
<exclusion>
106+
<artifactId>d-haven-managed-pool</artifactId>
107+
<groupId>d-haven-managed-pool</groupId>
108+
</exclusion>
109+
</exclusions>
78110
</dependency>
79111
<dependency>
80112
<groupId>org.apache.jmeter</groupId>
81113
<artifactId>ApacheJMeter_http</artifactId>
82-
<version>2.10</version>
114+
<version>${jMeter.version}</version>
83115
<type>jar</type>
84116
<scope>provided</scope>
117+
<!--for some reason those jars are missing, and failing the package. since it is provided anyway - there is no implication for excluding them-->
118+
<exclusions>
119+
<exclusion>
120+
<artifactId>commons-math3</artifactId>
121+
<groupId>commons-math3</groupId>
122+
</exclusion>
123+
<exclusion>
124+
<artifactId>d-haven-managed-pool</artifactId>
125+
<groupId>d-haven-managed-pool</groupId>
126+
</exclusion>
127+
<exclusion>
128+
<artifactId>commons-pool2</artifactId>
129+
<groupId>commons-pool2</groupId>
130+
</exclusion>
131+
</exclusions>
85132
</dependency>
86133
</dependencies>
87134
</project>

src/main/java/JMeter/plugins/functional/samplers/websocket/ServiceSocket.java

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -66,25 +66,18 @@ public ServiceSocket(WebSocketSampler parent, WebSocketClient client) {
6666
initializePatterns();
6767
}
6868

69-
@OnWebSocketFrame
70-
public void onFrame(Frame frame) {
71-
log.debug("Received frame: " + frame.getPayload() + " "
72-
+ frame.getType().name());
73-
String length = " (" + frame.getPayloadLength() + " bytes)";
74-
logMessage.append(" - Received frame #").append(messageCounter.get())
75-
.append(length);
76-
String frameTxt = new String(frame.getPayload().array());
77-
addResponseMessage("[Frame " + (messageCounter.getAndIncrement()) + ", Time: " + DATE_FORMAT.format(new Date()) + "]\n"
78-
+ frameTxt + "\n\n");
79-
80-
if (responseExpression == null
81-
|| responseExpression.matcher(frameTxt).find()) {
69+
@OnWebSocketMessage
70+
public void onMessage(String msg) {
71+
// log.info("Received message: " + msg);
72+
String length = " (" + msg.length() + " bytes)";
73+
logMessage.append(" - Received message #").append(messageCounter).append(length);
74+
addResponseMessage("[Message " + messageCounter.getAndIncrement() + ", Time: " + DATE_FORMAT.format(new Date()) + "]\n" + msg + "\n\n");
75+
76+
if (responseExpression == null || responseExpression.matcher(msg).find()) {
8277
logMessage.append("; matched response pattern").append("\n");
8378
closeLatch.countDown();
84-
} else if (!disconnectPattern.isEmpty()
85-
&& disconnectExpression.matcher(frameTxt).find()) {
86-
logMessage.append("; matched connection close pattern").append(
87-
"\n");
79+
} else if (!disconnectPattern.isEmpty() && disconnectExpression.matcher(msg).find()) {
80+
logMessage.append("; matched connection close pattern").append("\n");
8881
closeLatch.countDown();
8982
close(StatusCode.NORMAL, "JMeter closed session.");
9083
} else {

0 commit comments

Comments
 (0)