|
|
@@ -1,10 +1,7 @@
|
|
|
package com.ruoyi;
|
|
|
|
|
|
-import com.aizuda.snailjob.client.job.core.handler.query.RequestQueryHandler;
|
|
|
-import com.aizuda.snailjob.model.response.JobApiResponse;
|
|
|
-import com.ruoyi.RuoYiApplication;
|
|
|
-import com.ruoyi.common.utils.DateUtils;
|
|
|
-import com.ruoyi.interfaces.api.SnailJobApi;
|
|
|
+import com.agentsflex.chain.node.JsExecNode;
|
|
|
+import com.agentsflex.core.chain.Chain;
|
|
|
import org.jasypt.encryption.StringEncryptor;
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
import org.slf4j.Logger;
|
|
|
@@ -12,9 +9,11 @@ import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
import org.springframework.test.context.TestPropertySource;
|
|
|
-import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
|
|
import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
@SpringBootTest(classes = RuoYiApplication.class)
|
|
|
@TestPropertySource(properties = {"spring.profiles.active=druid"})
|
|
|
public class JasyptTest {
|
|
|
@@ -24,9 +23,334 @@ public class JasyptTest {
|
|
|
|
|
|
@Test
|
|
|
public void encryptPwd() {
|
|
|
- RequestQueryHandler jobDetail = SnailJobApi.getJobDetail(1l);
|
|
|
- JobApiResponse execute = jobDetail.execute();
|
|
|
- System.out.println(execute.toString());
|
|
|
+
|
|
|
+ String code = "{\n" +
|
|
|
+ " \"edges\": [\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"id\": \"g1MbfnZ5Gwb90H8H\",\n" +
|
|
|
+ " \"source\": \"node_ncZomj9VYJSr3P3V\",\n" +
|
|
|
+ " \"target\": \"node_6ajjEYlMDPcYl3ae\",\n" +
|
|
|
+ " \"selected\": false\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"id\": \"jC3w6Thci7Ua8tFO\",\n" +
|
|
|
+ " \"source\": \"U6DteBZHGQfaBvpP\",\n" +
|
|
|
+ " \"target\": \"node_6ajjEYlMDPcYl3ae\",\n" +
|
|
|
+ " \"selected\": false\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"id\": \"LY9hCUFEEqq0AoZl\",\n" +
|
|
|
+ " \"source\": \"ucHhhciLB2U9snEM\",\n" +
|
|
|
+ " \"target\": \"node_6ajjEYlMDPcYl3ae\",\n" +
|
|
|
+ " \"selected\": false\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"id\": \"EIOzuvcuPaD4k9tb\",\n" +
|
|
|
+ " \"source\": \"node_B3Lz55SHHuTTE3TC\",\n" +
|
|
|
+ " \"target\": \"node_ncZomj9VYJSr3P3V\",\n" +
|
|
|
+ " \"selected\": false\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"id\": \"t68rwPo1Q8UFcRZc\",\n" +
|
|
|
+ " \"source\": \"node_1z5lKKFYhSYjDyKI\",\n" +
|
|
|
+ " \"target\": \"node_B3Lz55SHHuTTE3TC\",\n" +
|
|
|
+ " \"selected\": false\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"id\": \"M11hEF6ug1Wb79XB\",\n" +
|
|
|
+ " \"source\": \"node_B3Lz55SHHuTTE3TC\",\n" +
|
|
|
+ " \"target\": \"U6DteBZHGQfaBvpP\",\n" +
|
|
|
+ " \"selected\": false\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"id\": \"6mL3Q2RAiHqiCkHm\",\n" +
|
|
|
+ " \"source\": \"node_B3Lz55SHHuTTE3TC\",\n" +
|
|
|
+ " \"target\": \"ucHhhciLB2U9snEM\",\n" +
|
|
|
+ " \"selected\": false\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"id\": \"L8v1pqEBUdeqsk1e\",\n" +
|
|
|
+ " \"source\": \"node_6ajjEYlMDPcYl3ae\",\n" +
|
|
|
+ " \"target\": \"node_tciO7KE86u6PHgKr\"\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"id\": \"aO2ayu7f6CkuKs0r\",\n" +
|
|
|
+ " \"source\": \"node_tciO7KE86u6PHgKr\",\n" +
|
|
|
+ " \"target\": \"node_At2IIxQgEILAOu4n\"\n" +
|
|
|
+ " }\n" +
|
|
|
+ " ],\n" +
|
|
|
+ " \"nodes\": [\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"id\": \"node_1z5lKKFYhSYjDyKI\",\n" +
|
|
|
+ " \"data\": {\n" +
|
|
|
+ " \"title\": \"开始节点\",\n" +
|
|
|
+ " \"description\": \"开始定义输入参数\"\n" +
|
|
|
+ " },\n" +
|
|
|
+ " \"type\": \"startNode\",\n" +
|
|
|
+ " \"dragging\": false,\n" +
|
|
|
+ " \"measured\": {\n" +
|
|
|
+ " \"width\": 306,\n" +
|
|
|
+ " \"height\": 88\n" +
|
|
|
+ " },\n" +
|
|
|
+ " \"position\": {\n" +
|
|
|
+ " \"x\": -547.0868680833916,\n" +
|
|
|
+ " \"y\": 137.4465838737692\n" +
|
|
|
+ " },\n" +
|
|
|
+ " \"selected\": false\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"id\": \"node_ncZomj9VYJSr3P3V\",\n" +
|
|
|
+ " \"data\": {\n" +
|
|
|
+ " \"title\": \"获取雨量数据\",\n" +
|
|
|
+ " \"expand\": false,\n" +
|
|
|
+ " \"method\": \"get\",\n" +
|
|
|
+ " \"outputDefs\": [\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"id\": \"1tTsWjENoLfB4JJa\",\n" +
|
|
|
+ " \"name\": \"headers\",\n" +
|
|
|
+ " \"refType\": \"ref\",\n" +
|
|
|
+ " \"dataType\": \"Object\",\n" +
|
|
|
+ " \"nameDisabled\": true,\n" +
|
|
|
+ " \"deleteDisabled\": true,\n" +
|
|
|
+ " \"dataTypeDisabled\": true\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"id\": \"9OP5JjlkBqARboVZ\",\n" +
|
|
|
+ " \"name\": \"body\",\n" +
|
|
|
+ " \"refType\": \"ref\",\n" +
|
|
|
+ " \"dataType\": \"String\",\n" +
|
|
|
+ " \"nameDisabled\": true,\n" +
|
|
|
+ " \"deleteDisabled\": true\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"id\": \"94bsldmZ4cbcx7Or\",\n" +
|
|
|
+ " \"name\": \"statusCode\",\n" +
|
|
|
+ " \"refType\": \"ref\",\n" +
|
|
|
+ " \"dataType\": \"Number\",\n" +
|
|
|
+ " \"nameDisabled\": true,\n" +
|
|
|
+ " \"deleteDisabled\": true,\n" +
|
|
|
+ " \"dataTypeDisabled\": true\n" +
|
|
|
+ " }\n" +
|
|
|
+ " ],\n" +
|
|
|
+ " \"parameters\": [\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"id\": \"xscx2BZ3xAx8FBdB\",\n" +
|
|
|
+ " \"name\": \"STCD\",\n" +
|
|
|
+ " \"refType\": \"ref\",\n" +
|
|
|
+ " \"dataType\": \"String\"\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"id\": \"tvzDXYZDpPHuCm1b\",\n" +
|
|
|
+ " \"name\": \"\",\n" +
|
|
|
+ " \"refType\": \"ref\",\n" +
|
|
|
+ " \"dataType\": \"String\"\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"id\": \"jGFiQp0F47cfUODL\",\n" +
|
|
|
+ " \"name\": \"\",\n" +
|
|
|
+ " \"refType\": \"ref\",\n" +
|
|
|
+ " \"dataType\": \"String\"\n" +
|
|
|
+ " }\n" +
|
|
|
+ " ],\n" +
|
|
|
+ " \"description\": \"通过 HTTP 请求获取数据\"\n" +
|
|
|
+ " },\n" +
|
|
|
+ " \"type\": \"httpNode\",\n" +
|
|
|
+ " \"dragging\": false,\n" +
|
|
|
+ " \"measured\": {\n" +
|
|
|
+ " \"width\": 306,\n" +
|
|
|
+ " \"height\": 88\n" +
|
|
|
+ " },\n" +
|
|
|
+ " \"position\": {\n" +
|
|
|
+ " \"x\": 392.078125,\n" +
|
|
|
+ " \"y\": 34.671875\n" +
|
|
|
+ " },\n" +
|
|
|
+ " \"selected\": false\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"id\": \"U6DteBZHGQfaBvpP\",\n" +
|
|
|
+ " \"data\": {\n" +
|
|
|
+ " \"title\": \"获取水位数据\",\n" +
|
|
|
+ " \"expand\": false,\n" +
|
|
|
+ " \"method\": \"get\",\n" +
|
|
|
+ " \"outputDefs\": [\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"id\": \"1tTsWjENoLfB4JJa\",\n" +
|
|
|
+ " \"name\": \"headers\",\n" +
|
|
|
+ " \"refType\": \"ref\",\n" +
|
|
|
+ " \"dataType\": \"Object\",\n" +
|
|
|
+ " \"nameDisabled\": true,\n" +
|
|
|
+ " \"deleteDisabled\": true,\n" +
|
|
|
+ " \"dataTypeDisabled\": true\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"id\": \"9OP5JjlkBqARboVZ\",\n" +
|
|
|
+ " \"name\": \"body\",\n" +
|
|
|
+ " \"refType\": \"ref\",\n" +
|
|
|
+ " \"dataType\": \"String\",\n" +
|
|
|
+ " \"nameDisabled\": true,\n" +
|
|
|
+ " \"deleteDisabled\": true\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"id\": \"94bsldmZ4cbcx7Or\",\n" +
|
|
|
+ " \"name\": \"statusCode\",\n" +
|
|
|
+ " \"refType\": \"ref\",\n" +
|
|
|
+ " \"dataType\": \"Number\",\n" +
|
|
|
+ " \"nameDisabled\": true,\n" +
|
|
|
+ " \"deleteDisabled\": true,\n" +
|
|
|
+ " \"dataTypeDisabled\": true\n" +
|
|
|
+ " }\n" +
|
|
|
+ " ],\n" +
|
|
|
+ " \"description\": \"通过 HTTP 请求获取数据\"\n" +
|
|
|
+ " },\n" +
|
|
|
+ " \"type\": \"httpNode\",\n" +
|
|
|
+ " \"dragging\": false,\n" +
|
|
|
+ " \"measured\": {\n" +
|
|
|
+ " \"width\": 306,\n" +
|
|
|
+ " \"height\": 88\n" +
|
|
|
+ " },\n" +
|
|
|
+ " \"position\": {\n" +
|
|
|
+ " \"x\": 390.078125,\n" +
|
|
|
+ " \"y\": 154.671875\n" +
|
|
|
+ " },\n" +
|
|
|
+ " \"selected\": false\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"id\": \"ucHhhciLB2U9snEM\",\n" +
|
|
|
+ " \"data\": {\n" +
|
|
|
+ " \"title\": \"获取气象数据\",\n" +
|
|
|
+ " \"method\": \"get\",\n" +
|
|
|
+ " \"outputDefs\": [\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"id\": \"1tTsWjENoLfB4JJa\",\n" +
|
|
|
+ " \"name\": \"headers\",\n" +
|
|
|
+ " \"refType\": \"ref\",\n" +
|
|
|
+ " \"dataType\": \"Object\",\n" +
|
|
|
+ " \"nameDisabled\": true,\n" +
|
|
|
+ " \"deleteDisabled\": true,\n" +
|
|
|
+ " \"dataTypeDisabled\": true\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"id\": \"9OP5JjlkBqARboVZ\",\n" +
|
|
|
+ " \"name\": \"body\",\n" +
|
|
|
+ " \"refType\": \"ref\",\n" +
|
|
|
+ " \"dataType\": \"String\",\n" +
|
|
|
+ " \"nameDisabled\": true,\n" +
|
|
|
+ " \"deleteDisabled\": true\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"id\": \"94bsldmZ4cbcx7Or\",\n" +
|
|
|
+ " \"name\": \"statusCode\",\n" +
|
|
|
+ " \"refType\": \"ref\",\n" +
|
|
|
+ " \"dataType\": \"Number\",\n" +
|
|
|
+ " \"nameDisabled\": true,\n" +
|
|
|
+ " \"deleteDisabled\": true,\n" +
|
|
|
+ " \"dataTypeDisabled\": true\n" +
|
|
|
+ " }\n" +
|
|
|
+ " ],\n" +
|
|
|
+ " \"description\": \"通过 HTTP 请求获取数据\"\n" +
|
|
|
+ " },\n" +
|
|
|
+ " \"type\": \"httpNode\",\n" +
|
|
|
+ " \"dragging\": false,\n" +
|
|
|
+ " \"measured\": {\n" +
|
|
|
+ " \"width\": 306,\n" +
|
|
|
+ " \"height\": 88\n" +
|
|
|
+ " },\n" +
|
|
|
+ " \"position\": {\n" +
|
|
|
+ " \"x\": 390.078125,\n" +
|
|
|
+ " \"y\": 268.671875\n" +
|
|
|
+ " },\n" +
|
|
|
+ " \"selected\": false\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"id\": \"node_6ajjEYlMDPcYl3ae\",\n" +
|
|
|
+ " \"data\": {\n" +
|
|
|
+ " \"title\": \"模型计算\",\n" +
|
|
|
+ " \"expand\": false\n" +
|
|
|
+ " },\n" +
|
|
|
+ " \"type\": \"task-node\",\n" +
|
|
|
+ " \"dragging\": false,\n" +
|
|
|
+ " \"measured\": {\n" +
|
|
|
+ " \"width\": 306,\n" +
|
|
|
+ " \"height\": 88\n" +
|
|
|
+ " },\n" +
|
|
|
+ " \"position\": {\n" +
|
|
|
+ " \"x\": 866.148775304685,\n" +
|
|
|
+ " \"y\": 134.94990664309157\n" +
|
|
|
+ " },\n" +
|
|
|
+ " \"selected\": false\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"id\": \"node_At2IIxQgEILAOu4n\",\n" +
|
|
|
+ " \"data\": {\n" +
|
|
|
+ " \"title\": \"图表节点\",\n" +
|
|
|
+ " \"expand\": false\n" +
|
|
|
+ " },\n" +
|
|
|
+ " \"type\": \"chart-node\",\n" +
|
|
|
+ " \"dragging\": false,\n" +
|
|
|
+ " \"measured\": {\n" +
|
|
|
+ " \"width\": 306,\n" +
|
|
|
+ " \"height\": 88\n" +
|
|
|
+ " },\n" +
|
|
|
+ " \"position\": {\n" +
|
|
|
+ " \"x\": 1707.2668779489672,\n" +
|
|
|
+ " \"y\": 134.90843037541023\n" +
|
|
|
+ " },\n" +
|
|
|
+ " \"selected\": false\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"id\": \"node_B3Lz55SHHuTTE3TC\",\n" +
|
|
|
+ " \"data\": {\n" +
|
|
|
+ " \"title\": \"新建方案\"\n" +
|
|
|
+ " },\n" +
|
|
|
+ " \"type\": \"task-node\",\n" +
|
|
|
+ " \"dragging\": false,\n" +
|
|
|
+ " \"measured\": {\n" +
|
|
|
+ " \"width\": 306,\n" +
|
|
|
+ " \"height\": 88\n" +
|
|
|
+ " },\n" +
|
|
|
+ " \"position\": {\n" +
|
|
|
+ " \"x\": -124.87829206235932,\n" +
|
|
|
+ " \"y\": 142.06519629483878\n" +
|
|
|
+ " },\n" +
|
|
|
+ " \"selected\": false\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"id\": \"node_tciO7KE86u6PHgKr\",\n" +
|
|
|
+ " \"data\": {\n" +
|
|
|
+ " \"title\": \"输出结果\",\n" +
|
|
|
+ " \"expand\": false\n" +
|
|
|
+ " },\n" +
|
|
|
+ " \"type\": \"task-node\",\n" +
|
|
|
+ " \"dragging\": false,\n" +
|
|
|
+ " \"measured\": {\n" +
|
|
|
+ " \"width\": 306,\n" +
|
|
|
+ " \"height\": 88\n" +
|
|
|
+ " },\n" +
|
|
|
+ " \"position\": {\n" +
|
|
|
+ " \"x\": 1291.991164789477,\n" +
|
|
|
+ " \"y\": 134.31405390092667\n" +
|
|
|
+ " },\n" +
|
|
|
+ " \"selected\": false\n" +
|
|
|
+ " }\n" +
|
|
|
+ " ],\n" +
|
|
|
+ " \"viewport\": {\n" +
|
|
|
+ " \"x\": 830.8418078373795,\n" +
|
|
|
+ " \"y\": 130.69047266353977,\n" +
|
|
|
+ " \"zoom\": 1.741101126592249\n" +
|
|
|
+ " }\n" +
|
|
|
+ "}";
|
|
|
+
|
|
|
+ Chain chain = new Chain();
|
|
|
+
|
|
|
+ JsExecNode a = new JsExecNode();
|
|
|
+ a.setCode(code);
|
|
|
+ a.setId("a");
|
|
|
+// a.setCode(code);
|
|
|
+ chain.addNode(a);
|
|
|
+
|
|
|
+ Map<String, Object> result = chain.executeForResult(new HashMap<>());
|
|
|
+ System.out.println(result.getClass());
|
|
|
+ System.out.println(result);
|
|
|
}
|
|
|
|
|
|
}
|