From 0f54bc965f577e0926daff40c3929d658ce31378 Mon Sep 17 00:00:00 2001
From: bsw215583320 <baoshiwei121@163.com>
Date: 星期三, 06 三月 2024 08:58:31 +0800
Subject: [PATCH] 提交测试代码

---
 jeecg-module-dry/jeecg-module-dry-start/src/main/test/java/com/lanbao/SocketTest.java |   29 +++++++++++++++++++++++++++++
 jeecg-module-dry/jeecg-module-dry-start/src/main/test/java/com/lanbao/AiTest.java     |   27 +++++++++++++++++++++++++++
 2 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/jeecg-module-dry/jeecg-module-dry-start/src/main/test/java/com/lanbao/AiTest.java b/jeecg-module-dry/jeecg-module-dry-start/src/main/test/java/com/lanbao/AiTest.java
new file mode 100644
index 0000000..4f2a6c3
--- /dev/null
+++ b/jeecg-module-dry/jeecg-module-dry-start/src/main/test/java/com/lanbao/AiTest.java
@@ -0,0 +1,27 @@
+package com.lanbao;
+
+import ai.djl.modality.Classifications;
+import org.jeecg.modules.dry.util.HerbUtil;
+import org.junit.Test;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.List;
+
+public class AiTest {
+    @Test
+    public void test() {
+        try {
+            String img = "E:\\testImg\\szp1.jpg";
+            HerbUtil herbUtil = new HerbUtil();
+            File file = new File(img);
+            InputStream is = new FileInputStream(file);
+            List<Classifications.Classification> predict = herbUtil.predict(is);
+            System.out.println(predict);
+        } catch (FileNotFoundException e) {
+            throw new RuntimeException(e);
+        }
+    }
+}
diff --git a/jeecg-module-dry/jeecg-module-dry-start/src/main/test/java/com/lanbao/SocketTest.java b/jeecg-module-dry/jeecg-module-dry-start/src/main/test/java/com/lanbao/SocketTest.java
new file mode 100644
index 0000000..4590ae1
--- /dev/null
+++ b/jeecg-module-dry/jeecg-module-dry-start/src/main/test/java/com/lanbao/SocketTest.java
@@ -0,0 +1,29 @@
+package com.lanbao;
+
+import com.alibaba.fastjson.JSONObject;
+import org.jeecg.modules.dry.vo.SocketMsgVo;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.net.Socket;
+import java.nio.channels.SocketChannel;
+
+public class SocketTest {
+    public static void main(String[] args) {
+        try {
+            Socket socket = new Socket("192.168.2.6", 1115);
+            ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
+
+            SocketMsgVo msgVo = new SocketMsgVo();
+            msgVo.setCode("1");
+            msgVo.setMsg("1111");
+            oos.writeObject(JSONObject.toJSONString(msgVo));
+            oos.close();
+            socket.close();
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+}

--
Gitblit v1.9.3