Ver Fonte

feature: 推送审计https测试类

mazq há 1 ano atrás
pai
commit
62be1838cf

+ 2 - 2
dcuc-auth-service/src/main/resources/application-auth.yml

@@ -71,6 +71,6 @@ dcuc:
       address: redis://127.0.0.1:6379
       password:
 app:
-  audit:
+  auditlog:
     qmtj:
-      host-address: https://127.0.0.1:8843
+      host-address: https://10.11.0.168:8843

+ 40 - 0
dcuc-auth-service/src/test/java/com/dragoninfo/dcuc/auth/auth/service/LogSendComponentTest.java

@@ -0,0 +1,40 @@
+package com.dragoninfo.dcuc.auth.auth.service;
+
+import com.dragoninfo.dcuc.auth.DcucAuthApplication;
+import com.dragoninfo.dcuc.auth.audit.config.AuditConfig;
+import com.dragoninfo.dcuc.auth.audit.constance.AuditConstance;
+import com.dragoninfo.dcuc.auth.config.DcucAuthConfig;
+import com.dragonsoft.auditlog.collection.qmtj.LogSendComponent;
+import com.dragonsoft.auditlog.collection.qmtj.pojo.req.AuthenticationBusLog;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author mazq
+ * @date 2023/4/3
+ */
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = DcucAuthApplication.class)
+public class LogSendComponentTest {
+
+    @Autowired
+    private LogSendComponent logSendComponent;
+
+    @Test
+    public void httpsLogSend() {
+        List<AuthenticationBusLog> busLogs = new ArrayList<>();
+        AuthenticationBusLog busLog = new AuthenticationBusLog();
+        busLog.setAppToken("appToken");
+        busLog.setAuthId("authId");
+        busLog.setAuthIdcard("0000000000000000001");
+        busLogs.add(busLog);
+        logSendComponent.sendAuthenticationBusLog("sysId", AuditConstance.AUDIT_LOG_TYPE_JQ, busLogs);
+    }
+
+}

+ 1 - 0
dcuc-auth-service/src/test/java/com/dragoninfo/dcuc/auth/auth/service/QmAuditPushServiceTest.java

@@ -43,6 +43,7 @@ public class QmAuditPushServiceTest {
 
         LogSendComponent logSendComponent = new LogSendComponent();
         QmTjProperties qmTjProperties = Mockito.spy(QmTjProperties.class);
+        qmTjProperties.setHostAddress("https://10.11.0.168:8843");
         logSendComponent.setQmTjProperties(qmTjProperties);
 
         qmAuditPushService.setConfig(auditConfig);