NO-JIRA fixing MQTT Test

This commit is contained in:
Clebert Suconic 2017-08-18 16:36:03 -04:00
parent ce6942a9aa
commit 2033ee8c43
2 changed files with 19 additions and 4 deletions

View File

@ -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.MqttFixedHeader;
import io.netty.handler.codec.mqtt.MqttMessage; 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.ActiveMQException;
import org.apache.activemq.artemis.core.protocol.mqtt.MQTTConnectionManager; import org.apache.activemq.artemis.core.protocol.mqtt.MQTTConnectionManager;
import org.apache.activemq.artemis.core.protocol.mqtt.MQTTInterceptor; import org.apache.activemq.artemis.core.protocol.mqtt.MQTTInterceptor;
@ -96,7 +97,12 @@ public class MQTTInterceptorPropertiesTest extends MQTTTestSupport {
@Override @Override
public boolean intercept(MqttMessage packet, RemotingConnection connection) throws ActiveMQException { public boolean intercept(MqttMessage packet, RemotingConnection connection) throws ActiveMQException {
System.out.println("incoming"); 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 @Override
public boolean intercept(MqttMessage packet, RemotingConnection connection) throws ActiveMQException { public boolean intercept(MqttMessage packet, RemotingConnection connection) throws ActiveMQException {
System.out.println("outgoing"); System.out.println("outgoing");
return checkMessageProperties(packet, expectedProperties); if (packet.getClass() == MqttPublishMessage.class) {
return checkMessageProperties(packet, expectedProperties);
} else {
return true;
}
} }
}; };
server.getRemotingService().addIncomingInterceptor(incomingInterceptor); server.getRemotingService().addIncomingInterceptor(incomingInterceptor);

View File

@ -34,6 +34,7 @@ import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import io.netty.handler.codec.mqtt.MqttMessage; 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.ActiveMQException;
import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.TransportConfiguration;
@ -369,7 +370,9 @@ public class MQTTTestSupport extends ActiveMQTestBase {
@Override @Override
public boolean intercept(MqttMessage packet, RemotingConnection connection) throws ActiveMQException { public boolean intercept(MqttMessage packet, RemotingConnection connection) throws ActiveMQException {
messageCount++; if (packet.getClass() == MqttPublishMessage.class) {
messageCount++;
}
return true; return true;
} }
@ -388,7 +391,9 @@ public class MQTTTestSupport extends ActiveMQTestBase {
@Override @Override
public boolean intercept(MqttMessage packet, RemotingConnection connection) throws ActiveMQException { public boolean intercept(MqttMessage packet, RemotingConnection connection) throws ActiveMQException {
messageCount++; if (packet.getClass() == MqttPublishMessage.class) {
messageCount++;
}
return true; return true;
} }