From 8b2bba6fe647c1d4aac15f7b4bdb7f469c7c9a9d Mon Sep 17 00:00:00 2001 From: Michal Duda Date: Wed, 24 Feb 2021 13:36:16 +0100 Subject: [PATCH] SONAR-13848 remove deprecated response field 'debtTotal' from api/issues/search --- .../sonar/server/issue/ws/SearchResponseFormat.java | 10 +--------- .../ws/SearchActionTest/filter_by_leak_period.json | 1 - .../filter_by_leak_period_has_no_effect_on_prs.json | 1 - .../ws/SearchActionTest/filter_by_main_scope.json | 1 - .../ws/SearchActionTest/filter_by_main_scope_2.json | 1 - .../ws/SearchActionTest/filter_by_test_scope.json | 1 - sonar-ws/src/main/protobuf/ws-issues.proto | 3 +-- 7 files changed, 2 insertions(+), 16 deletions(-) diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchResponseFormat.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchResponseFormat.java index 040a1f95071..b200d469384 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchResponseFormat.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchResponseFormat.java @@ -92,7 +92,7 @@ public class SearchResponseFormat { SearchWsResponse.Builder response = SearchWsResponse.newBuilder(); formatPaging(paging, response); - formatEffortTotal(data, response); + ofNullable(data.getEffortTotal()).ifPresent(response::setEffortTotal); response.addAllIssues(formatIssues(fields, data)); response.addAllComponents(formatComponents(data)); formatFacets(data, facets, response); @@ -126,14 +126,6 @@ public class SearchResponseFormat { return response.build(); } - private static void formatEffortTotal(SearchResponseData data, SearchWsResponse.Builder response) { - Long effort = data.getEffortTotal(); - if (effort != null) { - response.setDebtTotal(effort); - response.setEffortTotal(effort); - } - } - private static void formatPaging(Paging paging, SearchWsResponse.Builder response) { response.setP(paging.pageIndex()); response.setPs(paging.pageSize()); diff --git a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/issue/ws/SearchActionTest/filter_by_leak_period.json b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/issue/ws/SearchActionTest/filter_by_leak_period.json index eaf0a994b23..cfc1450e3ae 100644 --- a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/issue/ws/SearchActionTest/filter_by_leak_period.json +++ b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/issue/ws/SearchActionTest/filter_by_leak_period.json @@ -8,7 +8,6 @@ "total": 1 }, "effortTotal": 10, - "debtTotal": 10, "issues": [ { "key": "7b112bd4-b650-4037-80bc-82fd47d4eac2", diff --git a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/issue/ws/SearchActionTest/filter_by_leak_period_has_no_effect_on_prs.json b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/issue/ws/SearchActionTest/filter_by_leak_period_has_no_effect_on_prs.json index ddf09eb8396..f54458ec29a 100644 --- a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/issue/ws/SearchActionTest/filter_by_leak_period_has_no_effect_on_prs.json +++ b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/issue/ws/SearchActionTest/filter_by_leak_period_has_no_effect_on_prs.json @@ -8,7 +8,6 @@ "total": 2 }, "effortTotal": 20, - "debtTotal": 20, "issues": [ { "key": "7b112bd4-b650-4037-80bc-82fd47d4eac2", diff --git a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/issue/ws/SearchActionTest/filter_by_main_scope.json b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/issue/ws/SearchActionTest/filter_by_main_scope.json index 4f42d886933..740f756f398 100644 --- a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/issue/ws/SearchActionTest/filter_by_main_scope.json +++ b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/issue/ws/SearchActionTest/filter_by_main_scope.json @@ -8,7 +8,6 @@ "total": 2 }, "effortTotal": 20, - "debtTotal": 20, "issues": [ { "key": "7b112bd4-b650-4037-80bc-82fd47d4eac2", diff --git a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/issue/ws/SearchActionTest/filter_by_main_scope_2.json b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/issue/ws/SearchActionTest/filter_by_main_scope_2.json index 8dfd300765f..b5945de7c84 100644 --- a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/issue/ws/SearchActionTest/filter_by_main_scope_2.json +++ b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/issue/ws/SearchActionTest/filter_by_main_scope_2.json @@ -8,7 +8,6 @@ "total": 2 }, "effortTotal": 20, - "debtTotal": 20, "issues": [ { "key": "7b112bd4-b650-4037-80bc-82fd47d4eac2", diff --git a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/issue/ws/SearchActionTest/filter_by_test_scope.json b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/issue/ws/SearchActionTest/filter_by_test_scope.json index a0ba18c93ba..e87cfca059d 100644 --- a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/issue/ws/SearchActionTest/filter_by_test_scope.json +++ b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/issue/ws/SearchActionTest/filter_by_test_scope.json @@ -8,7 +8,6 @@ "total": 1 }, "effortTotal": 10, - "debtTotal": 10, "issues": [ { "key": "82fd47d4-4037-b650-80bc-7b112bd4eac2", diff --git a/sonar-ws/src/main/protobuf/ws-issues.proto b/sonar-ws/src/main/protobuf/ws-issues.proto index 13a5436b177..6c5f4ba193f 100644 --- a/sonar-ws/src/main/protobuf/ws-issues.proto +++ b/sonar-ws/src/main/protobuf/ws-issues.proto @@ -28,6 +28,7 @@ option optimize_for = SPEED; // Response of GET api/issues/search message SearchWsResponse { + reserved 5; optional int64 total = 1; optional int64 p = 2; optional int32 ps = 3; @@ -35,8 +36,6 @@ message SearchWsResponse { // Total amount of effort, only when the facet "total" is enabled optional int64 effortTotal = 13; - // Deprecated since 5.5, replaced by effortTotal - optional int64 debtTotal = 5; repeated Issue issues = 6; repeated Component components = 7; -- 2.39.5