From 5fc3a5d3ad8eddfb20db1cdaf66d79975e12570a Mon Sep 17 00:00:00 2001 From: Michal Duda Date: Mon, 22 Feb 2021 12:43:16 +0100 Subject: [PATCH] SONAR-13848 remove deprecated component#uuid from WS responses --- .../server/issue/ws/DeleteCommentAction.java | 1 - .../server/issue/ws/EditCommentAction.java | 1 - .../server/issue/ws/SearchResponseFormat.java | 2 -- .../sonar/server/issue/ws/SetTagsAction.java | 3 +-- .../issue/ws/DeleteCommentActionTest.java | 14 ------------- .../issue/ws/EditCommentActionTest.java | 21 ++----------------- .../server/issue/ws/SetTagsActionTest.java | 11 ---------- .../filter_by_leak_period.json | 2 -- ...r_by_leak_period_has_no_effect_on_prs.json | 1 - .../filter_by_main_scope.json | 2 -- .../filter_by_main_scope_2.json | 2 -- .../filter_by_test_scope.json | 2 -- .../result_for_rule_search.json | 2 -- sonar-ws/src/main/protobuf/ws-issues.proto | 3 +-- 14 files changed, 4 insertions(+), 63 deletions(-) diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/DeleteCommentAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/DeleteCommentAction.java index 51bb8b22feb..67c9a12a9b0 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/DeleteCommentAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/DeleteCommentAction.java @@ -70,7 +70,6 @@ public class DeleteCommentAction implements IssuesWsAction { action.createParam(PARAM_COMMENT) .setDescription("Comment key") - .setDeprecatedKey("key", "6.3") .setSince("6.3") .setRequired(true) .setExampleValue(UUID_EXAMPLE_01); diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/EditCommentAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/EditCommentAction.java index b67de00461a..9edb0b0bbdd 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/EditCommentAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/EditCommentAction.java @@ -76,7 +76,6 @@ public class EditCommentAction implements IssuesWsAction { action.createParam(PARAM_COMMENT) .setDescription("Comment key") - .setDeprecatedKey("key", "6.3") .setSince("6.3") .setRequired(true) .setExampleValue(UUID_EXAMPLE_01); 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 3ab5564dbaa..040a1f95071 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 @@ -304,10 +304,8 @@ public class SearchResponseFormat { Collection components = data.getComponents(); List result = new ArrayList<>(); for (ComponentDto dto : components) { - String uuid = dto.uuid(); Component.Builder builder = Component.newBuilder() .setKey(dto.getKey()) - .setUuid(uuid) .setQualifier(dto.qualifier()) .setName(nullToEmpty(dto.name())) .setLongName(nullToEmpty(dto.longName())) diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SetTagsAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SetTagsAction.java index 1f219c647be..8f6d44def87 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SetTagsAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SetTagsAction.java @@ -56,7 +56,7 @@ public class SetTagsAction implements IssuesWsAction { private final OperationResponseWriter responseWriter; public SetTagsAction(UserSession userSession, DbClient dbClient, IssueFinder issueFinder, IssueFieldsSetter issueFieldsSetter, IssueUpdater issueUpdater, - OperationResponseWriter responseWriter) { + OperationResponseWriter responseWriter) { this.userSession = userSession; this.dbClient = dbClient; this.issueFinder = issueFinder; @@ -81,7 +81,6 @@ public class SetTagsAction implements IssuesWsAction { action.createParam(PARAM_ISSUE) .setDescription("Issue key") .setSince("6.3") - .setDeprecatedKey("key", "6.3") .setExampleValue(Uuids.UUID_EXAMPLE_01) .setRequired(true); action.createParam(PARAM_TAGS) diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/DeleteCommentActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/DeleteCommentActionTest.java index a42d098a410..8baef6a14a7 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/DeleteCommentActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/DeleteCommentActionTest.java @@ -83,20 +83,6 @@ public class DeleteCommentActionTest { verifyContentOfPreloadedSearchResponseData(issueDto); } - @Test - public void delete_comment_using_deprecated_key_parameter() { - IssueDto issueDto = issueDbTester.insertIssue(); - UserDto user = dbTester.users().insertUser(); - IssueChangeDto commentDto = issueDbTester.insertComment(issueDto, user, "please fix it"); - loginAndAddProjectPermission(user, issueDto, USER); - - tester.newRequest().setParam("key", commentDto.getKey()).setParam("text", "please have a look").execute(); - - verify(responseWriter).write(eq(issueDto.getKey()), preloadedSearchResponseDataCaptor.capture(), any(Request.class), any(Response.class)); - assertThat(dbClient.issueChangeDao().selectCommentByKey(dbTester.getSession(), commentDto.getKey())).isNotPresent(); - verifyContentOfPreloadedSearchResponseData(issueDto); - } - @Test public void fail_when_comment_does_not_belong_to_current_user() { IssueDto issueDto = issueDbTester.insertIssue(); diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/EditCommentActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/EditCommentActionTest.java index 21e97d75cb8..c02aecef67e 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/EditCommentActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/EditCommentActionTest.java @@ -97,23 +97,6 @@ public class EditCommentActionTest { assertThat(issueComment.getUpdatedAt()).isEqualTo(NOW); } - @Test - public void edit_comment_using_deprecated_key_parameter() { - IssueDto issueDto = newIssue(); - UserDto user = dbTester.users().insertUser(); - IssueChangeDto commentDto = issueDbTester.insertComment(issueDto, user, "please fix it"); - loginWithBrowsePermission(user, USER, issueDto); - - tester.newRequest().setParam("key", commentDto.getKey()).setParam("text", "please have a look").execute(); - - verify(responseWriter).write(eq(issueDto.getKey()), preloadedSearchResponseDataCaptor.capture(), any(Request.class), any(Response.class)); - - verifyContentOfPreloadedSearchResponseData(issueDto); - IssueChangeDto issueComment = dbClient.issueChangeDao().selectCommentByKey(dbTester.getSession(), commentDto.getKey()).get(); - assertThat(issueComment.getChangeData()).isEqualTo("please have a look"); - assertThat(issueComment.getUpdatedAt()).isEqualTo(NOW); - } - @Test public void fail_when_comment_is_for_hotspot() { IssueDto hotspot = issueDbTester.insertHotspot(); @@ -124,8 +107,8 @@ public class EditCommentActionTest { String commentDtoKey = commentDto.getKey(); assertThatThrownBy(() -> call(commentDtoKey, "please have a look")) - .isInstanceOf(NotFoundException.class) - .hasMessage("Issue with key '%s' does not exist", hotspot.getKey()); + .isInstanceOf(NotFoundException.class) + .hasMessage("Issue with key '%s' does not exist", hotspot.getKey()); } @Test diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/SetTagsActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/SetTagsActionTest.java index 17d8db63054..8b39af0b940 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/SetTagsActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/SetTagsActionTest.java @@ -133,17 +133,6 @@ public class SetTagsActionTest { assertThat(issueReloaded.getTags()).isEmpty(); } - @Test - public void set_tags_using_deprecated_key_param() { - IssueDto issueDto = insertIssueForPublicProject(i -> i.setTags(singletonList("old-tag"))); - logIn(issueDto); - - ws.newRequest().setParam("key", issueDto.getKey()).setParam("tags", "bug").execute(); - - IssueDto issueReloaded = dbClient.issueDao().selectByKey(db.getSession(), issueDto.getKey()).get(); - assertThat(issueReloaded.getTags()).containsOnly("bug"); - } - @Test public void tags_are_stored_as_lowercase() { IssueDto issueDto = insertIssueForPublicProject(i -> i.setTags(singletonList("old-tag"))); 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 0b868a72643..eaf0a994b23 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 @@ -31,7 +31,6 @@ "components": [ { "key": "FILE_KEY", - "uuid": "FILE_ID", "enabled": true, "qualifier": "FIL", "name": "NAME_FILE_ID", @@ -40,7 +39,6 @@ }, { "key": "PROJECT_KEY", - "uuid": "PROJECT_ID", "enabled": true, "qualifier": "TRK", "name": "NAME_PROJECT_ID", 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 75400d0b309..ddf09eb8396 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 @@ -50,7 +50,6 @@ "components": [ { "key": "FILE_KEY", - "uuid": "FILE_ID", "enabled": true, "qualifier": "FIL", "name": "NAME_FILE_ID", 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 d40d5cadcf1..4f42d886933 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 @@ -38,7 +38,6 @@ "components": [ { "key": "FILE_KEY", - "uuid": "FILE_ID", "enabled": true, "qualifier": "FIL", "name": "NAME_FILE_ID", @@ -47,7 +46,6 @@ }, { "key": "PROJECT_KEY", - "uuid": "PROJECT_ID", "enabled": true, "qualifier": "TRK", "name": "NAME_PROJECT_ID", 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 1cb0ca26609..8dfd300765f 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 @@ -38,7 +38,6 @@ "components": [ { "key": "FILE_KEY", - "uuid": "FILE_ID", "enabled": true, "qualifier": "FIL", "name": "NAME_FILE_ID", @@ -47,7 +46,6 @@ }, { "key": "PROJECT_KEY", - "uuid": "PROJECT_ID", "enabled": true, "qualifier": "TRK", "name": "NAME_PROJECT_ID", 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 3afa99ee9b9..a0ba18c93ba 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 @@ -26,7 +26,6 @@ "components": [ { "key": "ANOTHER_FILE_KEY", - "uuid": "ANOTHER_FILE_ID", "enabled": true, "qualifier": "UTS", "name": "NAME_ANOTHER_FILE_ID", @@ -35,7 +34,6 @@ }, { "key": "PROJECT_KEY", - "uuid": "PROJECT_ID", "enabled": true, "qualifier": "TRK", "name": "NAME_PROJECT_ID", diff --git a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/issue/ws/SearchActionTest/result_for_rule_search.json b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/issue/ws/SearchActionTest/result_for_rule_search.json index ae2fcf37687..964d722b8de 100644 --- a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/issue/ws/SearchActionTest/result_for_rule_search.json +++ b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/issue/ws/SearchActionTest/result_for_rule_search.json @@ -16,7 +16,6 @@ }], "components": [ { "key": "FILE_KEY", - "uuid": "FILE_ID", "enabled": true, "qualifier": "FIL", "name": "NAME_FILE_ID", @@ -25,7 +24,6 @@ }, { "key": "PROJECT_KEY", - "uuid": "PROJECT_ID", "enabled": true, "qualifier": "TRK", "name": "NAME_PROJECT_ID", diff --git a/sonar-ws/src/main/protobuf/ws-issues.proto b/sonar-ws/src/main/protobuf/ws-issues.proto index 4ef3ae4d54c..13a5436b177 100644 --- a/sonar-ws/src/main/protobuf/ws-issues.proto +++ b/sonar-ws/src/main/protobuf/ws-issues.proto @@ -198,10 +198,9 @@ message Languages { } message Component { - reserved 11; //drop organization + reserved 3, 11; //drop organization optional int64 deprecatedId = 1; optional string key = 2; - optional string uuid = 3; optional bool enabled = 4; optional string qualifier = 5; optional string name = 6; -- 2.39.5