From 85ef668a1c8d35039a1a9ca58945be18c3d94e4b Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Mon, 9 Jan 2017 14:15:39 +0100 Subject: [PATCH] SONAR-7297 Add response samples in all issues WS --- .../server/issue/ws/AddCommentAction.java | 2 + .../sonar/server/issue/ws/AssignAction.java | 3 +- .../server/issue/ws/BulkChangeAction.java | 2 + .../server/issue/ws/ChangelogAction.java | 4 +- .../server/issue/ws/DeleteCommentAction.java | 2 + .../server/issue/ws/DoTransitionAction.java | 2 + .../server/issue/ws/EditCommentAction.java | 2 + .../server/issue/ws/SetSeverityAction.java | 2 + .../sonar/server/issue/ws/SetTagsAction.java | 8 +- .../sonar/server/issue/ws/SetTypeAction.java | 2 + .../server/issue/ws/add_comment-example.json | 100 ++++++++++++++++++ .../sonar/server/issue/ws/assign-example.json | 100 ++++++++++++++++++ .../server/issue/ws/bulk_change-example.json | 6 ++ .../issue/ws/delete_comment-example.json | 100 ++++++++++++++++++ .../issue/ws/do_transition-example.json | 100 ++++++++++++++++++ .../server/issue/ws/edit_comment-example.json | 100 ++++++++++++++++++ .../server/issue/ws/set_severity-example.json | 100 ++++++++++++++++++ .../server/issue/ws/set_tags-example.json | 100 ++++++++++++++++++ .../server/issue/ws/set_type-example.json | 100 ++++++++++++++++++ .../server/issue/ws/AddCommentActionTest.java | 2 +- .../server/issue/ws/BulkChangeActionTest.java | 2 +- .../issue/ws/DeleteCommentActionTest.java | 2 +- .../issue/ws/EditCommentActionTest.java | 2 +- .../server/issue/ws/SetTagsActionTest.java | 2 +- 24 files changed, 834 insertions(+), 11 deletions(-) create mode 100644 server/sonar-server/src/main/resources/org/sonar/server/issue/ws/add_comment-example.json create mode 100644 server/sonar-server/src/main/resources/org/sonar/server/issue/ws/assign-example.json create mode 100644 server/sonar-server/src/main/resources/org/sonar/server/issue/ws/bulk_change-example.json create mode 100644 server/sonar-server/src/main/resources/org/sonar/server/issue/ws/delete_comment-example.json create mode 100644 server/sonar-server/src/main/resources/org/sonar/server/issue/ws/do_transition-example.json create mode 100644 server/sonar-server/src/main/resources/org/sonar/server/issue/ws/edit_comment-example.json create mode 100644 server/sonar-server/src/main/resources/org/sonar/server/issue/ws/set_severity-example.json create mode 100644 server/sonar-server/src/main/resources/org/sonar/server/issue/ws/set_tags-example.json create mode 100644 server/sonar-server/src/main/resources/org/sonar/server/issue/ws/set_type-example.json diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/AddCommentAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/AddCommentAction.java index a4c75c19dbe..03bfa8870ca 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/AddCommentAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/AddCommentAction.java @@ -20,6 +20,7 @@ package org.sonar.server.issue.ws; +import com.google.common.io.Resources; import java.util.Date; import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; @@ -72,6 +73,7 @@ public class AddCommentAction implements IssuesWsAction { "Since 6.3, the response contains the issue with all details, not only the added comment") .setSince("3.6") .setHandler(this) + .setResponseExample(Resources.getResource(this.getClass(), "add_comment-example.json")) .setPost(true); action.createParam(PARAM_ISSUE) diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/AssignAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/AssignAction.java index 93f07df82f4..379656dae1f 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/AssignAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/AssignAction.java @@ -19,6 +19,7 @@ */ package org.sonar.server.issue.ws; +import com.google.common.io.Resources; import org.apache.commons.lang.BooleanUtils; import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; @@ -52,8 +53,8 @@ public class AssignAction implements IssuesWsAction { .setDescription("Assign/Unassign an issue. Requires authentication and Browse permission on project") .setSince("3.6") .setHandler(this) + .setResponseExample(Resources.getResource(this.getClass(), "assign-example.json")) .setPost(true); - // TODO add example of response action.createParam(PARAM_ISSUE) .setDescription("Issue key") diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/BulkChangeAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/BulkChangeAction.java index 4e3a4f2bb2b..310e942b413 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/BulkChangeAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/BulkChangeAction.java @@ -20,6 +20,7 @@ package org.sonar.server.issue.ws; +import com.google.common.io.Resources; import java.util.Collection; import java.util.Date; import java.util.HashMap; @@ -123,6 +124,7 @@ public class BulkChangeAction implements IssuesWsAction { .setDescription("Bulk change on issues. Requires authentication and User role on project(s)") .setSince("3.7") .setHandler(this) + .setResponseExample(Resources.getResource(this.getClass(), "bulk_change-example.json")) .setPost(true); action.createParam(PARAM_ISSUES) diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/ChangelogAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/ChangelogAction.java index b7d63fec1e7..88f8b0b1d27 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/ChangelogAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/ChangelogAction.java @@ -68,8 +68,8 @@ public class ChangelogAction implements IssuesWsAction { @Override public void define(WebService.NewController context) { WebService.NewAction action = context.createAction(ACTION_CHANGELOG) - .setDescription("Display changelog of an issue
." + - "Require the 'Browse' permission on the project of the specified issue
." + + .setDescription("Display changelog of an issue.
" + + "Require the 'Browse' permission on the project of the specified issue.
" + "Since 6.3, changes on effort are returning raw value in minutes, it doesn't return anymore the duration.") .setSince("4.1") .setHandler(this) diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/DeleteCommentAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/DeleteCommentAction.java index fd8ba6c6d35..d611c5a5f3d 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/DeleteCommentAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/DeleteCommentAction.java @@ -20,6 +20,7 @@ package org.sonar.server.issue.ws; +import com.google.common.io.Resources; import java.util.Objects; import java.util.function.Consumer; import java.util.function.Function; @@ -65,6 +66,7 @@ public class DeleteCommentAction implements IssuesWsAction { "Since 6.3, 'key' parameter has been renamed to %s", PARAM_COMMENT) .setSince("3.6") .setHandler(this) + .setResponseExample(Resources.getResource(this.getClass(), "delete_comment-example.json")) .setPost(true); action.createParam(PARAM_COMMENT) diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/DoTransitionAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/DoTransitionAction.java index e7ae247583b..19448122943 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/DoTransitionAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/DoTransitionAction.java @@ -19,6 +19,7 @@ */ package org.sonar.server.issue.ws; +import com.google.common.io.Resources; import java.util.Date; import org.sonar.api.issue.DefaultTransitions; import org.sonar.api.server.ws.Request; @@ -65,6 +66,7 @@ public class DoTransitionAction implements IssuesWsAction { "The transitions '" + DefaultTransitions.WONT_FIX + "' and '" + DefaultTransitions.FALSE_POSITIVE + "' require the permission 'Administer Issues'.") .setSince("3.6") .setHandler(this) + .setResponseExample(Resources.getResource(this.getClass(), "do_transition-example.json")) .setPost(true); action.createParam(PARAM_ISSUE) diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/EditCommentAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/EditCommentAction.java index ee1b6ee6d9e..177d3cc292a 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/EditCommentAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/EditCommentAction.java @@ -20,6 +20,7 @@ package org.sonar.server.issue.ws; +import com.google.common.io.Resources; import java.util.Objects; import java.util.function.Consumer; import java.util.function.Function; @@ -71,6 +72,7 @@ public class EditCommentAction implements IssuesWsAction { "Since 6.3, 'key' parameter has been renamed %s", PARAM_COMMENT) .setSince("3.6") .setHandler(this) + .setResponseExample(Resources.getResource(this.getClass(), "edit_comment-example.json")) .setPost(true); action.createParam(PARAM_COMMENT) diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SetSeverityAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SetSeverityAction.java index 6ddceb5503d..5486d7dd0bc 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SetSeverityAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SetSeverityAction.java @@ -19,6 +19,7 @@ */ package org.sonar.server.issue.ws; +import com.google.common.io.Resources; import org.sonar.api.rule.Severity; import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; @@ -46,6 +47,7 @@ public class SetSeverityAction implements IssuesWsAction { .setDescription("Change severity. Requires authentication and Browse permission on project") .setSince("3.6") .setHandler(this) + .setResponseExample(Resources.getResource(this.getClass(), "set_severity-example.json")) .setPost(true); action.createParam(PARAM_ISSUE) diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SetTagsAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SetTagsAction.java index af3028ff8d7..8806fcf7d12 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SetTagsAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SetTagsAction.java @@ -20,6 +20,7 @@ package org.sonar.server.issue.ws; import com.google.common.base.MoreObjects; +import com.google.common.io.Resources; import java.util.Collection; import java.util.Collections; import java.util.List; @@ -49,12 +50,13 @@ public class SetTagsAction implements IssuesWsAction { @Override public void define(WebService.NewController controller) { NewAction action = controller.createAction(ACTION_SET_TAGS) - .setHandler(this) .setPost(true) .setSince("5.1") .setDescription("Set tags on an issue.
" + - "Requires authentication and Browse permission on project
" + - "Since 6.3, the parameter 'key' has been replaced by '%s'", PARAM_ISSUE); + "Requires authentication and Browse permission on project
" + + "Since 6.3, the parameter 'key' has been replaced by '%s'", PARAM_ISSUE) + .setResponseExample(Resources.getResource(this.getClass(), "set_tags-example.json")) + .setHandler(this); action.createParam(PARAM_ISSUE) .setDescription("Issue key") .setSince("6.3") diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SetTypeAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SetTypeAction.java index 4f52a2a076b..5f860e8484d 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SetTypeAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SetTypeAction.java @@ -19,6 +19,7 @@ */ package org.sonar.server.issue.ws; +import com.google.common.io.Resources; import org.sonar.api.rules.RuleType; import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; @@ -46,6 +47,7 @@ public class SetTypeAction implements IssuesWsAction { .setDescription("Change type of issue, for instance from 'code smell' to 'bug'. Requires authentication and Browse permission on project.") .setSince("5.5") .setHandler(this) + .setResponseExample(Resources.getResource(this.getClass(), "set_type-example.json")) .setPost(true); action.createParam(PARAM_ISSUE) diff --git a/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/add_comment-example.json b/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/add_comment-example.json new file mode 100644 index 00000000000..bc58343b9ec --- /dev/null +++ b/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/add_comment-example.json @@ -0,0 +1,100 @@ +{ + "issue": { + "key": "AVibidgv1LF0E-ru2DVv", + "rule": "squid:S2301", + "severity": "MAJOR", + "component": "org.sonarsource.sonarlint.intellij:sonarlint-intellij:src/main/java/org/sonarlint/intellij/core/ServerIssueUpdater.java", + "componentId": 87163, + "project": "org.sonarsource.sonarlint.intellij:sonarlint-intellij", + "line": 78, + "textRange": { + "startLine": 78, + "endLine": 78, + "startOffset": 14, + "endOffset": 39 + }, + "flows": [], + "status": "CONFIRMED", + "message": "Provide multiple methods instead of using \"modal\" to determine which action to take.", + "effort": "15min", + "debt": "15min", + "assignee": "john.smith", + "author": "john.smith@email.com", + "tags": [ + "design" + ], + "transitions": [ + "unconfirm", + "resolve", + "falsepositive", + "wontfix" + ], + "actions": [ + "comment", + "assign", + "set_tags", + "set_type", + "assign_to_me", + "set_severity" + ], + "comments": [ + { + "key": "AVmDRx8Zm-z8OYZYRSxo", + "login": "jane.doo", + "htmlText": "Please fix this", + "markdown": "Please fix this", + "updatable": true, + "createdAt": "2017-01-09T13:49:53+0100" + } + ], + "creationDate": "2016-11-25T13:50:24+0100", + "updateDate": "2017-01-09T13:51:12+0100", + "type": "CODE_SMELL" + }, + "components": [ + { + "id": 87163, + "key": "org.sonarsource.sonarlint.intellij:sonarlint-intellij:src/main/java/org/sonarlint/intellij/core/ServerIssueUpdater.java", + "uuid": "AVfTIlxMwczdZ2UaLhnt", + "enabled": true, + "qualifier": "FIL", + "name": "ServerIssueUpdater.java", + "longName": "src/main/java/org/sonarlint/intellij/core/ServerIssueUpdater.java", + "path": "src/main/java/org/sonarlint/intellij/core/ServerIssueUpdater.java", + "projectId": 23498, + "subProjectId": 23498 + }, + { + "id": 23498, + "key": "org.sonarsource.sonarlint.intellij:sonarlint-intellij", + "uuid": "8b745480-b598-4e34-af4a-cb2de1808e50", + "enabled": true, + "qualifier": "TRK", + "name": "SonarLint for IntelliJ IDEA", + "longName": "SonarLint for IntelliJ IDEA" + } + ], + "rules": [ + { + "key": "squid:S2301", + "name": "Public methods should not contain selector arguments", + "lang": "java", + "status": "READY", + "langName": "Java" + } + ], + "users": [ + { + "login": "john.smith", + "name": "John Smith", + "email": "john.smith@email.com", + "active": true + }, + { + "login": "jane.doo", + "name": "Jane Doo", + "email": "jane.doo@mail.net", + "active": true + } + ] +} diff --git a/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/assign-example.json b/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/assign-example.json new file mode 100644 index 00000000000..bc58343b9ec --- /dev/null +++ b/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/assign-example.json @@ -0,0 +1,100 @@ +{ + "issue": { + "key": "AVibidgv1LF0E-ru2DVv", + "rule": "squid:S2301", + "severity": "MAJOR", + "component": "org.sonarsource.sonarlint.intellij:sonarlint-intellij:src/main/java/org/sonarlint/intellij/core/ServerIssueUpdater.java", + "componentId": 87163, + "project": "org.sonarsource.sonarlint.intellij:sonarlint-intellij", + "line": 78, + "textRange": { + "startLine": 78, + "endLine": 78, + "startOffset": 14, + "endOffset": 39 + }, + "flows": [], + "status": "CONFIRMED", + "message": "Provide multiple methods instead of using \"modal\" to determine which action to take.", + "effort": "15min", + "debt": "15min", + "assignee": "john.smith", + "author": "john.smith@email.com", + "tags": [ + "design" + ], + "transitions": [ + "unconfirm", + "resolve", + "falsepositive", + "wontfix" + ], + "actions": [ + "comment", + "assign", + "set_tags", + "set_type", + "assign_to_me", + "set_severity" + ], + "comments": [ + { + "key": "AVmDRx8Zm-z8OYZYRSxo", + "login": "jane.doo", + "htmlText": "Please fix this", + "markdown": "Please fix this", + "updatable": true, + "createdAt": "2017-01-09T13:49:53+0100" + } + ], + "creationDate": "2016-11-25T13:50:24+0100", + "updateDate": "2017-01-09T13:51:12+0100", + "type": "CODE_SMELL" + }, + "components": [ + { + "id": 87163, + "key": "org.sonarsource.sonarlint.intellij:sonarlint-intellij:src/main/java/org/sonarlint/intellij/core/ServerIssueUpdater.java", + "uuid": "AVfTIlxMwczdZ2UaLhnt", + "enabled": true, + "qualifier": "FIL", + "name": "ServerIssueUpdater.java", + "longName": "src/main/java/org/sonarlint/intellij/core/ServerIssueUpdater.java", + "path": "src/main/java/org/sonarlint/intellij/core/ServerIssueUpdater.java", + "projectId": 23498, + "subProjectId": 23498 + }, + { + "id": 23498, + "key": "org.sonarsource.sonarlint.intellij:sonarlint-intellij", + "uuid": "8b745480-b598-4e34-af4a-cb2de1808e50", + "enabled": true, + "qualifier": "TRK", + "name": "SonarLint for IntelliJ IDEA", + "longName": "SonarLint for IntelliJ IDEA" + } + ], + "rules": [ + { + "key": "squid:S2301", + "name": "Public methods should not contain selector arguments", + "lang": "java", + "status": "READY", + "langName": "Java" + } + ], + "users": [ + { + "login": "john.smith", + "name": "John Smith", + "email": "john.smith@email.com", + "active": true + }, + { + "login": "jane.doo", + "name": "Jane Doo", + "email": "jane.doo@mail.net", + "active": true + } + ] +} diff --git a/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/bulk_change-example.json b/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/bulk_change-example.json new file mode 100644 index 00000000000..cfd9f3a8a7c --- /dev/null +++ b/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/bulk_change-example.json @@ -0,0 +1,6 @@ +{ + "total": 2, + "success": 1, + "ignored": 1, + "failures": 0 +} diff --git a/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/delete_comment-example.json b/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/delete_comment-example.json new file mode 100644 index 00000000000..bc58343b9ec --- /dev/null +++ b/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/delete_comment-example.json @@ -0,0 +1,100 @@ +{ + "issue": { + "key": "AVibidgv1LF0E-ru2DVv", + "rule": "squid:S2301", + "severity": "MAJOR", + "component": "org.sonarsource.sonarlint.intellij:sonarlint-intellij:src/main/java/org/sonarlint/intellij/core/ServerIssueUpdater.java", + "componentId": 87163, + "project": "org.sonarsource.sonarlint.intellij:sonarlint-intellij", + "line": 78, + "textRange": { + "startLine": 78, + "endLine": 78, + "startOffset": 14, + "endOffset": 39 + }, + "flows": [], + "status": "CONFIRMED", + "message": "Provide multiple methods instead of using \"modal\" to determine which action to take.", + "effort": "15min", + "debt": "15min", + "assignee": "john.smith", + "author": "john.smith@email.com", + "tags": [ + "design" + ], + "transitions": [ + "unconfirm", + "resolve", + "falsepositive", + "wontfix" + ], + "actions": [ + "comment", + "assign", + "set_tags", + "set_type", + "assign_to_me", + "set_severity" + ], + "comments": [ + { + "key": "AVmDRx8Zm-z8OYZYRSxo", + "login": "jane.doo", + "htmlText": "Please fix this", + "markdown": "Please fix this", + "updatable": true, + "createdAt": "2017-01-09T13:49:53+0100" + } + ], + "creationDate": "2016-11-25T13:50:24+0100", + "updateDate": "2017-01-09T13:51:12+0100", + "type": "CODE_SMELL" + }, + "components": [ + { + "id": 87163, + "key": "org.sonarsource.sonarlint.intellij:sonarlint-intellij:src/main/java/org/sonarlint/intellij/core/ServerIssueUpdater.java", + "uuid": "AVfTIlxMwczdZ2UaLhnt", + "enabled": true, + "qualifier": "FIL", + "name": "ServerIssueUpdater.java", + "longName": "src/main/java/org/sonarlint/intellij/core/ServerIssueUpdater.java", + "path": "src/main/java/org/sonarlint/intellij/core/ServerIssueUpdater.java", + "projectId": 23498, + "subProjectId": 23498 + }, + { + "id": 23498, + "key": "org.sonarsource.sonarlint.intellij:sonarlint-intellij", + "uuid": "8b745480-b598-4e34-af4a-cb2de1808e50", + "enabled": true, + "qualifier": "TRK", + "name": "SonarLint for IntelliJ IDEA", + "longName": "SonarLint for IntelliJ IDEA" + } + ], + "rules": [ + { + "key": "squid:S2301", + "name": "Public methods should not contain selector arguments", + "lang": "java", + "status": "READY", + "langName": "Java" + } + ], + "users": [ + { + "login": "john.smith", + "name": "John Smith", + "email": "john.smith@email.com", + "active": true + }, + { + "login": "jane.doo", + "name": "Jane Doo", + "email": "jane.doo@mail.net", + "active": true + } + ] +} diff --git a/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/do_transition-example.json b/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/do_transition-example.json new file mode 100644 index 00000000000..bc58343b9ec --- /dev/null +++ b/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/do_transition-example.json @@ -0,0 +1,100 @@ +{ + "issue": { + "key": "AVibidgv1LF0E-ru2DVv", + "rule": "squid:S2301", + "severity": "MAJOR", + "component": "org.sonarsource.sonarlint.intellij:sonarlint-intellij:src/main/java/org/sonarlint/intellij/core/ServerIssueUpdater.java", + "componentId": 87163, + "project": "org.sonarsource.sonarlint.intellij:sonarlint-intellij", + "line": 78, + "textRange": { + "startLine": 78, + "endLine": 78, + "startOffset": 14, + "endOffset": 39 + }, + "flows": [], + "status": "CONFIRMED", + "message": "Provide multiple methods instead of using \"modal\" to determine which action to take.", + "effort": "15min", + "debt": "15min", + "assignee": "john.smith", + "author": "john.smith@email.com", + "tags": [ + "design" + ], + "transitions": [ + "unconfirm", + "resolve", + "falsepositive", + "wontfix" + ], + "actions": [ + "comment", + "assign", + "set_tags", + "set_type", + "assign_to_me", + "set_severity" + ], + "comments": [ + { + "key": "AVmDRx8Zm-z8OYZYRSxo", + "login": "jane.doo", + "htmlText": "Please fix this", + "markdown": "Please fix this", + "updatable": true, + "createdAt": "2017-01-09T13:49:53+0100" + } + ], + "creationDate": "2016-11-25T13:50:24+0100", + "updateDate": "2017-01-09T13:51:12+0100", + "type": "CODE_SMELL" + }, + "components": [ + { + "id": 87163, + "key": "org.sonarsource.sonarlint.intellij:sonarlint-intellij:src/main/java/org/sonarlint/intellij/core/ServerIssueUpdater.java", + "uuid": "AVfTIlxMwczdZ2UaLhnt", + "enabled": true, + "qualifier": "FIL", + "name": "ServerIssueUpdater.java", + "longName": "src/main/java/org/sonarlint/intellij/core/ServerIssueUpdater.java", + "path": "src/main/java/org/sonarlint/intellij/core/ServerIssueUpdater.java", + "projectId": 23498, + "subProjectId": 23498 + }, + { + "id": 23498, + "key": "org.sonarsource.sonarlint.intellij:sonarlint-intellij", + "uuid": "8b745480-b598-4e34-af4a-cb2de1808e50", + "enabled": true, + "qualifier": "TRK", + "name": "SonarLint for IntelliJ IDEA", + "longName": "SonarLint for IntelliJ IDEA" + } + ], + "rules": [ + { + "key": "squid:S2301", + "name": "Public methods should not contain selector arguments", + "lang": "java", + "status": "READY", + "langName": "Java" + } + ], + "users": [ + { + "login": "john.smith", + "name": "John Smith", + "email": "john.smith@email.com", + "active": true + }, + { + "login": "jane.doo", + "name": "Jane Doo", + "email": "jane.doo@mail.net", + "active": true + } + ] +} diff --git a/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/edit_comment-example.json b/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/edit_comment-example.json new file mode 100644 index 00000000000..bc58343b9ec --- /dev/null +++ b/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/edit_comment-example.json @@ -0,0 +1,100 @@ +{ + "issue": { + "key": "AVibidgv1LF0E-ru2DVv", + "rule": "squid:S2301", + "severity": "MAJOR", + "component": "org.sonarsource.sonarlint.intellij:sonarlint-intellij:src/main/java/org/sonarlint/intellij/core/ServerIssueUpdater.java", + "componentId": 87163, + "project": "org.sonarsource.sonarlint.intellij:sonarlint-intellij", + "line": 78, + "textRange": { + "startLine": 78, + "endLine": 78, + "startOffset": 14, + "endOffset": 39 + }, + "flows": [], + "status": "CONFIRMED", + "message": "Provide multiple methods instead of using \"modal\" to determine which action to take.", + "effort": "15min", + "debt": "15min", + "assignee": "john.smith", + "author": "john.smith@email.com", + "tags": [ + "design" + ], + "transitions": [ + "unconfirm", + "resolve", + "falsepositive", + "wontfix" + ], + "actions": [ + "comment", + "assign", + "set_tags", + "set_type", + "assign_to_me", + "set_severity" + ], + "comments": [ + { + "key": "AVmDRx8Zm-z8OYZYRSxo", + "login": "jane.doo", + "htmlText": "Please fix this", + "markdown": "Please fix this", + "updatable": true, + "createdAt": "2017-01-09T13:49:53+0100" + } + ], + "creationDate": "2016-11-25T13:50:24+0100", + "updateDate": "2017-01-09T13:51:12+0100", + "type": "CODE_SMELL" + }, + "components": [ + { + "id": 87163, + "key": "org.sonarsource.sonarlint.intellij:sonarlint-intellij:src/main/java/org/sonarlint/intellij/core/ServerIssueUpdater.java", + "uuid": "AVfTIlxMwczdZ2UaLhnt", + "enabled": true, + "qualifier": "FIL", + "name": "ServerIssueUpdater.java", + "longName": "src/main/java/org/sonarlint/intellij/core/ServerIssueUpdater.java", + "path": "src/main/java/org/sonarlint/intellij/core/ServerIssueUpdater.java", + "projectId": 23498, + "subProjectId": 23498 + }, + { + "id": 23498, + "key": "org.sonarsource.sonarlint.intellij:sonarlint-intellij", + "uuid": "8b745480-b598-4e34-af4a-cb2de1808e50", + "enabled": true, + "qualifier": "TRK", + "name": "SonarLint for IntelliJ IDEA", + "longName": "SonarLint for IntelliJ IDEA" + } + ], + "rules": [ + { + "key": "squid:S2301", + "name": "Public methods should not contain selector arguments", + "lang": "java", + "status": "READY", + "langName": "Java" + } + ], + "users": [ + { + "login": "john.smith", + "name": "John Smith", + "email": "john.smith@email.com", + "active": true + }, + { + "login": "jane.doo", + "name": "Jane Doo", + "email": "jane.doo@mail.net", + "active": true + } + ] +} diff --git a/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/set_severity-example.json b/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/set_severity-example.json new file mode 100644 index 00000000000..bc58343b9ec --- /dev/null +++ b/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/set_severity-example.json @@ -0,0 +1,100 @@ +{ + "issue": { + "key": "AVibidgv1LF0E-ru2DVv", + "rule": "squid:S2301", + "severity": "MAJOR", + "component": "org.sonarsource.sonarlint.intellij:sonarlint-intellij:src/main/java/org/sonarlint/intellij/core/ServerIssueUpdater.java", + "componentId": 87163, + "project": "org.sonarsource.sonarlint.intellij:sonarlint-intellij", + "line": 78, + "textRange": { + "startLine": 78, + "endLine": 78, + "startOffset": 14, + "endOffset": 39 + }, + "flows": [], + "status": "CONFIRMED", + "message": "Provide multiple methods instead of using \"modal\" to determine which action to take.", + "effort": "15min", + "debt": "15min", + "assignee": "john.smith", + "author": "john.smith@email.com", + "tags": [ + "design" + ], + "transitions": [ + "unconfirm", + "resolve", + "falsepositive", + "wontfix" + ], + "actions": [ + "comment", + "assign", + "set_tags", + "set_type", + "assign_to_me", + "set_severity" + ], + "comments": [ + { + "key": "AVmDRx8Zm-z8OYZYRSxo", + "login": "jane.doo", + "htmlText": "Please fix this", + "markdown": "Please fix this", + "updatable": true, + "createdAt": "2017-01-09T13:49:53+0100" + } + ], + "creationDate": "2016-11-25T13:50:24+0100", + "updateDate": "2017-01-09T13:51:12+0100", + "type": "CODE_SMELL" + }, + "components": [ + { + "id": 87163, + "key": "org.sonarsource.sonarlint.intellij:sonarlint-intellij:src/main/java/org/sonarlint/intellij/core/ServerIssueUpdater.java", + "uuid": "AVfTIlxMwczdZ2UaLhnt", + "enabled": true, + "qualifier": "FIL", + "name": "ServerIssueUpdater.java", + "longName": "src/main/java/org/sonarlint/intellij/core/ServerIssueUpdater.java", + "path": "src/main/java/org/sonarlint/intellij/core/ServerIssueUpdater.java", + "projectId": 23498, + "subProjectId": 23498 + }, + { + "id": 23498, + "key": "org.sonarsource.sonarlint.intellij:sonarlint-intellij", + "uuid": "8b745480-b598-4e34-af4a-cb2de1808e50", + "enabled": true, + "qualifier": "TRK", + "name": "SonarLint for IntelliJ IDEA", + "longName": "SonarLint for IntelliJ IDEA" + } + ], + "rules": [ + { + "key": "squid:S2301", + "name": "Public methods should not contain selector arguments", + "lang": "java", + "status": "READY", + "langName": "Java" + } + ], + "users": [ + { + "login": "john.smith", + "name": "John Smith", + "email": "john.smith@email.com", + "active": true + }, + { + "login": "jane.doo", + "name": "Jane Doo", + "email": "jane.doo@mail.net", + "active": true + } + ] +} diff --git a/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/set_tags-example.json b/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/set_tags-example.json new file mode 100644 index 00000000000..bc58343b9ec --- /dev/null +++ b/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/set_tags-example.json @@ -0,0 +1,100 @@ +{ + "issue": { + "key": "AVibidgv1LF0E-ru2DVv", + "rule": "squid:S2301", + "severity": "MAJOR", + "component": "org.sonarsource.sonarlint.intellij:sonarlint-intellij:src/main/java/org/sonarlint/intellij/core/ServerIssueUpdater.java", + "componentId": 87163, + "project": "org.sonarsource.sonarlint.intellij:sonarlint-intellij", + "line": 78, + "textRange": { + "startLine": 78, + "endLine": 78, + "startOffset": 14, + "endOffset": 39 + }, + "flows": [], + "status": "CONFIRMED", + "message": "Provide multiple methods instead of using \"modal\" to determine which action to take.", + "effort": "15min", + "debt": "15min", + "assignee": "john.smith", + "author": "john.smith@email.com", + "tags": [ + "design" + ], + "transitions": [ + "unconfirm", + "resolve", + "falsepositive", + "wontfix" + ], + "actions": [ + "comment", + "assign", + "set_tags", + "set_type", + "assign_to_me", + "set_severity" + ], + "comments": [ + { + "key": "AVmDRx8Zm-z8OYZYRSxo", + "login": "jane.doo", + "htmlText": "Please fix this", + "markdown": "Please fix this", + "updatable": true, + "createdAt": "2017-01-09T13:49:53+0100" + } + ], + "creationDate": "2016-11-25T13:50:24+0100", + "updateDate": "2017-01-09T13:51:12+0100", + "type": "CODE_SMELL" + }, + "components": [ + { + "id": 87163, + "key": "org.sonarsource.sonarlint.intellij:sonarlint-intellij:src/main/java/org/sonarlint/intellij/core/ServerIssueUpdater.java", + "uuid": "AVfTIlxMwczdZ2UaLhnt", + "enabled": true, + "qualifier": "FIL", + "name": "ServerIssueUpdater.java", + "longName": "src/main/java/org/sonarlint/intellij/core/ServerIssueUpdater.java", + "path": "src/main/java/org/sonarlint/intellij/core/ServerIssueUpdater.java", + "projectId": 23498, + "subProjectId": 23498 + }, + { + "id": 23498, + "key": "org.sonarsource.sonarlint.intellij:sonarlint-intellij", + "uuid": "8b745480-b598-4e34-af4a-cb2de1808e50", + "enabled": true, + "qualifier": "TRK", + "name": "SonarLint for IntelliJ IDEA", + "longName": "SonarLint for IntelliJ IDEA" + } + ], + "rules": [ + { + "key": "squid:S2301", + "name": "Public methods should not contain selector arguments", + "lang": "java", + "status": "READY", + "langName": "Java" + } + ], + "users": [ + { + "login": "john.smith", + "name": "John Smith", + "email": "john.smith@email.com", + "active": true + }, + { + "login": "jane.doo", + "name": "Jane Doo", + "email": "jane.doo@mail.net", + "active": true + } + ] +} diff --git a/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/set_type-example.json b/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/set_type-example.json new file mode 100644 index 00000000000..bc58343b9ec --- /dev/null +++ b/server/sonar-server/src/main/resources/org/sonar/server/issue/ws/set_type-example.json @@ -0,0 +1,100 @@ +{ + "issue": { + "key": "AVibidgv1LF0E-ru2DVv", + "rule": "squid:S2301", + "severity": "MAJOR", + "component": "org.sonarsource.sonarlint.intellij:sonarlint-intellij:src/main/java/org/sonarlint/intellij/core/ServerIssueUpdater.java", + "componentId": 87163, + "project": "org.sonarsource.sonarlint.intellij:sonarlint-intellij", + "line": 78, + "textRange": { + "startLine": 78, + "endLine": 78, + "startOffset": 14, + "endOffset": 39 + }, + "flows": [], + "status": "CONFIRMED", + "message": "Provide multiple methods instead of using \"modal\" to determine which action to take.", + "effort": "15min", + "debt": "15min", + "assignee": "john.smith", + "author": "john.smith@email.com", + "tags": [ + "design" + ], + "transitions": [ + "unconfirm", + "resolve", + "falsepositive", + "wontfix" + ], + "actions": [ + "comment", + "assign", + "set_tags", + "set_type", + "assign_to_me", + "set_severity" + ], + "comments": [ + { + "key": "AVmDRx8Zm-z8OYZYRSxo", + "login": "jane.doo", + "htmlText": "Please fix this", + "markdown": "Please fix this", + "updatable": true, + "createdAt": "2017-01-09T13:49:53+0100" + } + ], + "creationDate": "2016-11-25T13:50:24+0100", + "updateDate": "2017-01-09T13:51:12+0100", + "type": "CODE_SMELL" + }, + "components": [ + { + "id": 87163, + "key": "org.sonarsource.sonarlint.intellij:sonarlint-intellij:src/main/java/org/sonarlint/intellij/core/ServerIssueUpdater.java", + "uuid": "AVfTIlxMwczdZ2UaLhnt", + "enabled": true, + "qualifier": "FIL", + "name": "ServerIssueUpdater.java", + "longName": "src/main/java/org/sonarlint/intellij/core/ServerIssueUpdater.java", + "path": "src/main/java/org/sonarlint/intellij/core/ServerIssueUpdater.java", + "projectId": 23498, + "subProjectId": 23498 + }, + { + "id": 23498, + "key": "org.sonarsource.sonarlint.intellij:sonarlint-intellij", + "uuid": "8b745480-b598-4e34-af4a-cb2de1808e50", + "enabled": true, + "qualifier": "TRK", + "name": "SonarLint for IntelliJ IDEA", + "longName": "SonarLint for IntelliJ IDEA" + } + ], + "rules": [ + { + "key": "squid:S2301", + "name": "Public methods should not contain selector arguments", + "lang": "java", + "status": "READY", + "langName": "Java" + } + ], + "users": [ + { + "login": "john.smith", + "name": "John Smith", + "email": "john.smith@email.com", + "active": true + }, + { + "login": "jane.doo", + "name": "Jane Doo", + "email": "jane.doo@mail.net", + "active": true + } + ] +} diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/AddCommentActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/AddCommentActionTest.java index a621eadb07e..87f9797acad 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/AddCommentActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/AddCommentActionTest.java @@ -175,7 +175,7 @@ public class AddCommentActionTest { assertThat(action.isPost()).isTrue(); assertThat(action.isInternal()).isFalse(); assertThat(action.params()).hasSize(2); - assertThat(action.responseExample()).isNull(); + assertThat(action.responseExample()).isNotNull(); } private TestResponse call(@Nullable String issueKey, @Nullable String commentText) { diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/BulkChangeActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/BulkChangeActionTest.java index f5c06b06e77..1c50b22773c 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/BulkChangeActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/BulkChangeActionTest.java @@ -402,7 +402,7 @@ public class BulkChangeActionTest { assertThat(action.isPost()).isTrue(); assertThat(action.isInternal()).isFalse(); assertThat(action.params()).hasSize(11); - assertThat(action.responseExample()).isNull(); + assertThat(action.responseExample()).isNotNull(); } private BulkChangeWsResponse call(BulkChangeRequest bulkChangeRequest) { diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/DeleteCommentActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/DeleteCommentActionTest.java index 592386656d0..79e64428e7d 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/DeleteCommentActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/DeleteCommentActionTest.java @@ -155,7 +155,7 @@ public class DeleteCommentActionTest { assertThat(action.isPost()).isTrue(); assertThat(action.isInternal()).isFalse(); assertThat(action.params()).hasSize(1); - assertThat(action.responseExample()).isNull(); + assertThat(action.responseExample()).isNotNull(); } private TestResponse call(@Nullable String commentKey) { diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/EditCommentActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/EditCommentActionTest.java index 53a670e1a8f..bd8c46bbe08 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/EditCommentActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/EditCommentActionTest.java @@ -189,7 +189,7 @@ public class EditCommentActionTest { assertThat(action.isPost()).isTrue(); assertThat(action.isInternal()).isFalse(); assertThat(action.params()).hasSize(2); - assertThat(action.responseExample()).isNull(); + assertThat(action.responseExample()).isNotNull(); } private TestResponse call(@Nullable String commentKey, @Nullable String commentText) { diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SetTagsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SetTagsActionTest.java index 9ad6933331a..378fe71707f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SetTagsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SetTagsActionTest.java @@ -53,7 +53,7 @@ public class SetTagsActionTest { public void should_define() { Action action = tester.controller("api/issues").action("set_tags"); assertThat(action.description()).isNotEmpty(); - assertThat(action.responseExampleAsString()).isNull(); + assertThat(action.responseExampleAsString()).isNotEmpty(); assertThat(action.isPost()).isTrue(); assertThat(action.isInternal()).isFalse(); assertThat(action.handler()).isEqualTo(sut); -- 2.39.5