refactor: del id create validated size and change girdConcurrentNumber type

This commit is contained in:
guoyuqi 2023-07-24 17:58:04 +08:00 committed by fit2-zhao
parent d2842126a3
commit a8b750a5cf
3 changed files with 54 additions and 44 deletions

View File

@ -82,7 +82,7 @@ public class TestResourceDTO {
private String uiGrid; private String uiGrid;
@Schema(title = "grid最大线程数") @Schema(title = "grid最大线程数")
private String girdConcurrentNumber; private Integer girdConcurrentNumber;
/** /**
* 关联的组织id集合 * 关联的组织id集合

View File

@ -13,7 +13,7 @@ public class TestResourcePoolRequest {
@Schema(title = "资源池ID", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(title = "资源池ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{test_resource_pool.id.not_blank}", groups = {Updated.class}) @NotBlank(message = "{test_resource_pool.id.not_blank}", groups = {Updated.class})
@Size(min = 1, max = 50, message = "{test_resource_pool.id.length_range}", groups = {Created.class, Updated.class}) @Size(min = 1, max = 50, message = "{test_resource_pool.id.length_range}", groups = {Updated.class})
private String id; private String id;
@Schema(title = "名称", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(title = "名称", requiredMode = Schema.RequiredMode.REQUIRED)

View File

@ -97,6 +97,7 @@ class TestResourcePoolControllerTests extends BaseTest {
private MvcResult addTestResourcePoolSuccess(String name, Boolean allOrg, Boolean partOrg, Boolean useApi, Boolean useLoad, Boolean useUi, String type) throws Exception { private MvcResult addTestResourcePoolSuccess(String name, Boolean allOrg, Boolean partOrg, Boolean useApi, Boolean useLoad, Boolean useUi, String type) throws Exception {
TestResourcePoolRequest testResourcePoolRequest = new TestResourcePoolRequest(); TestResourcePoolRequest testResourcePoolRequest = new TestResourcePoolRequest();
testResourcePoolRequest.setId("");
testResourcePoolRequest.setName(name); testResourcePoolRequest.setName(name);
testResourcePoolRequest.setType(type); testResourcePoolRequest.setType(type);
testResourcePoolRequest.setApiTest(useApi); testResourcePoolRequest.setApiTest(useApi);
@ -148,6 +149,7 @@ class TestResourcePoolControllerTests extends BaseTest {
this.addTestResourcePoolSuccess("test_pool_3", true, false, true, false, false, ResourcePoolTypeEnum.NODE.name()); this.addTestResourcePoolSuccess("test_pool_3", true, false, true, false, false, ResourcePoolTypeEnum.NODE.name());
} }
@Test @Test
@Order(4) @Order(4)
void addTestResourcePoolFour() throws Exception { void addTestResourcePoolFour() throws Exception {
@ -155,6 +157,7 @@ class TestResourcePoolControllerTests extends BaseTest {
this.addTestResourcePoolSuccess("test_pool_4", true, false, false, false, false, ResourcePoolTypeEnum.NODE.name()); this.addTestResourcePoolSuccess("test_pool_4", true, false, false, false, false, ResourcePoolTypeEnum.NODE.name());
} }
@Test @Test
@Order(5) @Order(5)
void addTestResourcePoolFive() throws Exception { void addTestResourcePoolFive() throws Exception {
@ -163,6 +166,7 @@ class TestResourcePoolControllerTests extends BaseTest {
this.addTestResourcePoolSuccess("test_pool_5", true, true, true, false, false, ResourcePoolTypeEnum.NODE.name()); this.addTestResourcePoolSuccess("test_pool_5", true, true, true, false, false, ResourcePoolTypeEnum.NODE.name());
} }
@Test @Test
@Order(6) @Order(6)
void addTestResourcePoolSix() throws Exception { void addTestResourcePoolSix() throws Exception {
@ -170,6 +174,7 @@ class TestResourcePoolControllerTests extends BaseTest {
this.addTestResourcePoolSuccess("test_pool_6", false, true, true, false, false, ResourcePoolTypeEnum.NODE.name()); this.addTestResourcePoolSuccess("test_pool_6", false, true, true, false, false, ResourcePoolTypeEnum.NODE.name());
} }
@Test @Test
@Order(7) @Order(7)
void addTestResourcePoolSeven() throws Exception { void addTestResourcePoolSeven() throws Exception {
@ -342,12 +347,18 @@ class TestResourcePoolControllerTests extends BaseTest {
if (StringUtils.equals(urlType, "ADD")) { if (StringUtils.equals(urlType, "ADD")) {
url = TEST_RESOURCE_POOL_ADD; url = TEST_RESOURCE_POOL_ADD;
} else { } else {
//更新 ID 为空
url = TEST_RESOURCE_POOL_UPDATE;
TestResourcePoolRequest testResourcePoolRequest = generatorDto(true, false, false, false, false, false, false, false, false);
testResourcePoolRequest.setId("");
this.requestPost(urlType, url, id, testResourcePoolRequest, status().isBadRequest());
MvcResult testPoolBlob = this.addTestResourcePoolSuccess("test_pool_blob2", false, true, true, false, false, ResourcePoolTypeEnum.K8S.name()); MvcResult testPoolBlob = this.addTestResourcePoolSuccess("test_pool_blob2", false, true, true, false, false, ResourcePoolTypeEnum.K8S.name());
TestResourcePoolRequest testResourcePoolRequest1 = getResult(testPoolBlob); TestResourcePoolRequest testResourcePoolRequest1 = getResult(testPoolBlob);
id = testResourcePoolRequest1.getId(); id = testResourcePoolRequest1.getId();
url = TEST_RESOURCE_POOL_UPDATE;
} }
//资源池名称为空
TestResourcePoolRequest testResourcePoolRequest = generatorDto(true, true, false, false, false, false, false, false, false); TestResourcePoolRequest testResourcePoolRequest = generatorDto(true, true, false, false, false, false, false, false, false);
this.requestPost(urlType, url, id, testResourcePoolRequest, status().isBadRequest()); this.requestPost(urlType, url, id, testResourcePoolRequest, status().isBadRequest());
//资源池类型为空 //资源池类型为空
@ -479,7 +490,6 @@ class TestResourcePoolControllerTests extends BaseTest {
testResourcePoolDTO.setName("test_pool_test"); testResourcePoolDTO.setName("test_pool_test");
} }
//没类型 //没类型
if (!noType) { if (!noType) {
testResourcePoolDTO.setType(ResourcePoolTypeEnum.NODE.name()); testResourcePoolDTO.setType(ResourcePoolTypeEnum.NODE.name());
} }