diff --git a/config/application-test.yml b/config/application-test.yml index 6be6370..bf9d592 100644 --- a/config/application-test.yml +++ b/config/application-test.yml @@ -33,13 +33,13 @@ spring : fail-on-unknown-properties: false datasource: - #url : jdbc:mysql://xajhuang.com:3307/common_framework?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&useUnicode=true - url : jdbc:mysql://localhost:3306/common_framework?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&useUnicode=true + url : jdbc:mysql://xajhuang.com:3307/common_framework?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&useUnicode=true + #url : jdbc:mysql://localhost:3306/common_framework?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&useUnicode=true driver-class-name: com.mysql.cj.jdbc.Driver - #username : xajhuang - #password : wkj!nky5cjb!GMV6guq - username : root - password : aaaHuang1 + username : xajhuang + password : wkj!nky5cjb!GMV6guq + #username : root + #password : aaaHuang1 dbcp2 : max-total : 128 max-wait-millis : 10000 diff --git a/cs-authentication/src/test/java/com/cf/cs/authentication/CsAuthenticationApplicationTests.java b/cs-authentication/src/test/java/com/cf/cs/authentication/CsAuthenticationApplicationTests.java index 9560746..65a2b61 100644 --- a/cs-authentication/src/test/java/com/cf/cs/authentication/CsAuthenticationApplicationTests.java +++ b/cs-authentication/src/test/java/com/cf/cs/authentication/CsAuthenticationApplicationTests.java @@ -2,10 +2,8 @@ package com.cf.cs.authentication; import com.cf.cs.authentication.configure.SecuritySecurity; import com.cf.cs.authentication.configure.UserSecurityConfigure; -import com.cf.cs.base.CsBaseApplication; import com.cf.cs.base.config.CacheConfigure; import com.cf.cs.base.config.CommonConfigure; -import com.cf.cs.database.CsDatabaseApplication; import com.cf.cs.database.config.MybatisFlexConfigure; import com.cf.cs.protocol.config.ProtocolConfigure; import org.junit.jupiter.api.Test; diff --git a/cs-integrate-test/src/test/java/com/cf/cs/integratetest/common/TestBaseAuthentication.java b/cs-integrate-test/src/test/java/com/cf/cs/integratetest/common/TestBaseAuthentication.java index 5bafdd8..8fb8216 100644 --- a/cs-integrate-test/src/test/java/com/cf/cs/integratetest/common/TestBaseAuthentication.java +++ b/cs-integrate-test/src/test/java/com/cf/cs/integratetest/common/TestBaseAuthentication.java @@ -76,7 +76,7 @@ public abstract class TestBaseAuthentication { // 假设JWT在响应体中返回。您需要根据实际情况调整此行代码。 String respJson = mvcResult.getResponse().getContentAsString(); Assertions.assertNotNull(respJson); - Assertions.assertNotEquals(respJson.length(), 0); + Assertions.assertNotEquals(0, respJson.length()); ProtocolResp resp = ProtocolJsonUtils.jsonGetProtocolResp(respJson, LoginResp.class); Assertions.assertNotNull(resp); @@ -87,7 +87,7 @@ public abstract class TestBaseAuthentication { Assertions.assertEquals(loginResp.getStatus(), ErrorCode.ERR_OK.getCode()); Assertions.assertNotNull(loginResp.getToken()); - Assertions.assertNotEquals(loginResp.getToken().length(), 0); + Assertions.assertNotEquals(0, loginResp.getToken().length()); HttpHeaders headers = new HttpHeaders(); MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8"); @@ -169,7 +169,7 @@ public abstract class TestBaseAuthentication { Assertions.assertNotNull(resp); Assertions.assertNotNull(resp.getStatus()); Assertions.assertNotNull(resp.getMessage()); - Assertions.assertNotEquals(resp.getMessage().length, 0); + Assertions.assertNotEquals(0, resp.getMessage().length); Assertions.assertEquals(resp.getStatus(), ErrorCode.ERR_OK.getCode()); } } diff --git a/cs-integrate-test/src/test/java/com/cf/cs/integratetest/controller/CommonFrameworkApiTest.java b/cs-integrate-test/src/test/java/com/cf/cs/integratetest/controller/CommonFrameworkApiTest.java index acc9e82..4113adf 100644 --- a/cs-integrate-test/src/test/java/com/cf/cs/integratetest/controller/CommonFrameworkApiTest.java +++ b/cs-integrate-test/src/test/java/com/cf/cs/integratetest/controller/CommonFrameworkApiTest.java @@ -6,7 +6,6 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.RequestMethod; @@ -17,7 +16,7 @@ public class CommonFrameworkApiTest extends TestBaseAuthentication { @Test @DisplayName("获取版本信息") void testGetVersion() throws Exception { - VersionResp resp = (VersionResp) performanceRestful(RequestMethod.GET, null, "/api/version", new Class[]{VersionResp.class}); + VersionResp resp = (VersionResp) performanceRestful(RequestMethod.GET, null, "/api/version", new Class[] {VersionResp.class}); AssertValidCommonResp(resp); Assertions.assertNotNull(resp.getVersion()); @@ -32,7 +31,7 @@ public class CommonFrameworkApiTest extends TestBaseAuthentication { @Test @DisplayName("获取版本信息(POST)") void testGetVersionV2() throws Exception { - VersionResp resp = (VersionResp) performanceRestful(RequestMethod.POST, null, "/api/version", new Class[]{VersionResp.class}); + VersionResp resp = (VersionResp) performanceRestful(RequestMethod.POST, null, "/api/version", new Class[] {VersionResp.class}); AssertValidCommonResp(resp); Assertions.assertNotNull(resp.getVersion()); diff --git a/cs-integrate-test/src/test/java/com/cf/cs/integratetest/controller/OperationLogApiTest.java b/cs-integrate-test/src/test/java/com/cf/cs/integratetest/controller/OperationLogApiTest.java index b9c81da..e3c69ef 100644 --- a/cs-integrate-test/src/test/java/com/cf/cs/integratetest/controller/OperationLogApiTest.java +++ b/cs-integrate-test/src/test/java/com/cf/cs/integratetest/controller/OperationLogApiTest.java @@ -15,7 +15,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.boot.test.context.SpringBootTest; import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.RequestMethod; @@ -87,8 +86,7 @@ public class OperationLogApiTest extends TestBaseAuthentication { OperationLogDetailsReq req = new OperationLogDetailsReq(optIdArray); - Object obj = performanceRestful(RequestMethod.POST, req, "/api/operation/details", - new Class[] {OperationLogDetailsResp.class}); + Object obj = performanceRestful(RequestMethod.POST, req, "/api/operation/details", new Class[] {OperationLogDetailsResp.class}); Assertions.assertNotNull(obj); OperationLogDetailsResp resp = (OperationLogDetailsResp) obj; AssertValidCommonResp(resp); diff --git a/cs-integrate-test/src/test/java/com/cf/cs/integratetest/controller/PermissionManagerApiTest.java b/cs-integrate-test/src/test/java/com/cf/cs/integratetest/controller/PermissionManagerApiTest.java index 6d96bdb..3178a8b 100644 --- a/cs-integrate-test/src/test/java/com/cf/cs/integratetest/controller/PermissionManagerApiTest.java +++ b/cs-integrate-test/src/test/java/com/cf/cs/integratetest/controller/PermissionManagerApiTest.java @@ -19,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.boot.test.context.SpringBootTest; import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.RequestMethod; @@ -147,8 +146,7 @@ public class PermissionManagerApiTest extends TestBaseAuthentication { IdArrayReq req = new IdArrayReq(rid); - RegisterResourceResp resp = (RegisterResourceResp) performanceRestful(RequestMethod.DELETE, req, - "/api/permission/resource", + RegisterResourceResp resp = (RegisterResourceResp) performanceRestful(RequestMethod.DELETE, req, "/api/permission/resource", new Class[] {RegisterResourceResp.class}); AssertValidCommonResp(resp); Assertions.assertNotNull(resp.getResult()); @@ -179,12 +177,9 @@ public class PermissionManagerApiTest extends TestBaseAuthentication { .httpMethod(new ArrayList<>() {{add("PUT");}}) .build()); - RegisterResourceReq req = RegisterResourceReq.builder() - .resources(resList) - .build(); + RegisterResourceReq req = RegisterResourceReq.builder().resources(resList).build(); - RegisterResourceResp resp = (RegisterResourceResp) performanceRestful(RequestMethod.PUT, req, - "/api/permission/resource", + RegisterResourceResp resp = (RegisterResourceResp) performanceRestful(RequestMethod.PUT, req, "/api/permission/resource", new Class[] {RegisterResourceResp.class}); AssertValidCommonResp(resp); @@ -207,8 +202,7 @@ public class PermissionManagerApiTest extends TestBaseAuthentication { testRegisterResource(); IdArrayReq req = new IdArrayReq(addResUid); - RegisterResourceResp resp = (RegisterResourceResp) performanceRestful(RequestMethod.DELETE, req, - "/api/permission/resource", + RegisterResourceResp resp = (RegisterResourceResp) performanceRestful(RequestMethod.DELETE, req, "/api/permission/resource", new Class[] {RegisterResourceResp.class}); AssertValidCommonResp(resp); Assertions.assertNotNull(resp.getResult()); diff --git a/cs-integrate-test/src/test/java/com/cf/cs/integratetest/controller/SystemDictControllerTest.java b/cs-integrate-test/src/test/java/com/cf/cs/integratetest/controller/SystemDictControllerTest.java index d5d1844..9a93ad1 100644 --- a/cs-integrate-test/src/test/java/com/cf/cs/integratetest/controller/SystemDictControllerTest.java +++ b/cs-integrate-test/src/test/java/com/cf/cs/integratetest/controller/SystemDictControllerTest.java @@ -3,7 +3,6 @@ package com.cf.cs.integratetest.controller; 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; import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.transaction.annotation.Transactional; @@ -11,27 +10,27 @@ import org.springframework.transaction.annotation.Transactional; @Transactional public class SystemDictControllerTest extends TestBaseAuthentication { @Test - void testGetEnumDictionary() throws Exception { + void testGetEnumDictionary() { } @Test - void testGetEnumDictionary_DictionaryServiceReturnsNoItems() throws Exception { + void testGetEnumDictionary_DictionaryServiceReturnsNoItems() { } @Test - void testGetEnumDictionaryContent() throws Exception { + void testGetEnumDictionaryContent() { } @Test - void testGetEnumDictionaryContent_DictionaryServiceReturnsNoItems() throws Exception { + void testGetEnumDictionaryContent_DictionaryServiceReturnsNoItems() { } @Test - void testCreateNewDictionary() throws Exception { + void testCreateNewDictionary() { } } diff --git a/cs-integrate-test/src/test/java/com/cf/cs/integratetest/controller/UserManagerApiTest.java b/cs-integrate-test/src/test/java/com/cf/cs/integratetest/controller/UserManagerApiTest.java index 713cbdb..c621c9b 100644 --- a/cs-integrate-test/src/test/java/com/cf/cs/integratetest/controller/UserManagerApiTest.java +++ b/cs-integrate-test/src/test/java/com/cf/cs/integratetest/controller/UserManagerApiTest.java @@ -6,7 +6,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.boot.test.context.SpringBootTest; import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.transaction.annotation.Transactional; @@ -16,27 +15,27 @@ import org.springframework.transaction.annotation.Transactional; @TestMethodOrder(MethodOrderer.OrderAnnotation.class) public class UserManagerApiTest extends TestBaseAuthentication { @Test - void testGetUserInfoById() throws Exception { + void testGetUserInfoById() { } @Test - void testGetAllUserInfoPaged() throws Exception { + void testGetAllUserInfoPaged() { } @Test - void testGetCurrentUserInfo() throws Exception { + void testGetCurrentUserInfo() { } @Test - void testCreateNewUser() throws Exception { + void testCreateNewUser() { } @Test - void testRemoveUser() throws Exception { + void testRemoveUser() { } }