|
|
|
@ -20,6 +20,7 @@ import io.netty.handler.codec.mqtt.MqttQoS; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.junit.Assert; |
|
|
|
import org.thingsboard.server.common.data.Device; |
|
|
|
import org.thingsboard.server.common.msg.session.FeatureType; |
|
|
|
import org.thingsboard.server.transport.mqtt.sparkplug.AbstractMqttV5ClientSparkplugTest; |
|
|
|
import org.thingsboard.server.transport.mqtt.util.sparkplug.MetricDataType; |
|
|
|
import org.thingsboard.server.transport.mqtt.util.sparkplug.SparkplugMessageType; |
|
|
|
@ -50,6 +51,7 @@ public abstract class AbstractMqttV5ClientSparkplugAttributesTest extends Abstra |
|
|
|
String SHARED_ATTRIBUTES_PAYLOAD = "{\"" + keyNodeRebirth + "\":" + value + "}"; |
|
|
|
Assert.assertTrue("Connection node is failed", client.isConnected()); |
|
|
|
client.subscribeAndWait(NAMESPACE + "/" + groupId + "/" + NCMD.name() + "/" + edgeNode + "/#", MqttQoS.AT_MOST_ONCE); |
|
|
|
awaitForDeviceActorToReceiveSubscription(savedGateway.getId(), FeatureType.ATTRIBUTES, 1); |
|
|
|
doPostAsync("/api/plugins/telemetry/DEVICE/" + savedGateway.getId().getId() + "/attributes/SHARED_SCOPE", SHARED_ATTRIBUTES_PAYLOAD, String.class, status().isOk()); |
|
|
|
await(alias + SparkplugMessageType.NBIRTH.name()) |
|
|
|
.atMost(40, TimeUnit.SECONDS) |
|
|
|
@ -75,6 +77,7 @@ public abstract class AbstractMqttV5ClientSparkplugAttributesTest extends Abstra |
|
|
|
connectionWithNBirth(metricDataType, metricKey, metricValue); |
|
|
|
Assert.assertTrue("Connection node is failed", client.isConnected()); |
|
|
|
client.subscribeAndWait(NAMESPACE + "/" + groupId + "/" + NCMD.name() + "/" + edgeNode + "/#", MqttQoS.AT_MOST_ONCE); |
|
|
|
awaitForDeviceActorToReceiveSubscription(savedGateway.getId(), FeatureType.ATTRIBUTES, 1); |
|
|
|
|
|
|
|
// Boolean <-> String
|
|
|
|
boolean expectedValue = true; |
|
|
|
@ -138,6 +141,7 @@ public abstract class AbstractMqttV5ClientSparkplugAttributesTest extends Abstra |
|
|
|
connectionWithNBirth(metricDataType, metricKey, metricValue); |
|
|
|
Assert.assertTrue("Connection node is failed", client.isConnected()); |
|
|
|
client.subscribeAndWait(NAMESPACE + "/" + groupId + "/" + NCMD.name() + "/" + edgeNode + "/#", MqttQoS.AT_MOST_ONCE); |
|
|
|
awaitForDeviceActorToReceiveSubscription(savedGateway.getId(), FeatureType.ATTRIBUTES, 1); |
|
|
|
|
|
|
|
// Long <-> String
|
|
|
|
String valueStr = "123"; |
|
|
|
@ -189,6 +193,7 @@ public abstract class AbstractMqttV5ClientSparkplugAttributesTest extends Abstra |
|
|
|
connectionWithNBirth(metricDataType, metricKey, metricValue); |
|
|
|
Assert.assertTrue("Connection node is failed", client.isConnected()); |
|
|
|
client.subscribeAndWait(NAMESPACE + "/" + groupId + "/" + NCMD.name() + "/" + edgeNode + "/#", MqttQoS.AT_MOST_ONCE); |
|
|
|
awaitForDeviceActorToReceiveSubscription(savedGateway.getId(), FeatureType.ATTRIBUTES, 1); |
|
|
|
|
|
|
|
// Float <-> String
|
|
|
|
String valueStr = "123.345"; |
|
|
|
@ -240,6 +245,7 @@ public abstract class AbstractMqttV5ClientSparkplugAttributesTest extends Abstra |
|
|
|
connectionWithNBirth(metricDataType, metricKey, metricValue); |
|
|
|
Assert.assertTrue("Connection node is failed", client.isConnected()); |
|
|
|
client.subscribeAndWait(NAMESPACE + "/" + groupId + "/" + NCMD.name() + "/" + edgeNode + "/#", MqttQoS.AT_MOST_ONCE); |
|
|
|
awaitForDeviceActorToReceiveSubscription(savedGateway.getId(), FeatureType.ATTRIBUTES, 1); |
|
|
|
|
|
|
|
// Double <-> String
|
|
|
|
String valueStr = "123345456"; |
|
|
|
@ -291,6 +297,7 @@ public abstract class AbstractMqttV5ClientSparkplugAttributesTest extends Abstra |
|
|
|
connectionWithNBirth(metricDataType, metricKey, metricValue); |
|
|
|
Assert.assertTrue("Connection node is failed", client.isConnected()); |
|
|
|
client.subscribeAndWait(NAMESPACE + "/" + groupId + "/" + NCMD.name() + "/" + edgeNode + "/#", MqttQoS.AT_MOST_ONCE); |
|
|
|
awaitForDeviceActorToReceiveSubscription(savedGateway.getId(), FeatureType.ATTRIBUTES, 1); |
|
|
|
|
|
|
|
// String <-> Long
|
|
|
|
long valueLong = 123345456L; |
|
|
|
|