diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-02-27 17:22:15 +0100 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-02-27 17:27:55 +0100 |
commit | 34bbb693d3012f97fd7041a97a14223fec2445b6 (patch) | |
tree | 0518eec4a7512ce5b40cd9c48e07b8e527d98a9b /sonar-ws-client | |
parent | 75e7a86e62284c92185824b126e0efc99cda9a4d (diff) | |
download | sonarqube-34bbb693d3012f97fd7041a97a14223fec2445b6.tar.gz sonarqube-34bbb693d3012f97fd7041a97a14223fec2445b6.zip |
Return information on groupId and rootId on issue WS
Diffstat (limited to 'sonar-ws-client')
6 files changed, 49 insertions, 10 deletions
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/component/Component.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/component/Component.java index 9b5f5431c6e..29680c2d21b 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/component/Component.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/component/Component.java @@ -43,25 +43,49 @@ public class Component { /** * @since 4.2 */ + public Long id() { + return JsonUtils.getLong(json, "id"); + } + + public String name() { + return JsonUtils.getString(json, "name"); + } + @CheckForNull - public String path() { - return JsonUtils.getString(json, "path"); + public String longName() { + return JsonUtils.getString(json, "longName"); } /** * @since 4.2 */ @CheckForNull - public String moduleKey() { - return JsonUtils.getString(json, "moduleKey"); + public Long groupId() { + return JsonUtils.getLong(json, "groupId"); } - public String name() { - return JsonUtils.getString(json, "name"); + /** + * @since 4.2 + */ + @CheckForNull + public Long rootId() { + return JsonUtils.getLong(json, "rootId"); } + /** + * @since 4.2 + */ @CheckForNull - public String longName() { - return JsonUtils.getString(json, "longName"); + public String path() { + return JsonUtils.getString(json, "path"); } + + /** + * @since 4.2 + */ + @CheckForNull + public String moduleKey() { + return JsonUtils.getString(json, "moduleKey"); + } + } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/Issue.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/Issue.java index f330e782faa..5f0c825ca50 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/Issue.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/Issue.java @@ -37,6 +37,8 @@ public interface Issue { String componentKey(); + Long componentId(); + String projectKey(); String ruleKey(); diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssue.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssue.java index a0744230d47..75c1d776925 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssue.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssue.java @@ -50,6 +50,10 @@ public class DefaultIssue implements Issue { return JsonUtils.getString(json, "component"); } + public Long componentId() { + return JsonUtils.getLong(json, "componentId"); + } + public String projectKey() { return JsonUtils.getString(json, "project"); } diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/internal/IssueJsonParserTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/internal/IssueJsonParserTest.java index 795431389a3..bd6c2f81b16 100644 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/internal/IssueJsonParserTest.java +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/internal/IssueJsonParserTest.java @@ -42,6 +42,7 @@ public class IssueJsonParserTest { Issue first = list.get(0); assertThat(first.key()).isEqualTo("ABCDE"); assertThat(first.componentKey()).isEqualTo("Action.java"); + assertThat(first.componentId()).isEqualTo(10L); assertThat(first.projectKey()).isEqualTo("struts"); assertThat(first.ruleKey()).isEqualTo("squid:CycleBetweenPackages"); assertThat(first.severity()).isEqualTo("CRITICAL"); @@ -160,9 +161,12 @@ public class IssueJsonParserTest { Component component = issues.component(issues.list().get(0)); assertThat(component.key()).isEqualTo("struts:Action.java"); + assertThat(component.id()).isEqualTo(10L); assertThat(component.qualifier()).isEqualTo("CLA"); assertThat(component.name()).isEqualTo("Action"); assertThat(component.longName()).isEqualTo("org.struts.Action"); + assertThat(component.groupId()).isEqualTo(2L); + assertThat(component.rootId()).isEqualTo(1L); } @Test diff --git a/sonar-ws-client/src/test/resources/org/sonar/wsclient/issue/internal/IssueJsonParserTest/issue-with-components.json b/sonar-ws-client/src/test/resources/org/sonar/wsclient/issue/internal/IssueJsonParserTest/issue-with-components.json index 2f331712d3c..c0b649fdd29 100644 --- a/sonar-ws-client/src/test/resources/org/sonar/wsclient/issue/internal/IssueJsonParserTest/issue-with-components.json +++ b/sonar-ws-client/src/test/resources/org/sonar/wsclient/issue/internal/IssueJsonParserTest/issue-with-components.json @@ -3,6 +3,7 @@ { "key": "ABCDE", "component": "struts:Action.java", + "componentId": 10, "project": "struts", "rule": "squid:CycleBetweenPackages", "severity": "CRITICAL", @@ -35,9 +36,12 @@ "components": [ { "key": "struts:Action.java", + "id": 10, "name": "Action", "qualifier": "CLA", - "longName": "org.struts.Action" + "longName": "org.struts.Action", + "groupId" : 2, + "rootId" : 1 } ], "paging": { @@ -47,4 +51,4 @@ "pages": 1 }, "maxResultsReached": false -}
\ No newline at end of file +} diff --git a/sonar-ws-client/src/test/resources/org/sonar/wsclient/issue/internal/IssueJsonParserTest/search.json b/sonar-ws-client/src/test/resources/org/sonar/wsclient/issue/internal/IssueJsonParserTest/search.json index 8a944880826..9890708cfa9 100644 --- a/sonar-ws-client/src/test/resources/org/sonar/wsclient/issue/internal/IssueJsonParserTest/search.json +++ b/sonar-ws-client/src/test/resources/org/sonar/wsclient/issue/internal/IssueJsonParserTest/search.json @@ -3,6 +3,7 @@ { "key": "ABCDE", "component": "Action.java", + "componentId": 10, "project": "struts", "rule": "squid:CycleBetweenPackages", "severity": "CRITICAL", |