summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2016-03-24 11:49:11 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2016-03-25 15:02:44 +0100
commit2404ce6699a1aa3a5c0cc8313f2953ad8af4d784 (patch)
tree09aa26c8c5d02cdb8203f00271d0ac1b9533f0ce /server
parent83dd467a6b49b6048b86b1eb8a9416926a1d1077 (diff)
downloadsonarqube-2404ce6699a1aa3a5c0cc8313f2953ad8af4d784.tar.gz
sonarqube-2404ce6699a1aa3a5c0cc8313f2953ad8af4d784.zip
SONAR-7468 SONAR-7199 Remove or update Action Plan related web services
Diffstat (limited to 'server')
-rw-r--r--server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/IssueIndexBenchmarkTest.java1
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/IssueQuery.java29
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/IssueQueryService.java4
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/IssueService.java1
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/PlanAction.java92
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/actionplan/ActionPlanWs.java147
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueDoc.java8
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndex.java40
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndexDefinition.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueResultSetIterator.java56
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/ws/IssueWsModule.java1
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/ws/IssuesWs.java3
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/ws/PlanAction.java65
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAction.java24
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAdditionalField.java6
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchResponseData.java11
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchResponseFormat.java30
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchResponseLoader.java11
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/ui/ws/ComponentNavigationAction.java5
-rw-r--r--server/sonar-server/src/main/resources/org/sonar/server/issue/actionplan/example-search.json27
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/issue/IssueQueryServiceTest.java1
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/issue/IssueQueryTest.java8
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/issue/IssueServiceMediumTest.java56
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/issue/IssueTesting.java1
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/issue/PlanActionTest.java153
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/issue/actionplan/ActionPlanWsTest.java101
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexDebtTest.java15
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexTest.java43
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueResultSetIteratorTest.java1
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/issue/ws/IssueWsModuleTest.java2
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/issue/ws/PlanActionTest.java61
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionMediumTest.java45
-rw-r--r--server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/display_facets.json9
-rw-r--r--server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/display_facets_effort.json9
-rw-r--r--server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/display_zero_facets.json9
-rw-r--r--server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/load_additional_fields.json18
-rw-r--r--server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/response_contains_all_fields_except_additional_fields.json1
-rw-r--r--server/sonar-server/src/test/resources/org/sonar/server/ui/ws/ComponentNavigationActionTest/with_admin_rights.json2
-rw-r--r--server/sonar-server/src/test/resources/org/sonar/server/ui/ws/ComponentNavigationActionTest/with_all_properties.json2
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/action_plans_controller.rb165
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/issues_controller.rb2
42 files changed, 75 insertions, 1194 deletions
diff --git a/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/IssueIndexBenchmarkTest.java b/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/IssueIndexBenchmarkTest.java
index 537fe822429..616a256f0ed 100644
--- a/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/IssueIndexBenchmarkTest.java
+++ b/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/IssueIndexBenchmarkTest.java
@@ -180,7 +180,6 @@ public class IssueIndexBenchmarkTest {
issue.setFilePath("src/main/java/Foo" + currentFile);
issue.setComponentUuid("FILE" + currentFile);
issue.setProjectUuid("PROJECT" + currentProject);
- issue.setActionPlanKey("PLAN" + currentProject);
issue.setAssignee(users.next());
issue.setAuthorLogin(users.next());
issue.setLine(RandomUtils.nextInt());
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/IssueQuery.java b/server/sonar-server/src/main/java/org/sonar/server/issue/IssueQuery.java
index 9c75dbf5640..ed0c82abd0c 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/issue/IssueQuery.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/issue/IssueQuery.java
@@ -66,7 +66,6 @@ public class IssueQuery {
private final Collection<String> files;
private final Collection<String> views;
private final Collection<RuleKey> rules;
- private final Collection<String> actionPlans;
private final Collection<String> reporters;
private final Collection<String> assignees;
private final Collection<String> authors;
@@ -75,7 +74,6 @@ public class IssueQuery {
private final Collection<String> types;
private final Boolean onComponentOnly;
private final Boolean assigned;
- private final Boolean planned;
private final Boolean resolved;
private final Boolean hideRules;
private final Boolean hideComments;
@@ -103,7 +101,6 @@ public class IssueQuery {
this.files = defaultCollection(builder.files);
this.views = defaultCollection(builder.views);
this.rules = defaultCollection(builder.rules);
- this.actionPlans = defaultCollection(builder.actionPlans);
this.reporters = defaultCollection(builder.reporters);
this.assignees = defaultCollection(builder.assignees);
this.authors = defaultCollection(builder.authors);
@@ -112,7 +109,6 @@ public class IssueQuery {
this.types = defaultCollection(builder.types);
this.onComponentOnly = builder.onComponentOnly;
this.assigned = builder.assigned;
- this.planned = builder.planned;
this.resolved = builder.resolved;
this.hideRules = builder.hideRules;
this.hideComments = builder.hideComments;
@@ -175,10 +171,6 @@ public class IssueQuery {
return rules;
}
- public Collection<String> actionPlans() {
- return actionPlans;
- }
-
public Collection<String> reporters() {
return reporters;
}
@@ -214,11 +206,6 @@ public class IssueQuery {
}
@CheckForNull
- public Boolean planned() {
- return planned;
- }
-
- @CheckForNull
public Boolean resolved() {
return resolved;
}
@@ -303,7 +290,6 @@ public class IssueQuery {
private Collection<String> files;
private Collection<String> views;
private Collection<RuleKey> rules;
- private Collection<String> actionPlans;
private Collection<String> reporters;
private Collection<String> assignees;
private Collection<String> authors;
@@ -312,7 +298,6 @@ public class IssueQuery {
private Collection<String> types;
private Boolean onComponentOnly = false;
private Boolean assigned = null;
- private Boolean planned = null;
private Boolean resolved = null;
private Boolean hideRules = false;
private Boolean hideComments = false;
@@ -391,11 +376,6 @@ public class IssueQuery {
return this;
}
- public Builder actionPlans(@Nullable Collection<String> l) {
- this.actionPlans = l;
- return this;
- }
-
public Builder reporters(@Nullable Collection<String> l) {
this.reporters = l;
return this;
@@ -445,15 +425,6 @@ public class IssueQuery {
}
/**
- * If true, it will return all issues linked to an action plan
- * If false, it will return all issues not linked to an action plan
- */
- public Builder planned(@Nullable Boolean planned) {
- this.planned = planned;
- return this;
- }
-
- /**
* If true, it will return all resolved issues
* If false, it will return all none resolved issues
*/
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/IssueQueryService.java b/server/sonar-server/src/main/java/org/sonar/server/issue/IssueQueryService.java
index 0ddc0f472f8..737606925ee 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/issue/IssueQueryService.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/issue/IssueQueryService.java
@@ -102,14 +102,12 @@ public class IssueQueryService {
.resolutions(RubyUtils.toStrings(params.get(IssueFilterParameters.RESOLUTIONS)))
.resolved(RubyUtils.toBoolean(params.get(IssueFilterParameters.RESOLVED)))
.rules(toRules(params.get(IssueFilterParameters.RULES)))
- .actionPlans(RubyUtils.toStrings(params.get(IssueFilterParameters.ACTION_PLANS)))
.reporters(RubyUtils.toStrings(params.get(IssueFilterParameters.REPORTERS)))
.assignees(buildAssignees(RubyUtils.toStrings(params.get(IssueFilterParameters.ASSIGNEES))))
.languages(RubyUtils.toStrings(params.get(IssueFilterParameters.LANGUAGES)))
.tags(RubyUtils.toStrings(params.get(IssueFilterParameters.TAGS)))
.types(RubyUtils.toStrings(params.get(IssueFilterParameters.TYPES)))
.assigned(RubyUtils.toBoolean(params.get(IssueFilterParameters.ASSIGNED)))
- .planned(RubyUtils.toBoolean(params.get(IssueFilterParameters.PLANNED)))
.hideRules(RubyUtils.toBoolean(params.get(IssueFilterParameters.HIDE_RULES)))
.createdAt(RubyUtils.toDate(params.get(IssueFilterParameters.CREATED_AT)))
.createdAfter(buildCreatedAfterFromDates(RubyUtils.toDate(params.get(CREATED_AFTER)), (String) params.get(CREATED_IN_LAST)))
@@ -176,14 +174,12 @@ public class IssueQueryService {
.resolutions(request.getResolutions())
.resolved(request.getResolved())
.rules(stringsToRules(request.getRules()))
- .actionPlans(request.getActionPlans())
.reporters(request.getReporters())
.assignees(buildAssignees(request.getAssignees()))
.languages(request.getLanguages())
.tags(request.getTags())
.types(request.getTypes())
.assigned(request.getAssigned())
- .planned(request.getPlanned())
.createdAt(parseAsDateTime(request.getCreatedAt()))
.createdBefore(parseAsDateTime(request.getCreatedBefore()))
.facetMode(request.getFacetMode());
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/IssueService.java b/server/sonar-server/src/main/java/org/sonar/server/issue/IssueService.java
index 39c9a1969e9..2abe464e468 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/issue/IssueService.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/issue/IssueService.java
@@ -187,6 +187,7 @@ public class IssueService {
}
}
+ //TODO to delete
public void plan(String issueKey, @Nullable String actionPlanKey) {
userSession.checkLoggedIn();
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/PlanAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/PlanAction.java
deleted file mode 100644
index 7d82e9be151..00000000000
--- a/server/sonar-server/src/main/java/org/sonar/server/issue/PlanAction.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.issue;
-
-import com.google.common.base.Strings;
-import java.util.Collection;
-import java.util.Map;
-import org.sonar.api.issue.ActionPlan;
-import org.sonar.api.issue.Issue;
-import org.sonar.api.issue.condition.IsUnResolved;
-import org.sonar.api.server.ServerSide;
-import org.sonar.core.issue.DefaultIssue;
-import org.sonar.server.issue.actionplan.ActionPlanService;
-import org.sonar.server.user.UserSession;
-
-@ServerSide
-public class PlanAction extends Action {
-
- public static final String PLAN_KEY = "plan";
- public static final String VERIFIED_ACTION_PLAN = "verifiedActionPlan";
-
- private final ActionPlanService actionPlanService;
- private final IssueUpdater issueUpdater;
-
- public PlanAction(ActionPlanService actionPlanService, IssueUpdater issueUpdater) {
- super(PLAN_KEY);
- this.actionPlanService = actionPlanService;
- this.issueUpdater = issueUpdater;
- super.setConditions(new IsUnResolved());
- }
-
- @Override
- public boolean verify(Map<String, Object> properties, Collection<Issue> issues, UserSession userSession) {
- String actionPlanValue = planValue(properties);
- if (!Strings.isNullOrEmpty(actionPlanValue)) {
- ActionPlan actionPlan = selectActionPlan(actionPlanValue, userSession);
- if (actionPlan == null) {
- throw new IllegalArgumentException("Unknown action plan: " + actionPlanValue);
- }
- verifyIssuesAreAllRelatedOnActionPlanProject(issues, actionPlan);
- properties.put(VERIFIED_ACTION_PLAN, actionPlan);
- } else {
- properties.put(VERIFIED_ACTION_PLAN, null);
- }
- return true;
- }
-
- @Override
- public boolean execute(Map<String, Object> properties, Context context) {
- if (!properties.containsKey(VERIFIED_ACTION_PLAN)) {
- throw new IllegalArgumentException("Action plan is missing from the execution parameters");
- }
- ActionPlan actionPlan = (ActionPlan) properties.get(VERIFIED_ACTION_PLAN);
- return issueUpdater.plan((DefaultIssue) context.issue(), actionPlan, context.issueChangeContext());
- }
-
- private String planValue(Map<String, Object> properties) {
- return (String) properties.get("plan");
- }
-
- private void verifyIssuesAreAllRelatedOnActionPlanProject(Collection<Issue> issues, ActionPlan actionPlan) {
- String projectKey = actionPlan.projectKey();
- for (Issue issue : issues) {
- DefaultIssue defaultIssue = (DefaultIssue) issue;
- String issueProjectKey = defaultIssue.projectKey();
- if (issueProjectKey == null || !issueProjectKey.equals(projectKey)) {
- throw new IllegalArgumentException("Issues are not all related to the action plan project: " + projectKey);
- }
- }
- }
-
- private ActionPlan selectActionPlan(String planValue, UserSession userSession) {
- return actionPlanService.findByKey(planValue, userSession);
- }
-}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/actionplan/ActionPlanWs.java b/server/sonar-server/src/main/java/org/sonar/server/issue/actionplan/ActionPlanWs.java
deleted file mode 100644
index 89536c5e3ad..00000000000
--- a/server/sonar-server/src/main/java/org/sonar/server/issue/actionplan/ActionPlanWs.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.issue.actionplan;
-
-import com.google.common.io.Resources;
-import org.sonar.api.server.ws.RailsHandler;
-import org.sonar.api.server.ws.WebService;
-
-import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
-
-public class ActionPlanWs implements WebService {
-
- @Override
- public void define(Context context) {
- NewController controller = context.createController("api/action_plans");
- controller.setDescription("Action plans management");
-
- defineSearchAction(controller);
- defineCreateAction(controller);
- defineUpdateAction(controller);
- defineDeleteAction(controller);
- defineOpenAction(controller);
- defineCloseAction(controller);
-
- controller.done();
- }
-
- private static void defineSearchAction(NewController controller) {
- WebService.NewAction action = controller.createAction("search")
- .setDescription("Get a list of action plans. Requires Browse permission on project")
- .setSince("3.6")
- .setHandler(RailsHandler.INSTANCE)
- .setResponseExample(Resources.getResource(ActionPlanWs.class, "example-search.json"));
- addProjectParam(action);
- addFormatParam(action);
- }
-
- private static void defineCreateAction(NewController controller) {
- WebService.NewAction action = controller.createAction("create")
- .setDescription("Create an action plan. Requires Administer permission on project")
- .setSince("3.6")
- .setPost(true)
- .setHandler(RailsHandler.INSTANCE);
- addNameParam(action);
- addDescriptionParam(action);
- addDeadLineParam(action);
- addProjectParam(action);
- addFormatParam(action);
- }
-
- private static void defineUpdateAction(NewController controller) {
- WebService.NewAction action = controller.createAction("update")
- .setDescription("Update an action plan. Requires Administer permission on project")
- .setSince("3.6")
- .setPost(true)
- .setHandler(RailsHandler.INSTANCE);
- addKeyParam(action);
- addNameParam(action);
- addDescriptionParam(action);
- addDeadLineParam(action);
- addFormatParam(action);
- }
-
- private static void defineDeleteAction(NewController controller) {
- WebService.NewAction action = controller.createAction("delete")
- .setDescription("Delete an action plan. Requires Administer permission on project")
- .setSince("3.6")
- .setPost(true)
- .setHandler(RailsHandler.INSTANCE);
- addKeyParam(action);
- addFormatParam(action);
- }
-
- private static void defineOpenAction(NewController controller) {
- WebService.NewAction action = controller.createAction("open")
- .setDescription("Open an action plan. Requires Administer permission on project")
- .setSince("3.6")
- .setPost(true)
- .setHandler(RailsHandler.INSTANCE);
- addKeyParam(action);
- addFormatParam(action);
- }
-
- private static void defineCloseAction(NewController controller) {
- WebService.NewAction action = controller.createAction("close")
- .setDescription("Close an action plan. Requires Administer permission on project")
- .setSince("3.6")
- .setPost(true)
- .setHandler(RailsHandler.INSTANCE);
- addKeyParam(action);
- addFormatParam(action);
- }
-
- private static NewParam addKeyParam(WebService.NewAction action) {
- return action.createParam("key")
- .setDescription("Key of the action plan")
- .setExampleValue("3f19de90-1521-4482-a737-a311758ff513")
- .setRequired(true);
- }
-
- private static NewParam addNameParam(WebService.NewAction action) {
- return action.createParam("name")
- .setDescription("Name of the action plan")
- .setExampleValue("Version 3.6")
- .setRequired(true);
- }
-
- private static NewParam addDescriptionParam(WebService.NewAction action) {
- return action.createParam("description")
- .setDescription("Description of the action plan")
- .setExampleValue("Version 3.6");
- }
-
- private static NewParam addDeadLineParam(WebService.NewAction action) {
- return action.createParam("deadLine")
- .setDescription("Due date of the action plan. Format: YYYY-MM-DD")
- .setExampleValue("2013-12-31");
- }
-
- private static NewParam addProjectParam(WebService.NewAction action) {
- return action.createParam("project")
- .setDescription("Project key")
- .setExampleValue(KEY_PROJECT_EXAMPLE_001)
- .setRequired(true);
- }
-
- private static NewParam addFormatParam(WebService.NewAction action) {
- return RailsHandler.addFormatParam(action);
- }
-}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueDoc.java b/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueDoc.java
index 9b37841d993..03a29a0fbe6 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueDoc.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueDoc.java
@@ -203,7 +203,8 @@ public class IssueDoc extends BaseDoc implements Issue {
@Override
@CheckForNull
public String actionPlanKey() {
- return getNullableField(IssueIndexDefinition.FIELD_ISSUE_ACTION_PLAN);
+ // since 5.5, action plan is dropped. Kept for API compatibility
+ return null;
}
@CheckForNull
@@ -367,11 +368,6 @@ public class IssueDoc extends BaseDoc implements Issue {
return this;
}
- public IssueDoc setActionPlanKey(@Nullable String s) {
- setField(IssueIndexDefinition.FIELD_ISSUE_ACTION_PLAN, s);
- return this;
- }
-
public IssueDoc setEffort(@Nullable Long l) {
setField(IssueIndexDefinition.FIELD_ISSUE_EFFORT, l);
return this;
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndex.java b/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndex.java
index ae7d8934a49..d73764f45c9 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndex.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndex.java
@@ -82,10 +82,10 @@ import org.sonar.server.user.UserSession;
import org.sonar.server.view.index.ViewIndexDefinition;
import static com.google.common.collect.Lists.newArrayList;
-import static org.sonarqube.ws.client.issue.IssueFilterParameters.ACTION_PLANS;
import static org.sonarqube.ws.client.issue.IssueFilterParameters.ASSIGNEES;
import static org.sonarqube.ws.client.issue.IssueFilterParameters.AUTHORS;
import static org.sonarqube.ws.client.issue.IssueFilterParameters.CREATED_AT;
+import static org.sonarqube.ws.client.issue.IssueFilterParameters.DEPRECATED_ACTION_PLANS;
import static org.sonarqube.ws.client.issue.IssueFilterParameters.DEPRECATED_FACET_MODE_DEBT;
import static org.sonarqube.ws.client.issue.IssueFilterParameters.DIRECTORIES;
import static org.sonarqube.ws.client.issue.IssueFilterParameters.FACET_ASSIGNED_TO_ME;
@@ -114,7 +114,7 @@ public class IssueIndex extends BaseIndex {
SEVERITIES,
STATUSES,
RESOLUTIONS,
- ACTION_PLANS,
+ DEPRECATED_ACTION_PLANS,
PROJECT_UUIDS,
RULES,
ASSIGNEES,
@@ -257,14 +257,6 @@ public class IssueIndex extends BaseIndex {
filters.put(IS_ASSIGNED_FILTER, FilterBuilders.missingFilter(IssueIndexDefinition.FIELD_ISSUE_ASSIGNEE));
}
- // Issue is planned Filter
- String isPlanned = "__isPlanned";
- if (BooleanUtils.isTrue(query.planned())) {
- filters.put(isPlanned, FilterBuilders.existsFilter(IssueIndexDefinition.FIELD_ISSUE_ACTION_PLAN));
- } else if (BooleanUtils.isFalse(query.planned())) {
- filters.put(isPlanned, FilterBuilders.missingFilter(IssueIndexDefinition.FIELD_ISSUE_ACTION_PLAN));
- }
-
// Issue is Resolved Filter
String isResolved = "__isResolved";
if (BooleanUtils.isTrue(query.resolved())) {
@@ -275,7 +267,6 @@ public class IssueIndex extends BaseIndex {
// Field Filters
filters.put(IssueIndexDefinition.FIELD_ISSUE_KEY, createTermsFilter(IssueIndexDefinition.FIELD_ISSUE_KEY, query.issueKeys()));
- filters.put(IssueIndexDefinition.FIELD_ISSUE_ACTION_PLAN, createTermsFilter(IssueIndexDefinition.FIELD_ISSUE_ACTION_PLAN, query.actionPlans()));
filters.put(IssueIndexDefinition.FIELD_ISSUE_ASSIGNEE, createTermsFilter(IssueIndexDefinition.FIELD_ISSUE_ASSIGNEE, query.assignees()));
addComponentRelatedFilters(query, filters);
@@ -432,9 +423,6 @@ public class IssueIndex extends BaseIndex {
esSearch.addAggregation(createAssigneesFacet(query, filters, esQuery));
}
addAssignedToMeFacetIfNeeded(esSearch, options, query, filters, esQuery);
- if (options.getFacets().contains(ACTION_PLANS)) {
- esSearch.addAggregation(createActionPlansFacet(query, filters, esQuery));
- }
if (options.getFacets().contains(CREATED_AT)) {
esSearch.addAggregation(getCreatedAtFacet(query, filters, esQuery));
}
@@ -615,30 +603,6 @@ public class IssueIndex extends BaseIndex {
.subAggregation(facetTopAggregation);
}
- private static AggregationBuilder createActionPlansFacet(IssueQuery query, Map<String, FilterBuilder> filters, QueryBuilder esQuery) {
- String fieldName = IssueIndexDefinition.FIELD_ISSUE_ACTION_PLAN;
- String facetName = ACTION_PLANS;
-
- // Same as in super.stickyFacetBuilder
- Map<String, FilterBuilder> actionPlanFilters = Maps.newHashMap(filters);
- actionPlanFilters.remove("__isPlanned");
- actionPlanFilters.remove(fieldName);
- StickyFacetBuilder actionPlanFacetBuilder = newStickyFacetBuilder(query, actionPlanFilters, esQuery);
- BoolFilterBuilder facetFilter = actionPlanFacetBuilder.getStickyFacetFilter(fieldName);
- FilterAggregationBuilder facetTopAggregation = actionPlanFacetBuilder.buildTopFacetAggregation(fieldName, facetName, facetFilter, DEFAULT_FACET_SIZE);
- facetTopAggregation = actionPlanFacetBuilder.addSelectedItemsToFacet(fieldName, facetName, facetTopAggregation, query.actionPlans().toArray());
-
- // Add missing facet for unresolved issues
- facetTopAggregation.subAggregation(
- addEffortAggregationIfNeeded(query, AggregationBuilders
- .missing(facetName + FACET_SUFFIX_MISSING)
- .field(fieldName)));
-
- return AggregationBuilders
- .global(facetName)
- .subAggregation(facetTopAggregation);
- }
-
@CheckForNull
private FilterBuilder createTermsFilter(String field, Collection<?> values) {
if (!values.isEmpty()) {
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndexDefinition.java b/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndexDefinition.java
index 74116231c46..6945a72e2f6 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndexDefinition.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndexDefinition.java
@@ -39,7 +39,6 @@ public class IssueIndexDefinition implements IndexDefinition {
public static final String FIELD_AUTHORIZATION_USERS = "users";
public static final String FIELD_AUTHORIZATION_UPDATED_AT = "updatedAt";
- public static final String FIELD_ISSUE_ACTION_PLAN = "actionPlan";
public static final String FIELD_ISSUE_ASSIGNEE = "assignee";
public static final String FIELD_ISSUE_ATTRIBUTES = "attributes";
public static final String FIELD_ISSUE_AUTHOR_LOGIN = "authorLogin";
@@ -108,7 +107,6 @@ public class IssueIndexDefinition implements IndexDefinition {
issueMapping.setAttribute("_id", ImmutableMap.of("path", FIELD_ISSUE_KEY));
issueMapping.setAttribute("_parent", ImmutableMap.of("type", TYPE_AUTHORIZATION));
issueMapping.setAttribute("_routing", ImmutableMap.of("required", true, "path", FIELD_ISSUE_PROJECT_UUID));
- issueMapping.stringFieldBuilder(FIELD_ISSUE_ACTION_PLAN).docValues().build();
issueMapping.stringFieldBuilder(FIELD_ISSUE_ASSIGNEE).enableSorting().build();
issueMapping.stringFieldBuilder(FIELD_ISSUE_ATTRIBUTES).docValues().disableSearch().build();
issueMapping.stringFieldBuilder(FIELD_ISSUE_AUTHOR_LOGIN).docValues().build();
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueResultSetIterator.java b/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueResultSetIterator.java
index fa8e3c4009a..31f3eda2f22 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueResultSetIterator.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueResultSetIterator.java
@@ -53,16 +53,15 @@ class IssueResultSetIterator extends ResultSetIterator<IssueDoc> {
"i.kee",
"root.uuid",
"i.updated_at",
- "i.action_plan_key",
"i.assignee",
"i.gap",
"i.issue_attributes",
"i.line",
"i.message",
"i.resolution",
+ "i.severity",
// column 11
- "i.severity",
"i.manual_severity",
"i.checksum",
"i.status",
@@ -72,9 +71,9 @@ class IssueResultSetIterator extends ResultSetIterator<IssueDoc> {
"i.issue_close_date",
"i.issue_creation_date",
"i.issue_update_date",
+ "r.plugin_name",
// column 21
- "r.plugin_name",
"r.plugin_rule_key",
"r.language",
"p.uuid",
@@ -162,38 +161,37 @@ class IssueResultSetIterator extends ResultSetIterator<IssueDoc> {
doc.setKey(key);
doc.setProjectUuid(projectUuid);
doc.setTechnicalUpdateDate(new Date(rs.getLong(3)));
- doc.setActionPlanKey(rs.getString(4));
- doc.setAssignee(rs.getString(5));
- doc.setGap(DatabaseUtils.getDouble(rs, 6));
- doc.setAttributes(rs.getString(7));
- doc.setLine(DatabaseUtils.getInt(rs, 8));
- doc.setMessage(rs.getString(9));
- doc.setResolution(rs.getString(10));
- doc.setSeverity(rs.getString(11));
- doc.setManualSeverity(rs.getBoolean(12));
- doc.setChecksum(rs.getString(13));
- doc.setStatus(rs.getString(14));
- doc.setEffort(getLong(rs, 15));
- doc.setReporter(rs.getString(16));
- doc.setAuthorLogin(rs.getString(17));
- doc.setFuncCloseDate(longToDate(getLong(rs, 18)));
- doc.setFuncCreationDate(longToDate(getLong(rs, 19)));
- doc.setFuncUpdateDate(longToDate(getLong(rs, 20)));
- String ruleRepo = rs.getString(21);
- String ruleKey = rs.getString(22);
+ doc.setAssignee(rs.getString(4));
+ doc.setGap(DatabaseUtils.getDouble(rs, 5));
+ doc.setAttributes(rs.getString(6));
+ doc.setLine(DatabaseUtils.getInt(rs, 7));
+ doc.setMessage(rs.getString(8));
+ doc.setResolution(rs.getString(9));
+ doc.setSeverity(rs.getString(10));
+ doc.setManualSeverity(rs.getBoolean(11));
+ doc.setChecksum(rs.getString(12));
+ doc.setStatus(rs.getString(13));
+ doc.setEffort(getLong(rs, 14));
+ doc.setReporter(rs.getString(15));
+ doc.setAuthorLogin(rs.getString(16));
+ doc.setFuncCloseDate(longToDate(getLong(rs, 17)));
+ doc.setFuncCreationDate(longToDate(getLong(rs, 18)));
+ doc.setFuncUpdateDate(longToDate(getLong(rs, 19)));
+ String ruleRepo = rs.getString(20);
+ String ruleKey = rs.getString(21);
doc.setRuleKey(RuleKey.of(ruleRepo, ruleKey).toString());
- doc.setLanguage(rs.getString(23));
- doc.setComponentUuid(rs.getString(24));
- String moduleUuidPath = rs.getString(25);
+ doc.setLanguage(rs.getString(22));
+ doc.setComponentUuid(rs.getString(23));
+ String moduleUuidPath = rs.getString(24);
doc.setModuleUuid(extractModule(moduleUuidPath));
doc.setModuleUuidPath(moduleUuidPath);
- String scope = rs.getString(27);
- String filePath = extractFilePath(rs.getString(26), scope);
+ String scope = rs.getString(26);
+ String filePath = extractFilePath(rs.getString(25), scope);
doc.setFilePath(filePath);
doc.setDirectoryPath(extractDirPath(doc.filePath(), scope));
- String tags = rs.getString(28);
+ String tags = rs.getString(27);
doc.setTags(ImmutableList.copyOf(TAGS_SPLITTER.split(tags == null ? "" : tags)));
- doc.setType(RuleType.valueOf(rs.getInt(29)));
+ doc.setType(RuleType.valueOf(rs.getInt(28)));
return doc;
}
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/IssueWsModule.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/IssueWsModule.java
index c0892e075a1..a2e7c0fcf27 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/IssueWsModule.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/IssueWsModule.java
@@ -32,7 +32,6 @@ public class IssueWsModule extends Module {
AssignAction.class,
CreateAction.class,
DoTransitionAction.class,
- PlanAction.class,
SearchAction.class,
SetSeverityAction.class,
TagsAction.class,
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 47d0bcc832d..6014a49da8e 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
@@ -171,7 +171,8 @@ public class IssuesWs implements WebService {
.setPossibleValues(RuleType.ALL_NAMES)
.setSince("5.5");
action.createParam("plan.plan")
- .setDescription("To plan the list of issues to a specific action plan (key), or unlink all the issues from an action 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")
+ .setDeprecatedSince("5.5")
.setExampleValue("3f19de90-1521-4482-a737-a311758ff513");
action.createParam("do_transition.transition")
.setDescription("Transition")
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/PlanAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/PlanAction.java
deleted file mode 100644
index 6e6f8659de9..00000000000
--- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/PlanAction.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.issue.ws;
-
-import org.sonar.api.server.ws.Request;
-import org.sonar.api.server.ws.Response;
-import org.sonar.api.server.ws.WebService;
-import org.sonar.server.issue.IssueService;
-
-import static com.google.common.base.Strings.emptyToNull;
-
-public class PlanAction implements IssuesWsAction {
-
- public static final String ACTION = "plan";
-
- private final IssueService issueService;
- private final OperationResponseWriter responseWriter;
-
- public PlanAction(IssueService issueService, OperationResponseWriter responseWriter) {
- this.issueService = issueService;
- this.responseWriter = responseWriter;
- }
-
- @Override
- public void define(WebService.NewController controller) {
- WebService.NewAction action = controller.createAction(ACTION)
- .setDescription("Plan/Unplan an issue. Requires authentication and Browse permission on project")
- .setSince("3.6")
- .setHandler(this)
- .setPost(true);
-
- action.createParam("issue")
- .setDescription("Key of the issue")
- .setRequired(true)
- .setExampleValue("5bccd6e8-f525-43a2-8d76-fcb13dde79ef");
- action.createParam("plan")
- .setDescription("Key of the action plan. Absent value removes the current plan.")
- .setExampleValue("3f19de90-1521-4482-a737-a311758ff513");
- }
-
- @Override
- public void handle(Request request, Response response) throws Exception {
- String key = request.mandatoryParam("issue");
- issueService.plan(key, emptyToNull(request.param("plan")));
-
- responseWriter.write(key, request, response);
- }
-}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAction.java
index 7430632729a..9c8c2827857 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAction.java
@@ -57,7 +57,6 @@ import static org.sonar.api.utils.Paging.forPageIndex;
import static org.sonar.server.es.SearchOptions.MAX_LIMIT;
import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
-import static org.sonarqube.ws.client.issue.IssueFilterParameters.ACTION_PLANS;
import static org.sonarqube.ws.client.issue.IssueFilterParameters.ADDITIONAL_FIELDS;
import static org.sonarqube.ws.client.issue.IssueFilterParameters.ASC;
import static org.sonarqube.ws.client.issue.IssueFilterParameters.ASSIGNED;
@@ -72,6 +71,7 @@ import static org.sonarqube.ws.client.issue.IssueFilterParameters.CREATED_AFTER;
import static org.sonarqube.ws.client.issue.IssueFilterParameters.CREATED_AT;
import static org.sonarqube.ws.client.issue.IssueFilterParameters.CREATED_BEFORE;
import static org.sonarqube.ws.client.issue.IssueFilterParameters.CREATED_IN_LAST;
+import static org.sonarqube.ws.client.issue.IssueFilterParameters.DEPRECATED_ACTION_PLANS;
import static org.sonarqube.ws.client.issue.IssueFilterParameters.DEPRECATED_FACET_MODE_DEBT;
import static org.sonarqube.ws.client.issue.IssueFilterParameters.DIRECTORIES;
import static org.sonarqube.ws.client.issue.IssueFilterParameters.FACET_ASSIGNED_TO_ME;
@@ -124,13 +124,15 @@ public class SearchAction implements IssuesWsAction {
.setHandler(this)
.setDescription(
"Search for issues. Requires Browse permission on project(s).<br/>" +
- "Since 5.5, response field 'debt' has been renamed to 'effort'")
+ "Since 5.5, response field 'debt' has been renamed to 'effort'.<br/>" +
+ "Since 5.5, response field 'actionPlan' has been removed")
.setSince("3.6")
.setResponseExample(Resources.getResource(this.getClass(), "example-search.json"));
action.addPagingParams(100, MAX_LIMIT);
action.createParam(Param.FACETS)
- .setDescription("Comma-separated list of the facets to be computed. No facet is computed by default.")
+ .setDescription("Comma-separated list of the facets to be computed. No facet is computed by default.<br/>" +
+ "Since 5.5, facet 'actionPlans' is deprecated.")
.setPossibleValues(IssueIndex.SUPPORTED_FACETS);
action.createParam(FACET_MODE)
.setDefaultValue(FACET_MODE_COUNT)
@@ -140,7 +142,7 @@ public class SearchAction implements IssuesWsAction {
action.addSortParams(IssueQuery.SORTS, null, true);
action.createParam(ADDITIONAL_FIELDS)
.setSince("5.2")
- .setDescription("Comma-separated list of the optional fields to be returned in response.")
+ .setDescription("Comma-separated list of the optional fields to be returned in response. Action plans are dropped in 5.5, it is not returned in the response.")
.setPossibleValues(SearchAdditionalField.possibleValues());
addComponentRelatedParams(action);
action.createParam(ISSUES)
@@ -172,11 +174,13 @@ public class SearchAction implements IssuesWsAction {
.setSince("5.5")
.setPossibleValues(RuleType.values())
.setExampleValue(format("%s,%s", RuleType.CODE_SMELL, RuleType.BUG));
- action.createParam(ACTION_PLANS)
- .setDescription("Comma-separated list of action plan keys (not names)")
+ action.createParam(DEPRECATED_ACTION_PLANS)
+ .setDescription("Action plans are dropped in 5.5. This parameter has no effect. Comma-separated list of action plan keys (not names)")
+ .setDeprecatedSince("5.5")
.setExampleValue("3f19de90-1521-4482-a737-a311758ff513");
action.createParam(PLANNED)
- .setDescription("To retrieve issues associated to an action plan or not")
+ .setDescription("Since 5.5 this parameter is no more used, as action plan feature has been dropped")
+ .setDeprecatedSince("5.5")
.setBooleanPossibleValues();
action.createParam(REPORTERS)
.setDescription("Comma-separated list of reporter logins")
@@ -362,7 +366,7 @@ public class SearchAction implements IssuesWsAction {
if (actionPlansFromRequest != null) {
actionPlans.addAll(actionPlansFromRequest);
}
- addMandatoryValuesToFacet(facets, ACTION_PLANS, actionPlans);
+ addMandatoryValuesToFacet(facets, DEPRECATED_ACTION_PLANS, actionPlans);
addMandatoryValuesToFacet(facets, COMPONENT_UUIDS, request.getComponentUuids());
for (String facetName : request.getFacets()) {
@@ -411,7 +415,6 @@ public class SearchAction implements IssuesWsAction {
collector.addComponentUuids(facets.getBucketKeys(MODULE_UUIDS));
collector.addAll(SearchAdditionalField.USERS, facets.getBucketKeys(ASSIGNEES));
collector.addAll(SearchAdditionalField.USERS, facets.getBucketKeys(REPORTERS));
- collector.addAll(SearchAdditionalField.ACTION_PLANS, facets.getBucketKeys(ACTION_PLANS));
}
private void collectRequestParams(SearchResponseLoader.Collector collector, SearchWsRequest request) {
@@ -421,12 +424,10 @@ public class SearchAction implements IssuesWsAction {
collector.addComponentUuids(request.getComponentRootUuids());
collector.addAll(SearchAdditionalField.USERS, request.getAssignees());
collector.addAll(SearchAdditionalField.USERS, request.getReporters());
- collector.addAll(SearchAdditionalField.ACTION_PLANS, request.getActionPlans());
}
private static SearchWsRequest toSearchWsRequest(Request request) {
return new SearchWsRequest()
- .setActionPlans(request.paramAsStrings(ACTION_PLANS))
.setAdditionalFields(request.paramAsStrings(ADDITIONAL_FIELDS))
.setAsc(request.paramAsBoolean(ASC))
.setAssigned(request.paramAsBoolean(ASSIGNED))
@@ -451,7 +452,6 @@ public class SearchAction implements IssuesWsAction {
.setOnComponentOnly(request.paramAsBoolean(ON_COMPONENT_ONLY))
.setPage(request.mandatoryParamAsInt(Param.PAGE))
.setPageSize(request.mandatoryParamAsInt(Param.PAGE_SIZE))
- .setPlanned(request.paramAsBoolean(PLANNED))
.setProjectKeys(request.paramAsStrings(PROJECT_KEYS))
.setProjectUuids(request.paramAsStrings(PROJECT_UUIDS))
.setProjects(request.paramAsStrings(PROJECTS))
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAdditionalField.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAdditionalField.java
index 9940c9c25ea..b87a9e10c65 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAdditionalField.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAdditionalField.java
@@ -31,7 +31,11 @@ import org.sonarqube.ws.client.issue.SearchWsRequest;
public enum SearchAdditionalField {
ACTIONS("actions"),
- ACTION_PLANS("actionPlans"),
+ /**
+ * @deprecated since 5.5, action plan feature has been removed
+ */
+ @Deprecated
+ DEPRECATED_ACTION_PLANS("actionPlans"),
COMMENTS("comments"),
LANGUAGES("languages"),
RULES("rules"),
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchResponseData.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchResponseData.java
index 877068ded6a..eaec552b104 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchResponseData.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchResponseData.java
@@ -30,7 +30,6 @@ import java.util.Set;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import org.sonar.db.component.ComponentDto;
-import org.sonar.db.issue.ActionPlanDto;
import org.sonar.db.issue.IssueChangeDto;
import org.sonar.db.issue.IssueDto;
import org.sonar.db.rule.RuleDto;
@@ -49,7 +48,6 @@ public class SearchResponseData {
private Long effortTotal = null;
private List<UserDto> users = null;
private List<RuleDto> rules = null;
- private List<ActionPlanDto> actionPlans = null;
private final Map<String, ComponentDto> componentsByUuid = new HashMap<>();
private final ListMultimap<String, IssueChangeDto> commentsByIssueKey = ArrayListMultimap.create();
private final ListMultimap<String, String> actionsByIssueKey = ArrayListMultimap.create();
@@ -86,11 +84,6 @@ public class SearchResponseData {
}
@CheckForNull
- public List<ActionPlanDto> getActionPlans() {
- return actionPlans;
- }
-
- @CheckForNull
public List<IssueChangeDto> getCommentsForIssueKey(String issueKey) {
if (commentsByIssueKey.containsKey(issueKey)) {
return commentsByIssueKey.get(issueKey);
@@ -122,10 +115,6 @@ public class SearchResponseData {
this.rules = rules;
}
- public void setActionPlans(@Nullable List<ActionPlanDto> actionPlans) {
- this.actionPlans = actionPlans;
- }
-
public void setComments(@Nullable List<IssueChangeDto> comments) {
for (IssueChangeDto comment : comments) {
commentsByIssueKey.put(comment.getIssueKey(), comment);
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchResponseFormat.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchResponseFormat.java
index b8417c74cac..d9c58d6c444 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchResponseFormat.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchResponseFormat.java
@@ -36,7 +36,6 @@ import org.sonar.api.utils.Duration;
import org.sonar.api.utils.Durations;
import org.sonar.api.utils.Paging;
import org.sonar.db.component.ComponentDto;
-import org.sonar.db.issue.ActionPlanDto;
import org.sonar.db.issue.IssueChangeDto;
import org.sonar.db.issue.IssueDto;
import org.sonar.db.protobuf.DbCommons;
@@ -81,9 +80,6 @@ public class SearchResponseFormat {
if (fields.contains(SearchAdditionalField.USERS)) {
response.setUsers(formatUsers(data));
}
- if (fields.contains(SearchAdditionalField.ACTION_PLANS)) {
- response.setActionPlans(formatActionPlans(data));
- }
if (fields.contains(SearchAdditionalField.LANGUAGES)) {
response.setLanguages(formatLanguages());
}
@@ -105,7 +101,6 @@ public class SearchResponseFormat {
response.addAllComponents(formatComponents(data));
response.addAllRules(formatRules(data).getRulesList());
response.addAllUsers(formatUsers(data).getUsersList());
- response.addAllActionPlans(formatActionPlans(data).getActionPlansList());
return response.build();
}
@@ -174,9 +169,6 @@ public class SearchResponseFormat {
issueBuilder.setResolution(dto.getResolution());
}
issueBuilder.setStatus(dto.getStatus());
- if (!Strings.isNullOrEmpty(dto.getActionPlanKey())) {
- issueBuilder.setActionPlan(dto.getActionPlanKey());
- }
issueBuilder.setMessage(nullToEmpty(dto.getMessage()));
issueBuilder.addAllTags(dto.getTags());
Long effort = dto.getEffort();
@@ -355,28 +347,6 @@ public class SearchResponseFormat {
return wsUsers;
}
- private Issues.ActionPlans.Builder formatActionPlans(SearchResponseData data) {
- Issues.ActionPlans.Builder wsActionPlans = Issues.ActionPlans.newBuilder();
- List<ActionPlanDto> actionPlans = data.getActionPlans();
- if (actionPlans != null) {
- Issues.ActionPlan.Builder planBuilder = Issues.ActionPlan.newBuilder();
- for (ActionPlanDto actionPlan : actionPlans) {
- planBuilder
- .clear()
- .setKey(actionPlan.getKey())
- .setName(nullToEmpty(actionPlan.getName()))
- .setStatus(nullToEmpty(actionPlan.getStatus()))
- .setProject(nullToEmpty(actionPlan.getProjectKey()));
- Date deadLine = actionPlan.getDeadLine();
- if (deadLine != null) {
- planBuilder.setDeadLine(DateUtils.formatDateTime(deadLine));
- }
- wsActionPlans.addActionPlans(planBuilder);
- }
- }
- return wsActionPlans;
- }
-
private Issues.Languages.Builder formatLanguages() {
Issues.Languages.Builder wsLangs = Issues.Languages.newBuilder();
Issues.Language.Builder wsLang = Issues.Language.newBuilder();
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchResponseLoader.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchResponseLoader.java
index 457d804d810..71d1d9c8a59 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchResponseLoader.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchResponseLoader.java
@@ -44,7 +44,7 @@ import org.sonarqube.ws.client.issue.IssueFilterParameters;
import static com.google.common.collect.Lists.newArrayList;
import static org.sonar.server.issue.ws.SearchAdditionalField.ACTIONS;
-import static org.sonar.server.issue.ws.SearchAdditionalField.ACTION_PLANS;
+import static org.sonar.server.issue.ws.SearchAdditionalField.DEPRECATED_ACTION_PLANS;
import static org.sonar.server.issue.ws.SearchAdditionalField.COMMENTS;
import static org.sonar.server.issue.ws.SearchAdditionalField.RULES;
import static org.sonar.server.issue.ws.SearchAdditionalField.TRANSITIONS;
@@ -81,7 +81,6 @@ public class SearchResponseLoader {
// before loadUsers()
loadComments(collector, dbSession, result);
loadUsers(collector, dbSession, result);
- loadActionPlans(collector, dbSession, result);
loadComponents(collector, dbSession, result);
loadActionsAndTransitions(collector, result);
completeTotalEffortFromFacet(facets, result);
@@ -110,12 +109,6 @@ public class SearchResponseLoader {
}
}
- private void loadActionPlans(Collector collector, DbSession dbSession, SearchResponseData result) {
- if (collector.contains(ACTION_PLANS)) {
- result.setActionPlans(dbClient.actionPlanDao().selectByKeys(dbSession, collector.<String>get(ACTION_PLANS)));
- }
- }
-
private void loadRules(Collector collector, DbSession dbSession, SearchResponseData result) {
if (collector.contains(RULES)) {
result.setRules(dbClient.ruleDao().selectByKeys(dbSession, collector.<RuleKey>get(RULES)));
@@ -178,7 +171,7 @@ public class SearchResponseLoader {
for (IssueDto issue : issues) {
componentUuids.add(issue.getComponentUuid());
projectUuids.add(issue.getProjectUuid());
- add(ACTION_PLANS, issue.getActionPlanKey());
+ add(DEPRECATED_ACTION_PLANS, issue.getActionPlanKey());
add(RULES, issue.getRuleKey());
add(USERS, issue.getReporter());
add(USERS, issue.getAssignee());
diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java
index 7a39ad8281a..673e1f70a24 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java
@@ -118,7 +118,6 @@ import org.sonar.server.issue.SetSeverityAction;
import org.sonar.server.issue.SetTypeAction;
import org.sonar.server.issue.TransitionAction;
import org.sonar.server.issue.actionplan.ActionPlanService;
-import org.sonar.server.issue.actionplan.ActionPlanWs;
import org.sonar.server.issue.filter.IssueFilterWsModule;
import org.sonar.server.issue.index.IssueAuthorizationIndexer;
import org.sonar.server.issue.index.IssueIndexDefinition;
@@ -601,7 +600,6 @@ public class PlatformLevel4 extends PlatformLevel {
IssueFilterWsModule.class,
// action plan
- ActionPlanWs.class,
ActionPlanService.class,
// issues actions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/ui/ws/ComponentNavigationAction.java b/server/sonar-server/src/main/java/org/sonar/server/ui/ws/ComponentNavigationAction.java
index 31926da662c..9d3c137644c 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/ui/ws/ComponentNavigationAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/ui/ws/ComponentNavigationAction.java
@@ -49,8 +49,8 @@ import org.sonar.db.dashboard.ActiveDashboardDao;
import org.sonar.db.dashboard.DashboardDto;
import org.sonar.db.property.PropertyDto;
import org.sonar.db.property.PropertyQuery;
-import org.sonar.server.component.ComponentFinder;
import org.sonar.server.ce.ws.ActivityAction;
+import org.sonar.server.component.ComponentFinder;
import org.sonar.server.ui.ViewProxy;
import org.sonar.server.ui.Views;
import org.sonar.server.user.UserSession;
@@ -235,7 +235,8 @@ public class ComponentNavigationAction implements NavigationWsAction {
json.prop("showQualityProfiles", isProject);
json.prop("showQualityGates", isProject);
json.prop("showManualMeasures", isAdmin);
- json.prop("showActionPlans", isAdmin && isProject);
+ // TODO delete showActionPlans when UI is updated
+ json.prop("showActionPlans", false);
json.prop("showLinks", isAdmin && isProject);
json.prop("showPermissions", isAdmin && componentTypeHasProperty(component, PROPERTY_HAS_ROLE_POLICY));
json.prop("showHistory", isAdmin && componentTypeHasProperty(component, PROPERTY_MODIFIABLE_HISTORY));
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/issue/actionplan/example-search.json b/server/sonar-server/src/main/resources/org/sonar/server/issue/actionplan/example-search.json
deleted file mode 100644
index b96ee24ebab..00000000000
--- a/server/sonar-server/src/main/resources/org/sonar/server/issue/actionplan/example-search.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "actionPlans": [
- {
- "key": "3f19de90-1521-4482-a737-a311758ff513",
- "name": "Version 3.6",
- "status": "OPEN",
- "project": "java-sonar-runner-simple",
- "userLogin": "admin",
- "deadLine": "2013-12-31T00:00:00+0100",
- "totalIssues": 1,
- "unresolvedIssues": 0,
- "createdAt": "2013-05-31T22:40:50+0200",
- "updatedAt": "2013-05-31T22:40:50+0200"
- },
- {
- "key": "8ab022c0-f0dc-41b7-a762-82502bda749f",
- "name": "Version 3.5",
- "status": "CLOSED",
- "project": "java-sonar-runner-simple4",
- "userLogin": "admin",
- "totalIssues": 0,
- "unresolvedIssues": 0,
- "createdAt": "2013-05-31T22:40:30+0200",
- "updatedAt": "2013-05-31T22:42:13+0200"
- }
- ]
-}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/IssueQueryServiceTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/IssueQueryServiceTest.java
index 659be6dc3c6..8a80c76b37e 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/issue/IssueQueryServiceTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/issue/IssueQueryServiceTest.java
@@ -168,7 +168,6 @@ public class IssueQueryServiceTest {
assertThat(query.tags()).containsOnly("tag1", "tag2");
assertThat(query.onComponentOnly()).isFalse();
assertThat(query.assigned()).isTrue();
- assertThat(query.planned()).isTrue();
assertThat(query.hideRules()).isTrue();
assertThat(query.rules()).hasSize(2);
assertThat(query.directories()).containsOnly("/src/main/java/example");
diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/IssueQueryTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/IssueQueryTest.java
index f033679ff74..1811941a0d6 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/issue/IssueQueryTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/issue/IssueQueryTest.java
@@ -45,7 +45,6 @@ public class IssueQueryTest {
.componentUuids(newArrayList("org/struts/Action.java"))
.moduleUuids(newArrayList("org.struts:core"))
.rules(newArrayList(RuleKey.of("squid", "AvoidCycle")))
- .actionPlans(newArrayList("AP1", "AP2"))
.reporters(newArrayList("crunky"))
.assignees(newArrayList("gargantua"))
.languages(newArrayList("xoo"))
@@ -56,7 +55,6 @@ public class IssueQueryTest {
.createdAfter(new Date())
.createdBefore(new Date())
.createdAt(new Date())
- .planned(true)
.resolved(true)
.sort(IssueQuery.SORT_BY_ASSIGNEE)
.asc(true)
@@ -75,11 +73,9 @@ public class IssueQueryTest {
assertThat(query.assigned()).isTrue();
assertThat(query.hideRules()).isTrue();
assertThat(query.rules()).containsOnly(RuleKey.of("squid", "AvoidCycle"));
- assertThat(query.actionPlans()).containsOnly("AP1", "AP2");
assertThat(query.createdAfter()).isNotNull();
assertThat(query.createdBefore()).isNotNull();
assertThat(query.createdAt()).isNotNull();
- assertThat(query.planned()).isTrue();
assertThat(query.resolved()).isTrue();
assertThat(query.sort()).isEqualTo(IssueQuery.SORT_BY_ASSIGNEE);
assertThat(query.asc()).isTrue();
@@ -118,7 +114,6 @@ public class IssueQueryTest {
.componentUuids(null)
.moduleUuids(null)
.statuses(null)
- .actionPlans(null)
.assignees(null)
.reporters(null)
.resolutions(null)
@@ -132,7 +127,6 @@ public class IssueQueryTest {
assertThat(query.componentUuids()).isEmpty();
assertThat(query.moduleUuids()).isEmpty();
assertThat(query.statuses()).isEmpty();
- assertThat(query.actionPlans()).isEmpty();
assertThat(query.assignees()).isEmpty();
assertThat(query.reporters()).isEmpty();
assertThat(query.resolutions()).isEmpty();
@@ -150,7 +144,6 @@ public class IssueQueryTest {
assertThat(query.componentUuids()).isEmpty();
assertThat(query.moduleUuids()).isEmpty();
assertThat(query.statuses()).isEmpty();
- assertThat(query.actionPlans()).isEmpty();
assertThat(query.assignees()).isEmpty();
assertThat(query.reporters()).isEmpty();
assertThat(query.resolutions()).isEmpty();
@@ -161,7 +154,6 @@ public class IssueQueryTest {
assertThat(query.assigned()).isNull();
assertThat(query.createdAfter()).isNull();
assertThat(query.createdBefore()).isNull();
- assertThat(query.planned()).isNull();
assertThat(query.resolved()).isNull();
assertThat(query.sort()).isNull();
diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/IssueServiceMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/IssueServiceMediumTest.java
index 40acd958b67..bd8f8b59a70 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/issue/IssueServiceMediumTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/issue/IssueServiceMediumTest.java
@@ -44,7 +44,6 @@ import org.sonar.db.DbSession;
import org.sonar.db.component.ComponentDao;
import org.sonar.db.component.ComponentDto;
import org.sonar.db.component.ComponentTesting;
-import org.sonar.db.issue.ActionPlanDto;
import org.sonar.db.issue.IssueDao;
import org.sonar.db.issue.IssueDto;
import org.sonar.db.protobuf.DbFileSources;
@@ -211,61 +210,6 @@ public class IssueServiceMediumTest {
}
@Test
- public void plan() {
- RuleDto rule = newRule();
- ComponentDto project = newProject();
- ComponentDto file = newFile(project);
- userSessionRule.login("john").addProjectPermissions(UserRole.USER, project.key());
-
- IssueDto issue = saveIssue(IssueTesting.newDto(rule, file, project));
-
- String actionPlanKey = "EFGH";
- db.actionPlanDao().save(new ActionPlanDto().setKey(actionPlanKey).setProjectId(project.getId()));
- session.commit();
- index();
-
- assertThat(IssueIndex.getByKey(issue.getKey()).actionPlanKey()).isNull();
-
- service.plan(issue.getKey(), actionPlanKey);
-
- assertThat(IssueIndex.getByKey(issue.getKey()).actionPlanKey()).isEqualTo(actionPlanKey);
- }
-
- @Test
- public void un_plan() {
- RuleDto rule = newRule();
- ComponentDto project = newProject();
- ComponentDto file = newFile(project);
- userSessionRule.login("john");
-
- String actionPlanKey = "EFGH";
- db.actionPlanDao().save(new ActionPlanDto().setKey(actionPlanKey).setProjectId(project.getId()));
- IssueDto issue = saveIssue(IssueTesting.newDto(rule, file, project).setActionPlanKey(actionPlanKey));
-
- assertThat(IssueIndex.getByKey(issue.getKey()).actionPlanKey()).isEqualTo(actionPlanKey);
-
- service.plan(issue.getKey(), null);
-
- assertThat(IssueIndex.getByKey(issue.getKey()).actionPlanKey()).isNull();
- }
-
- @Test
- public void fail_plan_if_action_plan_not_found() {
- RuleDto rule = newRule();
- ComponentDto project = newProject();
- ComponentDto file = newFile(project);
- userSessionRule.login("john");
-
- IssueDto issue = saveIssue(IssueTesting.newDto(rule, file, project));
- try {
- service.plan(issue.getKey(), "unknown");
- fail();
- } catch (Exception e) {
- assertThat(e).isInstanceOf(BadRequestException.class).hasMessage("Unknown action plan: unknown");
- }
- }
-
- @Test
public void set_severity() {
RuleDto rule = newRule();
ComponentDto project = newProject();
diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/IssueTesting.java b/server/sonar-server/src/test/java/org/sonar/server/issue/IssueTesting.java
index b2a5252f2c4..ded112a90ef 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/issue/IssueTesting.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/issue/IssueTesting.java
@@ -64,7 +64,6 @@ public class IssueTesting {
doc.setKey("ABC");
doc.setRuleKey(RuleTesting.XOO_X1.toString());
doc.setType(RuleType.CODE_SMELL);
- doc.setActionPlanKey(null);
doc.setReporter(null);
doc.setAssignee("steve");
doc.setAuthorLogin("roger");
diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/PlanActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/PlanActionTest.java
deleted file mode 100644
index 05e28447b30..00000000000
--- a/server/sonar-server/src/test/java/org/sonar/server/issue/PlanActionTest.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.issue;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.sonar.api.issue.ActionPlan;
-import org.sonar.api.issue.Issue;
-import org.sonar.core.issue.DefaultIssue;
-import org.sonar.core.issue.IssueChangeContext;
-import org.sonar.core.issue.DefaultActionPlan;
-import org.sonar.server.issue.actionplan.ActionPlanService;
-import org.sonar.server.user.ThreadLocalUserSession;
-
-import java.util.List;
-import java.util.Map;
-
-import static com.google.common.collect.Lists.newArrayList;
-import static com.google.common.collect.Maps.newHashMap;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.*;
-
-public class PlanActionTest {
-
- private PlanAction action;
-
- private ActionPlanService actionPlanService = mock(ActionPlanService.class);
- private IssueUpdater issueUpdater = mock(IssueUpdater.class);
-
- @Rule
- public ExpectedException throwable = ExpectedException.none();
-
- @Before
- public void before(){
- action = new PlanAction(actionPlanService, issueUpdater);
- }
-
- @Test
- public void should_execute(){
- ActionPlan actionPlan = new DefaultActionPlan();
- Map<String, Object> properties = newHashMap();
- properties.put(PlanAction.VERIFIED_ACTION_PLAN, actionPlan);
- DefaultIssue issue = mock(DefaultIssue.class);
-
- Action.Context context = mock(Action.Context.class);
- when(context.issue()).thenReturn(issue);
-
- action.execute(properties, context);
- verify(issueUpdater).plan(eq(issue), eq(actionPlan), any(IssueChangeContext.class));
- }
-
- @Test
- public void should_fail_on_unverified_action_plan() {
- throwable.expect(IllegalArgumentException.class);
- throwable.expectMessage("Action plan is missing from the execution parameters");
-
- Map<String, Object> properties = newHashMap();
- Action.Context context = mock(Action.Context.class);
-
- action.execute(properties, context);
- }
-
- @Test
- public void should_execute_on_null_action_plan(){
- Map<String, Object> properties = newHashMap();
- properties.put(PlanAction.VERIFIED_ACTION_PLAN, null);
- DefaultIssue issue = mock(DefaultIssue.class);
-
- Action.Context context = mock(Action.Context.class);
- when(context.issue()).thenReturn(issue);
-
- action.execute(properties, context);
- verify(issueUpdater).plan(eq(issue), eq((ActionPlan) null), any(IssueChangeContext.class));
- }
-
- @Test
- public void should_verify(){
- String planKey = "ABCD";
- Map<String, Object> properties = newHashMap();
- properties.put("plan", planKey);
- ActionPlan actionPlan = new DefaultActionPlan().setProjectKey("struts");
-
- List<Issue> issues = newArrayList((Issue) new DefaultIssue().setKey("ABC").setProjectKey("struts"));
- when(actionPlanService.findByKey(eq(planKey), any(ThreadLocalUserSession.class))).thenReturn(actionPlan);
- assertThat(action.verify(properties, issues, mock(ThreadLocalUserSession.class))).isTrue();
- assertThat(properties.get(PlanAction.VERIFIED_ACTION_PLAN)).isEqualTo(actionPlan);
- }
-
- @Test
- public void should_fail_if_action_plan_does_not_exist(){
- throwable.expect(IllegalArgumentException.class);
- throwable.expectMessage("Unknown action plan: ABCD");
-
- String planKey = "ABCD";
- Map<String, Object> properties = newHashMap();
- properties.put("plan", planKey);
-
- List<Issue> issues = newArrayList((Issue) new DefaultIssue().setKey("ABC").setProjectKey("struts"));
- when(actionPlanService.findByKey(eq(planKey), any(ThreadLocalUserSession.class))).thenReturn(null);
- action.verify(properties, issues, mock(ThreadLocalUserSession.class));
- }
-
- @Test
- public void should_unplan_if_action_plan_is_empty() {
- String planKey = "";
- Map<String, Object> properties = newHashMap();
- properties.put("plan", planKey);
-
- List<Issue> issues = newArrayList((Issue) new DefaultIssue().setKey("ABC").setProjectKey("struts"));
- action.verify(properties, issues, mock(ThreadLocalUserSession.class));
- assertThat(properties.containsKey(PlanAction.VERIFIED_ACTION_PLAN)).isTrue();
- assertThat(properties.get(PlanAction.VERIFIED_ACTION_PLAN)).isNull();
- }
-
- @Test
- public void should_verify_issues_are_on_the_same_project(){
- throwable.expect(IllegalArgumentException.class);
- throwable.expectMessage("Issues are not all related to the action plan project: struts");
-
- String planKey = "ABCD";
- Map<String, Object> properties = newHashMap();
- properties.put("plan", planKey);
-
- when(actionPlanService.findByKey(eq(planKey), any(ThreadLocalUserSession.class))).thenReturn(new DefaultActionPlan().setProjectKey("struts"));
- List<Issue> issues = newArrayList(new DefaultIssue().setKey("ABC").setProjectKey("struts"), (Issue) new DefaultIssue().setKey("ABE").setProjectKey("mybatis"));
- action.verify(properties, issues, mock(ThreadLocalUserSession.class));
- }
-
- @Test
- public void should_support_only_unresolved_issues(){
- assertThat(action.supports(new DefaultIssue().setResolution(null))).isTrue();
- assertThat(action.supports(new DefaultIssue().setResolution(Issue.RESOLUTION_FIXED))).isFalse();
- }
-}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/actionplan/ActionPlanWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/actionplan/ActionPlanWsTest.java
deleted file mode 100644
index 69bf2a52aa4..00000000000
--- a/server/sonar-server/src/test/java/org/sonar/server/issue/actionplan/ActionPlanWsTest.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.issue.actionplan;
-
-import org.junit.Test;
-import org.sonar.api.server.ws.RailsHandler;
-import org.sonar.api.server.ws.WebService;
-import org.sonar.server.ws.WsTester;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class ActionPlanWsTest {
-
- WsTester tester = new WsTester(new ActionPlanWs());
-
- @Test
- public void define_controller() {
- WebService.Controller controller = tester.controller("api/action_plans");
- assertThat(controller).isNotNull();
- assertThat(controller.description()).isNotEmpty();
- assertThat(controller.actions()).hasSize(6);
- }
-
- @Test
- public void define_search_action() {
- WebService.Controller controller = tester.controller("api/action_plans");
-
- WebService.Action action = controller.action("search");
- assertThat(action).isNotNull();
- assertThat(action.handler()).isInstanceOf(RailsHandler.class);
- assertThat(action.responseExampleAsString()).isNotEmpty();
- assertThat(action.params()).hasSize(2);
- }
-
- @Test
- public void define_create_action() {
- WebService.Controller controller = tester.controller("api/action_plans");
-
- WebService.Action action = controller.action("create");
- assertThat(action).isNotNull();
- assertThat(action.handler()).isInstanceOf(RailsHandler.class);
- assertThat(action.params()).hasSize(5);
- }
-
- @Test
- public void define_delete_action() {
- WebService.Controller controller = tester.controller("api/action_plans");
-
- WebService.Action action = controller.action("delete");
- assertThat(action).isNotNull();
- assertThat(action.handler()).isInstanceOf(RailsHandler.class);
- assertThat(action.params()).hasSize(2);
- }
-
- @Test
- public void define_update_action() {
- WebService.Controller controller = tester.controller("api/action_plans");
-
- WebService.Action action = controller.action("update");
- assertThat(action).isNotNull();
- assertThat(action.handler()).isInstanceOf(RailsHandler.class);
- assertThat(action.params()).hasSize(5);
- }
-
- @Test
- public void define_open_action() {
- WebService.Controller controller = tester.controller("api/action_plans");
-
- WebService.Action action = controller.action("open");
- assertThat(action).isNotNull();
- assertThat(action.handler()).isInstanceOf(RailsHandler.class);
- assertThat(action.params()).hasSize(2);
- }
-
- @Test
- public void define_close_action() {
- WebService.Controller controller = tester.controller("api/action_plans");
-
- WebService.Action action = controller.action("close");
- assertThat(action).isNotNull();
- assertThat(action.handler()).isInstanceOf(RailsHandler.class);
- assertThat(action.params()).hasSize(2);
- }
-}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexDebtTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexDebtTest.java
index 28f01d7342e..0adf6a29cb3 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexDebtTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexDebtTest.java
@@ -183,21 +183,6 @@ public class IssueIndexDebtTest {
}
@Test
- public void facets_on_action_plans() {
- ComponentDto project = ComponentTesting.newProjectDto();
- ComponentDto file = ComponentTesting.newFileDto(project);
-
- indexIssues(
- IssueTesting.newDoc("ISSUE1", file).setActionPlanKey("plan1"),
- IssueTesting.newDoc("ISSUE2", file).setActionPlanKey("plan2"));
-
- SearchResult<IssueDoc> result = index.search(newQueryBuilder().build(), new SearchOptions().addFacets(newArrayList("actionPlans")));
- assertThat(result.getFacets().getNames()).containsOnly("actionPlans", FACET_MODE_EFFORT);
- assertThat(result.getFacets().get("actionPlans")).containsOnly(entry("plan1", 10L), entry("plan2", 10L));
- assertThat(result.getFacets().get(FACET_MODE_EFFORT)).containsOnly(entry("total", 20L));
- }
-
- @Test
public void facets_on_languages() {
ComponentDto project = ComponentTesting.newProjectDto();
ComponentDto file = ComponentTesting.newFileDto(project);
diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexTest.java
index b6d18f17851..cccea32a348 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexTest.java
@@ -464,49 +464,6 @@ public class IssueIndexTest {
}
@Test
- public void filter_by_action_plans() {
- ComponentDto project = ComponentTesting.newProjectDto();
- ComponentDto file = ComponentTesting.newFileDto(project);
-
- indexIssues(
- IssueTesting.newDoc("ISSUE1", file).setActionPlanKey("plan1"),
- IssueTesting.newDoc("ISSUE2", file).setActionPlanKey("plan2"));
-
- assertThat(index.search(IssueQuery.builder(userSessionRule).actionPlans(newArrayList("plan1")).build(), new SearchOptions()).getDocs()).hasSize(1);
- assertThat(index.search(IssueQuery.builder(userSessionRule).actionPlans(newArrayList("plan1", "plan2")).build(), new SearchOptions()).getDocs()).hasSize(2);
- assertThat(index.search(IssueQuery.builder(userSessionRule).actionPlans(newArrayList("unknown")).build(), new SearchOptions()).getDocs()).isEmpty();
- }
-
- @Test
- public void facets_on_action_plans() {
- ComponentDto project = ComponentTesting.newProjectDto();
- ComponentDto file = ComponentTesting.newFileDto(project);
-
- indexIssues(
- IssueTesting.newDoc("ISSUE1", file).setActionPlanKey("plan1"),
- IssueTesting.newDoc("ISSUE2", file).setActionPlanKey("plan2"));
-
- SearchResult<IssueDoc> result = index.search(IssueQuery.builder(userSessionRule).build(), new SearchOptions().addFacets(newArrayList("actionPlans")));
- assertThat(result.getFacets().getNames()).containsOnly("actionPlans");
- assertThat(result.getFacets().get("actionPlans")).containsOnly(entry("plan1", 1L), entry("plan2", 1L));
- }
-
- @Test
- public void filter_by_planned() {
- ComponentDto project = ComponentTesting.newProjectDto();
- ComponentDto file = ComponentTesting.newFileDto(project);
-
- indexIssues(
- IssueTesting.newDoc("ISSUE1", file).setActionPlanKey("AP-KEY"),
- IssueTesting.newDoc("ISSUE2", file).setActionPlanKey(null),
- IssueTesting.newDoc("ISSUE3", file).setActionPlanKey(null));
-
- assertThat(index.search(IssueQuery.builder(userSessionRule).planned(true).build(), new SearchOptions()).getDocs()).hasSize(1);
- assertThat(index.search(IssueQuery.builder(userSessionRule).planned(false).build(), new SearchOptions()).getDocs()).hasSize(2);
- assertThat(index.search(IssueQuery.builder(userSessionRule).planned(null).build(), new SearchOptions()).getDocs()).hasSize(3);
- }
-
- @Test
public void filter_by_rules() {
ComponentDto project = ComponentTesting.newProjectDto();
ComponentDto file = ComponentTesting.newFileDto(project);
diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueResultSetIteratorTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueResultSetIteratorTest.java
index b86450a500a..93acb15a7ed 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueResultSetIteratorTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueResultSetIteratorTest.java
@@ -82,7 +82,6 @@ public class IssueResultSetIteratorTest {
assertThat(issue.tags()).containsOnly("tag1", "tag2", "tag3");
assertThat(issue.effort().toMinutes()).isGreaterThan(0L);
assertThat(issue.gap()).isEqualTo(2d);
- assertThat(issue.actionPlanKey()).isEqualTo("PLAN1");
assertThat(issue.attribute("JIRA")).isEqualTo("http://jira.com");
assertThat(issue.type().getDbConstant()).isEqualTo(2);
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/IssueWsModuleTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/IssueWsModuleTest.java
index 9e3936ace12..5ce2b6b6ffc 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/IssueWsModuleTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/IssueWsModuleTest.java
@@ -29,6 +29,6 @@ public class IssueWsModuleTest {
public void verify_count_of_added_components() {
ComponentContainer container = new ComponentContainer();
new IssueWsModule().configure(container);
- assertThat(container.size()).isEqualTo(17);
+ assertThat(container.size()).isEqualTo(2 + 14);
}
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/PlanActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/PlanActionTest.java
deleted file mode 100644
index 2d4ad46c63b..00000000000
--- a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/PlanActionTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.issue.ws;
-
-import org.junit.Test;
-import org.sonar.api.server.ws.Request;
-import org.sonar.api.server.ws.Response;
-import org.sonar.server.issue.IssueService;
-import org.sonar.server.ws.WsAction;
-import org.sonar.server.ws.WsActionTester;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-
-public class PlanActionTest {
-
- IssueService issueService = mock(IssueService.class);
- OperationResponseWriter responseWriter = mock(OperationResponseWriter.class);
- WsAction underTest = new PlanAction(issueService, responseWriter);
- WsActionTester tester = new WsActionTester(underTest);
-
- @Test
- public void plan() throws Exception {
- tester.newRequest()
- .setParam("issue", "ABC")
- .setParam("plan", "P1")
- .execute();
-
- verify(issueService).plan("ABC", "P1");
- verify(responseWriter).write(eq("ABC"), any(Request.class), any(Response.class));
- }
-
- @Test
- public void unplan_if_value_is_absent() throws Exception {
- tester.newRequest()
- .setParam("issue", "ABC")
- .execute();
-
- verify(issueService).plan("ABC", null);
- verify(responseWriter).write(eq("ABC"), any(Request.class), any(Response.class));
- }
-}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionMediumTest.java
index ddae87c0089..088ccde0a45 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionMediumTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionMediumTest.java
@@ -35,8 +35,6 @@ import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
import org.sonar.db.component.ComponentDto;
import org.sonar.db.component.ComponentTesting;
-import org.sonar.db.issue.ActionPlanDao;
-import org.sonar.db.issue.ActionPlanDto;
import org.sonar.db.issue.IssueChangeDao;
import org.sonar.db.issue.IssueChangeDto;
import org.sonar.db.issue.IssueDao;
@@ -215,55 +213,18 @@ public class SearchActionMediumTest {
}
@Test
- public void issue_with_action_plan() throws Exception {
- ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("PROJECT_KEY"));
- setDefaultProjectPermission(project);
- ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("FILE_KEY"));
-
- tester.get(ActionPlanDao.class).save(new ActionPlanDto()
- .setKey("AP-ABCD")
- .setName("1.0")
- .setStatus("OPEN")
- .setProjectId(project.getId())
- .setUserLogin("simon")
- .setDeadLine(DateUtils.parseDateTime("2014-01-24T19:10:03+0000"))
- .setCreatedAt(DateUtils.parseDateTime("2014-01-22T19:10:03+0000"))
- .setUpdatedAt(DateUtils.parseDateTime("2014-01-23T19:10:03+0000")));
-
- IssueDto issue = IssueTesting.newDto(newRule(), file, project)
- .setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2")
- .setActionPlanKey("AP-ABCD");
- db.issueDao().insert(session, issue);
- session.commit();
- tester.get(IssueIndexer.class).indexAll();
-
- WsTester.Result result = wsTester.newGetRequest(IssuesWs.API_ENDPOINT, SearchAction.SEARCH_ACTION)
- .setParam("additionalFields", "actionPlans")
- .execute();
- result.assertJson(this.getClass(), "issue_with_action_plan.json");
- }
-
- @Test
public void load_additional_fields() throws Exception {
db.userDao().insert(session, new UserDto().setLogin("simon").setName("Simon").setEmail("simon@email.com"));
db.userDao().insert(session, new UserDto().setLogin("fabrice").setName("Fabrice").setEmail("fabrice@email.com"));
- ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("PROJECT_KEY"));
+ ComponentDto project = insertComponent(ComponentTesting.newProjectDto("PROJECT_ID").setKey("PROJECT_KEY").setLanguage("java"));
setDefaultProjectPermission(project);
- ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("FILE_KEY"));
-
- tester.get(ActionPlanDao.class).save(new ActionPlanDto()
- .setKey("AP-ABCD")
- .setName("1.0")
- .setStatus("OPEN")
- .setProjectId(project.getId())
- .setUserLogin("simon"));
+ ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, "FILE_ID").setKey("FILE_KEY").setLanguage("js"));
IssueDto issue = IssueTesting.newDto(newRule(), file, project)
.setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2")
.setAuthorLogin("John")
.setAssignee("simon")
- .setReporter("fabrice")
- .setActionPlanKey("AP-ABCD");
+ .setReporter("fabrice");
db.issueDao().insert(session, issue);
session.commit();
tester.get(IssueIndexer.class).indexAll();
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/display_facets.json b/server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/display_facets.json
index 8cec05d3980..2670131b7ec 100644
--- a/server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/display_facets.json
+++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/display_facets.json
@@ -131,15 +131,6 @@
]
},
{
- "property": "actionPlans",
- "values": [
- {
- "val": "",
- "count": 1
- }
- ]
- },
- {
"property": "types",
"values": [
{
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/display_facets_effort.json b/server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/display_facets_effort.json
index c71a31ef12f..9b3fd00c836 100644
--- a/server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/display_facets_effort.json
+++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/display_facets_effort.json
@@ -131,14 +131,5 @@
"count": 10
}
]
- },
- {
- "property": "actionPlans",
- "values": [
- {
- "val": "",
- "count": 10
- }
- ]
}
]}
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/display_zero_facets.json b/server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/display_zero_facets.json
index 7b6d10d0f11..35810d03c73 100644
--- a/server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/display_zero_facets.json
+++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/display_zero_facets.json
@@ -147,14 +147,5 @@
"count": 0
}
]
- },
- {
- "property": "actionPlans",
- "values": [
- {
- "val": "",
- "count": 1
- }
- ]
}
]}
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/load_additional_fields.json b/server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/load_additional_fields.json
index e7b5fb75d06..4037df58091 100644
--- a/server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/load_additional_fields.json
+++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/load_additional_fields.json
@@ -4,20 +4,26 @@
"key": "82fd47d4-b650-4037-80bc-7b112bd4eac2",
"assignee": "simon",
"reporter": "fabrice",
- "actionPlan": "AP-ABCD",
"actions": [
- "comment", "assign", "set_tags", "set_type", "assign_to_me", "plan"
+ "comment", "assign", "set_tags", "set_type", "assign_to_me"
],
"transitions": [
"confirm", "resolve"
]
}
],
- "actionPlans": [
+ "users": [
{
- "key": "AP-ABCD",
- "name": "1.0",
- "status": "OPEN"
+ "login": "fabrice",
+ "name": "Fabrice",
+ "email": "fabrice@email.com",
+ "active": true
+ },
+ {
+ "login": "simon",
+ "name": "Simon",
+ "email": "simon@email.com",
+ "active": true
}
]
}
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/response_contains_all_fields_except_additional_fields.json b/server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/response_contains_all_fields_except_additional_fields.json
index a4abf93e3f6..e1dcff8afbe 100644
--- a/server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/response_contains_all_fields_except_additional_fields.json
+++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/response_contains_all_fields_except_additional_fields.json
@@ -12,7 +12,6 @@
"assignee": "simon",
"reporter": "fabrice",
"author": "John",
- "actionPlan": "AP-ABCD",
"tags": [
"bug",
"owasp"
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/ui/ws/ComponentNavigationActionTest/with_admin_rights.json b/server/sonar-server/src/test/resources/org/sonar/server/ui/ws/ComponentNavigationActionTest/with_admin_rights.json
index 21a739685e9..9cc9467afec 100644
--- a/server/sonar-server/src/test/resources/org/sonar/server/ui/ws/ComponentNavigationActionTest/with_admin_rights.json
+++ b/server/sonar-server/src/test/resources/org/sonar/server/ui/ws/ComponentNavigationActionTest/with_admin_rights.json
@@ -11,7 +11,7 @@
"showQualityProfiles": true,
"showQualityGates": true,
"showManualMeasures": true,
- "showActionPlans": true,
+ "showActionPlans": false,
"showLinks": true,
"showPermissions": false,
"showHistory": false,
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/ui/ws/ComponentNavigationActionTest/with_all_properties.json b/server/sonar-server/src/test/resources/org/sonar/server/ui/ws/ComponentNavigationActionTest/with_all_properties.json
index 1acea8658f2..d48abffd64d 100644
--- a/server/sonar-server/src/test/resources/org/sonar/server/ui/ws/ComponentNavigationActionTest/with_all_properties.json
+++ b/server/sonar-server/src/test/resources/org/sonar/server/ui/ws/ComponentNavigationActionTest/with_all_properties.json
@@ -11,7 +11,7 @@
"showQualityProfiles": true,
"showQualityGates": true,
"showManualMeasures": true,
- "showActionPlans": true,
+ "showActionPlans": false,
"showLinks": true,
"showPermissions": true,
"showHistory": true,
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/action_plans_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/action_plans_controller.rb
deleted file mode 100644
index 203dff8f92e..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/action_plans_controller.rb
+++ /dev/null
@@ -1,165 +0,0 @@
-#
-# SonarQube, open source software quality management tool.
-# Copyright (C) 2008-2014 SonarSource
-# mailto:contact AT sonarsource DOT com
-#
-# SonarQube is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 3 of the License, or (at your option) any later version.
-#
-# SonarQube is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-
-class Api::ActionPlansController < Api::ApiController
-
- #
- # GET /api/action_plans/search?project=<project>
- #
- # -- Example
- # curl -v -u 'http://localhost:9000/api/action_plans/search?project=org.sonar.Sample'
- #
- def search
- require_parameters :project
-
- action_plans = Internal.issues.findActionPlanStats(params[:project])
- hash = {:actionPlans => action_plans.map { |plan| ActionPlan.to_hash(plan)}}
-
- respond_to do |format|
- format.json { render :json => jsonp(hash) }
- format.xml { render :xml => hash.to_xml(:skip_types => true, :root => 'actionPlans') }
- end
- end
-
- #
- # POST /api/action_plans/create
- #
- # -- Mandatory parameters
- # 'name' is the name of the action plan
- # 'project' is the key of the project to link the action plan to
- #
- # -- Optional parameters
- # 'description' is the plain-text description
- # 'deadLine' is the due date of the action plan. Format is 'year-month-day', for instance, '2013-12-31'.
- #
- # -- Example
- # curl -X POST -v -u admin:admin 'http://localhost:9000/api/action_plans/create?name=Current&project=org.sonar.Sample'
- #
- def create
- verify_post_request
- require_parameters :project, :name
-
- result = Internal.issues.createActionPlan(params)
- render_result(result)
- end
-
- #
- # POST /api/action_plans/delete
- #
- # -- Mandatory parameters
- # 'key' is the action plan key
- #
- # -- Example
- # curl -X POST -v -u admin:admin 'http://localhost:9000/api/action_plans/delete?key=9b6f89c0-3347-46f6-a6d1-dd6c761240e0'
- #
- def delete
- verify_post_request
- require_parameters :key
-
- result = Internal.issues.deleteActionPlan(params[:key])
- render_result(result)
- end
-
- #
- # POST /api/action_plans/update
- #
- # -- Mandatory parameters
- # 'name' is the name of the action plan
- #
- # -- Optional parameters
- # 'description' is the plain-text description
- # 'deadLine' is the due date of the action plan. Format is 'year-month-day', for instance, '2013-12-31'.
- #
- # -- Information
- # 'project' cannot be update
- #
- # -- Example
- # curl -X POST -v -u admin:admin 'http://localhost:9000/api/action_plans/update?key=9b6f89c0-3347-46f6-a6d1-dd6c761240e0&name=Current'
- #
- def update
- verify_post_request
- require_parameters :key, :name
-
- result = Internal.issues.updateActionPlan(params[:key], params)
- render_result(result)
- end
-
- #
- # POST /api/action_plans/close
- #
- # -- Mandatory parameters
- # 'key' is the action plan key
- #
- # -- Example
- # curl -X POST -v -u admin:admin 'http://localhost:9000/api/action_plans/close?key=9b6f89c0-3347-46f6-a6d1-dd6c761240e0'
- #
- def close
- verify_post_request
- require_parameters :key
-
- result = Internal.issues.closeActionPlan(params[:key])
- render_result(result)
- end
-
- #
- # POST /api/action_plans/open
- #
- # -- Mandatory parameters
- # 'key' is the action plan key
- #
- # -- Example
- # curl -X POST -v -u admin:admin 'http://localhost:9000/api/action_plans/open?key=9b6f89c0-3347-46f6-a6d1-dd6c761240e0'
- #
- def open
- verify_post_request
- require_parameters :key
-
- result = Internal.issues.openActionPlan(params[:key])
- render_result(result)
- end
-
-
- private
-
- def render_result(result)
- http_status = (result.ok ? 200 : 400)
- hash = result_to_hash(result)
- hash[:actionPlan] = ActionPlan.to_hash(result.get) if result.get
-
- respond_to do |format|
- # if the request header "Accept" is "*/*", then the default format is the first one (json)
- format.json { render :json => jsonp(hash), :status => result.httpStatus }
- format.xml { render :xml => hash.to_xml(:skip_types => true, :root => 'sonar', :status => http_status) }
- end
- end
-
- def result_to_hash(result)
- hash = {}
- if result.errors and !result.errors.empty?
- hash[:errors] = result.errors().map do |error|
- {
- :msg => (error.text ? error.text : Api::Utils.message(error.l10nKey, :params => error.l10nParams))
- }
- end
- end
- hash
- end
-
-end
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 18d0f2a3ecc..768a23bbcde 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
@@ -159,7 +159,7 @@ class Api::IssuesController < Api::ApiController
# -- Optional parameters
# 'assign.assignee' to assign all issues to a user or un-assign.
# 'set_severity.severity' to change the severity of all issues.
- # 'plan.plan' to plan all issues to an action plan or unlink.
+ # Action Plan are dropped in 5.5'plan.plan' 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.