package com.ho.datacollect;

import com.alibaba.fastjson.JSONObject;
import com.ho.common.tools.service.RedisService;
import com.ho.datacollect.config.SendMsgMqttClient;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.HashMap;
import java.util.Map;

/**
 * @author fancl
 * @desc: DateCollect模块自测
 * @date 2023/2/11
 */
@SpringBootTest
@RunWith(SpringRunner.class)
public class DataCollectTest {

    @Autowired
    RedisService redisService;

    @Autowired
    SendMsgMqttClient mqttClient;

    @Test
    public void t(){
        Map<String,String> map = new HashMap<>();
        map.put("token", "v1:4fb062aff1c9270209db");
        String jsonString = JSONObject.toJSONString(map);
        String topic = "1/cloud/APO1231564/read/request";
        mqttClient.publish(topic,jsonString);

    }






}
