|
@@ -14,7 +14,7 @@ import (
|
|
|
)
|
|
|
|
|
|
func TestMqttBinding(t *testing.T) {
|
|
|
- err := mqtt_binding.Init(&mqtt_client.MqttClientOptions{
|
|
|
+ err := mqtt_binding.Init("test_prefix", &mqtt_client.MqttClientOptions{
|
|
|
UserName: "admin",
|
|
|
Password: "mtyzxhc",
|
|
|
Address: "tcp://127.0.0.1:1883",
|
|
@@ -68,7 +68,7 @@ func TestMqttBinding(t *testing.T) {
|
|
|
SetPingTimeout(5).
|
|
|
SetWill("test-client/will", "dead", 2, true).
|
|
|
SetOnConnectHandler(func(client mqtt.Client) {
|
|
|
- token := client.Subscribe("test/test-topic/reply", 2, func(client mqtt.Client, message mqtt.Message) {
|
|
|
+ token := client.Subscribe("test_prefix/test/test-topic/reply", 2, func(client mqtt.Client, message mqtt.Message) {
|
|
|
respMap := make(map[string]interface{})
|
|
|
err = json.Unmarshal(message.Payload(), &respMap)
|
|
|
if err != nil {
|
|
@@ -102,7 +102,7 @@ func TestMqttBinding(t *testing.T) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- token = client.Publish("test/test-topic", 2, false, sendJson)
|
|
|
+ token = client.Publish("test_prefix/test/test-topic", 2, false, sendJson)
|
|
|
if token.Wait(); token.Error() != nil {
|
|
|
fmt.Println(token.Error())
|
|
|
return
|