Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 80 additions & 18 deletions activemq-mqtt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
<artifactId>activemq-mqtt</artifactId>
<packaging>jar</packaging>
<name>ActiveMQ :: MQTT Protocol</name>

<properties>
<surefire.version>3.5.3</surefire.version>
</properties>

<description>The ActiveMQ MQTT Protocol Implementation</description>

<dependencies>
Expand Down Expand Up @@ -198,24 +203,6 @@
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
<argLine>${surefire.argLine}</argLine>
<runOrder>alphabetical</runOrder>
<systemPropertyValues>
<org.apache.activemq.default.directory.prefix>target</org.apache.activemq.default.directory.prefix>
</systemPropertyValues>
<!-- includes>
<include>**/*Test.*</include>
</includes -->
<excludes>
<exclude>**/PahoMQTNioTTest.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.activemq.protobuf</groupId>
<artifactId>activemq-protobuf</artifactId>
Expand Down Expand Up @@ -293,6 +280,81 @@
</plugins>
</build>
</profile>
<profile>
<id>all-parallel</id>
<activation>
<activeByDefault>true</activeByDefault>
<property>
<name>activemq.tests</name>
<value>parallel</value>
</property>
</activation>
<properties>
<parallel.tests.fork.count>2C</parallel.tests.fork.count>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
<executions>
<execution>
<id>parallel</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration combine.self="override">
<forkCount>${parallel.tests.fork.count}</forkCount>
<reuseForks>false</reuseForks>
<forkedProcessTimeoutInSeconds>600</forkedProcessTimeoutInSeconds>
<runOrder>balanced</runOrder>
<failIfNoTests>false</failIfNoTests>
<groups>org.apache.activemq.transport.mqtt.ParallelTest</groups>
<systemPropertyVariables>
<java.net.preferIPv4Stack>true</java.net.preferIPv4Stack>
<org.apache.activemq.default.directory.prefix>${project.build.directory}/parallel-tests-${surefire.forkNumber}/</org.apache.activemq.default.directory.prefix>
<org.apache.activemq.AutoFailTestSupport.disableSystemExit>true</org.apache.activemq.AutoFailTestSupport.disableSystemExit>
<org.apache.activemq.broker.jmx.createConnector>false</org.apache.activemq.broker.jmx.createConnector>
<!-- when running MQTT tests in parallel in the CI (quite slow) we need to bump the wireformat negotiation timeout (5s by default) -->
<org.apache.activemq.transport.wireFormatNegotiationTimeout>20000</org.apache.activemq.transport.wireFormatNegotiationTimeout>
</systemPropertyVariables>
</configuration>
</execution>
<execution>
<id>serial</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration combine.self="override">
<runOrder>balanced</runOrder>
<failIfNoTests>false</failIfNoTests>
<excludedGroups>org.apache.activemq.transport.mqtt.ParallelTest</excludedGroups>
<systemPropertyVariables>
<java.net.preferIPv4Stack>true</java.net.preferIPv4Stack>
<org.apache.activemq.default.directory.prefix>${project.build.directory}/</org.apache.activemq.default.directory.prefix>
<org.apache.activemq.AutoFailTestSupport.disableSystemExit>true</org.apache.activemq.AutoFailTestSupport.disableSystemExit>
<org.apache.activemq.broker.jmx.createConnector>false</org.apache.activemq.broker.jmx.createConnector>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>${surefire.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<repositories>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,16 @@
import org.fusesource.mqtt.codec.CONNACK;
import org.fusesource.mqtt.codec.MQTTFrame;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Tests various use cases that require authentication or authorization over MQTT
*/
@Category(ParallelTest.class)
@RunWith(Parameterized.class)
public class MQTTAuthTest extends MQTTAuthTestSupport {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@
import org.fusesource.mqtt.codec.UNSUBSCRIBE;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Tests the functionality of the MQTTCodec class.
*/
@Category(ParallelTest.class)
public class MQTTCodecTest {

private static final Logger LOG = LoggerFactory.getLogger(MQTTCodecTest.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@
import org.apache.activemq.util.ByteSequence;
import org.junit.Test;

import org.junit.experimental.categories.Category;

/**
*
*/
@Category(ParallelTest.class)
public class MQTTCompositeQueueRetainedTest extends MQTTTestSupport {

// configure composite topic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.junit.experimental.categories.Category;
/**
* Test that the maxFrameSize configuration value is applied across the transports.
*/
@Category(ParallelTest.class)
@RunWith(Parameterized.class)
public class MQTTMaxFrameSizeTest extends MQTTTestSupport {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
package org.apache.activemq.transport.mqtt;

import org.junit.experimental.categories.Category;

/**
* Run the basic tests with the NIO Transport.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@
*/
package org.apache.activemq.transport.mqtt;

import org.junit.experimental.categories.Category;

/**
* Run the basic tests with the NIO Transport.
*/
@Category(ParallelTest.class)
public class MQTTNIOTest extends MQTTTest {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;

@Category(ParallelTest.class)
public class MQTTOverlapedSubscriptionsTest {

private BrokerService brokerService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.junit.experimental.categories.Category;
/**
* Test to show that a PINGRESP will only be sent for a PINGREQ
* packet after a CONNECT packet has been received.
*/
@Category(ParallelTest.class)
@RunWith(Parameterized.class)
public class MQTTPingReqTest extends MQTTTestSupport {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@
import org.fusesource.mqtt.codec.MQTTFrame;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;

/**
* Tests for various usage scenarios of the protocol converter
*/
@Category(ParallelTest.class)
public class MQTTProtocolConverterTest {

private MQTTTransport transport;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@
*/
package org.apache.activemq.transport.mqtt;

import org.junit.experimental.categories.Category;

/**
* Run the basic tests with the NIO Transport.
*/
@Category(ParallelTest.class)
public class MQTTSSLTest extends MQTTTest {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.junit.experimental.categories.Category;
/**
* Test that all previous QoS 2 subscriptions are recovered on Broker restart.
*/
@Category(ParallelTest.class)
@RunWith(Parameterized.class)
public class MQTTSubscriptionRecoveryTest extends MQTTTestSupport {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.apache.activemq.broker.jmx.TopicViewMBean;
import org.apache.activemq.store.kahadb.KahaDBStore;
import org.apache.activemq.transport.mqtt.util.ResourceLoadingSslContext;
import org.apache.activemq.util.IOHelper;
import org.fusesource.mqtt.client.MQTT;
import org.fusesource.mqtt.client.Tracer;
import org.fusesource.mqtt.codec.MQTTFrame;
Expand All @@ -53,8 +54,6 @@ public class MQTTTestSupport {

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

public static final String KAHADB_DIRECTORY = "target/activemq-data/";

protected BrokerService brokerService;
protected int port;
protected String jmsUri = "vm://localhost";
Expand Down Expand Up @@ -143,7 +142,7 @@ protected BrokerService createBroker(boolean deleteAllMessages) throws Exception
brokerService.setPersistent(isPersistent());
if (isPersistent()) {
KahaDBStore kaha = new KahaDBStore();
kaha.setDirectory(new File(KAHADB_DIRECTORY + getTestName()));
kaha.setDirectory(new File(IOHelper.getDefaultDataDirectory() + "/" + getTestName()));
brokerService.setPersistenceAdapter(kaha);
}
brokerService.setAdvisorySupport(advisorySupport);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.fusesource.mqtt.client.Topic;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -55,6 +56,7 @@
/**
* Run the basic tests with the NIO Transport.
*/
@Category(ParallelTest.class)
public class MQTTVirtualTopicSubscriptionsTest extends MQTTTest {
private static final Logger LOG = LoggerFactory.getLogger(MQTTVirtualTopicSubscriptionsTest.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@
*/
package org.apache.activemq.transport.mqtt;

import org.junit.experimental.categories.Category;

/**
* Test the NIO transport with this Test group
*/
@Category(ParallelTest.class)
public class PahoMQTTNIOTest extends PahoMQTTTest {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.junit.experimental.categories.Category;

@Category(ParallelTest.class)
public class PahoMQTTTest extends MQTTTestSupport {

private static final Logger LOG = LoggerFactory.getLogger(PahoMQTTTest.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import jakarta.jms.MessageConsumer;
import jakarta.jms.Session;

import static org.junit.Assert.assertEquals;

@Category(ParallelTest.class)
public class PahoVirtualTopicMQTTTest extends PahoMQTTTest {

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.transport.mqtt;


/**
* Marker interface used with {@code @Category(ParallelTest.class)} to opt a
* test class or method into the {@code all-parallel} Maven profile. Only tests
* explicitly tagged with this category execute when the profile is enabled,
* which allows a gradual migration toward full parallelism.
*/
public interface ParallelTest {
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@
package org.apache.activemq.transport.mqtt.auto;

import org.apache.activemq.transport.mqtt.MQTTTest;
import org.apache.activemq.transport.mqtt.ParallelTest;
import org.junit.experimental.categories.Category;

/**
* Run the basic tests with the NIO Transport.
*/
@Category(ParallelTest.class)
public class MQTTAutoNioTest extends MQTTTest {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;

import org.junit.experimental.categories.Category;
import org.apache.activemq.transport.mqtt.ParallelTest;

@Category(ParallelTest.class)
@RunWith(Parameterized.class)
public class MQTTAutoSslAuthTest extends MQTTTestSupport {

Expand Down
Loading