From efdb99f8cecc4afb592afad79c761081d5d5cf22 Mon Sep 17 00:00:00 2001
From: lee <4766465@qq.com>
Date: Wed, 18 Dec 2024 13:27:00 +0800
Subject: [PATCH] init

---
 xxl-job/xxl-job-admin/src/test/java/com/xxl/job/adminbiz/AdminBizTest.java |   75 +++++++++++++++++++++++++++++++++++++
 1 files changed, 75 insertions(+), 0 deletions(-)

diff --git a/xxl-job/xxl-job-admin/src/test/java/com/xxl/job/adminbiz/AdminBizTest.java b/xxl-job/xxl-job-admin/src/test/java/com/xxl/job/adminbiz/AdminBizTest.java
new file mode 100644
index 0000000..6fb89e7
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/test/java/com/xxl/job/adminbiz/AdminBizTest.java
@@ -0,0 +1,75 @@
+package com.xxl.job.adminbiz;
+
+import com.xxl.job.core.biz.AdminBiz;
+import com.xxl.job.core.biz.client.AdminBizClient;
+import com.xxl.job.core.biz.model.HandleCallbackParam;
+import com.xxl.job.core.biz.model.RegistryParam;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.context.XxlJobContext;
+import com.xxl.job.core.enums.RegistryConfig;
+import org.junit.jupiter.api.Test;
+
+import java.util.Arrays;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * admin api test
+ *
+ * @author xuxueli 2017-07-28 22:14:52
+ */
+public class AdminBizTest {
+
+    // admin-client
+    private static String addressUrl = "http://127.0.0.1:8080/xxl-job-admin/";
+    private static String accessToken = null;
+
+
+    @Test
+    public void callback() throws Exception {
+        AdminBiz adminBiz = new AdminBizClient(addressUrl, accessToken);
+
+        HandleCallbackParam param = new HandleCallbackParam();
+        param.setLogId(1);
+        param.setHandleCode(XxlJobContext.HANDLE_CODE_SUCCESS);
+
+        List<HandleCallbackParam> callbackParamList = Arrays.asList(param);
+
+        ReturnT<String> returnT = adminBiz.callback(callbackParamList);
+
+        assertTrue(returnT.getCode() == ReturnT.SUCCESS_CODE);
+    }
+
+    /**
+     * registry executor
+     *
+     * @throws Exception
+     */
+    @Test
+    public void registry() throws Exception {
+        AdminBiz adminBiz = new AdminBizClient(addressUrl, accessToken);
+
+        RegistryParam registryParam = new RegistryParam(RegistryConfig.RegistType.EXECUTOR.name(), "xxl-job-executor-example", "127.0.0.1:9999");
+        ReturnT<String> returnT = adminBiz.registry(registryParam);
+
+        assertTrue(returnT.getCode() == ReturnT.SUCCESS_CODE);
+    }
+
+    /**
+     * registry executor remove
+     *
+     * @throws Exception
+     */
+    @Test
+    public void registryRemove() throws Exception {
+        AdminBiz adminBiz = new AdminBizClient(addressUrl, accessToken);
+
+        RegistryParam registryParam = new RegistryParam(RegistryConfig.RegistType.EXECUTOR.name(), "xxl-job-executor-example", "127.0.0.1:9999");
+        ReturnT<String> returnT = adminBiz.registryRemove(registryParam);
+
+        assertTrue(returnT.getCode() == ReturnT.SUCCESS_CODE);
+
+    }
+
+}

--
Gitblit v1.9.3