diff options
author | Jean-Baptiste Lievremont <jeanbaptiste.lievremont@sonarsource.com> | 2020-11-18 22:23:15 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2020-11-26 20:06:29 +0000 |
commit | 4f8796c39feec635aa736945839aad48170ae024 (patch) | |
tree | 96c5fa84a81028d049b2c6a62c03dc5ed2ea1fb6 /server/sonar-webserver-webapi/src | |
parent | 4a49b28ca62eb6b89e03dc277b255d98d3d11ae3 (diff) | |
download | sonarqube-4f8796c39feec635aa736945839aad48170ae024.tar.gz sonarqube-4f8796c39feec635aa736945839aad48170ae024.zip |
SONAR-14113 Make hotspot show WS public, add line hash of primary location
Diffstat (limited to 'server/sonar-webserver-webapi/src')
3 files changed, 7 insertions, 4 deletions
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/ShowAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/ShowAction.java index 6bca86e2e88..8140dd10bf8 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/ShowAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/ShowAction.java @@ -53,6 +53,7 @@ import org.sonarqube.ws.Hotspots; import org.sonarqube.ws.Hotspots.ShowWsResponse; import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Strings.emptyToNull; import static com.google.common.base.Strings.nullToEmpty; import static java.lang.String.format; import static java.util.Collections.singleton; @@ -91,8 +92,7 @@ public class ShowAction implements HotspotsWsAction { .createAction("show") .setHandler(this) .setDescription("Provides the details of a Security Hotspot.") - .setSince("8.1") - .setInternal(true); + .setSince("8.1"); action.createParam(PARAM_HOTSPOT_KEY) .setDescription("Key of the Security Hotspot") @@ -144,6 +144,7 @@ public class ShowAction implements HotspotsWsAction { ofNullable(hotspot.getStatus()).ifPresent(builder::setStatus); ofNullable(hotspot.getResolution()).ifPresent(builder::setResolution); ofNullable(hotspot.getLine()).ifPresent(builder::setLine); + ofNullable(emptyToNull(hotspot.getChecksum())).ifPresent(builder::setHash); builder.setMessage(nullToEmpty(hotspot.getMessage())); builder.setCreationDate(formatDateTime(hotspot.getIssueCreationDate())); builder.setUpdateDate(formatDateTime(hotspot.getIssueUpdateDate())); diff --git a/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/hotspot/ws/show-example.json b/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/hotspot/ws/show-example.json index f43ea76a03c..71f1f88710b 100644 --- a/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/hotspot/ws/show-example.json +++ b/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/hotspot/ws/show-example.json @@ -23,6 +23,7 @@ }, "status": "TO_REVIEW", "line": 10, + "hash": "a227e508d6646b55a086ee11d63b21e9", "message": "message", "assignee": "joe", "author": "joe", diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/hotspot/ws/ShowActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/hotspot/ws/ShowActionTest.java index a64c9013ca8..3c1acec46f4 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/hotspot/ws/ShowActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/hotspot/ws/ShowActionTest.java @@ -130,8 +130,8 @@ public class ShowActionTest { } @Test - public void ws_is_internal() { - assertThat(actionTester.getDef().isInternal()).isTrue(); + public void ws_is_public() { + assertThat(actionTester.getDef().isInternal()).isFalse(); } @Test @@ -911,6 +911,7 @@ public class ShowActionTest { .setAuthorLogin("joe") .setMessage("message") .setLine(10) + .setChecksum("a227e508d6646b55a086ee11d63b21e9") .setIssueCreationTime(time) .setIssueUpdateTime(time) .setAuthorLogin(author.getLogin()) |