Bläddra i källkod

fix:移除iot-test-mqtt到插件中

xiwa 1 år sedan
förälder
incheckning
a636d3b283

+ 7 - 0
iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/impl/PluginServiceImpl.java

@@ -6,6 +6,7 @@ import cc.iotkit.common.enums.ErrCode;
 import cc.iotkit.common.exception.BizException;
 import cc.iotkit.common.utils.MapstructUtils;
 import cc.iotkit.common.utils.StringUtils;
+import cc.iotkit.common.utils.file.FileUtils;
 import cc.iotkit.data.manager.IPluginInfoData;
 import cc.iotkit.manager.dto.bo.plugin.PluginInfoBo;
 import cc.iotkit.manager.dto.vo.plugin.PluginInfoVo;
@@ -55,6 +56,8 @@ public class PluginServiceImpl implements IPluginService {
                         pluginOperator.stop(pluginId);
                     }
                     pluginOperator.uninstall(pluginId, true, false);
+                    //兼容相同版本包,先删除,再上传
+                    FileUtils.del(pluginInfo.getPluginDescriptor().getPluginPath());
                 }
             }
 
@@ -147,6 +150,10 @@ public class PluginServiceImpl implements IPluginService {
         if (old == null) {
             throw new BizException(ErrCode.DATA_NOT_EXIST);
         }
+        if (StringUtils.isBlank(old.getFile())) {
+            throw new BizException(ErrCode.DATA_BLANK, "插件包为空");
+        }
+
         String pluginId = old.getPluginId();
 
         com.gitee.starblues.core.PluginInfo pluginInfo = pluginOperator.getPluginInfo(pluginId);

BIN
iot-test-tool/iot-test-mqtt/.DS_Store


+ 0 - 63
iot-test-tool/iot-test-mqtt/pom.xml

@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <parent>
-        <artifactId>iot-test-tool</artifactId>
-        <groupId>cc.iotkit</groupId>
-        <version>0.5.0-SNAPSHOT</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
-
-    <artifactId>iot-test-mqtt</artifactId>
-
-
-    <dependencies>
-
-        <dependency>
-            <groupId>cc.iotkit</groupId>
-            <artifactId>iot-common-core</artifactId>
-        </dependency>
-
-        <!--====================第三方库===================-->
-
-        <dependency>
-            <groupId>io.vertx</groupId>
-            <artifactId>vertx-mqtt</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>ch.qos.logback</groupId>
-            <artifactId>logback-core</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>ch.qos.logback</groupId>
-            <artifactId>logback-classic</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.projectlombok</groupId>
-            <artifactId>lombok</artifactId>
-        </dependency>
-
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <configuration>
-                    <source>${java.version}</source>
-                    <target>${java.version}</target>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
-</project>

+ 0 - 17
iot-test-tool/iot-test-mqtt/src/main/java/cc/iotkit/test/mqtt/config/Mqtt.java

@@ -1,17 +0,0 @@
-/*
- * +----------------------------------------------------------------------
- * | Copyright (c) 奇特物联 2021-2022 All rights reserved.
- * +----------------------------------------------------------------------
- * | Licensed 未经许可不能去掉「奇特物联」相关版权
- * +----------------------------------------------------------------------
- * | Author: xw2sy@163.com
- * +----------------------------------------------------------------------
- */
-package cc.iotkit.test.mqtt.config;
-
-public class Mqtt {
-
-    public static String brokerHost;
-    public static int brokerPort = 1883;
-
-}

+ 0 - 73
iot-test-tool/iot-test-mqtt/src/main/java/cc/iotkit/test/mqtt/example/TransparentTest.java

@@ -1,73 +0,0 @@
-/*
- * +----------------------------------------------------------------------
- * | Copyright (c) 奇特物联 2021-2022 All rights reserved.
- * +----------------------------------------------------------------------
- * | Licensed 未经许可不能去掉「奇特物联」相关版权
- * +----------------------------------------------------------------------
- * | Author: xw2sy@163.com
- * +----------------------------------------------------------------------
- */
-package cc.iotkit.test.mqtt.example;
-
-import cc.iotkit.test.mqtt.config.Mqtt;
-import cc.iotkit.test.mqtt.model.Request;
-import cc.iotkit.test.mqtt.service.Gateway;
-import cc.iotkit.test.mqtt.service.ReportTask;
-import lombok.extern.slf4j.Slf4j;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
-/**
- * 透传测试
- */
-@Slf4j
-public class TransparentTest {
-
-    public static void main(String[] args) throws IOException {
-
-
-        if (args.length == 0) {
-            Mqtt.brokerHost = "127.0.0.1";
-//            Mqtt.brokerHost = "120.76.96.206";
-//            Mqtt.brokerHost = "172.16.1.109";
-        } else {
-            Mqtt.brokerHost = args[0];
-        }
-
-        log.info("start gateway ");
-        Gateway gateway = new Gateway("hbtgIA0SuVw9lxjB", "xdkKUymrEGSCYWswqCvSPyRSFvH5j7CU",
-                "TEST:GW:T0001");
-
-        gateway.addSubDevice("hbtgIA0SuVw9lxjB", "xdkKUymrEGSCYWswqCvSPyRSFvH5j7CU",
-                "TEST_LIGHT_0001",
-                "M1");
-
-        gateway.onDeviceOnline(device -> {
-            String pk = device.getProductKey();
-
-            //设备上线后添加上报定时任务
-            ReportTask reportTask = new ReportTask(gateway.getClient());
-            reportTask.addTask(String.format("/sys/%s/%s/s/event/rawReport",
-                            pk, device.getDeviceName()),
-                    () -> {
-                        Request request = new Request();
-                        request.setId(UUID.randomUUID().toString());
-                        request.setMethod("thing.event.rawReport");
-                        Map<String, Object> param = new HashMap<>();
-                        param.put("model", "M1");
-                        param.put("deviceName", "TEST_LIGHT_0001");
-                        param.put("data", "111110011");
-                        request.setParams(param);
-                        return request;
-                    });
-            reportTask.start(10);
-        });
-
-        gateway.start();
-
-        System.in.read();
-    }
-}

+ 0 - 26
iot-test-tool/iot-test-mqtt/src/main/java/cc/iotkit/test/mqtt/model/Request.java

@@ -1,26 +0,0 @@
-/*
- * +----------------------------------------------------------------------
- * | Copyright (c) 奇特物联 2021-2022 All rights reserved.
- * +----------------------------------------------------------------------
- * | Licensed 未经许可不能去掉「奇特物联」相关版权
- * +----------------------------------------------------------------------
- * | Author: xw2sy@163.com
- * +----------------------------------------------------------------------
- */
-package cc.iotkit.test.mqtt.model;
-
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-public class Request {
-
-    private String id;
-
-    private String method;
-
-    private Object params;
-}

+ 0 - 29
iot-test-tool/iot-test-mqtt/src/main/java/cc/iotkit/test/mqtt/model/Response.java

@@ -1,29 +0,0 @@
-/*
- * +----------------------------------------------------------------------
- * | Copyright (c) 奇特物联 2021-2022 All rights reserved.
- * +----------------------------------------------------------------------
- * | Licensed 未经许可不能去掉「奇特物联」相关版权
- * +----------------------------------------------------------------------
- * | Author: xw2sy@163.com
- * +----------------------------------------------------------------------
- */
-package cc.iotkit.test.mqtt.model;
-
-
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-import java.util.Map;
-
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-public class Response {
-
-    private String id;
-
-    private int code;
-
-    private Map<String, Object> data;
-}

+ 0 - 67
iot-test-tool/iot-test-mqtt/src/main/java/cc/iotkit/test/mqtt/performance/ConnectionTest.java

@@ -1,67 +0,0 @@
-/*
- * +----------------------------------------------------------------------
- * | Copyright (c) 奇特物联 2021-2022 All rights reserved.
- * +----------------------------------------------------------------------
- * | Licensed 未经许可不能去掉「奇特物联」相关版权
- * +----------------------------------------------------------------------
- * | Author: xw2sy@163.com
- * +----------------------------------------------------------------------
- */
-package cc.iotkit.test.mqtt.performance;
-
-import cc.iotkit.test.mqtt.config.Mqtt;
-import cc.iotkit.test.mqtt.service.Gateway;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-
-import java.io.IOException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-/**
- * 连接压力测试
- */
-@Slf4j
-public class ConnectionTest {
-
-    public static void main(String[] args) throws IOException {
-
-        if (args.length == 0) {
-            Mqtt.brokerHost = "127.0.0.1";
-//            Mqtt.brokerHost = "120.76.96.206";
-        } else {
-            Mqtt.brokerHost = args[0];
-        }
-
-        int total = 10;
-        if (args.length > 1) {
-            total = Integer.parseInt(args[1]);
-        }
-
-        ExecutorService executor = Executors.newCachedThreadPool();
-        for (int i = 0; i < total; i++) {
-            int finalI = i;
-            executor.submit(() -> {
-                log.info("start gateway " + (finalI + 1));
-                Gateway gateway = new Gateway("hbtgIA0SuVw9lxjB","xdkKUymrEGSCYWswqCvSPyRSFvH5j7CU",
-                        "TEST:GW:T" + StringUtils.leftPad(finalI + "", 6, "0"));
-
-//                gateway.addSubDevice("Rf4QSjbm65X45753",
-//                        "TEST_SW_" + StringUtils.leftPad(finalI + "", 6, "0"),
-//                        "S01");
-//
-//                gateway.addSubDevice("cGCrkK7Ex4FESAwe",
-//                        "TEST_SC_" + StringUtils.leftPad(finalI + "", 6, "0"),
-//                        "S01");
-//
-//                gateway.addSubDevice("xpsYHExTKPFaQMS7",
-//                        "TEST_LT_" + StringUtils.leftPad(finalI + "", 6, "0"),
-//                        "L01");
-
-                gateway.start();
-            });
-        }
-
-        System.in.read();
-    }
-}

+ 0 - 93
iot-test-tool/iot-test-mqtt/src/main/java/cc/iotkit/test/mqtt/performance/ReportTest.java

@@ -1,93 +0,0 @@
-/*
- * +----------------------------------------------------------------------
- * | Copyright (c) 奇特物联 2021-2022 All rights reserved.
- * +----------------------------------------------------------------------
- * | Licensed 未经许可不能去掉「奇特物联」相关版权
- * +----------------------------------------------------------------------
- * | Author: xw2sy@163.com
- * +----------------------------------------------------------------------
- */
-package cc.iotkit.test.mqtt.performance;
-
-import cc.iotkit.test.mqtt.config.Mqtt;
-import cc.iotkit.test.mqtt.model.Request;
-import cc.iotkit.test.mqtt.service.Gateway;
-import cc.iotkit.test.mqtt.service.ReportTask;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-/**
- * 上报压力测试
- */
-@Slf4j
-public class ReportTest {
-
-    public static void main(String[] args) throws IOException {
-
-
-        if (args.length == 0) {
-            Mqtt.brokerHost = "127.0.0.1";
-//            Mqtt.brokerPort = 2883;
-//            Mqtt.brokerHost = "120.76.96.206";
-//            Mqtt.brokerHost = "172.16.1.109";
-        } else {
-            Mqtt.brokerHost = args[0];
-        }
-
-        int total = 10;
-        if (args.length > 1) {
-            total = Integer.parseInt(args[1]);
-        }
-
-        ExecutorService executor = Executors.newCachedThreadPool();
-        for (int i = 0; i < total; i++) {
-            int finalI = i;
-            executor.submit(() -> {
-                log.info("start gateway " + (finalI + 1));
-                Gateway gateway = new Gateway("hbtgIA0SuVw9lxjB", "xdkKUymrEGSCYWswqCvSPyRSFvH5j7CU",
-                        "TEST:GW:" + StringUtils.leftPad(finalI + "", 6, "0"));
-
-                gateway.addSubDevice("Rf4QSjbm65X45753", "xdkKUymrEGSCYWswqCvSPyRSFvH5j7CU",
-                        "TEST_SW_" + StringUtils.leftPad(finalI + "", 6, "0"),
-                        "S01");
-
-                gateway.addSubDevice("cGCrkK7Ex4FESAwe", "xdkKUymrEGSCYWswqCvSPyRSFvH5j7CU",
-                        "TEST_SC_" + StringUtils.leftPad(finalI + "", 6, "0"),
-                        "S01");
-
-                gateway.onDeviceOnline((device) -> {
-                    String pk = device.getProductKey();
-                    if (!"Rf4QSjbm65X45753".equals(pk)) {
-                        return;
-                    }
-
-                    //设备上线后添加上报定时任务
-                    ReportTask reportTask = new ReportTask(gateway.getClient());
-                    reportTask.addTask(String.format("/sys/%s/%s/s/event/property/post",
-                                    pk, device.getDeviceName()),
-                            () -> {
-                                Request request = new Request();
-                                request.setId(UUID.randomUUID().toString());
-                                request.setMethod("thing.event.property.post");
-                                Map<String, Object> param = new HashMap<>();
-                                param.put("volt", Math.round(Math.random() * 100));
-                                request.setParams(param);
-                                return request;
-                            });
-                    reportTask.start(10);
-                });
-
-                gateway.start();
-            });
-        }
-
-        System.in.read();
-    }
-}

+ 0 - 28
iot-test-tool/iot-test-mqtt/src/main/java/cc/iotkit/test/mqtt/service/Device.java

@@ -1,28 +0,0 @@
-/*
- * +----------------------------------------------------------------------
- * | Copyright (c) 奇特物联 2021-2022 All rights reserved.
- * +----------------------------------------------------------------------
- * | Licensed 未经许可不能去掉「奇特物联」相关版权
- * +----------------------------------------------------------------------
- * | Author: xw2sy@163.com
- * +----------------------------------------------------------------------
- */
-package cc.iotkit.test.mqtt.service;
-
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-public class Device {
-
-    protected String productKey;
-
-    private String productSecret ;
-
-    protected String deviceName;
-
-    private String model;
-}

+ 0 - 153
iot-test-tool/iot-test-mqtt/src/main/java/cc/iotkit/test/mqtt/service/Gateway.java

@@ -1,153 +0,0 @@
-/*
- * +----------------------------------------------------------------------
- * | Copyright (c) 奇特物联 2021-2022 All rights reserved.
- * +----------------------------------------------------------------------
- * | Licensed 未经许可不能去掉「奇特物联」相关版权
- * +----------------------------------------------------------------------
- * | Author: xw2sy@163.com
- * +----------------------------------------------------------------------
- */
-package cc.iotkit.test.mqtt.service;
-
-
-import cc.iotkit.test.mqtt.config.Mqtt;
-import cc.iotkit.test.mqtt.model.Request;
-import io.netty.handler.codec.mqtt.MqttQoS;
-import io.vertx.core.AsyncResult;
-import io.vertx.core.Handler;
-import io.vertx.core.buffer.Buffer;
-import io.vertx.core.json.Json;
-import io.vertx.mqtt.MqttClient;
-import io.vertx.mqtt.MqttClientOptions;
-import io.vertx.mqtt.messages.MqttConnAckMessage;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.SneakyThrows;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.codec.digest.DigestUtils;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-import java.util.function.Consumer;
-
-@Slf4j
-@EqualsAndHashCode(callSuper = true)
-@Data
-public class Gateway extends Device {
-
-    private List<Device> subDevices = new ArrayList<>();
-
-    private Consumer<Device> deviceOnlineListener;
-
-    private MqttClient client;
-
-    private boolean isConnecting;
-
-    public Gateway(String productKey, String productSecret, String deviceName) {
-        super(productKey, productSecret, deviceName, "GW01");
-    }
-
-    @SneakyThrows
-    public void start() {
-        ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1);
-        executorService.scheduleAtFixedRate(this::connect, 0, 3, TimeUnit.SECONDS);
-    }
-
-    private void connect() {
-        if (client != null && client.isConnected()) {
-            return;
-        }
-
-        if (isConnecting) {
-            return;
-        }
-
-        String clientId = String.format("%s_%s_%s", productKey, deviceName, getModel());
-
-        try {
-            isConnecting = true;
-            MqttClientOptions options = new MqttClientOptions();
-            options.setUsername(this.deviceName);
-            options.setPassword(DigestUtils.md5Hex(getProductSecret() + clientId));
-            options.setCleanSession(true);
-            options.setKeepAliveInterval(30);
-            options.setClientId(clientId);
-            options.setReconnectInterval(3000);
-            options.setReconnectAttempts(100);
-
-            client = MqttClient.create(Vertxs.getVertx(), options);
-
-            CountDownLatch countDownLatch = new CountDownLatch(1);
-            client.connect(Mqtt.brokerPort, Mqtt.brokerHost, s -> {
-                if (s.succeeded()) {
-                    log.info("mqtt connected,clientId:{}", clientId);
-                    countDownLatch.countDown();
-                } else {
-                    log.info("mqtt connect failed,clientId:{}", clientId);
-                }
-            });
-            countDownLatch.await();
-
-            // 订阅
-            String topic = String.format("/sys/%s/%s/c/#", productKey, deviceName);
-            log.info("subscribe topic:{}", topic);
-
-            client.subscribe(topic, 1, r -> {
-                //配置获取
-//                String configGetTopic = String.format("/sys/%s/%s/s/config/get", productKey, deviceName);
-//                Request configRequest = new Request();
-//                configRequest.setId(UUID.randomUUID().toString());
-//                String configPayload = JsonUtils.toJsonString(configRequest);
-//                client.publish(configGetTopic, Buffer.buffer(configPayload), MqttQoS.AT_LEAST_ONCE, false, false);
-//                log.info("publish message,topic:{},payload:{}", configGetTopic, configPayload);
-
-                //注册子设备
-                for (Device subDevice : subDevices) {
-                    log.info("start register sub device,pk:{},dn:{}", subDevice.getProductKey(), subDevice.getDeviceName());
-                    Request request = new Request();
-                    request.setId(UUID.randomUUID().toString());
-                    request.setParams(subDevice);
-                    String registerTopic = String.format("/sys/%s/%s/s/register", productKey, deviceName);
-                    String payload = Json.encode(request);
-                    client.publish(registerTopic, Buffer.buffer(payload), MqttQoS.AT_LEAST_ONCE, false, false);
-                    log.info("publish message,topic:{},payload:{}", registerTopic, payload);
-                }
-            });
-
-            client.publishHandler(new MessageHandler(client, this, deviceOnlineListener));
-
-            client.closeHandler((v) -> {
-                log.info("{} closed,reconnecting...", deviceName);
-                client.disconnect();
-            });
-
-        } catch (Throwable e) {
-            log.error("connect mqtt-broker error", e);
-        } finally {
-            isConnecting = false;
-        }
-    }
-
-    public void addSubDevice(String productKey, String productSecret, String deviceName, String model) {
-        subDevices.add(new Device(productKey, productSecret, deviceName, model));
-    }
-
-    public void onDeviceOnline(Consumer<Device> listener) {
-        this.deviceOnlineListener = listener;
-    }
-
-
-    public static class OnConnected implements Handler<AsyncResult<MqttConnAckMessage>> {
-
-        @Override
-        public void handle(AsyncResult<MqttConnAckMessage> mqttConnAckMessageAsyncResult) {
-
-        }
-    }
-
-}

+ 0 - 100
iot-test-tool/iot-test-mqtt/src/main/java/cc/iotkit/test/mqtt/service/MessageHandler.java

@@ -1,100 +0,0 @@
-/*
- * +----------------------------------------------------------------------
- * | Copyright (c) 奇特物联 2021-2022 All rights reserved.
- * +----------------------------------------------------------------------
- * | Licensed 未经许可不能去掉「奇特物联」相关版权
- * +----------------------------------------------------------------------
- * | Author: xw2sy@163.com
- * +----------------------------------------------------------------------
- */
-package cc.iotkit.test.mqtt.service;
-
-
-import cc.iotkit.test.mqtt.model.Request;
-import cc.iotkit.test.mqtt.model.Response;
-import io.netty.handler.codec.mqtt.MqttQoS;
-import io.vertx.core.Handler;
-import io.vertx.core.buffer.Buffer;
-import io.vertx.core.json.Json;
-import io.vertx.mqtt.MqttClient;
-import io.vertx.mqtt.messages.MqttPublishMessage;
-import lombok.Data;
-import lombok.SneakyThrows;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-import java.util.function.Consumer;
-
-@Slf4j
-@Data
-public class MessageHandler implements Handler<MqttPublishMessage> {
-
-    private MqttClient client;
-    private Gateway gateway;
-    private Consumer<Device> deviceOnlineListener;
-
-    public MessageHandler(MqttClient client, Gateway gateway, Consumer<Device> deviceOnlineListener) {
-        this.client = client;
-        this.gateway = gateway;
-        this.deviceOnlineListener = deviceOnlineListener;
-    }
-
-    @SneakyThrows
-
-    @Override
-    public void handle(MqttPublishMessage msg) {
-        try {
-            String topic = msg.topicName();
-            String payload = msg.payload().toString();
-
-            log.info("received msg,topic:{},payload:{}", topic, payload);
-
-            if (topic.endsWith("register_reply")) {
-                Response response = Json.decodeValue(payload, Response.class);
-                //子设备注册成功
-                if (response.getCode() == 0) {
-                    Map<String, Object> data = response.getData();
-                    String productKey = data.get("productKey").toString();
-                    String deviceName = data.get("deviceName").toString();
-                    if (StringUtils.isBlank(productKey)) {
-                        deviceOnlineListener.accept(new Device(productKey, "",deviceName, ""));
-                        return;
-                    }
-
-                    //订阅子设备消息
-                    String subTopic = String.format("/sys/%s/%s/c/#", productKey, deviceName);
-                    log.info("subscribe topic:{}", subTopic);
-                    client.subscribe(subTopic, 1, r -> {
-                        if (deviceOnlineListener != null) {
-                            deviceOnlineListener.accept(new Device(productKey,"", deviceName, ""));
-                        }
-                    });
-                }
-            }
-
-            if (topic.endsWith("_reply")) {
-                return;
-            }
-            Request request = Json.decodeValue(payload, Request.class);
-
-            Response response = new Response(request.getId(), 0, new HashMap<>());
-            client.publish(topic.replace("/c/", "/s/") + "_reply",
-                    Buffer.buffer(Json.encode(response)), MqttQoS.AT_LEAST_ONCE, false, false);
-
-            //属性设置后上报属性
-            String setTopic = "/c/service/property/set";
-            if (topic.endsWith(setTopic)) {
-                request.setId(UUID.randomUUID().toString());
-                client.publish(topic.replace(setTopic, "/s/event/property/post"),
-                        Buffer.buffer(Json.encode(request)), MqttQoS.AT_LEAST_ONCE, false, false);
-            }
-        } catch (Throwable e) {
-            log.info("receive msg error", e);
-        }
-    }
-
-
-}

+ 0 - 67
iot-test-tool/iot-test-mqtt/src/main/java/cc/iotkit/test/mqtt/service/ReportTask.java

@@ -1,67 +0,0 @@
-/*
- * +----------------------------------------------------------------------
- * | Copyright (c) 奇特物联 2021-2022 All rights reserved.
- * +----------------------------------------------------------------------
- * | Licensed 未经许可不能去掉「奇特物联」相关版权
- * +----------------------------------------------------------------------
- * | Author: xw2sy@163.com
- * +----------------------------------------------------------------------
- */
-package cc.iotkit.test.mqtt.service;
-
-import cc.iotkit.test.mqtt.model.Request;
-import io.netty.handler.codec.mqtt.MqttQoS;
-import io.vertx.core.buffer.Buffer;
-import io.vertx.core.json.Json;
-import io.vertx.mqtt.MqttClient;
-import lombok.extern.slf4j.Slf4j;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.Callable;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-
-@Slf4j
-public class ReportTask {
-
-    private final MqttClient client;
-    private final Map<String, Callable<Request>> taskMap = new HashMap<>();
-    private ScheduledExecutorService taskService = null;
-
-    public ReportTask(MqttClient client) {
-        this.client = client;
-    }
-
-    public void start(int interval) {
-        if (taskService == null) {
-            taskService = Executors.newScheduledThreadPool(1);
-            taskService.scheduleWithFixedDelay(this::send, 3, interval, TimeUnit.SECONDS);
-        }
-    }
-
-    private void send() {
-        taskMap.forEach((topic, action) -> {
-            try {
-                Request request = action.call();
-                if (request == null) {
-                    return;
-                }
-                if (!client.isConnected()) {
-                    return;
-                }
-                String msg = Json.encode(request);
-                log.info("send msg,topic:{},payload:{}", topic, msg);
-                client.publish(topic, Buffer.buffer(msg), MqttQoS.AT_LEAST_ONCE, false, false);
-
-            } catch (Throwable e) {
-                log.error("send error", e);
-            }
-        });
-    }
-
-    public void addTask(String topic, Callable<Request> callable) {
-        taskMap.put(topic, callable);
-    }
-}

+ 0 - 21
iot-test-tool/iot-test-mqtt/src/main/java/cc/iotkit/test/mqtt/service/Vertxs.java

@@ -1,21 +0,0 @@
-/*
- * +----------------------------------------------------------------------
- * | Copyright (c) 奇特物联 2021-2022 All rights reserved.
- * +----------------------------------------------------------------------
- * | Licensed 未经许可不能去掉「奇特物联」相关版权
- * +----------------------------------------------------------------------
- * | Author: xw2sy@163.com
- * +----------------------------------------------------------------------
- */
-package cc.iotkit.test.mqtt.service;
-
-import io.vertx.core.Vertx;
-
-public class Vertxs {
-
-    private static final Vertx INSTANCE = Vertx.vertx();
-
-    public static Vertx getVertx() {
-        return INSTANCE;
-    }
-}

+ 0 - 36
iot-test-tool/iot-test-mqtt/src/main/resources/log4j2.xml

@@ -1,36 +0,0 @@
-
-<?xml version="1.0" encoding="UTF-8"?>
-<Configuration>
-    <Properties>
-        <property name="CONSOLE_LOG_PATTERN"
-                  value="%d{yyyy-MM-dd HH:mm:ss.SSS} %highlight{%5p}{TRACE=blue, DEBUG=green, INFO=green,
-            WARN=yellow, ERROR=red, FATAL=red} %tid --- [%style{%15.15t}{magenta}] %-40.40logger{39}---[%4L] : %m%n"/>
-        <property name="FILE_LOG_PATTERN"
-                  value="%d{yyyy-MM-dd HH:mm:ss.SSS} %5p %tid --- [%15.15t] %-40.40logger{39}---[%4L] : %m%n"/>
-    </Properties>
-
-    <Appenders>
-        <Console name="Console" target="SYSTEM_OUT">
-            <PatternLayout pattern="${CONSOLE_LOG_PATTERN}"/>
-        </Console>
-        <RollingRandomAccessFile name="FILE" fileName="logs/logging-log4j2.log" append="true"
-                                 filePattern="logs/logging-log4j2.log.%d{yyyyMMdd}">
-            <PatternLayout>
-                <Pattern>${FILE_LOG_PATTERN}</Pattern>
-            </PatternLayout>
-            <Policies>
-                <TimeBasedTriggeringPolicy interval="24" modulate="true"/>
-            </Policies>
-        </RollingRandomAccessFile>
-    </Appenders>
-
-    <Loggers>
-        <AsyncLogger name="cc.iotkit" level="debug" additivity="false" includeLocation="true">
-            <AppenderRef ref="Console"/>
-            <appender-ref ref="FILE"/>
-        </AsyncLogger>
-        <Root level="debug">
-            <AppenderRef ref="Console"/>
-        </Root>
-    </Loggers>
-</Configuration>

+ 0 - 1
iot-test-tool/iot-test-mqtt/src/main/resources/vertx-default-jul-logging.properties

@@ -1 +0,0 @@
-.level=DEBUG

+ 0 - 1
iot-test-tool/pom.xml

@@ -14,7 +14,6 @@
     </description>
 
     <modules>
-        <module>iot-test-mqtt</module>
         <module>iot-virtual-device</module>
     </modules>