Browse Source

ICE待办测试

wuhb 4 tháng trước cách đây
mục cha
commit
6bf46047ab

+ 79 - 0
ygtx-admin/src/main/java/com/ygtx/web/util/IcePendiingTaskTest.java

@@ -0,0 +1,79 @@
+package com.ygtx.web.util;
+
+import cn.hutool.json.JSONUtil;
+import com.ygtx.common.config.IcePendingTaskProperties;
+import com.ygtx.common.core.domain.ice.IcePendingTaskRequest;
+import com.ygtx.common.core.domain.ice.IcePendingTaskResponse;
+import com.ygtx.common.core.domain.ice.IcePendingTaskStatusRequest;
+import com.ygtx.web.service.IcePendingTaskService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class IcePendiingTaskTest {
+    @Autowired
+    private IcePendingTaskService icePendingTaskService;
+
+    @Autowired
+    private IcePendingTaskProperties icePendingTaskProperties;
+
+    /**
+     * 测试推送待办消息
+     */
+    public void testSendPendingTask()
+    {
+        // 创建待办任务请求对象
+        IcePendingTaskRequest request = new IcePendingTaskRequest();
+        request.setTitle("测试待办任务");
+        request.setSumary("这是一个测试待办任务");
+        request.setContent("详细内容:这是一条测试推送的消息。");
+        request.setCode("TEST001");
+        request.setUrl("http://localhost:8080/test/task/123");
+        request.setTaskId("test-task-123");
+        request.setIsCompleted("1"); // 待办状态
+
+        // 推送待办消息
+        IcePendingTaskResponse response = icePendingTaskService.sendPendingTask(request);
+
+        // 验证响应对象不为空
+        System.out.println(JSONUtil.parse(response));
+    }
+
+    /**
+     * 测试更新待办任务状态
+     */
+    public void testUpdatePendingTaskStatus()
+    {
+        // 创建状态变更请求对象
+        IcePendingTaskStatusRequest statusRequest = new IcePendingTaskStatusRequest();
+        statusRequest.setTaskId("test-task-123");
+        statusRequest.setIsCompleted("2"); // 已办状态
+        statusRequest.setSystemId("ygtx-system");
+
+        // 更新状态
+        IcePendingTaskResponse response = icePendingTaskService.updatePendingTaskStatus(statusRequest);
+
+        // 验证响应对象不为空
+        System.out.println(JSONUtil.parse(response));
+    }
+
+    /**
+     * 测试取消待办任务
+     */
+    public void testCancelPendingTask()
+    {
+        // 测试取消待办任务
+        IcePendingTaskResponse response = icePendingTaskService.cancelPendingTask("test-task-123", "ygtx-system");
+
+        // 验证响应对象不为空
+        System.out.println(JSONUtil.parse(response));
+    }
+
+    /**
+     * 测试配置属性加载
+     */
+    public void testConfigProperties()
+    {
+        // 验证配置属性已正确加载
+        System.out.println(JSONUtil.parse(icePendingTaskProperties));
+        System.out.println(icePendingTaskProperties.getSystemId());
+    }
+}