From afc8f54f9638417016b12fb30d50c3a36e83256e Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Mon, 25 Nov 2024 14:44:39 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E5=B7=A5=E4=BD=9C=E5=8F=B0):=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B5=8B=E8=AF=95=E8=A6=86=E7=9B=96=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/DashboardFrontPageControllerTests.java | 8 ++++++-- .../dashboard/src/test/resources/dml/init_dashboard.sql | 8 ++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/backend/services/dashboard/src/test/java/io/metersphere/dashboard/controller/DashboardFrontPageControllerTests.java b/backend/services/dashboard/src/test/java/io/metersphere/dashboard/controller/DashboardFrontPageControllerTests.java index 92da910113..91a8d4b5ca 100644 --- a/backend/services/dashboard/src/test/java/io/metersphere/dashboard/controller/DashboardFrontPageControllerTests.java +++ b/backend/services/dashboard/src/test/java/io/metersphere/dashboard/controller/DashboardFrontPageControllerTests.java @@ -140,7 +140,7 @@ public class DashboardFrontPageControllerTests extends BaseTest { Assertions.assertNotNull(moduleCountAll); dashboardFrontPageRequest.setDayNumber(null); - dashboardFrontPageRequest.setStartTime(1716185577387L); + dashboardFrontPageRequest.setStartTime(1697971947000L); dashboardFrontPageRequest.setEndTime(1730181702699L); dashboardFrontPageRequest.setSelectAll(true); mvcResult = this.requestPostWithOkAndReturn(CREATE_BY_ME, dashboardFrontPageRequest); @@ -208,7 +208,11 @@ public class DashboardFrontPageControllerTests extends BaseTest { @Order(2) public void testLayout() throws Exception { this.requestGet(GET_LAYOUT + "DEFAULT_ORGANIZATION_ID").andExpect(status().is5xxServerError()); - + MvcResult defaultResult = this.requestGetWithOkAndReturn(GET_LAYOUT + DEFAULT_ORGANIZATION_ID); + String defaultString = defaultResult.getResponse().getContentAsString(StandardCharsets.UTF_8); + ResultHolder defaultHolder = JSON.parseObject(defaultString, ResultHolder.class); + ListdefaultDTOS = JSON.parseArray(JSON.toJSONString(defaultHolder.getData()), LayoutDTO.class); + Assertions.assertEquals(3, defaultDTOS.size()); ProjectExample projectExample = new ProjectExample(); projectExample.createCriteria().andOrganizationIdEqualTo(DEFAULT_ORGANIZATION_ID); List projects = projectMapper.selectByExample(projectExample); diff --git a/backend/services/dashboard/src/test/resources/dml/init_dashboard.sql b/backend/services/dashboard/src/test/resources/dml/init_dashboard.sql index 77846b212d..e47f9dda00 100644 --- a/backend/services/dashboard/src/test/resources/dml/init_dashboard.sql +++ b/backend/services/dashboard/src/test/resources/dml/init_dashboard.sql @@ -71,16 +71,16 @@ INSERT INTO bug (id, num, title, handle_users, handle_user, create_user, create_ VALUES ('dashboard_bug3', 100003, 'oasis3', 'admin', 'admin', 'admin', 1697971947000, 'admin', UNIX_TIMESTAMP() * 1000, 'admin', UNIX_TIMESTAMP() * 1000, '100001100001', 'bug-template-id', 'Local', 'open', '["default-tag"]', null, 0, 5000); INSERT INTO api_definition(id, name, protocol, method, path, status, num, tags, pos, project_id, module_id, latest, version_id, ref_id, description, create_time, create_user, update_time, update_user, delete_user, delete_time, deleted) -VALUES ('dashboard_api_definition_id_1', 'gyq_associate_api_definition_id_1', 'HTTP', 'POST','api/test','DONE', 1000001, null, 1, '100001100001' , 'gyq_associate_test_module', true, 'v1.10','gyq_associate_api_definition_id_1', null, 1697971947000,'admin', 1697971947000,'admin', null,null,false); +VALUES ('dashboard_api_definition_id_1', 'gyq_associate_api_definition_id_1', 'HTTP', 'POST','api/test','DONE', 1000001, null, 1, '100001100001' , 'gyq_associate_test_module', true, 'v1.10','gyq_associate_api_definition_id_1', null, 1697885547000,'admin', 1697971947000,'admin', null,null,false); INSERT INTO api_definition(id, name, protocol, method, path, status, num, tags, pos, project_id, module_id, latest, version_id, ref_id, description, create_time, create_user, update_time, update_user, delete_user, delete_time, deleted) -VALUES ('dashboard_api_definition_id_2', 'gyq_associate_api_definition_id_2', 'TCP', 'POST','api/test','PROCESSING', 1000001, null, 1, '100001100001' , 'gyq_associate_test_module', true, 'v1.10','gyq_associate_api_definition_id_1', null, 1697971947000,'admin', 1697971947000,'admin', null,null,false); +VALUES ('dashboard_api_definition_id_2', 'gyq_associate_api_definition_id_2', 'TCP', 'POST','api/test','PROCESSING', 1000001, null, 1, '100001100001' , 'gyq_associate_test_module', true, 'v1.10','gyq_associate_api_definition_id_1', null, 1697885547000,'admin', 1697971947000,'admin', null,null,false); INSERT INTO api_definition(id, name, protocol, method, path, status, num, tags, pos, project_id, module_id, latest, version_id, ref_id, description, create_time, create_user, update_time, update_user, delete_user, delete_time, deleted) -VALUES ('dashboard_api_definition_id_3', 'gyq_associate_api_definition_id_2', 'DUBBO', 'POST','api/test','DEPRECATED', 1000001, null, 1, '100001100001' , 'gyq_associate_test_module', true, 'v1.10','gyq_associate_api_definition_id_1', null, 1697971947000,'admin', 1697971947000,'admin', null,null,false); +VALUES ('dashboard_api_definition_id_3', 'gyq_associate_api_definition_id_2', 'DUBBO', 'POST','api/test','DEPRECATED', 1000001, null, 1, '100001100001' , 'gyq_associate_test_module', true, 'v1.10','gyq_associate_api_definition_id_1', null, 1697885547000,'admin', 1697971947000,'admin', null,null,false); INSERT INTO api_definition(id, name, protocol, method, path, status, num, tags, pos, project_id, module_id, latest, version_id, ref_id, description, create_time, create_user, update_time, update_user, delete_user, delete_time, deleted) -VALUES ('dashboard_api_definition_id_4', 'gyq_associate_api_definition_id_2', 'HTTP', 'POST','api/test','DEBUGGING', 1000001, null, 1, '100001100001' , 'gyq_associate_test_module', true, 'v1.10','gyq_associate_api_definition_id_1', null, 1697971947000,'admin', 1697971947000,'admin', null,null,false); +VALUES ('dashboard_api_definition_id_4', 'gyq_associate_api_definition_id_2', 'HTTP', 'POST','api/test','DEBUGGING', 1000001, null, 1, '100001100001' , 'gyq_associate_test_module', true, 'v1.10','gyq_associate_api_definition_id_1', null, 1697885547000,'admin', 1697971947000,'admin', null,null,false); INSERT INTO api_test_case(id, name, priority, num, tags, status, last_report_status, last_report_id, pos, project_id, api_definition_id, version_id, environment_id, create_time, create_user, update_time, update_user, delete_time, delete_user, deleted) VALUES ('dashboard_ac_1', 'oasis_ac', 'P0', 1001, null, 'Underway', 'PENDING', null, 100, '100001100001', 'dashboard_api_definition_id_1', 'oasis_ac_version_id', 'oasis_ac_env_id', 1697971947000, 'admin', 1698058347559, 'admin', null, null, false);