From 2cf5d0f82c96846af16007233b674e0e5c638eea Mon Sep 17 00:00:00 2001 From: Teryk Bellahsene Date: Wed, 30 Mar 2016 10:34:27 +0200 Subject: [PATCH] MMF-165 Remove action plan mentions --- .../org/sonar/server/issue/ws/IssuesWs.java | 7 +- .../org/sonar/server/ws/list-example.json | 222 ++++-------------- .../sonar/server/ws/WebServicesWsTest.java | 6 +- .../extract_directory_path.xml | 8 +- .../IssueResultSetIteratorTest/shared.xml | 8 +- .../server/ws/WebServicesWsTest/list.json | 87 ------- .../app/controllers/api/issues_controller.rb | 3 +- .../java/org/sonar/db/issue/IssueDto.java | 5 - .../find_severities_by_component.xml | 83 ------- .../db/issue/IssueDaoTest/update-result.xml | 30 --- .../sonar/db/issue/IssueDaoTest/update.xml | 29 --- .../sonar/api/issue/action/ActionsTest.java | 2 +- 12 files changed, 69 insertions(+), 421 deletions(-) delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/ws/WebServicesWsTest/list.json delete mode 100644 sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/find_severities_by_component.xml delete mode 100644 sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/update-result.xml delete mode 100644 sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/update.xml diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/IssuesWs.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/IssuesWs.java index 6014a49da8e..48dfa38a99d 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/IssuesWs.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/IssuesWs.java @@ -155,9 +155,10 @@ public class IssuesWs implements WebService { .setRequired(true) .setExampleValue("01fc972e-2a3c-433e-bcae-0bd7f88f5123,01fc972e-2a3c-433e-bcae-0bd7f88f9999"); action.createParam("actions") - .setDescription("Comma-separated list of actions to perform. Possible values: assign | set_severity | plan | do_transition") + .setDescription("Comma-separated list of actions to perform. Possible values: assign | set_severity | do_transition | plan.
" + + "In 5.5 action plans are dropped. plan action has no effect.") .setRequired(true) - .setExampleValue("assign,plan"); + .setExampleValue("assign,set_severity"); action.createParam("assign.assignee") .setDescription("To assign the list of issues to a specific user (login), or un-assign all the issues") .setExampleValue("john.smith"); @@ -171,7 +172,7 @@ public class IssuesWs implements WebService { .setPossibleValues(RuleType.ALL_NAMES) .setSince("5.5"); action.createParam("plan.plan") - .setDescription("Deprecated in 5.5. Has no effect. To plan the list of issues to a specific action plan (key), or unlink all the issues from an action plan") + .setDescription("In 5.5, action plans are dropped. Has no effect. To plan the list of issues to a specific action plan (key), or unlink all the issues from an action plan") .setDeprecatedSince("5.5") .setExampleValue("3f19de90-1521-4482-a737-a311758ff513"); action.createParam("do_transition.transition") diff --git a/server/sonar-server/src/main/resources/org/sonar/server/ws/list-example.json b/server/sonar-server/src/main/resources/org/sonar/server/ws/list-example.json index 3f2d8e04df9..8aad3729e82 100644 --- a/server/sonar-server/src/main/resources/org/sonar/server/ws/list-example.json +++ b/server/sonar-server/src/main/resources/org/sonar/server/ws/list-example.json @@ -1,217 +1,93 @@ { "webServices": [ { - "path": "api/action_plans", - "description": "Action plans management", + "path": "api/metric", + "since": "3.2", + "description": "Metrics", "actions": [ - { - "key": "close", - "description": "Close an action plan. Requires Administer permission on project", - "since": "3.6", - "internal": false, - "post": true, - "hasResponseExample": false, - "params": [ - { - "key": "format", - "description": "Response format can be set through:If nothing is set, json is used", - "required": false, - "possibleValues": [ - "json", - "xml" - ] - }, - { - "key": "key", - "description": "Key of the action plan", - "required": true, - "exampleValue": "3f19de90-1521-4482-a737-a311758ff513" - } - ] - }, { "key": "create", - "description": "Create an action plan. Requires Administer permission on project", - "since": "3.6", + "description": "Create metric", + "since": "4.1", + "deprecatedSince": "5.3", "internal": false, "post": true, - "hasResponseExample": false, + "hasResponseExample": true, "params": [ - { - "key": "deadLine", - "description": "Due date of the action plan. Format: YYYY-MM-DD", - "required": false, - "exampleValue": "2013-12-31" - }, - { - "key": "description", - "description": "Description of the action plan", - "required": false, - "exampleValue": "Version 3.6" - }, - { - "key": "format", - "description": "Response format can be set through:If nothing is set, json is used", - "required": false, - "possibleValues": [ - "json", - "xml" - ] - }, { "key": "name", - "description": "Name of the action plan", - "required": true, - "exampleValue": "Version 3.6" + "required": false }, { - "key": "project", - "description": "Project key", - "required": true, - "exampleValue": "org.codehaus.sonar:sonar" - } - ] - }, - { - "key": "delete", - "description": "Delete an action plan. Requires Administer permission on project", - "since": "3.6", - "internal": false, - "post": true, - "hasResponseExample": false, - "params": [ - { - "key": "format", - "description": "Response format can be set through:If nothing is set, json is used", + "key": "severity", + "description": "Severity", "required": false, + "defaultValue": "BLOCKER", + "exampleValue": "INFO", + "since": "4.4", + "deprecatedSince": "5.2", "possibleValues": [ - "json", - "xml" + "BLOCKER", + "INFO" ] - }, - { - "key": "key", - "description": "Key of the action plan", - "required": true, - "exampleValue": "3f19de90-1521-4482-a737-a311758ff513" } ] }, { - "key": "open", - "description": "Open an action plan. Requires Administer permission on project", - "since": "3.6", + "key": "show", + "since": "3.2", "internal": false, - "post": true, - "hasResponseExample": false, - "params": [ - { - "key": "format", - "description": "Response format can be set through:If nothing is set, json is used", - "required": false, - "possibleValues": [ - "json", - "xml" - ] - }, - { - "key": "key", - "description": "Key of the action plan", - "required": true, - "exampleValue": "3f19de90-1521-4482-a737-a311758ff513" - } - ] - }, + "post": false, + "hasResponseExample": true + } + ] + }, + { + "path": "api/webservices", + "description": "List web services", + "since": "4.2", + "actions": [ { - "key": "search", - "description": "Get a list of action plans. Requires Browse permission on project", - "since": "3.6", + "key": "list", + "since": "4.2", + "description": "List web services", "internal": false, "post": false, "hasResponseExample": true, "params": [ { - "key": "format", - "description": "Response format can be set through:If nothing is set, json is used", + "key": "include_internals", + "description": "Include web services that are implemented for internal use only. Their forward-compatibility is not assured", "required": false, + "defaultValue": "false", "possibleValues": [ - "json", - "xml" + "true", + "false", + "yes", + "no" ] - }, - { - "key": "project", - "description": "Project key", - "required": true, - "exampleValue": "org.codehaus.sonar:sonar" } ] }, { - "key": "update", - "description": "Update an action plan. Requires Administer permission on project", - "since": "3.6", + "key": "response_example", + "since": "4.4", + "description": "Display web service response example", "internal": false, - "post": true, - "hasResponseExample": false, + "post": false, + "hasResponseExample": true, "params": [ { - "key": "deadLine", - "description": "Due date of the action plan. Format: YYYY-MM-DD", - "required": false, - "exampleValue": "2013-12-31" - }, - { - "key": "description", - "description": "Description of the action plan", - "required": false, - "exampleValue": "Version 3.6" - }, - { - "key": "format", - "description": "Response format can be set through:If nothing is set, json is used", - "required": false, - "possibleValues": [ - "json", - "xml" - ] - }, - { - "key": "key", - "description": "Key of the action plan", + "key": "action", "required": true, - "exampleValue": "3f19de90-1521-4482-a737-a311758ff513" + "description": "Action of the web service", + "exampleValue": "search" }, { - "key": "name", - "description": "Name of the action plan", + "key": "controller", "required": true, - "exampleValue": "Version 3.6" - } - ] - } - ] - }, - { - "path": "api/authentication", - "description": "Check authentication credentials", - "actions": [ - { - "key": "validate", - "description": "Check credentials", - "since": "3.3", - "internal": false, - "post": false, - "hasResponseExample": true, - "params": [ - { - "key": "format", - "description": "Response format can be set through:If nothing is set, json is used", - "required": false, - "possibleValues": [ - "json", - "xml" - ] + "description": "Controller of the web service", + "exampleValue": "api/issues" } ] } diff --git a/server/sonar-server/src/test/java/org/sonar/server/ws/WebServicesWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/ws/WebServicesWsTest.java index 388b4d481e3..554a1c44c60 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/ws/WebServicesWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ws/WebServicesWsTest.java @@ -25,6 +25,7 @@ import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.RequestHandler; import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; +import org.sonar.test.JsonAssert; import static org.assertj.core.api.Assertions.assertThat; @@ -56,7 +57,10 @@ public class WebServicesWsTest { @Test public void list() throws Exception { WsTester tester = new WsTester(ws, new MetricWs()); - tester.newGetRequest("api/webservices", "list").execute().assertJson(getClass(), "list.json"); + + String response = tester.newGetRequest("api/webservices", "list").execute().outputAsString(); + + JsonAssert.assertJson(response).isSimilarTo(getClass().getResource("list-example.json")); } @Test diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/extract_directory_path.xml b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/extract_directory_path.xml index c68a82fb8c8..1e3158f86fb 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/extract_directory_path.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/extract_directory_path.xml @@ -26,7 +26,7 @@ rule_id="200" reporter="[null]" issue_attributes="JIRA=http://jira.com" - action_plan_key="PLAN1" + action_plan_key="[null]" tags="tag1,tag2,tag3" created_at="1400000000000" updated_at="1400000000000" @@ -55,7 +55,7 @@ rule_id="200" reporter="[null]" issue_attributes="JIRA=http://jira.com" - action_plan_key="PLAN2" + action_plan_key="[null]" tags="[null]" created_at="1400000000000" updated_at="1450000000000" @@ -84,7 +84,7 @@ rule_id="200" reporter="[null]" issue_attributes="JIRA=http://jira.com" - action_plan_key="PLAN2" + action_plan_key="[null]" tags="[null]" created_at="1400000000000" updated_at="1450000000000" @@ -113,7 +113,7 @@ rule_id="200" reporter="[null]" issue_attributes="JIRA=http://jira.com" - action_plan_key="PLAN2" + action_plan_key="[null]" tags="[null]" created_at="1400000000000" updated_at="1450000000000" diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/shared.xml b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/shared.xml index b48d250acaa..018199d9f56 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/shared.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/shared.xml @@ -26,7 +26,7 @@ rule_id="200" reporter="[null]" issue_attributes="JIRA=http://jira.com" - action_plan_key="PLAN1" + action_plan_key="[null]" tags="tag1,tag2,tag3" created_at="1400000000000" updated_at="1400000000000" @@ -56,7 +56,7 @@ rule_id="200" reporter="[null]" issue_attributes="JIRA=http://jira.com" - action_plan_key="PLAN1" + action_plan_key="[null]" tags="tag1,tag2,tag3" created_at="1400000000000" updated_at="1400000000000" @@ -86,7 +86,7 @@ rule_id="200" reporter="[null]" issue_attributes="JIRA=http://jira.com" - action_plan_key="PLAN2" + action_plan_key="[null]" tags="[null]" created_at="1400000000000" updated_at="1450000000000" @@ -116,7 +116,7 @@ rule_id="200" reporter="[null]" issue_attributes="JIRA=http://jira.com" - action_plan_key="PLAN1" + action_plan_key="[null]" tags="[null]" created_at="1400000000000" updated_at="1400000000000" diff --git a/server/sonar-server/src/test/resources/org/sonar/server/ws/WebServicesWsTest/list.json b/server/sonar-server/src/test/resources/org/sonar/server/ws/WebServicesWsTest/list.json deleted file mode 100644 index 6b3f7a3291c..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/ws/WebServicesWsTest/list.json +++ /dev/null @@ -1,87 +0,0 @@ -{"webServices": [ - { - "path": "api/metric", - "since": "3.2", - "description": "Metrics", - "actions": [ - { - "key": "create", - "description": "Create metric", - "since": "4.1", - "deprecatedSince" : "5.3", - "internal": false, - "post": true, - "hasResponseExample": true, - "params": [ - { - "key": "name", - "required": false - }, - { - "key": "severity", - "description": "Severity", - "required": false, - "defaultValue": "BLOCKER", - "exampleValue": "INFO", - "since":"4.4", - "deprecatedSince": "5.2", - "possibleValues": ["BLOCKER", "INFO"] - } - ] - }, - { - "key": "show", - "since": "3.2", - "internal": false, - "post": false, - "hasResponseExample": true - } - ] - }, - { - "path": "api/webservices", - "description": "List web services", - "since": "4.2", - "actions": [ - { - "key": "list", - "since": "4.2", - "description": "List web services", - "internal": false, - "post": false, - "hasResponseExample": true, - "params": [ - { - "key": "include_internals", - "description": "Include web services that are implemented for internal use only. Their forward-compatibility is not assured", - "required": false, - "defaultValue": "false", - "possibleValues": ["true", "false", "yes", "no"] - } - ] - }, - { - "key": "response_example", - "since": "4.4", - "description": "Display web service response example", - "internal": false, - "post": false, - "hasResponseExample": true, - "params": [ - { - "key": "action", - "required": true, - "description": "Action of the web service", - "exampleValue": "search" - }, - { - "key": "controller", - "required": true, - "description": "Controller of the web service", - "exampleValue": "api/issues" - } - ] - } - ] - } -]} diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/issues_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/issues_controller.rb index 768a23bbcde..62d75c2c884 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/issues_controller.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/issues_controller.rb @@ -155,11 +155,12 @@ class Api::IssuesController < Api::ApiController # -- Mandatory parameters # 'issues' is the list of issue keys # 'actions' the list of action to execute (expected at least one). Available actions are : assign,set_severity,plan,do_transition,add_tags + # Action plans are dropped in 5.5, the 'plan' action has no effect. # # -- Optional parameters # 'assign.assignee' to assign all issues to a user or un-assign. # 'set_severity.severity' to change the severity of all issues. - # Action Plan are dropped in 5.5'plan.plan' to plan all issues to an action plan or unlink. + # Action Plan are dropped in 5.5. 'plan.plan' has no effect. It was to plan all issues to an action plan or unlink. # 'do_transition.transition' to execute a transition on all issues. # 'add_tags.tags' to add tags on all issues. # 'remove_tags.tags' to remove tags on all issues. diff --git a/sonar-db/src/main/java/org/sonar/db/issue/IssueDto.java b/sonar-db/src/main/java/org/sonar/db/issue/IssueDto.java index 0c996463aa6..570ab0acda4 100644 --- a/sonar-db/src/main/java/org/sonar/db/issue/IssueDto.java +++ b/sonar-db/src/main/java/org/sonar/db/issue/IssueDto.java @@ -237,11 +237,6 @@ public final class IssueDto implements Serializable { return this; } - public IssueDto setActionPlanKey(@Nullable String s) { - checkArgument(s == null || s.length() <= 50, "Value is too long for issue action plan: %s", s); - return this; - } - @CheckForNull public String getSeverity() { return severity; diff --git a/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/find_severities_by_component.xml b/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/find_severities_by_component.xml deleted file mode 100644 index 3a272a88b28..00000000000 --- a/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/find_severities_by_component.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - - - - - diff --git a/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/update-result.xml b/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/update-result.xml deleted file mode 100644 index 483763302b6..00000000000 --- a/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/update-result.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - diff --git a/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/update.xml b/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/update.xml deleted file mode 100644 index cb0d74e8b18..00000000000 --- a/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/update.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/issue/action/ActionsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/issue/action/ActionsTest.java index 20d7b94c884..522ebbac329 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/issue/action/ActionsTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/issue/action/ActionsTest.java @@ -28,7 +28,7 @@ public class ActionsTest { @Test public void add_action() { Actions actions = new Actions(); - actions.add("plan"); + actions.add("assign"); assertThat(actions.list()).hasSize(1); } -- 2.39.5