From 473b592946fa31843073bcc9e469bc43675cd2ab Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Mon, 3 Jun 2013 16:55:05 +0200 Subject: [PATCH] SONAR-3755 add author to issue ws response --- sonar-server/src/main/webapp/WEB-INF/app/models/issue.rb | 1 + .../src/main/java/org/sonar/wsclient/issue/Issue.java | 8 ++++++++ .../org/sonar/wsclient/issue/IssueJsonParserTest.java | 2 ++ .../org/sonar/wsclient/issue/IssueParserTest/search.json | 1 + 4 files changed, 12 insertions(+) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/issue.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/issue.rb index 15238c29c66..49436c1582e 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/issue.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/issue.rb @@ -34,6 +34,7 @@ class Issue hash[:effortToFix] = issue.effortToFix.to_f if issue.effortToFix hash[:reporter] = issue.reporter if issue.reporter hash[:assignee] = issue.assignee if issue.assignee + hash[:author] = issue.authorLogin if issue.authorLogin hash[:actionPlan] = issue.actionPlanKey if issue.actionPlanKey hash[:creationDate] = Api::Utils.format_datetime(issue.creationDate) if issue.creationDate hash[:updateDate] = Api::Utils.format_datetime(issue.updateDate) if issue.updateDate 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 7e8ca71744e..b5b555087e5 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 @@ -99,6 +99,14 @@ public class Issue { return JsonUtils.getString(json, "assignee"); } + /** + * SCM account + */ + @CheckForNull + public String author() { + return JsonUtils.getString(json, "author"); + } + @CheckForNull public String actionPlan() { return JsonUtils.getString(json, "actionPlan"); diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/IssueJsonParserTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/IssueJsonParserTest.java index a33d6093190..09cb3941742 100644 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/IssueJsonParserTest.java +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/IssueJsonParserTest.java @@ -49,6 +49,7 @@ public class IssueJsonParserTest { assertThat(first.message()).isEqualTo("the message"); assertThat(first.effortToFix()).isEqualTo(4.2); assertThat(first.reporter()).isEqualTo("perceval"); + assertThat(first.author()).isEqualTo("pirlouis"); assertThat(first.actionPlan()).isEqualTo("9450b10c-e725-48b8-bf01-acdec751c491"); assertThat(first.creationDate()).isNotNull(); assertThat(first.updateDate()).isNotNull(); @@ -63,6 +64,7 @@ public class IssueJsonParserTest { assertThat(second.line()).isNull(); assertThat(second.effortToFix()).isNull(); assertThat(second.reporter()).isNull(); + assertThat(second.author()).isNull(); assertThat(second.attribute("JIRA")).isNull(); assertThat(second.attributes()).isEmpty(); assertThat(second.comments()).isEmpty(); diff --git a/sonar-ws-client/src/test/resources/org/sonar/wsclient/issue/IssueParserTest/search.json b/sonar-ws-client/src/test/resources/org/sonar/wsclient/issue/IssueParserTest/search.json index 40e1a7ab144..8c8505f5d73 100644 --- a/sonar-ws-client/src/test/resources/org/sonar/wsclient/issue/IssueParserTest/search.json +++ b/sonar-ws-client/src/test/resources/org/sonar/wsclient/issue/IssueParserTest/search.json @@ -14,6 +14,7 @@ "message": "the message", "title": "the title", "reporter": "perceval", + "author": "pirlouis", "actionPlan": "9450b10c-e725-48b8-bf01-acdec751c491", "creationDate": "2013-05-18T12:45:34+0200", "updateDate": "2013-05-18T13:45:34+0200", -- 2.39.5