Преглед на файлове

test: 引入 test 包,并增加用户获取测试用例

linwenhua преди 3 години
родител
ревизия
6797a5e212
променени са 2 файла, в които са добавени 34 реда и са изтрити 0 реда
  1. 10 0
      smsb-customer-manager-start/pom.xml
  2. 24 0
      smsb-customer-manager-start/src/test/java/com/inspur/customer/KeycloakTest.java

+ 10 - 0
smsb-customer-manager-start/pom.xml

@@ -35,6 +35,16 @@
             <groupId>org.springframework.cloud</groupId>
             <artifactId>spring-cloud-starter-bootstrap</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>

+ 24 - 0
smsb-customer-manager-start/src/test/java/com/inspur/customer/KeycloakTest.java

@@ -0,0 +1,24 @@
+package com.inspur.customer;
+
+import com.inspur.customer.service.client.keycloak.KeycloakService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+/**
+ * @author linwenhua
+ * @date 2022-06-14 17:20
+ **/
+@Slf4j
+@SpringBootTest
+class KeycloakTest {
+
+    @DubboReference
+    private KeycloakService keycloakService;
+
+    @Test
+    void getUsersInRole() {
+        log.info("user: {}", keycloakService.getUsersInRole("ROLE_SUPER_ADMIN"));
+    }
+}