From 6f2881c71996715ba3a9a7b2451f008c2239d7eb Mon Sep 17 00:00:00 2001 From: Duarte Meneses Date: Wed, 14 Sep 2022 10:52:04 -0500 Subject: [PATCH] SONAR-17287 Return optional flow description and type in WS responses --- .../org/sonar/server/issue/TextRangeResponseFormatter.java | 2 +- .../test/java/org/sonar/server/hotspot/ws/ShowActionTest.java | 4 ++-- sonar-ws/src/main/protobuf/ws-commons.proto | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/TextRangeResponseFormatter.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/TextRangeResponseFormatter.java index 42473599f39..aec7338ca63 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/TextRangeResponseFormatter.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/TextRangeResponseFormatter.java @@ -59,7 +59,7 @@ public class TextRangeResponseFormatter { targetFlow.setDescription(flow.getDescription()); } if (flow.hasType()) { - convertFlowType(flow.getType()).ifPresent(targetFlow::setFlowType); + convertFlowType(flow.getType()).ifPresent(targetFlow::setType); } return targetFlow.build(); }).collect(Collectors.toList()); 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 cfcced32b9c..84c1849a4f2 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 @@ -260,7 +260,7 @@ public class ShowActionTest { assertThat(response.getKey()).isEqualTo(hotspot.getKey()); assertThat(response.getFlowsCount()).isEqualTo(2); assertThat(response.getFlows(0).getDescription()).isEqualTo("FLOW DESCRIPTION"); - assertThat(response.getFlows(0).getFlowType()).isEqualTo(Common.FlowType.DATA); + assertThat(response.getFlows(0).getType()).isEqualTo(Common.FlowType.DATA); assertThat(response.getFlows(0).getLocationsList()) .extracting(Location::getMsg, Location::getComponent) .containsExactlyInAnyOrder( @@ -269,7 +269,7 @@ public class ShowActionTest { tuple("FLOW MESSAGE WITHOUT FILE UUID", file.getKey())); assertThat(response.getFlows(1).getDescription()).isEmpty(); - assertThat(response.getFlows(1).hasFlowType()).isFalse(); + assertThat(response.getFlows(1).hasType()).isFalse(); } @Test diff --git a/sonar-ws/src/main/protobuf/ws-commons.proto b/sonar-ws/src/main/protobuf/ws-commons.proto index 71a564212a0..c24c1d5d5e6 100644 --- a/sonar-ws/src/main/protobuf/ws-commons.proto +++ b/sonar-ws/src/main/protobuf/ws-commons.proto @@ -96,7 +96,7 @@ message TextRange { message Flow { repeated Location locations = 1; optional string description = 2; - optional FlowType flowType = 3; + optional FlowType type = 3; } enum FlowType { -- 2.39.5