From a14e9357d2acc4a320ca279f6e5e6aab4f6dbeb2 Mon Sep 17 00:00:00 2001 From: Teryk Bellahsene Date: Thu, 24 Mar 2016 18:27:47 +0100 Subject: [PATCH] SONAR-7467 Drop/deprecate action plan API --- .../computation/issue/IssueLifecycle.java | 1 - .../dashboard/widget/ActionPlansWidget.java | 35 ----- .../issue/InternalRubyIssueService.java | 19 --- .../org/sonar/server/issue/IssueUpdater.java | 18 --- .../platformlevel/PlatformLevel4.java | 2 - .../dashboard/widget/action_plans.html.erb | 97 ------------ .../computation/issue/IssueAssignerTest.java | 2 +- .../computation/issue/IssueLifecycleTest.java | 2 - .../issue/TrackerRawInputFactoryTest.java | 1 - .../issue/UpdateConflictResolverTest.java | 2 - .../sonar/server/issue/IssueUpdaterTest.java | 59 ------- .../sonar/core/issue/DefaultActionPlan.java | 145 ------------------ .../org/sonar/core/issue/DefaultIssue.java | 9 +- .../sonar/core/issue/DefaultIssueTest.java | 2 - .../java/org/sonar/api/issue/ActionPlan.java | 58 ------- .../main/java/org/sonar/api/issue/Issue.java | 4 + .../DeprecatedIssueAdapterForFilterTest.java | 7 - .../batch/issue/TrackedIssueAdapterTest.java | 1 - 18 files changed, 7 insertions(+), 457 deletions(-) delete mode 100644 server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/ActionPlansWidget.java delete mode 100644 server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/action_plans.html.erb delete mode 100644 sonar-core/src/main/java/org/sonar/core/issue/DefaultActionPlan.java delete mode 100644 sonar-plugin-api/src/main/java/org/sonar/api/issue/ActionPlan.java diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/issue/IssueLifecycle.java b/server/sonar-server/src/main/java/org/sonar/server/computation/issue/IssueLifecycle.java index deb747d94e4..2acca806baa 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/issue/IssueLifecycle.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/issue/IssueLifecycle.java @@ -72,7 +72,6 @@ public class IssueLifecycle { raw.setCreationDate(base.creationDate()); raw.setUpdateDate(base.updateDate()); raw.setCloseDate(base.closeDate()); - raw.setActionPlanKey(base.actionPlanKey()); raw.setResolution(base.resolution()); raw.setStatus(base.status()); raw.setAssignee(base.assignee()); diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/ActionPlansWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/ActionPlansWidget.java deleted file mode 100644 index db8f0822cb7..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/ActionPlansWidget.java +++ /dev/null @@ -1,35 +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.dashboard.widget; - -import org.sonar.api.web.WidgetCategory; -import org.sonar.api.web.WidgetProperties; -import org.sonar.api.web.WidgetProperty; -import org.sonar.api.web.WidgetPropertyType; - -@WidgetCategory({"Issues"}) -@WidgetProperties({ - @WidgetProperty(key = "showResolvedIssues", type = WidgetPropertyType.BOOLEAN, defaultValue = "true") -}) -public class ActionPlansWidget extends CoreWidget { - public ActionPlansWidget() { - super("action_plans", "Issues action plans", "/org/sonar/server/dashboard/widget/action_plans.html.erb"); - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/InternalRubyIssueService.java b/server/sonar-server/src/main/java/org/sonar/server/issue/InternalRubyIssueService.java index ec3bf7e5eda..df3afc34089 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/InternalRubyIssueService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/InternalRubyIssueService.java @@ -25,16 +25,13 @@ import com.google.common.base.Strings; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; import java.util.Collection; -import java.util.Date; import java.util.List; import java.util.Map; import javax.annotation.CheckForNull; import javax.annotation.Nonnull; -import org.sonar.api.issue.ActionPlan; import org.sonar.api.issue.Issue; import org.sonar.api.issue.IssueComment; import org.sonar.api.server.ServerSide; -import org.sonar.api.utils.SonarException; import org.sonar.api.web.UserRole; import org.sonar.core.issue.DefaultIssueComment; import org.sonar.db.issue.IssueFilterDto; @@ -149,22 +146,6 @@ public class InternalRubyIssueService { return commentService.findComment(commentKey); } - private static Date checkAndReturnDeadline(String deadLineParam, Result result) { - Date deadLine = null; - if (!Strings.isNullOrEmpty(deadLineParam)) { - try { - deadLine = RubyUtils.toDate(deadLineParam); - Date today = new Date(); - if (deadLine != null && deadLine.before(today) && !org.apache.commons.lang.time.DateUtils.isSameDay(deadLine, today)) { - result.addError(Result.Message.ofL10n("action_plans.date_cant_be_in_past")); - } - } catch (SonarException e) { - result.addError(Result.Message.ofL10n("errors.is_not_valid", "date")); - } - } - return deadLine; - } - public List listActions(String issueKey) { return actionService.listAvailableActions(issueKey); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/IssueUpdater.java b/server/sonar-server/src/main/java/org/sonar/server/issue/IssueUpdater.java index c8a910ad14c..3be9fef044e 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/IssueUpdater.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/IssueUpdater.java @@ -32,7 +32,6 @@ import java.util.Set; import javax.annotation.Nullable; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.time.DateUtils; -import org.sonar.api.issue.ActionPlan; import org.sonar.api.rules.RuleType; import org.sonar.api.server.ServerSide; import org.sonar.api.server.rule.RuleTagFormat; @@ -307,23 +306,6 @@ public class IssueUpdater { return false; } - public boolean plan(DefaultIssue issue, @Nullable ActionPlan actionPlan, IssueChangeContext context) { - String sanitizedActionPlanKey = null; - if (actionPlan != null) { - sanitizedActionPlanKey = StringUtils.defaultIfBlank(actionPlan.key(), null); - } - if (!Objects.equal(sanitizedActionPlanKey, issue.actionPlanKey())) { - String newActionPlanName = actionPlan != null ? actionPlan.name() : null; - issue.setFieldChange(context, ACTION_PLAN, UNUSED, newActionPlanName); - issue.setActionPlanKey(sanitizedActionPlanKey); - issue.setUpdateDate(context.date()); - issue.setChanged(true); - issue.setSendNotifications(true); - return true; - } - return false; - } - public boolean setTags(DefaultIssue issue, Collection tags, IssueChangeContext context) { Set newTags = Sets.newHashSet(Collections2.transform( Collections2.filter(tags, new Predicate() { 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 9d4049e3817..e8ea9752617 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 @@ -55,7 +55,6 @@ import org.sonar.server.component.ws.ComponentsWsModule; import org.sonar.server.config.ws.PropertiesWs; import org.sonar.server.dashboard.template.GlobalDefaultDashboard; import org.sonar.server.dashboard.template.ProjectCustomDashboard; -import org.sonar.server.dashboard.widget.ActionPlansWidget; import org.sonar.server.dashboard.widget.AlertsWidget; import org.sonar.server.dashboard.widget.BubbleChartWidget; import org.sonar.server.dashboard.widget.ComplexityWidget; @@ -371,7 +370,6 @@ public class PlatformLevel4 extends PlatformLevel { MeasureFilterAsBubbleChartWidget.class, ProjectFileCloudWidget.class, DebtOverviewWidget.class, - ActionPlansWidget.class, IssueFilterWidget.class, ProjectIssueFilterWidget.class, IssueTagCloudWidget.class, diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/action_plans.html.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/action_plans.html.erb deleted file mode 100644 index 75553d3de15..00000000000 --- a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/action_plans.html.erb +++ /dev/null @@ -1,97 +0,0 @@ -<% - # This widget should only be display on root projects - if @project.qualifier == 'TRK' && has_role?(:user, @project) - action_plans = Internal.issues.findActionPlanStats(@resource.key) - open_action_plans = action_plans.select {|plan| plan.isOpen()} - - div_id = "issues-action-plan-widget-#{widget.id.to_s}" -%> - -
- <% if has_role?(:admin, @project) %> - - <% end %> - -

<%= message('widget.action_plans.title') -%>

-
- - -
- -<% if open_action_plans.size ==0 %> - - <%= message('widget.action_plans.no_action_plan') -%> - -<% - else - show_resolved_issues = widget_properties["showResolvedIssues"] - if show_resolved_issues - line_class = "top" - else - line_class = "middle" - max_unresolved_issues = open_action_plans.map {|plan| plan.unresolvedIssues()}.max - end -%> - - - - - - - - - <% - open_action_plans.each do |plan| - %> - "action_plan_" + widget.id.to_s) -%>"> - - - - <% if show_resolved_issues %> - <% if plan.totalIssues()==0 %> - - <% else %> - - <% end %> - <% - else - unresolved_issues_size = plan.unresolvedIssues() - %> - - - <% end %> - - - <% - end - %> - -
<%= h(plan.name) -%><%= format_date(plan.deadLine()) -%><%= message('action_plans.no_issues_linked_to_action_plan') -%> - <%= render :partial => 'action_plans/progress', :locals => {:action_plan => plan} -%> - - <% if unresolved_issues_size == 0 %> - <%= unresolved_issues_size -%> - <% else %> - <% - search_options = {} - search_options['actionPlans'] = plan.key - search_options['resolved'] = false - %> - <%= unresolved_issues_size -%> - <% end %> - -
-
-
-
- -<% end %> - -
- -<% end %> diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/IssueAssignerTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/IssueAssignerTest.java index 45dbe30b7ac..839437da0fb 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/IssueAssignerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/IssueAssignerTest.java @@ -181,7 +181,7 @@ public class IssueAssignerTest { underTest.onIssue(FILE, issue); assertThat(logTester.logs(LoggerLevel.WARN)).containsOnly( - "No SCM info has been found for issue DefaultIssue[key=,type=VULNERABILITY,componentUuid=,componentKey=,moduleUuid=,moduleUuidPath=,projectUuid=,projectKey=,ruleKey=,language=,severity=,manualSeverity=false,message=,line=2,gap=,effort=,status=,resolution=,reporter=,assignee=,checksum=,attributes=,authorLogin=,actionPlanKey=,comments=,tags=,locations=,creationDate=,updateDate=,closeDate=,currentChange=,changes=,isNew=true,beingClosed=false,onDisabledRule=false,isChanged=false,sendNotifications=false,selectedAt=]"); + "No SCM info has been found for issue DefaultIssue[key=,type=VULNERABILITY,componentUuid=,componentKey=,moduleUuid=,moduleUuidPath=,projectUuid=,projectKey=,ruleKey=,language=,severity=,manualSeverity=false,message=,line=2,gap=,effort=,status=,resolution=,reporter=,assignee=,checksum=,attributes=,authorLogin=,comments=,tags=,locations=,creationDate=,updateDate=,closeDate=,currentChange=,changes=,isNew=true,beingClosed=false,onDisabledRule=false,isChanged=false,sendNotifications=false,selectedAt=]"); } private void setSingleChangeset(String author, Long date, String revision) { diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/IssueLifecycleTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/IssueLifecycleTest.java index f9eafe22b03..0beeaebbb06 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/IssueLifecycleTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/IssueLifecycleTest.java @@ -110,7 +110,6 @@ public class IssueLifecycleTest { .setCreationDate(parseDate("2015-01-01")) .setUpdateDate(parseDate("2015-01-02")) .setCloseDate(parseDate("2015-01-03")) - .setActionPlanKey("BASE_ACTION_PLAN_KEY") .setResolution(RESOLUTION_FIXED) .setStatus(STATUS_CLOSED) .setSeverity(BLOCKER) @@ -135,7 +134,6 @@ public class IssueLifecycleTest { assertThat(raw.creationDate()).isEqualTo(base.creationDate()); assertThat(raw.updateDate()).isEqualTo(base.updateDate()); assertThat(raw.closeDate()).isEqualTo(base.closeDate()); - assertThat(raw.actionPlanKey()).isEqualTo("BASE_ACTION_PLAN_KEY"); assertThat(raw.resolution()).isEqualTo(RESOLUTION_FIXED); assertThat(raw.status()).isEqualTo(STATUS_CLOSED); assertThat(raw.assignee()).isEqualTo("base assignee"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/TrackerRawInputFactoryTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/TrackerRawInputFactoryTest.java index 83af9b05e88..240c547dc05 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/TrackerRawInputFactoryTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/TrackerRawInputFactoryTest.java @@ -154,7 +154,6 @@ public class TrackerRawInputFactoryTest { assertThat(issue.resolution()).isNull(); assertThat(issue.status()).isEqualTo(Issue.STATUS_OPEN); assertThat(issue.key()).isNull(); - assertThat(issue.actionPlanKey()).isNull(); assertThat(issue.authorLogin()).isNull(); assertThat(issue.debt()).isNull(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/UpdateConflictResolverTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/UpdateConflictResolverTest.java index bcb05322f49..32ba3aec6a3 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/UpdateConflictResolverTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/UpdateConflictResolverTest.java @@ -82,7 +82,6 @@ public class UpdateConflictResolverTest { // Before starting scan issue.setAssignee(null); - issue.setActionPlanKey("PLAN-1"); issue.setCreationDate(DateUtils.parseDate("2012-01-01")); issue.setUpdateDate(DateUtils.parseDate("2012-02-02")); @@ -123,7 +122,6 @@ public class UpdateConflictResolverTest { assertThat(issue.assignee()).isEqualTo("arthur"); assertThat(issue.resolution()).isEqualTo(Issue.RESOLUTION_FALSE_POSITIVE); assertThat(issue.status()).isEqualTo(Issue.STATUS_RESOLVED); - assertThat(issue.actionPlanKey()).isEqualTo("PLAN-2"); } @Test diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/IssueUpdaterTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/IssueUpdaterTest.java index 977a3863042..2c35227264d 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/IssueUpdaterTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/IssueUpdaterTest.java @@ -24,17 +24,14 @@ 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.user.User; import org.sonar.api.utils.Duration; -import org.sonar.core.issue.DefaultActionPlan; import org.sonar.core.issue.DefaultIssue; import org.sonar.core.issue.FieldDiffs; import org.sonar.core.issue.IssueChangeContext; import org.sonar.core.user.DefaultUser; import static org.assertj.core.api.Assertions.assertThat; -import static org.sonar.server.issue.IssueUpdater.ACTION_PLAN; import static org.sonar.server.issue.IssueUpdater.ASSIGNEE; import static org.sonar.server.issue.IssueUpdater.RESOLUTION; import static org.sonar.server.issue.IssueUpdater.SEVERITY; @@ -353,62 +350,6 @@ public class IssueUpdaterTest { assertThat(issue.mustSendNotifications()).isFalse(); } - @Test - public void plan_with_no_existing_plan() { - ActionPlan newActionPlan = DefaultActionPlan.create("newName"); - - boolean updated = updater.plan(issue, newActionPlan, context); - assertThat(updated).isTrue(); - assertThat(issue.actionPlanKey()).isEqualTo(newActionPlan.key()); - - FieldDiffs.Diff diff = issue.currentChange().get(ACTION_PLAN); - assertThat(diff.oldValue()).isEqualTo(UNUSED); - assertThat(diff.newValue()).isEqualTo("newName"); - assertThat(issue.mustSendNotifications()).isTrue(); - } - - @Test - public void plan_with_existing_plan() { - issue.setActionPlanKey("formerActionPlan"); - - ActionPlan newActionPlan = DefaultActionPlan.create("newName").setKey("newKey"); - - boolean updated = updater.plan(issue, newActionPlan, context); - assertThat(updated).isTrue(); - assertThat(issue.actionPlanKey()).isEqualTo(newActionPlan.key()); - - FieldDiffs.Diff diff = issue.currentChange().get(ACTION_PLAN); - assertThat(diff.oldValue()).isEqualTo(UNUSED); - assertThat(diff.newValue()).isEqualTo("newName"); - assertThat(issue.mustSendNotifications()).isTrue(); - } - - @Test - public void unplan() { - issue.setActionPlanKey("formerActionPlan"); - - boolean updated = updater.plan(issue, null, context); - assertThat(updated).isTrue(); - assertThat(issue.actionPlanKey()).isNull(); - - FieldDiffs.Diff diff = issue.currentChange().get(ACTION_PLAN); - assertThat(diff.oldValue()).isEqualTo(UNUSED); - assertThat(diff.newValue()).isNull(); - assertThat(issue.mustSendNotifications()).isTrue(); - } - - @Test - public void not_plan_again() { - issue.setActionPlanKey("existingActionPlan"); - - ActionPlan newActionPlan = DefaultActionPlan.create("existingActionPlan").setKey("existingActionPlan"); - - boolean updated = updater.plan(issue, newActionPlan, context); - assertThat(updated).isFalse(); - assertThat(issue.currentChange()).isNull(); - assertThat(issue.mustSendNotifications()).isFalse(); - } - @Test public void set_effort_to_fix() { boolean updated = updater.setGap(issue, 3.14, context); diff --git a/sonar-core/src/main/java/org/sonar/core/issue/DefaultActionPlan.java b/sonar-core/src/main/java/org/sonar/core/issue/DefaultActionPlan.java deleted file mode 100644 index 3b60ec123b5..00000000000 --- a/sonar-core/src/main/java/org/sonar/core/issue/DefaultActionPlan.java +++ /dev/null @@ -1,145 +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.core.issue; - -import java.util.Date; -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; -import org.sonar.api.issue.ActionPlan; -import org.sonar.core.util.Uuids; - -public class DefaultActionPlan implements ActionPlan { - - private String key; - private String name; - private String projectKey; - private String description; - private String userLogin; - private String status; - private Date deadLine; - private Date createdAt; - private Date updatedAt; - - public DefaultActionPlan() { - - } - - public static DefaultActionPlan create(String name) { - DefaultActionPlan actionPlan = new DefaultActionPlan(); - actionPlan.setKey(Uuids.create()); - Date now = new Date(); - actionPlan.setName(name); - actionPlan.setStatus(ActionPlan.STATUS_OPEN); - actionPlan.setCreatedAt(now).setUpdatedAt(now); - return actionPlan; - } - - @Override - public String key() { - return key; - } - - public DefaultActionPlan setKey(String key) { - this.key = key; - return this; - } - - @Override - public String name() { - return name; - } - - public DefaultActionPlan setName(String name) { - this.name = name; - return this; - } - - @Override - public String projectKey() { - return projectKey; - } - - public DefaultActionPlan setProjectKey(String projectKey) { - this.projectKey = projectKey; - return this; - } - - @Override - @CheckForNull - public String description() { - return description; - } - - public DefaultActionPlan setDescription(@Nullable String description) { - this.description = description; - return this; - } - - @Override - public String userLogin() { - return userLogin; - } - - public DefaultActionPlan setUserLogin(String userLogin) { - this.userLogin = userLogin; - return this; - } - - @Override - public String status() { - return status; - } - - public DefaultActionPlan setStatus(String status) { - this.status = status; - return this; - } - - @Override - @CheckForNull - public Date deadLine() { - return deadLine != null ? new Date(deadLine.getTime()) : null; - } - - public DefaultActionPlan setDeadLine(@Nullable Date deadLine) { - this.deadLine = deadLine != null ? new Date(deadLine.getTime()) : null; - return this; - } - - @Override - public Date createdAt() { - return createdAt; - } - - public DefaultActionPlan setCreatedAt(Date createdAt) { - this.createdAt = createdAt; - return this; - } - - @Override - public Date updatedAt() { - return updatedAt; - } - - public DefaultActionPlan setUpdatedAt(Date updatedAt) { - this.updatedAt = updatedAt; - return this; - } -} diff --git a/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java b/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java index 37eebd3f91b..aa56371cb11 100644 --- a/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java +++ b/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java @@ -80,7 +80,6 @@ public class DefaultIssue implements Issue, Trackable, org.sonar.api.ce.measure. private String checksum; private Map attributes = null; private String authorLogin = null; - private String actionPlanKey; private List comments = null; private Set tags = null; // temporarily an Object as long as DefaultIssue is used by sonar-batch @@ -507,12 +506,8 @@ public class DefaultIssue implements Issue, Trackable, org.sonar.api.ce.measure. @Override @CheckForNull public String actionPlanKey() { - return actionPlanKey; - } - - public DefaultIssue setActionPlanKey(@Nullable String actionPlanKey) { - this.actionPlanKey = actionPlanKey; - return this; + // In 5.5, action plan is dropped. + return null; } public DefaultIssue setFieldChange(IssueChangeContext context, String field, @Nullable Serializable oldValue, @Nullable Serializable newValue) { diff --git a/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueTest.java b/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueTest.java index 2dc8be7b155..a98373af68c 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueTest.java @@ -51,7 +51,6 @@ public class DefaultIssueTest { .setLine(7) .setGap(1.2d) .setEffort(Duration.create(28800L)) - .setActionPlanKey("BCDE") .setStatus(Issue.STATUS_CLOSED) .setResolution(Issue.RESOLUTION_FIXED) .setReporter("simon") @@ -79,7 +78,6 @@ public class DefaultIssueTest { assertThat(issue.line()).isEqualTo(7); assertThat(issue.effortToFix()).isEqualTo(1.2d); assertThat(issue.debt()).isEqualTo(Duration.create(28800L)); - assertThat(issue.actionPlanKey()).isEqualTo("BCDE"); assertThat(issue.status()).isEqualTo(Issue.STATUS_CLOSED); assertThat(issue.resolution()).isEqualTo(Issue.RESOLUTION_FIXED); assertThat(issue.reporter()).isEqualTo("simon"); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/ActionPlan.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/ActionPlan.java deleted file mode 100644 index b1db0c01563..00000000000 --- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/ActionPlan.java +++ /dev/null @@ -1,58 +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.api.issue; - -import javax.annotation.CheckForNull; - -import java.io.Serializable; -import java.util.Date; - -/** - * @since 3.6 - */ -public interface ActionPlan extends Serializable { - - String STATUS_OPEN = "OPEN"; - String STATUS_CLOSED = "CLOSED"; - - /** - * Unique generated key - */ - String key(); - - String name(); - - String projectKey(); - - @CheckForNull - String description(); - - String userLogin(); - - String status(); - - @CheckForNull - Date deadLine() ; - - Date createdAt(); - - Date updatedAt(); - -} diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java index 539ad85feef..ce99e1d3c25 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java @@ -176,6 +176,10 @@ public interface Issue extends Serializable { @CheckForNull String authorLogin(); + /** + * @deprecated since 5.5 Action plans are dropped in 5.5. This field has no effect + */ + @Deprecated @CheckForNull String actionPlanKey(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/batch/issue/DeprecatedIssueAdapterForFilterTest.java b/sonar-scanner-engine/src/test/java/org/sonar/batch/issue/DeprecatedIssueAdapterForFilterTest.java index dca0dea2cfe..5baf8932b2a 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/batch/issue/DeprecatedIssueAdapterForFilterTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/batch/issue/DeprecatedIssueAdapterForFilterTest.java @@ -103,13 +103,6 @@ public class DeprecatedIssueAdapterForFilterTest { assertThat(e).isExactlyInstanceOf(UnsupportedOperationException.class).hasMessage("Not available for issues filters"); } - try { - issue.actionPlanKey(); - fail("Should be unsupported"); - } catch (Exception e) { - assertThat(e).isExactlyInstanceOf(UnsupportedOperationException.class).hasMessage("Not available for issues filters"); - } - try { issue.comments(); fail("Should be unsupported"); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/batch/issue/TrackedIssueAdapterTest.java b/sonar-scanner-engine/src/test/java/org/sonar/batch/issue/TrackedIssueAdapterTest.java index 11fc560b318..d1a9a723897 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/batch/issue/TrackedIssueAdapterTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/batch/issue/TrackedIssueAdapterTest.java @@ -65,7 +65,6 @@ public class TrackedIssueAdapterTest { assertThat(issue.updateDate()).isNull(); assertThat(issue.closeDate()).isNull(); assertThat(issue.authorLogin()).isNull(); - assertThat(issue.actionPlanKey()).isNull(); assertThat(issue.comments()).isEmpty(); assertThat(issue.debt()).isNull(); assertThat(issue.projectKey()).isNull(); -- 2.39.5