1. 备份代码
This commit is contained in:
parent
60df58164d
commit
00e6ddcd98
|
@ -60,6 +60,13 @@
|
|||
<classifier>exec</classifier>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
|
|
@ -34,6 +34,13 @@
|
|||
<classifier>exec</classifier>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
|
@ -63,6 +63,12 @@
|
|||
</dependencies>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${project.basedir}/config</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
@ -71,6 +77,15 @@
|
|||
<classifier>exec</classifier>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<dependenciesToScan>
|
||||
<dependency>com.cf.cs:cs-base</dependency>
|
||||
</dependenciesToScan>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
|
|
@ -2,13 +2,15 @@ package com.cf.cs.database;
|
|||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
|
||||
/**
|
||||
* The type Cs database application tests.
|
||||
*
|
||||
* @author xajhuang @163.com
|
||||
*/
|
||||
@SpringBootTest
|
||||
@SpringBootTest(classes = {CsDatabaseApplication.class})
|
||||
@ActiveProfiles({"user", "local"})
|
||||
class CsDatabaseApplicationTests {
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,6 +17,12 @@
|
|||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
@ -35,6 +41,24 @@
|
|||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<version>0.8.11</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mybatis-flex</groupId>
|
||||
<artifactId>mybatis-flex-spring-boot3-starter</artifactId>
|
||||
<version>1.7.8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-undertow</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.cf.cs</groupId>
|
||||
|
|
|
@ -5,7 +5,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
|
||||
@SpringBootApplication
|
||||
public class CsIntegrateTestApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(CsIntegrateTestApplication.class, args);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.cf.cs.base.common.ErrorCode;
|
|||
import com.cf.cs.base.common.ProtoCryptoType;
|
||||
import com.cf.cs.base.misc.HelperUtils;
|
||||
import com.cf.cs.protocol.config.ProtocolConfigure;
|
||||
import com.cf.cs.protocol.misc.ProtocolJsonUtils;
|
||||
import com.cf.cs.protocol.pojo.dto.LoginReq;
|
||||
import com.cf.cs.protocol.pojo.dto.ProtocolReq;
|
||||
import com.cf.cs.protocol.pojo.po.BaseRespStatus;
|
||||
|
@ -73,7 +74,7 @@ public abstract class TestBaseAuthentication {
|
|||
String respJson = mvcResult.getResponse().getContentAsString();
|
||||
Assertions.assertNotNull(respJson);
|
||||
Assertions.assertNotEquals(respJson.length(), 0);
|
||||
ProtocolResp<?> resp = HelperUtils.jsonGetProtocolResp(respJson, LoginResp.class);
|
||||
ProtocolResp<?> resp = ProtocolJsonUtils.jsonGetProtocolResp(respJson, LoginResp.class);
|
||||
|
||||
Assertions.assertNotNull(resp);
|
||||
Assertions.assertNotNull(resp.getMsgContent());
|
||||
|
@ -134,7 +135,7 @@ public abstract class TestBaseAuthentication {
|
|||
rspValue = securityService.decryptProtocol(rspValue);
|
||||
AssertValidString(rspValue);
|
||||
|
||||
ProtocolResp<?> resp = HelperUtils.jsonGetProtocolResp(rspValue, subRespClass);
|
||||
ProtocolResp<?> resp = ProtocolJsonUtils.jsonGetProtocolResp(rspValue, subRespClass);
|
||||
|
||||
Assertions.assertNotNull(resp);
|
||||
Assertions.assertNotNull(resp.getMsgContent());
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.cf.cs.integratetest.controller;
|
||||
|
||||
import com.cmhi.cf.common.TestBaseAuthentication;
|
||||
import com.cmhi.cf.restapi.pojo.vo.VersionResp;
|
||||
import com.cf.cs.integratetest.common.TestBaseAuthentication;
|
||||
import com.cf.cs.protocol.pojo.vo.VersionResp;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package com.cf.cs.integratetest.controller;
|
||||
|
||||
import com.cmhi.cf.common.ErrorCode;
|
||||
import com.cmhi.cf.common.TestBaseAuthentication;
|
||||
import com.cmhi.cf.restapi.pojo.base.BasePageResultResp;
|
||||
import com.cmhi.cf.restapi.pojo.dto.OperationLogDetailsReq;
|
||||
import com.cmhi.cf.restapi.pojo.dto.OperationLogReq;
|
||||
import com.cmhi.cf.restapi.pojo.po.OperationLogSummary;
|
||||
import com.cmhi.cf.restapi.pojo.vo.OperationLogDetailsResp;
|
||||
import com.cf.cs.base.common.ErrorCode;
|
||||
import com.cf.cs.integratetest.common.TestBaseAuthentication;
|
||||
import com.cf.cs.protocol.pojo.dto.OperationLogDetailsReq;
|
||||
import com.cf.cs.protocol.pojo.dto.OperationLogReq;
|
||||
import com.cf.cs.protocol.pojo.vo.BasePageResultResp;
|
||||
import com.cf.cs.protocol.pojo.vo.OperationLogDetailsResp;
|
||||
import com.cf.cs.protocol.pojo.vo.OptLogSummaryResp;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.MethodOrderer;
|
||||
|
@ -44,7 +44,7 @@ public class OperationLogApiTest extends TestBaseAuthentication {
|
|||
req.setTotalSize(-1L);
|
||||
|
||||
Object obj = performanceRestful(RequestMethod.POST, req, "/api/operation/summary",
|
||||
new Class[] {BasePageResultResp.class, OperationLogSummary.class});
|
||||
new Class[] {BasePageResultResp.class, OptLogSummaryResp.class});
|
||||
Assertions.assertNotNull(obj);
|
||||
BasePageResultResp<?> resp = (BasePageResultResp<?>) obj;
|
||||
AssertValidCommonResp(resp);
|
||||
|
@ -63,8 +63,8 @@ public class OperationLogApiTest extends TestBaseAuthentication {
|
|||
}
|
||||
|
||||
resp.getItems().getItems().forEach(k -> {
|
||||
Assertions.assertInstanceOf(OperationLogSummary.class, k);
|
||||
OperationLogSummary o = (OperationLogSummary) k;
|
||||
Assertions.assertInstanceOf(OptLogSummaryResp.class, k);
|
||||
OptLogSummaryResp o = (OptLogSummaryResp) k;
|
||||
Assertions.assertNotNull(o);
|
||||
Assertions.assertNotNull(o.getId());
|
||||
Assertions.assertNotNull(o.getOperationTime());
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
package com.cf.cs.integratetest.controller;
|
||||
|
||||
import com.cmhi.cf.authentication.pojo.dto.IdArrayReq;
|
||||
import com.cmhi.cf.authentication.pojo.dto.RegisterResourceReq;
|
||||
import com.cmhi.cf.authentication.pojo.dto.UserIdReq;
|
||||
import com.cmhi.cf.authentication.pojo.po.ResourceInfo;
|
||||
import com.cmhi.cf.authentication.pojo.vo.GetRoleResp;
|
||||
import com.cmhi.cf.authentication.pojo.vo.RegisterResourceResp;
|
||||
import com.cmhi.cf.authentication.pojo.vo.UserResPermInfoResp;
|
||||
import com.cmhi.cf.common.ErrorCode;
|
||||
import com.cmhi.cf.common.TestBaseAuthentication;
|
||||
import com.cmhi.cf.database.authentication.entity.User;
|
||||
import com.cmhi.cf.database.authentication.service.UserService;
|
||||
import com.cf.cs.base.common.ErrorCode;
|
||||
import com.cf.cs.database.pojo.entity.User;
|
||||
import com.cf.cs.database.service.UserDataBaseService;
|
||||
import com.cf.cs.integratetest.common.TestBaseAuthentication;
|
||||
import com.cf.cs.protocol.pojo.dto.IdArrayReq;
|
||||
import com.cf.cs.protocol.pojo.dto.RegisterResourceReq;
|
||||
import com.cf.cs.protocol.pojo.dto.UserIdReq;
|
||||
import com.cf.cs.protocol.pojo.po.ResourceInfo;
|
||||
import com.cf.cs.protocol.pojo.vo.GetRoleResp;
|
||||
import com.cf.cs.protocol.pojo.vo.RegisterResourceResp;
|
||||
import com.cf.cs.protocol.pojo.vo.UserResPermInfoResp;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.MethodOrderer;
|
||||
|
@ -18,7 +19,6 @@ import org.junit.jupiter.api.Test;
|
|||
import org.junit.jupiter.api.TestInstance;
|
||||
import org.junit.jupiter.api.TestMethodOrder;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -36,8 +36,8 @@ import java.util.UUID;
|
|||
public class PermissionManagerApiTest extends TestBaseAuthentication {
|
||||
private final List<String> addResUid = new ArrayList<>();
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
@Resource
|
||||
private UserDataBaseService userDbService;
|
||||
|
||||
@Test
|
||||
@DisplayName("获取当前用户资源信息")
|
||||
|
@ -64,7 +64,7 @@ public class PermissionManagerApiTest extends TestBaseAuthentication {
|
|||
@Test
|
||||
@DisplayName("获取用户资源信息")
|
||||
void testGetUserResourcePermission() throws Exception {
|
||||
User user = userService.getAccountUserByName("admin");
|
||||
User user = userDbService.getAccountUserByName("admin");
|
||||
Assertions.assertNotNull(user);
|
||||
AssertValidString(user.getUid());
|
||||
UserResPermInfoResp resp = (UserResPermInfoResp) performanceRestful(RequestMethod.POST, new UserIdReq(user.getUid()),
|
||||
|
@ -90,14 +90,14 @@ public class PermissionManagerApiTest extends TestBaseAuthentication {
|
|||
@Test
|
||||
@DisplayName("不存在的用户获取资源信息")
|
||||
void testGetUserResourcePermission_UserServiceGetAccountUserByUidReturnsNull() {
|
||||
User user = userService.getAccountUserByUid("ff99fd68-14bf-4fd6-9320-bab85839245c");
|
||||
User user = userDbService.getAccountUserByUid("ff99fd68-14bf-4fd6-9320-bab85839245c");
|
||||
Assertions.assertNull(user);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("获取用户资源信息, 当前用户无资源")
|
||||
void testGetUserResourcePermission_UserServiceGetUserResourcePermReturnsNoItems() throws Exception {
|
||||
User user = userService.getAccountUserByName("guest");
|
||||
User user = userDbService.getAccountUserByName("guest");
|
||||
Assertions.assertNotNull(user);
|
||||
AssertValidString(user.getUid());
|
||||
UserResPermInfoResp resp = (UserResPermInfoResp) performanceRestful(RequestMethod.POST, new UserIdReq(user.getUid()),
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.cf.cs.integratetest.controller;
|
||||
|
||||
import com.cmhi.cf.common.TestBaseAuthentication;
|
||||
import com.cf.cs.integratetest.common.TestBaseAuthentication;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.cf.cs.integratetest.controller;
|
||||
|
||||
import com.cmhi.cf.common.TestBaseAuthentication;
|
||||
import com.cf.cs.integratetest.common.TestBaseAuthentication;
|
||||
import org.junit.jupiter.api.MethodOrderer;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestInstance;
|
||||
|
|
Loading…
Reference in New Issue