|
@@ -0,0 +1,68 @@
|
|
|
+package com.winhc.test;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.winhc.kafka.KafkaProduce;
|
|
|
+import com.winhc.service.impl.CaseRelationImpl;
|
|
|
+import org.apache.commons.logging.Log;
|
|
|
+import org.apache.commons.logging.LogFactory;
|
|
|
+import org.junit.Test;
|
|
|
+import org.junit.runner.RunWith;
|
|
|
+import org.neo4j.driver.*;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.boot.test.context.SpringBootTest;
|
|
|
+import org.springframework.test.context.junit4.SpringRunner;
|
|
|
+
|
|
|
+import java.util.HashMap;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author π
|
|
|
+ * @Description:案件关联测试
|
|
|
+ * @date 2021/05/17 16:24
|
|
|
+ */
|
|
|
+@RunWith(SpringRunner.class)
|
|
|
+@SpringBootTest
|
|
|
+public class TestCaseNode {
|
|
|
+ Log log = LogFactory.getLog(TestCaseNode.class);
|
|
|
+ @Autowired
|
|
|
+ CaseRelationImpl caseRelationImpl;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ Driver driver;
|
|
|
+ @Autowired
|
|
|
+ KafkaProduce kafkaProduce;
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void sendKafka() {
|
|
|
+ log.info("start push save !");
|
|
|
+ String topic = "inc_case_dev";
|
|
|
+ long start = System.currentTimeMillis();
|
|
|
+ HashMap<Object, Object> map = new HashMap<>();
|
|
|
+ map.put("start_id","94ddf154ceaf380ff43b93298d0ca755_1");
|
|
|
+// map.put("start_no","888");
|
|
|
+ map.put("end_id","78f8d51759e8afd169130aacb96b27d4_0");
|
|
|
+// map.put("end_no","999");
|
|
|
+ map.put("connect_type","7");
|
|
|
+ map.put("topic_type","400");
|
|
|
+ String msg = JSON.toJSONString(map);
|
|
|
+ System.out.println(msg);
|
|
|
+ kafkaProduce.produce(topic, msg);
|
|
|
+ System.out.println(System.currentTimeMillis() - start);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void sendKafka2() {
|
|
|
+ log.info("start push save !");
|
|
|
+ String topic = "inc_case_dev";
|
|
|
+ long start = System.currentTimeMillis();
|
|
|
+ HashMap<Object, Object> map = new HashMap<>();
|
|
|
+ map.put("start_id","94ddf154ceaf380ff43b93298d0ca755_1");
|
|
|
+// map.put("start_no","999");
|
|
|
+ map.put("connect_type","6");
|
|
|
+ map.put("topic_type","500");
|
|
|
+ String msg = JSON.toJSONString(map);
|
|
|
+ System.out.println(msg);
|
|
|
+ kafkaProduce.produce(topic, msg);
|
|
|
+ System.out.println(System.currentTimeMillis() - start);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|