|
|
@@ -1,4 +1,4 @@
|
|
|
-package cn.reghao.devops.mgr.thirdparty.consul;
|
|
|
+package cn.reghao.devops.mgr.devops;
|
|
|
|
|
|
import cn.reghao.jutil.jdk.http.WebClient;
|
|
|
import cn.reghao.jutil.jdk.http.WebRequest;
|
|
|
@@ -7,7 +7,9 @@ import cn.reghao.jutil.jdk.serializer.JsonConverter;
|
|
|
import com.google.gson.JsonArray;
|
|
|
import com.google.gson.JsonElement;
|
|
|
import com.google.gson.JsonObject;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import lombok.Getter;
|
|
|
+import org.junit.Test;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.net.URI;
|
|
|
@@ -19,12 +21,7 @@ import java.util.ArrayList;
|
|
|
import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
|
|
|
-/**
|
|
|
- * @author reghao
|
|
|
- * @date 2023-02-22 17:29:13
|
|
|
- */
|
|
|
-@Service
|
|
|
-public class ConsulService {
|
|
|
+public class ThirdpartyServiceTest {
|
|
|
private final WebRequest webRequest = new WebClient();
|
|
|
private final String host = "http://consul.iquizoo.cn";
|
|
|
|
|
|
@@ -75,15 +72,21 @@ public class ConsulService {
|
|
|
String body = httpResponse.body();
|
|
|
}
|
|
|
|
|
|
- public static void main(String[] args) throws URISyntaxException, IOException, InterruptedException {
|
|
|
- ConsulService consulService = new ConsulService();
|
|
|
- List<ConsulNode> consulNodes = consulService.getNodes();
|
|
|
+ @Test
|
|
|
+ public void consulTest() throws Exception {
|
|
|
+ //List<ConsulNode> consulNodes = getNodes();
|
|
|
|
|
|
- List<String> list = consulService.getServices();
|
|
|
- System.out.println(list);
|
|
|
+ //System.out.println(getServices());
|
|
|
|
|
|
String service = "FileGrpcService_172_16_45_66_8104";
|
|
|
service = "FileService-WebApi_172_16_45_66_8004";
|
|
|
- //consulService.deregister(service);
|
|
|
+ //deregister(service);
|
|
|
}
|
|
|
-}
|
|
|
+
|
|
|
+ @AllArgsConstructor
|
|
|
+ @Getter
|
|
|
+ static class ConsulNode {
|
|
|
+ private String dc;
|
|
|
+ private String address;
|
|
|
+ }
|
|
|
+}
|