]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9823 WS api/issues/search returns the line hash
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Thu, 12 Oct 2017 12:36:05 +0000 (14:36 +0200)
committerTeryk Bellahsene <teryk@users.noreply.github.com>
Mon, 16 Oct 2017 07:27:14 +0000 (09:27 +0200)
server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchResponseFormat.java
server/sonar-server/src/main/resources/org/sonar/server/issue/ws/search-example.json
server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionTest.java
server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionTest/response_contains_all_fields_except_additional_fields.json
sonar-ws/src/main/protobuf/ws-issues.proto

index 2b9190efa43d5213c36cfdd05a9972e11aa7e028..7fe847768429d51e8d33c41a476c25a9fc8778f3 100644 (file)
@@ -184,6 +184,7 @@ public class SearchResponseFormat {
       issueBuilder.setEffort(effortValue);
     }
     setNullable(dto.getLine(), issueBuilder::setLine);
+    setNullable(emptyToNull(dto.getChecksum()), issueBuilder::setHash);
     completeIssueLocations(dto, issueBuilder);
     issueBuilder.setAuthor(nullToEmpty(dto.getAuthorLogin()));
     setNullable(dto.getIssueCreationDate(), issueBuilder::setCreationDate, DateUtils::formatDateTime);
index bba05e3c70a3dfcb1da65a81ce9f8fe16ca2a114..6f0828e593aad311115f291f1086893b69d83292 100644 (file)
@@ -15,6 +15,7 @@
       "severity": "MINOR",
       "message": "'3' is a magic number.",
       "line": 81,
+      "hash":"a227e508d6646b55a086ee11d63b21e9",
       "textRange": {
         "startLine": 81,
         "endLine": 81,
index fcad3faf27ccae0a828464aa5e6c927bb94df4db..478417c4d69b685b0eac557a3a0865c43d59de09 100644 (file)
@@ -172,6 +172,8 @@ public class SearchActionTest {
     IssueDto issue = IssueTesting.newDto(newRule(), file, project)
       .setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2")
       .setEffort(10L)
+      .setLine(42)
+      .setChecksum("a227e508d6646b55a086ee11d63b21e9")
       .setMessage("the message")
       .setStatus(Issue.STATUS_RESOLVED)
       .setResolution(Issue.RESOLUTION_FIXED)
@@ -185,8 +187,7 @@ public class SearchActionTest {
     session.commit();
     issueIndexer.indexOnStartup(issueIndexer.getIndexTypes());
 
-    ws.newRequest().execute()
-      .assertJson(this.getClass(), "response_contains_all_fields_except_additional_fields.json");
+    ws.newRequest().execute().assertJson(this.getClass(), "response_contains_all_fields_except_additional_fields.json");
   }
 
   @Test
index 48675c596fc1a6ef506a74945abd27a9781e0d44..f7656e728d26b2af9f478d298e6e939a46745648 100644 (file)
@@ -12,6 +12,8 @@
       "effort": "10min",
       "assignee": "simon",
       "author": "John",
+      "line": 42,
+      "hash": "a227e508d6646b55a086ee11d63b21e9",
       "tags": [
         "bug",
         "owasp"
index 226691f512d9153fac87d43ce5c8ab4c6c98597f..a1309679f584d5c2d3530dc9505cc4f39c4dc3db 100644 (file)
@@ -68,6 +68,7 @@ message Issue {
   optional string project = 6;
   optional string subProject = 7;
   optional int32 line = 8;
+  optional string hash = 31;
   optional sonarqube.ws.commons.TextRange textRange = 9;
   repeated Flow flows = 10;
   optional string resolution = 11;