diff --git a/backend/services/dashboard/src/main/java/io/metersphere/dashboard/service/DashboardService.java b/backend/services/dashboard/src/main/java/io/metersphere/dashboard/service/DashboardService.java index bb98de5f72..64cf2f6098 100644 --- a/backend/services/dashboard/src/main/java/io/metersphere/dashboard/service/DashboardService.java +++ b/backend/services/dashboard/src/main/java/io/metersphere/dashboard/service/DashboardService.java @@ -1219,12 +1219,11 @@ public class DashboardService { List allSimpleList = extBugMapper.getSimpleList(projectId, null, null, handleUser, createUser, platforms); List localLastStepStatus = bugCommonService.getLocalLastStepStatus(projectId); List platformLastStepStatus = new ArrayList<>(); - //TODO: 第三方的单元测试没成功 - /*try { + try { platformLastStepStatus = bugCommonService.getPlatformLastStepStatus(projectId); } catch (Exception e) { throw new RuntimeException(e); - }*/ + } localLastStepStatus.addAll(platformLastStepStatus); List statusList = allSimpleList.stream().filter(t -> !localLastStepStatus.contains(t.getStatus())).toList(); int statusSize = CollectionUtils.isEmpty(statusList) ? 0 : statusList.size(); 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 407a4cb286..5abc451dc4 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 @@ -15,8 +15,11 @@ import io.metersphere.dashboard.service.DashboardService; import io.metersphere.functional.dto.CaseReviewDTO; import io.metersphere.plugin.platform.dto.SelectOption; import io.metersphere.project.domain.Project; +import io.metersphere.project.domain.ProjectApplication; +import io.metersphere.project.domain.ProjectApplicationExample; import io.metersphere.project.domain.ProjectExample; import io.metersphere.project.dto.ProjectUserDTO; +import io.metersphere.project.mapper.ProjectApplicationMapper; import io.metersphere.project.mapper.ProjectMapper; import io.metersphere.project.request.ProjectMemberRequest; import io.metersphere.project.service.ProjectMemberService; @@ -55,6 +58,8 @@ public class DashboardFrontPageControllerTests extends BaseTest { private DashboardService dashboardService; @Resource private ProjectMapper projectMapper; + @Resource + private ProjectApplicationMapper projectApplicationMapper; @Resource private ProjectMemberService projectMemberService; @@ -288,7 +293,7 @@ public class DashboardFrontPageControllerTests extends BaseTest { .withHeaders( new Header("Content-Type", "application/json; charset=utf-8"), new Header("Cache-Control", "public, max-age=86400")) - .withBody("{\"id\":\"123456\",\"name\":\"test\", \"issues\": [{\"key\": \"TES-1\",\"fields\": {\"summary\": \"Test\"}}], \"total\": 1}") + .withBody("{\"id\":\"123456\",\"name\":\"test\", \"issues\": [], \"total\": 1}") ); DashboardFrontPageRequest dashboardFrontPageRequest = new DashboardFrontPageRequest(); @@ -331,6 +336,7 @@ public class DashboardFrontPageControllerTests extends BaseTest { ResultHolder reviewResultHolder = JSON.parseObject(reviewContent, ResultHolder.class); StatisticsDTO reviewCount = JSON.parseObject(JSON.toJSONString(reviewResultHolder.getData()), StatisticsDTO.class); Assertions.assertNotNull(reviewCount); + enableDefaultPlatformConfig(); MvcResult bugMvcResult = this.requestPostWithOkAndReturn(BUG_COUNT, dashboardFrontPageRequest); String bugContentAsString = bugMvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8); ResultHolder bugResultHolder = JSON.parseObject(bugContentAsString, ResultHolder.class); @@ -513,4 +519,12 @@ public class DashboardFrontPageControllerTests extends BaseTest { List list = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), SelectOption.class); Assertions.assertNotNull(list); } + + private void enableDefaultPlatformConfig() { + ProjectApplication record = new ProjectApplication(); + record.setTypeValue("true"); + ProjectApplicationExample example = new ProjectApplicationExample(); + example.createCriteria().andProjectIdEqualTo(DEFAULT_PROJECT_ID).andTypeEqualTo("BUG_SYNC_SYNC_ENABLE"); + projectApplicationMapper.updateByExampleSelective(record, example); + } } 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 b95b830efb..f97444abbf 100644 --- a/backend/services/dashboard/src/test/resources/dml/init_dashboard.sql +++ b/backend/services/dashboard/src/test/resources/dml/init_dashboard.sql @@ -108,4 +108,9 @@ VALUES ('dashboard_scenario_four', 'api_scenario', 'p1', 'test-api-status', 'ER INSERT INTO api_scenario_step(id, scenario_id, name, sort, enable, resource_id, resource_num, step_type, project_id, parent_id, version_id, ref_type, origin_project_id, config) - VALUE ('dashboard_act_1', 'dashboard_sc_1', 'dd', 1, true, 'dashboard_api_definition_id_1', '1000', 'API', '100001100001', null, 'oasis_ac_version_id', 'REF', '100001100001', null) \ No newline at end of file + VALUE ('dashboard_act_1', 'dashboard_sc_1', 'dd', 1, true, 'dashboard_api_definition_id_1', '1000', 'API', '100001100001', null, 'oasis_ac_version_id', 'REF', '100001100001', null); + +INSERT INTO project_application (project_id, type, type_value) VALUES + ('100001100001', 'BUG_SYNC_BUG_PLATFORM_CONFIG', '{"jiraKey":"TES","jiraBugTypeId":"10009"}'), + ('100001100001', 'BUG_SYNC_PLATFORM_KEY', 'jira'), + ('100001100001', 'BUG_SYNC_SYNC_ENABLE', 'false'); \ No newline at end of file diff --git a/backend/services/system-setting/src/test/resources/file/metersphere-jira-plugin-3.x.jar b/backend/services/system-setting/src/test/resources/file/metersphere-jira-plugin-3.x.jar index cb0a392e49..05de17731d 100644 Binary files a/backend/services/system-setting/src/test/resources/file/metersphere-jira-plugin-3.x.jar and b/backend/services/system-setting/src/test/resources/file/metersphere-jira-plugin-3.x.jar differ