Browse Source

SONAR-9823 WS api/issues/search returns the line hash

tags/6.7-RC1
Teryk Bellahsene 6 years ago
parent
commit
40605449fc

+ 1
- 0
server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchResponseFormat.java View 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);

+ 1
- 0
server/sonar-server/src/main/resources/org/sonar/server/issue/ws/search-example.json View File

@@ -15,6 +15,7 @@
"severity": "MINOR",
"message": "'3' is a magic number.",
"line": 81,
"hash":"a227e508d6646b55a086ee11d63b21e9",
"textRange": {
"startLine": 81,
"endLine": 81,

+ 3
- 2
server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionTest.java View 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

+ 2
- 0
server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionTest/response_contains_all_fields_except_additional_fields.json View File

@@ -12,6 +12,8 @@
"effort": "10min",
"assignee": "simon",
"author": "John",
"line": 42,
"hash": "a227e508d6646b55a086ee11d63b21e9",
"tags": [
"bug",
"owasp"

+ 1
- 0
sonar-ws/src/main/protobuf/ws-issues.proto View 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;

Loading…
Cancel
Save