diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTInterceptorPropertiesTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTInterceptorPropertiesTest.java index 375e2f2986..2600952944 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTInterceptorPropertiesTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTInterceptorPropertiesTest.java @@ -18,6 +18,7 @@ package org.apache.activemq.artemis.tests.integration.mqtt.imported; import io.netty.handler.codec.mqtt.MqttFixedHeader; import io.netty.handler.codec.mqtt.MqttMessage; +import io.netty.handler.codec.mqtt.MqttPublishMessage; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.core.protocol.mqtt.MQTTConnectionManager; import org.apache.activemq.artemis.core.protocol.mqtt.MQTTInterceptor; @@ -96,7 +97,12 @@ public class MQTTInterceptorPropertiesTest extends MQTTTestSupport { @Override public boolean intercept(MqttMessage packet, RemotingConnection connection) throws ActiveMQException { System.out.println("incoming"); - return checkMessageProperties(packet, expectedProperties); + if (packet.getClass() == MqttPublishMessage.class) { + return checkMessageProperties(packet, expectedProperties); + } else { + return true; + } + } }; @@ -104,7 +110,11 @@ public class MQTTInterceptorPropertiesTest extends MQTTTestSupport { @Override public boolean intercept(MqttMessage packet, RemotingConnection connection) throws ActiveMQException { System.out.println("outgoing"); - return checkMessageProperties(packet, expectedProperties); + if (packet.getClass() == MqttPublishMessage.class) { + return checkMessageProperties(packet, expectedProperties); + } else { + return true; + } } }; server.getRemotingService().addIncomingInterceptor(incomingInterceptor); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTestSupport.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTestSupport.java index a45f06d88b..bac2e37b49 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTestSupport.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTestSupport.java @@ -34,6 +34,7 @@ import java.util.Map; import java.util.concurrent.TimeUnit; import io.netty.handler.codec.mqtt.MqttMessage; +import io.netty.handler.codec.mqtt.MqttPublishMessage; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; @@ -369,7 +370,9 @@ public class MQTTTestSupport extends ActiveMQTestBase { @Override public boolean intercept(MqttMessage packet, RemotingConnection connection) throws ActiveMQException { - messageCount++; + if (packet.getClass() == MqttPublishMessage.class) { + messageCount++; + } return true; } @@ -388,7 +391,9 @@ public class MQTTTestSupport extends ActiveMQTestBase { @Override public boolean intercept(MqttMessage packet, RemotingConnection connection) throws ActiveMQException { - messageCount++; + if (packet.getClass() == MqttPublishMessage.class) { + messageCount++; + } return true; }