.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.<br>" +
+ "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");
.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")
{
"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:<ul><li>Parameter format: xml | json</li><li>Or the 'Accept' property in the HTTP header:<ul><li>Accept:text/xml</li><li>Accept:application/json</li></ul></li></ul>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:<ul><li>Parameter format: xml | json</li><li>Or the 'Accept' property in the HTTP header:<ul><li>Accept:text/xml</li><li>Accept:application/json</li></ul></li></ul>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:<ul><li>Parameter format: xml | json</li><li>Or the 'Accept' property in the HTTP header:<ul><li>Accept:text/xml</li><li>Accept:application/json</li></ul></li></ul>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:<ul><li>Parameter format: xml | json</li><li>Or the 'Accept' property in the HTTP header:<ul><li>Accept:text/xml</li><li>Accept:application/json</li></ul></li></ul>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:<ul><li>Parameter format: xml | json</li><li>Or the 'Accept' property in the HTTP header:<ul><li>Accept:text/xml</li><li>Accept:application/json</li></ul></li></ul>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:<ul><li>Parameter format: xml | json</li><li>Or the 'Accept' property in the HTTP header:<ul><li>Accept:text/xml</li><li>Accept:application/json</li></ul></li></ul>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:<ul><li>Parameter format: xml | json</li><li>Or the 'Accept' property in the HTTP header:<ul><li>Accept:text/xml</li><li>Accept:application/json</li></ul></li></ul>If nothing is set, json is used",
- "required": false,
- "possibleValues": [
- "json",
- "xml"
- ]
+ "description": "Controller of the web service",
+ "exampleValue": "api/issues"
}
]
}
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;
@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
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"
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"
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"
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"
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"
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"
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"
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"
+++ /dev/null
-{"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"
- }
- ]
- }
- ]
- }
-]}
# -- 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.
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;
+++ /dev/null
-<dataset>
-
- <!-- rule 500 -->
- <issues
- id="100"
- kee="ABCDE-1"
- component_uuid="CDEF"
- project_uuid="ABCD"
- rule_id="500"
- severity="BLOCKER"
- manual_severity="[false]"
- message="[null]"
- line="200"
- gap="4.2"
- status="OPEN"
- resolution="[null]"
- checksum="XXX"
- reporter="[null]"
- assignee="perceval"
- author_login="[null]"
- issue_attributes="JIRA=FOO-1234"
- issue_creation_date="1366063200000"
- issue_update_date="1366063200000"
- issue_close_date="1366063200000"
- created_at="1400000000000"
- updated_at="1400000000000"
- locations="[null]"
- />
-
- <issues
- id="101"
- kee="ABCDE-2"
- component_uuid="CDEF"
- project_uuid="ABCD"
- rule_id="500"
- severity="MAJOR"
- manual_severity="[false]"
- message="[null]"
- line="200"
- gap="4.2"
- status="OPEN"
- resolution="[null]"
- checksum="XXX"
- reporter="[null]"
- assignee="perceval"
- author_login="[null]"
- issue_attributes="JIRA=FOO-1234"
- issue_creation_date="1366149600000"
- issue_update_date="1366149600000"
- issue_close_date="1366149600000"
- created_at="1400000000000"
- updated_at="1400000000000"
- locations="[null]"
- />
-
-
- <!-- rule 501 -->
- <issues
- id="102"
- kee="ABCDE-3"
- component_uuid="CDEF"
- project_uuid="ABCD"
- rule_id="501"
- severity="BLOCKER"
- manual_severity="[false]"
- message="[null]"
- line="200"
- gap="4.2"
- status="OPEN"
- resolution="[null]"
- checksum="XXX"
- reporter="[null]"
- assignee="perceval"
- author_login="[null]"
- issue_attributes="JIRA=FOO-1234"
- issue_creation_date="1366063200000"
- issue_update_date="1366063200000"
- issue_close_date="1366063200000"
- created_at="1400000000000"
- updated_at="1400000000000"
- locations="[null]"
- />
-</dataset>
+++ /dev/null
-<dataset>
- <issues
- id="100"
- kee="ABCDE"
- component_uuid="123"
- project_uuid="101"
- rule_id="200"
- severity="BLOCKER"
- manual_severity="[false]"
- message="the message"
- line="500"
- gap="3.14"
- effort="10"
- status="RESOLVED"
- resolution="FIXED"
- checksum="123456789"
- reporter="[null]"
- author_login="morgan"
- assignee="karadoc"
- issue_attributes="JIRA=FOO-1234"
- tags="[null]"
- issue_creation_date="1368828000000"
- issue_update_date="1368914400000"
- issue_close_date="1369000800000"
- created_at="1400000000000"
- updated_at="1450000000000"
- action_plan_key="current_sprint"
- locations="[null]"
- />
-</dataset>
+++ /dev/null
-<dataset>
- <issues
- id="100"
- kee="ABCDE"
- component_uuid="123"
- project_uuid="100"
- rule_id="200"
- severity="INFO"
- manual_severity="[false]"
- message="old"
- line="[null]"
- gap="[null]"
- effort="[null]"
- status="OPEN"
- resolution="[null]"
- checksum="[null]"
- reporter="[null]"
- author_login="[null]"
- assignee="[null]"
- issue_attributes="[null]"
- issue_creation_date="[null]"
- issue_update_date="[null]"
- issue_close_date="[null]"
- created_at="1400000000000"
- updated_at="1400000000000"
- action_plan_key="[null]"
- locations="[null]"
- />
-</dataset>
@Test
public void add_action() {
Actions actions = new Actions();
- actions.add("plan");
+ actions.add("assign");
assertThat(actions.list()).hasSize(1);
}