From 25940a59104e8ac6c170d000b509012c03df90e1 Mon Sep 17 00:00:00 2001 From: lukasz-jarocki-sonarsource Date: Wed, 22 Nov 2023 14:04:35 +0100 Subject: [PATCH] SONAR-20870 improving webapi changelog and description to correctly indicate deprecated transitions --- .../AnticipatedTransitionsActionIT.java | 2 +- .../java/org/sonar/server/issue/ws/BulkChangeAction.java | 7 +++++-- .../java/org/sonar/server/issue/ws/DoTransitionAction.java | 3 ++- .../AnticipatedTransitionsAction.java | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/issue/ws/anticipatedtransition/AnticipatedTransitionsActionIT.java b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/issue/ws/anticipatedtransition/AnticipatedTransitionsActionIT.java index 8dee07a4aa7..29c86658cd9 100644 --- a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/issue/ws/anticipatedtransition/AnticipatedTransitionsActionIT.java +++ b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/issue/ws/anticipatedtransition/AnticipatedTransitionsActionIT.java @@ -72,7 +72,7 @@ public class AnticipatedTransitionsActionIT { assertThat(definition.description()).isEqualTo(""" Receive a list of anticipated transitions that can be applied to not yet discovered issues on a specific project.
Requires the following permission: 'Administer Issues' on the specified project.
- Only falsepositive and wontfix transitions are supported.
+ Only falsepositive, wontfix and accept transitions are supported.
Upon successful execution, the HTTP status code returned is 202 (Accepted).

Request example:
[
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/BulkChangeAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/BulkChangeAction.java
index 2b808158f3a..70f0939263b 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/BulkChangeAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/BulkChangeAction.java
@@ -82,10 +82,12 @@ import static java.util.Objects.requireNonNull;
 import static java.util.function.Function.identity;
 import static java.util.stream.Collectors.toMap;
 import static org.sonar.api.issue.DefaultTransitions.ACCEPT;
+import static org.sonar.api.issue.DefaultTransitions.CONFIRM;
 import static org.sonar.api.issue.DefaultTransitions.OPEN_AS_VULNERABILITY;
 import static org.sonar.api.issue.DefaultTransitions.REOPEN;
 import static org.sonar.api.issue.DefaultTransitions.RESOLVE_AS_REVIEWED;
 import static org.sonar.api.issue.DefaultTransitions.SET_AS_IN_REVIEW;
+import static org.sonar.api.issue.DefaultTransitions.UNCONFIRM;
 import static org.sonar.api.issue.DefaultTransitions.WONT_FIX;
 import static org.sonar.api.rule.Severity.BLOCKER;
 import static org.sonar.api.rules.RuleType.BUG;
@@ -153,8 +155,9 @@ public class BulkChangeAction implements IssuesWsAction {
         "Requires authentication.")
       .setSince("3.7")
       .setChangelog(
-        new Change("10.4", "Transition '%s' is now deprecated. Use transition '%s' instead.".formatted(WONT_FIX, ACCEPT)),
-        new Change("10.4", "Transition  '%s' is now supported.".formatted(ACCEPT)),
+        new Change("10.4", ("Transitions '%s' and '%s' are now deprecated. Use transition '%s' instead. " +
+          "The transition '%s' is deprecated too.").formatted(WONT_FIX, CONFIRM, ACCEPT, UNCONFIRM)),
+        new Change("10.4", "Transition '%s' is now supported.".formatted(ACCEPT)),
         new Change("10.2", format("Parameters '%s' and '%s' are now deprecated.", PARAM_SET_SEVERITY, PARAM_SET_TYPE)),
         new Change("8.2", "Security hotspots are no longer supported and will be ignored."),
         new Change("8.2", format("Transitions '%s', '%s' and '%s' are no more supported", SET_AS_IN_REVIEW, RESOLVE_AS_REVIEWED, OPEN_AS_VULNERABILITY)),
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/DoTransitionAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/DoTransitionAction.java
index a98e38aa480..06359bf69ee 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/DoTransitionAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/DoTransitionAction.java
@@ -84,7 +84,8 @@ public class DoTransitionAction implements IssuesWsAction {
         """.formatted(DefaultTransitions.ACCEPT, DefaultTransitions.WONT_FIX, DefaultTransitions.FALSE_POSITIVE))
       .setSince("3.6")
       .setChangelog(
-        new Change("10.4", "The transition '%s' is deprecated. Please use '%s' instead.".formatted(DefaultTransitions.WONT_FIX, DefaultTransitions.ACCEPT)),
+        new Change("10.4", "The transitions '%s' and '%s' are deprecated. Please use '%s' instead. The transition '%s' is deprecated too. "
+          .formatted(DefaultTransitions.WONT_FIX, DefaultTransitions.CONFIRM, DefaultTransitions.ACCEPT, DefaultTransitions.UNCONFIRM)),
         new Change("10.4", "Add transition '%s'.".formatted(DefaultTransitions.ACCEPT)),
         new Change("10.4", "The response fields 'status' and 'resolution' are deprecated. Please use 'issueStatus' instead."),
         new Change("10.4", "Add 'issueStatus' field to the response."),
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/anticipatedtransition/AnticipatedTransitionsAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/anticipatedtransition/AnticipatedTransitionsAction.java
index 6177c174df6..4f1795b415f 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/anticipatedtransition/AnticipatedTransitionsAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/anticipatedtransition/AnticipatedTransitionsAction.java
@@ -54,7 +54,7 @@ public class AnticipatedTransitionsAction implements IssuesWsAction {
       .setDescription("""
       Receive a list of anticipated transitions that can be applied to not yet discovered issues on a specific project.
Requires the following permission: 'Administer Issues' on the specified project.
- Only falsepositive and wontfix transitions are supported.
+ Only falsepositive, wontfix and accept transitions are supported.
Upon successful execution, the HTTP status code returned is 202 (Accepted).

Request example:
[
-- 
2.39.5