Skip to content

Commit db10cab

Browse files
committed
AMQ-8525: improve stomp module performances
1 parent 5f394c1 commit db10cab

20 files changed

+162
-23
lines changed

activemq-stomp/pom.xml

Lines changed: 80 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
<artifactId>activemq-stomp</artifactId>
2929
<packaging>jar</packaging>
3030
<name>ActiveMQ :: STOMP Protocol</name>
31+
32+
<properties>
33+
<surefire.version>3.5.3</surefire.version>
34+
</properties>
35+
3136
<description>The ActiveMQ STOMP Protocol Implementation</description>
3237

3338
<dependencies>
@@ -123,27 +128,6 @@
123128
</resource>
124129
</resources>
125130

126-
<plugins>
127-
<plugin>
128-
<artifactId>maven-surefire-plugin</artifactId>
129-
<configuration>
130-
<forkCount>1</forkCount>
131-
<reuseForks>false</reuseForks>
132-
<argLine>${surefire.argLine}</argLine>
133-
<runOrder>alphabetical</runOrder>
134-
<failIfNoTests>false</failIfNoTests>
135-
<systemPropertyVariables>
136-
<org.apache.activemq.default.directory.prefix>target</org.apache.activemq.default.directory.prefix>
137-
</systemPropertyVariables>
138-
<includes>
139-
<include>**/*Test.*</include>
140-
</includes>
141-
<excludes>
142-
<exclude>**/StompNIOSSLLoadTest.java</exclude>
143-
</excludes>
144-
</configuration>
145-
</plugin>
146-
</plugins>
147131
</build>
148132

149133
<profiles>
@@ -192,7 +176,81 @@
192176
</plugins>
193177
</build>
194178
</profile>
195-
179+
<profile>
180+
<id>all-parallel</id>
181+
<activation>
182+
<activeByDefault>true</activeByDefault>
183+
<property>
184+
<name>activemq.tests</name>
185+
<value>parallel</value>
186+
</property>
187+
</activation>
188+
<properties>
189+
<parallel.tests.fork.count>2C</parallel.tests.fork.count>
190+
</properties>
191+
<build>
192+
<plugins>
193+
<plugin>
194+
<artifactId>maven-surefire-plugin</artifactId>
195+
<version>${surefire.version}</version>
196+
<configuration>
197+
<skipTests>true</skipTests>
198+
</configuration>
199+
<dependencies>
200+
<dependency>
201+
<groupId>org.apache.maven.surefire</groupId>
202+
<artifactId>surefire-junit47</artifactId>
203+
<version>${surefire.version}</version>
204+
</dependency>
205+
</dependencies>
206+
<executions>
207+
<execution>
208+
<id>parallel</id>
209+
<phase>test</phase>
210+
<goals>
211+
<goal>test</goal>
212+
</goals>
213+
<configuration combine.self="override">
214+
<skipTests>false</skipTests>
215+
<forkCount>${parallel.tests.fork.count}</forkCount>
216+
<reuseForks>false</reuseForks>
217+
<forkedProcessTimeoutInSeconds>600</forkedProcessTimeoutInSeconds>
218+
<runOrder>balanced</runOrder>
219+
<failIfNoTests>false</failIfNoTests>
220+
<groups>org.apache.activemq.transport.stomp.ParallelTest</groups>
221+
<systemPropertyVariables>
222+
<java.net.preferIPv4Stack>true</java.net.preferIPv4Stack>
223+
<org.apache.activemq.default.directory.prefix>${project.build.directory}/parallel-tests-${surefire.forkNumber}/</org.apache.activemq.default.directory.prefix>
224+
<org.apache.activemq.AutoFailTestSupport.disableSystemExit>true</org.apache.activemq.AutoFailTestSupport.disableSystemExit>
225+
<org.apache.activemq.broker.jmx.createConnector>false</org.apache.activemq.broker.jmx.createConnector>
226+
</systemPropertyVariables>
227+
</configuration>
228+
</execution>
229+
<execution>
230+
<id>serial</id>
231+
<phase>test</phase>
232+
<goals>
233+
<goal>test</goal>
234+
</goals>
235+
<configuration combine.self="override">
236+
<skipTests>false</skipTests>
237+
<runOrder>balanced</runOrder>
238+
<failIfNoTests>false</failIfNoTests>
239+
<excludedGroups>org.apache.activemq.transport.stomp.ParallelTest</excludedGroups>
240+
<systemPropertyVariables>
241+
<java.net.preferIPv4Stack>true</java.net.preferIPv4Stack>
242+
<org.apache.activemq.default.directory.prefix>${project.build.directory}/</org.apache.activemq.default.directory.prefix>
243+
<org.apache.activemq.AutoFailTestSupport.disableSystemExit>true</org.apache.activemq.AutoFailTestSupport.disableSystemExit>
244+
<org.apache.activemq.broker.jmx.createConnector>false</org.apache.activemq.broker.jmx.createConnector>
245+
</systemPropertyVariables>
246+
</configuration>
247+
</execution>
248+
</executions>
249+
</plugin>
250+
</plugins>
251+
</build>
252+
</profile>
253+
196254
<profile>
197255
<id>activemq.tests.windows.excludes</id>
198256
<activation>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package org.apache.activemq.transport.stomp;
18+
19+
20+
/**
21+
* Marker interface used with {@code @Category(ParallelTest.class)} to opt a
22+
* test class or method into the {@code all-parallel} Maven profile. Only tests
23+
* explicitly tagged with this category execute when the profile is enabled,
24+
* which allows a gradual migration toward full parallelism.
25+
*/
26+
public interface ParallelTest {
27+
}

activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/Stomp11Test.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040

4141
import static org.junit.Assert.*;
4242

43+
import org.junit.experimental.categories.Category;
44+
45+
@Category(ParallelTest.class)
4346
public class Stomp11Test extends StompTestSupport {
4447

4548
private static final Logger LOG = LoggerFactory.getLogger(Stomp11Test.class);

activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/Stomp12Test.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
import org.slf4j.Logger;
3535
import org.slf4j.LoggerFactory;
3636

37+
import org.junit.experimental.categories.Category;
38+
39+
@Category(ParallelTest.class)
3740
public class Stomp12Test extends StompTestSupport {
3841

3942
private static final Logger LOG = LoggerFactory.getLogger(Stomp12Test.class);

activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompAdvisoryTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@
4545
import org.slf4j.Logger;
4646
import org.slf4j.LoggerFactory;
4747

48+
import org.junit.experimental.categories.Category;
49+
50+
@Category(ParallelTest.class)
4851
public class StompAdvisoryTest extends StompTestSupport {
4952
static final String STATS_DESTINATION_PREFIX = "ActiveMQ.Statistics.Destination";
5053

activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompCompositeDestinationTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,12 @@
3939
import org.slf4j.Logger;
4040
import org.slf4j.LoggerFactory;
4141

42+
import org.junit.experimental.categories.Category;
43+
4244
/**
4345
* Tests for support of composite destination support over STOMP
4446
*/
47+
@Category(ParallelTest.class)
4548
public class StompCompositeDestinationTest extends StompTestSupport {
4649

4750
private static final Logger LOG = LoggerFactory.getLogger(StompCompositeDestinationTest.class);

activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompConnectTimeoutTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,13 @@
3434
import org.slf4j.Logger;
3535
import org.slf4j.LoggerFactory;
3636

37+
import org.junit.experimental.categories.Category;
38+
3739
/**
3840
* Test that connection attempts that don't send the connect performative
3941
* get cleaned up by the inactivity monitor.
4042
*/
43+
@Category(ParallelTest.class)
4144
@RunWith(Parameterized.class)
4245
public class StompConnectTimeoutTest extends StompTestSupport {
4346

activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompInactivityMonitorTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,12 @@
3333
import org.slf4j.Logger;
3434
import org.slf4j.LoggerFactory;
3535

36+
import org.junit.experimental.categories.Category;
37+
3638
/**
3739
* Test that the inactivity monitor works as expected.
3840
*/
41+
@Category(ParallelTest.class)
3942
@RunWith(Parameterized.class)
4043
public class StompInactivityMonitorTest extends StompTestSupport {
4144

activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompMaxDataSizeTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929

3030
import org.junit.Test;
3131

32+
import org.junit.experimental.categories.Category;
33+
34+
@Category(ParallelTest.class)
3235
public class StompMaxDataSizeTest extends StompTestSupport {
3336

3437
private static final int TEST_MAX_DATA_SIZE = 64 * 1024;

activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompMaxFrameSizeTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
import org.junit.runners.Parameterized;
3535
import org.junit.runners.Parameterized.Parameters;
3636

37+
import org.junit.experimental.categories.Category;
38+
39+
40+
@Category(ParallelTest.class)
3741
@RunWith(Parameterized.class)
3842
public class StompMaxFrameSizeTest extends StompTestSupport {
3943

@@ -273,7 +277,7 @@ protected void doOversizedTestMessage(int port, boolean useSsl, int dataSize) th
273277

274278
stompConnection.sendFrame(frame);
275279

276-
StompFrame received = stompConnection.receive(5000);
280+
StompFrame received = stompConnection.receive(10000);
277281
assertNotNull(received);
278282
assertEquals("ERROR", received.getAction());
279283
assertTrue(received.getBody().contains("maximum frame size"));

0 commit comments

Comments
 (0)