]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-13848 remove deprecated component#uuid from WS responses
authorMichal Duda <michal.duda@sonarsource.com>
Mon, 22 Feb 2021 11:43:16 +0000 (12:43 +0100)
committersonartech <sonartech@sonarsource.com>
Fri, 26 Feb 2021 20:07:40 +0000 (20:07 +0000)
14 files changed:
server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/DeleteCommentAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/EditCommentAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchResponseFormat.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SetTagsAction.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/DeleteCommentActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/EditCommentActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/SetTagsActionTest.java
server/sonar-webserver-webapi/src/test/resources/org/sonar/server/issue/ws/SearchActionTest/filter_by_leak_period.json
server/sonar-webserver-webapi/src/test/resources/org/sonar/server/issue/ws/SearchActionTest/filter_by_leak_period_has_no_effect_on_prs.json
server/sonar-webserver-webapi/src/test/resources/org/sonar/server/issue/ws/SearchActionTest/filter_by_main_scope.json
server/sonar-webserver-webapi/src/test/resources/org/sonar/server/issue/ws/SearchActionTest/filter_by_main_scope_2.json
server/sonar-webserver-webapi/src/test/resources/org/sonar/server/issue/ws/SearchActionTest/filter_by_test_scope.json
server/sonar-webserver-webapi/src/test/resources/org/sonar/server/issue/ws/SearchActionTest/result_for_rule_search.json
sonar-ws/src/main/protobuf/ws-issues.proto

index 51bb8b22feb0263f2fc31b1df21748ddf12a68fe..67c9a12a9b0e866518f64a3619660de436804b7c 100644 (file)
@@ -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);
index b67de00461a7a2db5ecb510183b9f496a79f36b1..9edb0b0bbddd6f73b32eba5e58d12ea08e7477de 100644 (file)
@@ -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);
index 3ab5564dbaa685b2cbfc03633a275a325c5a0e80..040a1f9507135eb531274e574885a81f528893c5 100644 (file)
@@ -304,10 +304,8 @@ public class SearchResponseFormat {
     Collection<ComponentDto> components = data.getComponents();
     List<Issues.Component> 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()))
index 1f219c647becde3f76abdc8ddebaa24d458f6ebd..8f6d44def872ed81ba0b81f40929ff375785b4d3 100644 (file)
@@ -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)
index a42d098a4102ed4c4d13f2f693042320c6ffea66..8baef6a14a7affa43906d834c9934b21c8f12b53 100644 (file)
@@ -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();
index 21e97d75cb8e8829f3223c9760a9f7252587113f..c02aecef67e32e1775f330016743fb20d0955c11 100644 (file)
@@ -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
index 17d8db63054026bf9d0dfd8c6a63e9b95c01437e..8b39af0b9402a6e0deaede75e815d7364e83d76b 100644 (file)
@@ -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")));
index 0b868a72643a1bfff6c323df9fa425c01af880bf..eaf0a994b23424a903bcf451c58cc03be0fbe9d8 100644 (file)
@@ -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",
index d40d5cadcf112c71d8ed3ceceaf85b7fb675c571..4f42d8869337fd6d0dbd14043f96a5a7fb9a24ef 100644 (file)
@@ -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",
index 1cb0ca2660960a02f1208deee833b34fc34e8857..8dfd300765fc6c535169087923cc5caa507775d2 100644 (file)
@@ -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",
index 3afa99ee9b9f0ee4fadf8a771a757e14d58392bb..a0ba18c93ba1b29c8669dff870cdc0f90778e004 100644 (file)
@@ -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",
index ae2fcf37687c9e5b6a568369526385e7f203e791..964d722b8de631395c54ec7c2c835c9945f32813 100644 (file)
@@ -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",
index 4ef3ae4d54c9ceb66e3bff3db6c0f6981338e9fa..13a5436b17767e1685c287eed89c80001f40fd7c 100644 (file)
@@ -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;