]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-11476 deprecate/drop support for providing module/dir keys as parameters to WS
authorMichal Duda <michal.duda@sonarsource.com>
Fri, 16 Nov 2018 15:41:05 +0000 (16:41 +0100)
committersonartech <sonartech@sonarsource.com>
Wed, 16 Jan 2019 08:43:01 +0000 (09:43 +0100)
33 files changed:
server/sonar-server/src/main/java/org/sonar/server/batch/IssuesAction.java
server/sonar-server/src/main/java/org/sonar/server/batch/ProjectAction.java
server/sonar-server/src/main/java/org/sonar/server/ce/ws/ActivityAction.java
server/sonar-server/src/main/java/org/sonar/server/ce/ws/ActivityStatusAction.java
server/sonar-server/src/main/java/org/sonar/server/ce/ws/AnalysisStatusAction.java
server/sonar-server/src/main/java/org/sonar/server/ce/ws/ComponentAction.java
server/sonar-server/src/main/java/org/sonar/server/component/ws/AppAction.java
server/sonar-server/src/main/java/org/sonar/server/component/ws/SearchAction.java
server/sonar-server/src/main/java/org/sonar/server/component/ws/ShowAction.java
server/sonar-server/src/main/java/org/sonar/server/component/ws/SuggestionCategory.java
server/sonar-server/src/main/java/org/sonar/server/component/ws/SuggestionsAction.java
server/sonar-server/src/main/java/org/sonar/server/component/ws/TreeAction.java
server/sonar-server/src/main/java/org/sonar/server/favorite/ws/AddAction.java
server/sonar-server/src/main/java/org/sonar/server/favorite/ws/RemoveAction.java
server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAction.java
server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentAction.java
server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeAction.java
server/sonar-server/src/main/java/org/sonar/server/measure/ws/SearchHistoryAction.java
server/sonar-server/src/main/java/org/sonar/server/setting/ws/ListDefinitionsAction.java
server/sonar-server/src/main/java/org/sonar/server/setting/ws/ResetAction.java
server/sonar-server/src/main/java/org/sonar/server/setting/ws/SetAction.java
server/sonar-server/src/main/java/org/sonar/server/setting/ws/ValuesAction.java
server/sonar-server/src/main/java/org/sonar/server/ui/ws/ComponentAction.java
server/sonar-server/src/main/java/org/sonar/server/ws/WsUtils.java
server/sonar-server/src/main/resources/org/sonar/server/component/ws/search-components-example.json
server/sonar-server/src/main/resources/org/sonar/server/component/ws/suggestions-example.json
server/sonar-server/src/test/java/org/sonar/server/component/ws/SearchActionTest.java
server/sonar-server/src/test/java/org/sonar/server/component/ws/ShowActionTest.java
server/sonar-server/src/test/java/org/sonar/server/component/ws/SuggestionsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/component/ws/TreeActionTest.java
server/sonar-server/src/test/java/org/sonar/server/ui/ws/ComponentActionTest.java
server/sonar-server/src/test/resources/org/sonar/server/ui/ws/ComponentActionTest/return_breadcrumbs_on_module.json [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/navigation/ComponentRequest.java

index 9877b755b25c7e1e26cd7d296d6b7bd0b2660976..bb6af68da8d5269396d70b7867d3bc77f7617e07 100644 (file)
 package org.sonar.server.batch;
 
 import com.google.common.base.Splitter;
-
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
-
 import org.sonar.api.resources.Scopes;
 import org.sonar.api.rules.RuleType;
+import org.sonar.api.server.ws.Change;
 import org.sonar.api.server.ws.Request;
 import org.sonar.api.server.ws.Response;
 import org.sonar.api.server.ws.WebService;
@@ -74,6 +73,7 @@ public class IssuesAction implements BatchWsAction {
       .setDescription("Return open issues")
       .setResponseExample(getClass().getResource("issues-example.proto"))
       .setSince("5.1")
+      .setChangelog(new Change("7.6", String.format("The use of module keys in parameter '%s' is deprecated", PARAM_KEY)))
       .setInternal(true)
       .setHandler(this);
 
index b15b8b76a63db2aac0a611507964fa687b57e7fc..2d6439ec78bdb3e91b40f2fbcac500f6411265bd 100644 (file)
@@ -22,6 +22,7 @@ package org.sonar.server.batch;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
+import org.sonar.api.server.ws.Change;
 import org.sonar.api.server.ws.Request;
 import org.sonar.api.server.ws.Response;
 import org.sonar.api.server.ws.WebService;
@@ -56,6 +57,8 @@ public class ProjectAction implements BatchWsAction {
       .setDescription("Return project repository")
       .setResponseExample(getClass().getResource("project-example.json"))
       .setSince("4.5")
+      .setChangelog(new Change("7.6", String.format("The use of module keys in parameter '%s' is deprecated", PARAM_KEY)))
+      .setChangelog(new Change("7.6", "Stop returning settings"))
       .setInternal(true)
       .setHandler(this);
 
index 3928e8865c82ba5c376e7699dc84b3088cb2dd2c..c956af8c87d4316e70a9497600620c8e0aa4714f 100644 (file)
@@ -56,6 +56,7 @@ import static java.util.Arrays.asList;
 import static java.util.Collections.emptyList;
 import static java.util.Collections.singletonList;
 import static org.apache.commons.lang.StringUtils.defaultString;
+import static org.sonar.api.server.ws.WebService.Param.TEXT_QUERY;
 import static org.sonar.api.utils.DateUtils.parseEndingDateOrDateTime;
 import static org.sonar.api.utils.DateUtils.parseStartingDateOrDateTime;
 import static org.sonar.core.util.stream.MoreCollectors.toList;
@@ -103,7 +104,8 @@ public class ActivityAction implements CeWsAction {
         new Change("5.5", "it's no more possible to specify the page parameter."),
         new Change("6.1", "field \"logs\" is deprecated and its value is always false"),
         new Change("6.6", "fields \"branch\" and \"branchType\" added"),
-        new Change("7.1", "field \"pullRequest\" added"))
+        new Change("7.1", "field \"pullRequest\" added"),
+        new Change("7.6", String.format("The use of module keys in parameters '%s' and '%s' is deprecated", TEXT_QUERY, PARAM_COMPONENT_QUERY)))
       .setSince("5.2");
 
     action.createParam(PARAM_COMPONENT_ID)
@@ -115,10 +117,10 @@ public class ActivityAction implements CeWsAction {
         "<li>component keys that are exactly the same as the supplied string</li>" +
         "</ul>" +
         "Must not be set together with %s.<br />" +
-        "Deprecated and replaced by '%s'", PARAM_COMPONENT_ID, Param.TEXT_QUERY))
+        "Deprecated and replaced by '%s'", PARAM_COMPONENT_ID, TEXT_QUERY))
       .setExampleValue("Apache")
       .setDeprecatedSince("5.5");
-    action.createParam(Param.TEXT_QUERY)
+    action.createParam(TEXT_QUERY)
       .setDescription(format("Limit search to: <ul>" +
         "<li>component names that contain the supplied string</li>" +
         "<li>component keys that are exactly the same as the supplied string</li>" +
@@ -288,7 +290,7 @@ public class ActivityAction implements CeWsAction {
   private static Request toSearchWsRequest(org.sonar.api.server.ws.Request request) {
     Request activityWsRequest = new Request()
       .setComponentId(request.param(PARAM_COMPONENT_ID))
-      .setQ(defaultString(request.param(Param.TEXT_QUERY), request.param(PARAM_COMPONENT_QUERY)))
+      .setQ(defaultString(request.param(TEXT_QUERY), request.param(PARAM_COMPONENT_QUERY)))
       .setStatus(request.paramAsStrings(PARAM_STATUS))
       .setType(request.param(PARAM_TYPE))
       .setMinSubmittedAt(request.param(PARAM_MIN_SUBMITTED_AT))
index 42489f781ab85f5075342d91d93ba14205e16525..f004c9bafb24de267c46c759a92fee8c62676867 100644 (file)
@@ -35,10 +35,10 @@ import org.sonar.server.user.UserSession;
 import org.sonar.server.ws.KeyExamples;
 import org.sonarqube.ws.Ce.ActivityStatusWsResponse;
 
-import static org.sonar.server.component.ComponentFinder.ParamNames.COMPONENT_ID_AND_KEY;
-import static org.sonar.server.ws.WsUtils.writeProtobuf;
 import static org.sonar.server.ce.ws.CeWsParameters.DEPRECATED_PARAM_COMPONENT_KEY;
 import static org.sonar.server.ce.ws.CeWsParameters.PARAM_COMPONENT_ID;
+import static org.sonar.server.component.ComponentFinder.ParamNames.COMPONENT_ID_AND_KEY;
+import static org.sonar.server.ws.WsUtils.writeProtobuf;
 
 public class ActivityStatusAction implements CeWsAction {
   private final UserSession userSession;
@@ -66,6 +66,7 @@ public class ActivityStatusAction implements CeWsAction {
       .setDescription("Id of the component (project) to filter on")
       .setExampleValue(Uuids.UUID_EXAMPLE_03);
     action.createParam(DEPRECATED_PARAM_COMPONENT_KEY)
+      .setDeprecatedSince("6.6")
       .setDescription("Key of the component (project) to filter on")
       .setExampleValue(KeyExamples.KEY_PROJECT_EXAMPLE_001);
 
index fa1b559be7e0644ae4ea720bd272cf4e8fe16756..cc2a0e52b11a735bed49b5f2f9ccf96e5b1f47f2 100644 (file)
@@ -74,13 +74,11 @@ public class AnalysisStatusAction implements CeWsAction {
 
     action.createParam(PARAM_BRANCH)
       .setDescription("Branch key")
-      .setExampleValue(KEY_BRANCH_EXAMPLE_001)
-      .setInternal(true);
+      .setExampleValue(KEY_BRANCH_EXAMPLE_001);
 
     action.createParam(PARAM_PULL_REQUEST)
       .setDescription("Pull request id")
-      .setExampleValue(KEY_PULL_REQUEST_EXAMPLE_001)
-      .setInternal(true);
+      .setExampleValue(KEY_PULL_REQUEST_EXAMPLE_001);
   }
 
   @Override
index 053324f16bebae08bff995ceb7663daa8d26b22e..a65b310c0e5e2120ea1895cea08418ee50cb8c44 100644 (file)
@@ -70,7 +70,8 @@ public class ComponentAction implements CeWsAction {
       .setResponseExample(getClass().getResource("component-example.json"))
       .setChangelog(
         new Change("6.1", "field \"logs\" is deprecated and its value is always false"),
-        new Change("6.6", "fields \"branch\" and \"branchType\" added"))
+        new Change("6.6", "fields \"branch\" and \"branchType\" added"),
+        new Change("7.6", String.format("The use of module keys in parameter \"%s\" is deprecated", PARAM_COMPONENT)))
       .setHandler(this);
 
     action.createParam(PARAM_COMPONENT_ID)
index 16708c7ff12f0d9216bf5d8015aeed41248c43a6..0fa020790cd81cc1ed2ca6262a67fb9782bdb6f6 100644 (file)
@@ -27,6 +27,7 @@ import javax.annotation.CheckForNull;
 import javax.annotation.Nullable;
 import org.apache.commons.lang.BooleanUtils;
 import org.sonar.api.measures.Metric;
+import org.sonar.api.server.ws.Change;
 import org.sonar.api.server.ws.Request;
 import org.sonar.api.server.ws.Response;
 import org.sonar.api.server.ws.WebService;
@@ -92,6 +93,7 @@ public class AppAction implements ComponentsWsAction {
         "Requires the following permission: 'Browse'.")
       .setResponseExample(getClass().getResource("app-example.json"))
       .setSince("4.4")
+      .setChangelog(new Change("7.6", String.format("The use of module keys in parameter '%s' is deprecated", PARAM_COMPONENT)))
       .setInternal(true)
       .setHandler(this);
 
index 443dccff7b12ca6e1c93f8dd9539cbaf3b06bb4e..22a67cb3c45f4f3a79d7e2892d622261c614c136 100644 (file)
@@ -23,10 +23,12 @@ import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
+import java.util.stream.Collectors;
 import javax.annotation.CheckForNull;
 import javax.annotation.Nullable;
 import org.sonar.api.i18n.I18n;
 import org.sonar.api.resources.Languages;
+import org.sonar.api.resources.Qualifiers;
 import org.sonar.api.resources.ResourceTypes;
 import org.sonar.api.server.ws.Response;
 import org.sonar.api.server.ws.WebService;
@@ -70,7 +72,7 @@ public class SearchAction implements ComponentsWsAction {
   private final DefaultOrganizationProvider defaultOrganizationProvider;
 
   public SearchAction(ComponentIndex componentIndex, DbClient dbClient, ResourceTypes resourceTypes, I18n i18n, Languages languages,
-                      DefaultOrganizationProvider defaultOrganizationProvider) {
+    DefaultOrganizationProvider defaultOrganizationProvider) {
     this.componentIndex = componentIndex;
     this.dbClient = dbClient;
     this.resourceTypes = resourceTypes;
@@ -146,7 +148,11 @@ public class SearchAction implements ComponentsWsAction {
     Set<String> projectUuidsToSearch = components.stream()
       .map(ComponentDto::projectUuid)
       .collect(toHashSet());
-    List<ComponentDto> projects = dbClient.componentDao().selectByUuids(dbSession, projectUuidsToSearch);
+    List<ComponentDto> projects = dbClient.componentDao()
+      .selectByUuids(dbSession, projectUuidsToSearch)
+      .stream()
+      .filter(c -> !c.qualifier().equals(Qualifiers.MODULE))
+      .collect(Collectors.toList());
     return projects.stream().collect(toMap(ComponentDto::uuid, ComponentDto::getDbKey));
   }
 
@@ -267,5 +273,4 @@ public class SearchAction implements ComponentsWsAction {
     }
   }
 
-
 }
index 9d640bb7fe3e13a7166d6c212e6ead3833e12bb5..5fa70c2056a182366ccc50d416f263507d55221f 100644 (file)
@@ -80,7 +80,8 @@ public class ShowAction implements ComponentsWsAction {
         new Change("6.4", "The 'visibility' field is added to the response"),
         new Change("6.5", "Leak period date is added to the response"),
         new Change("6.6", "'branch' is added to the response"),
-        new Change("6.6", "'version' is added to the response"))
+        new Change("6.6", "'version' is added to the response"),
+        new Change("7.6", String.format("The use of module keys in parameter '%s' is deprecated", PARAM_COMPONENT)))
       .setHandler(this);
 
     action.createParam(PARAM_COMPONENT_ID)
@@ -136,7 +137,7 @@ public class ShowAction implements ComponentsWsAction {
     if (branch == null && pullRequest == null) {
       return componentFinder.getByUuidOrKey(dbSession, componentId, componentKey, COMPONENT_ID_AND_COMPONENT);
     }
-    checkRequest(componentKey!=null, "The '%s' parameter is missing", PARAM_COMPONENT);
+    checkRequest(componentKey != null, "The '%s' parameter is missing", PARAM_COMPONENT);
     return componentFinder.getByKeyAndOptionalBranchOrPullRequest(dbSession, componentKey, branch, pullRequest);
   }
 
index 85db65351994eaae70c2b2b2f69957f0cea43937..bf79215625cf1243d7db8ba558bdfd0e85f777a6 100644 (file)
@@ -28,7 +28,6 @@ public enum SuggestionCategory {
   SUBVIEW(Qualifiers.SUBVIEW),
   APP(Qualifiers.APP),
   PROJECT(Qualifiers.PROJECT),
-  MODULE(Qualifiers.MODULE),
   FILE(Qualifiers.FILE),
   UNIT_TEST_FILE(Qualifiers.UNIT_TEST_FILE),;
 
index 7d7093ee2f21c1bd7548fbc4ed6f9533a2a019a1..6970e47e63d30e747594c1cff4ac291748dfaac2 100644 (file)
@@ -85,7 +85,7 @@ public class SuggestionsAction implements ComponentsWsAction {
   private static final int MAXIMUM_RECENTLY_BROWSED = 50;
 
   private static final int EXTENDED_LIMIT = 20;
-  private static final Set<String> QUALIFIERS_FOR_WHICH_TO_RETURN_PROJECT = Stream.of(Qualifiers.MODULE, Qualifiers.FILE, Qualifiers.UNIT_TEST_FILE).collect(Collectors.toSet());
+  private static final Set<String> QUALIFIERS_FOR_WHICH_TO_RETURN_PROJECT = Stream.of(Qualifiers.FILE, Qualifiers.UNIT_TEST_FILE).collect(Collectors.toSet());
 
   private final ComponentIndex index;
   private final FavoriteFinder favoriteFinder;
@@ -255,7 +255,10 @@ public class SuggestionsAction implements ComponentsWsAction {
   }
 
   private List<String> getQualifiers(@Nullable String more) {
-    Set<String> availableQualifiers = resourceTypes.getAll().stream().map(ResourceType::getQualifier).collect(MoreCollectors.toSet());
+    Set<String> availableQualifiers = resourceTypes.getAll().stream()
+      .map(ResourceType::getQualifier)
+      .filter(q -> !q.equals(Qualifiers.MODULE))
+      .collect(MoreCollectors.toSet());
     if (more == null) {
       return stream(SuggestionCategory.values())
         .map(SuggestionCategory::getQualifier)
index aac928275ddc785065316634cf45962fa67ff9e5..179d3a33552353ee635eb2ae9803e9f09f44bdf4 100644 (file)
@@ -31,9 +31,11 @@ import java.util.Map;
 import java.util.Objects;
 import java.util.Optional;
 import java.util.Set;
+import java.util.stream.Collectors;
 import javax.annotation.CheckForNull;
 import javax.annotation.Nullable;
 import org.sonar.api.i18n.I18n;
+import org.sonar.api.resources.Qualifiers;
 import org.sonar.api.resources.ResourceTypes;
 import org.sonar.api.server.ws.Change;
 import org.sonar.api.server.ws.Response;
@@ -120,7 +122,8 @@ public class TreeAction implements ComponentsWsAction {
       .setSince("5.4")
       .setResponseExample(getClass().getResource("tree-example.json"))
       .setChangelog(
-        new Change("6.4", "The field 'id' is deprecated in the response"))
+        new Change("6.4", "The field 'id' is deprecated in the response"),
+        new Change("7.6", String.format("The use of module keys in parameter '%s' is deprecated", PARAM_COMPONENT)))
       .setHandler(this)
       .addPagingParams(100, MAX_SIZE);
 
@@ -185,7 +188,10 @@ public class TreeAction implements ComponentsWsAction {
       OrganizationDto organizationDto = componentFinder.getOrganization(dbSession, baseComponent);
 
       ComponentTreeQuery query = toComponentTreeQuery(treeRequest, baseComponent);
-      List<ComponentDto> components = dbClient.componentDao().selectDescendants(dbSession, query);
+      List<ComponentDto> components = dbClient.componentDao().selectDescendants(dbSession, query)
+        .stream()
+        .filter(c -> !c.qualifier().equals(Qualifiers.MODULE))
+        .collect(Collectors.toList());
       int total = components.size();
       components = sortComponents(components, treeRequest);
       components = paginateComponents(components, treeRequest);
index 56f5447be66d05e0dc565c4ce972e8e216b61927..d8edb28f307185d164d86d459e3207a322af7aa4 100644 (file)
@@ -20,6 +20,7 @@
 package org.sonar.server.favorite.ws;
 
 import java.util.function.Consumer;
+import org.sonar.api.server.ws.Change;
 import org.sonar.api.server.ws.Request;
 import org.sonar.api.server.ws.Response;
 import org.sonar.api.server.ws.WebService;
@@ -53,10 +54,11 @@ public class AddAction implements FavoritesWsAction {
       .setDescription("Add a component (project, directory, file etc.) as favorite for the authenticated user.<br>" +
         "Requires authentication and the following permission: 'Browse' on the project of the specified component.")
       .setSince("6.3")
+      .setChangelog(new Change("7.6", String.format("The use of module keys in parameter '%s' is deprecated", PARAM_COMPONENT)))
       .setPost(true)
       .setHandler(this);
 
-    action.createParam("component")
+    action.createParam(PARAM_COMPONENT)
       .setDescription("Component key")
       .setRequired(true)
       .setExampleValue(KeyExamples.KEY_FILE_EXAMPLE_001);
index 25cea3dcea39bda18f28539522c89cca2838c671..1e93b6a18dfdab1d872422ee5970c6a22ddf89a6 100644 (file)
@@ -20,6 +20,7 @@
 package org.sonar.server.favorite.ws;
 
 import java.util.function.Consumer;
+import org.sonar.api.server.ws.Change;
 import org.sonar.api.server.ws.Request;
 import org.sonar.api.server.ws.Response;
 import org.sonar.api.server.ws.WebService;
@@ -52,10 +53,11 @@ public class RemoveAction implements FavoritesWsAction {
       .setDescription("Remove a component (project, directory, file etc.) as favorite for the authenticated user.<br>" +
         "Requires authentication.")
       .setSince("6.3")
+      .setChangelog(new Change("7.6", String.format("The use of module keys in parameter '%s' is deprecated", PARAM_COMPONENT)))
       .setPost(true)
       .setHandler(this);
 
-    action.createParam("component")
+    action.createParam(PARAM_COMPONENT)
       .setDescription("Component key")
       .setRequired(true)
       .setExampleValue(KeyExamples.KEY_PROJECT_EXAMPLE_001);
index 04366cad1ea1d7f11061d0b14710a0b3a135f5e9..523c462c4fc7afbc214d718338d23ff13d4b087c 100644 (file)
@@ -73,12 +73,12 @@ import static org.sonar.process.ProcessProperties.Property.SONARCLOUD_ENABLED;
 import static org.sonar.server.es.SearchOptions.MAX_LIMIT;
 import static org.sonar.server.issue.index.IssueIndex.FACET_ASSIGNED_TO_ME;
 import static org.sonar.server.issue.index.IssueIndex.FACET_PROJECTS;
+import static org.sonar.server.issue.index.IssueQuery.SORT_BY_ASSIGNEE;
+import static org.sonar.server.issue.index.IssueQueryFactory.UNKNOWN;
 import static org.sonar.server.issue.index.SecurityStandardHelper.SANS_TOP_25_INSECURE_INTERACTION;
 import static org.sonar.server.issue.index.SecurityStandardHelper.SANS_TOP_25_POROUS_DEFENSES;
 import static org.sonar.server.issue.index.SecurityStandardHelper.SANS_TOP_25_RISKY_RESOURCE;
 import static org.sonar.server.issue.index.SecurityStandardHelper.UNKNOWN_STANDARD;
-import static org.sonar.server.issue.index.IssueQuery.SORT_BY_ASSIGNEE;
-import static org.sonar.server.issue.index.IssueQueryFactory.UNKNOWN;
 import static org.sonar.server.ws.KeyExamples.KEY_BRANCH_EXAMPLE_001;
 import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
 import static org.sonar.server.ws.KeyExamples.KEY_PULL_REQUEST_EXAMPLE_001;
@@ -190,6 +190,7 @@ public class SearchAction implements IssuesWsAction, Startable {
         PARAM_COMPONENT_KEYS, PARAM_COMPONENT_UUIDS, PARAM_COMPONENTS, PARAM_COMPONENT_ROOT_UUIDS, PARAM_COMPONENT_ROOTS)
       .setSince("3.6")
       .setChangelog(
+        new Change("7.6", String.format("The use of module keys in parameter '%s' is deprecated", PARAM_COMPONENT_KEYS)),
         new Change("7.4", "The facet 'projectUuids' is dropped in favour of the new facet 'projects'. " +
           "Note that they are not strictly identical, the latter returns the project keys."),
         new Change("7.4", format("Parameter '%s' does not accept anymore deprecated value 'debt'", FACET_MODE)),
@@ -340,6 +341,7 @@ public class SearchAction implements IssuesWsAction, Startable {
       .setDescription("To retrieve issues associated to a specific list of modules (comma-separated list of module IDs). " +
         INTERNAL_PARAMETER_DISCLAIMER)
       .setInternal(true)
+      .setDeprecatedSince("7.6")
       .setExampleValue("7d8749e8-3070-4903-9188-bdd82933bb92");
 
     action.createParam(PARAM_DIRECTORIES)
index 349d67fe220ed354adcc4865a27b934ad1313188..d0dd316830c27883913682ae10202d2073038859 100644 (file)
@@ -105,6 +105,7 @@ public class ComponentAction implements MeasuresWsAction {
       .setResponseExample(getClass().getResource("component-example.json"))
       .setSince("5.4")
       .setChangelog(
+        new Change("7.6", String.format("The use of module keys in parameter '%s' is deprecated", PARAM_COMPONENT)),
         new Change("6.6", "the response field id is deprecated. Use key instead."),
         new Change("6.6", "the response field refId is deprecated. Use refKey instead."))
       .setHandler(this);
index cb81a185f7c845502d863e79fbc2966d2286d9b4..0af53195acd140f76bc629ece637335c3ee1598b 100644 (file)
@@ -185,6 +185,7 @@ public class ComponentTreeAction implements MeasuresWsAction {
       .setHandler(this)
       .addPagingParams(100, MAX_SIZE)
       .setChangelog(
+        new Change("7.6", String.format("The use of module keys in parameter '%s' is deprecated", PARAM_COMPONENT)),
         new Change("7.2", "field 'bestValue' is added to the response"),
         new Change("6.3", format("Number of metric keys is limited to %s", MAX_METRIC_KEYS)),
         new Change("6.6", "the response field id is deprecated. Use key instead."),
index 8ea80099c00e1838428cd0350f8c53d23c4df3b6..61e446fbe12c4dd499ba61a55b5d5cb326a2a514 100644 (file)
@@ -27,6 +27,7 @@ import java.util.function.Function;
 import java.util.stream.Stream;
 import javax.annotation.CheckForNull;
 import javax.annotation.Nullable;
+import org.sonar.api.server.ws.Change;
 import org.sonar.api.server.ws.Request;
 import org.sonar.api.server.ws.Response;
 import org.sonar.api.server.ws.WebService;
@@ -88,6 +89,7 @@ public class SearchHistoryAction implements MeasuresWsAction {
         "Requires the following permission: 'Browse' on the specified component")
       .setResponseExample(getClass().getResource("search_history-example.json"))
       .setSince("6.3")
+      .setChangelog(new Change("7.6", String.format("The use of module keys in parameter '%s' is deprecated", PARAM_COMPONENT)))
       .setHandler(this);
 
     action.createParam(PARAM_COMPONENT)
index dc49eb9bd5640803ed67655e498460128bf83954..a629d702b7e3cdfa1a0ae9867020dfc4f39a15a9 100644 (file)
@@ -26,6 +26,7 @@ import javax.annotation.Nullable;
 import org.sonar.api.config.PropertyDefinition;
 import org.sonar.api.config.PropertyDefinitions;
 import org.sonar.api.config.PropertyFieldDefinition;
+import org.sonar.api.server.ws.Change;
 import org.sonar.api.server.ws.Request;
 import org.sonar.api.server.ws.Response;
 import org.sonar.api.server.ws.WebService;
@@ -71,14 +72,15 @@ public class ListDefinitionsAction implements SettingsWsAction {
       .setDescription("List settings definitions.<br>" +
         "Requires 'Browse' permission when a component is specified<br/>" +
         "To access licensed settings, authentication is required<br/>" +
-          "To access secured settings, one of the following permissions is required: " +
-          "<ul>" +
-          "<li>'Execute Analysis'</li>" +
-          "<li>'Administer System'</li>" +
-          "<li>'Administer' rights on the specified component</li>" +
-          "</ul>")
+        "To access secured settings, one of the following permissions is required: " +
+        "<ul>" +
+        "<li>'Execute Analysis'</li>" +
+        "<li>'Administer System'</li>" +
+        "<li>'Administer' rights on the specified component</li>" +
+        "</ul>")
       .setResponseExample(getClass().getResource("list_definitions-example.json"))
       .setSince("6.3")
+      .setChangelog(new Change("7.6", String.format("The use of module keys in parameter '%s' is deprecated", PARAM_COMPONENT)))
       .setHandler(this);
     action.createParam(PARAM_COMPONENT)
       .setDescription("Component key")
index 9c40d3f383d7f0bb63f33e3a82f22778c27fef69..2812c31ff263845fa444670a5eb71e2a641bc088 100644 (file)
@@ -79,7 +79,9 @@ public class ResetAction implements SettingsWsAction {
         "<li>'Administer' rights on the specified component</li>" +
         "</ul>")
       .setSince("6.1")
-      .setChangelog(new Change("7.1", "The settings defined in config/sonar.properties are read-only and can't be changed"))
+      .setChangelog(
+        new Change("7.6", String.format("The use of module keys in parameter '%s' is deprecated", PARAM_COMPONENT)),
+        new Change("7.1", "The settings defined in config/sonar.properties are read-only and can't be changed"))
       .setPost(true)
       .setHandler(this);
 
index be22168c142aba2aa67e53a16905e4f885dc6e24..38991fd6c27d7ebae0dc2d6825b925ba826789d0 100644 (file)
@@ -101,7 +101,7 @@ public class SetAction implements SettingsWsAction {
     WebService.NewAction action = context.createAction("set")
       .setDescription("Update a setting value.<br>" +
         "Either '%s' or '%s' must be provided.<br> " +
-          "The settings defined in config/sonar.properties are read-only and can't be changed.<br/>" +
+        "The settings defined in config/sonar.properties are read-only and can't be changed.<br/>" +
         "Requires one of the following permissions: " +
         "<ul>" +
         "<li>'Administer System'</li>" +
@@ -109,7 +109,9 @@ public class SetAction implements SettingsWsAction {
         "</ul>",
         PARAM_VALUE, PARAM_VALUES)
       .setSince("6.1")
-      .setChangelog(new Change("7.1", "The settings defined in config/sonar.properties are read-only and can't be changed"))
+      .setChangelog(
+        new Change("7.6", String.format("The use of module keys in parameter '%s' is deprecated", PARAM_COMPONENT)),
+        new Change("7.1", "The settings defined in config/sonar.properties are read-only and can't be changed"))
       .setPost(true)
       .setHandler(this);
 
index b276a2d9f22182840b56aa407dde6b381f7cf4ca..c3b0b47cf515f24aa9f87e8cf4ba152892007e79 100644 (file)
@@ -112,7 +112,9 @@ public class ValuesAction implements SettingsWsAction {
         "</ul>")
       .setResponseExample(getClass().getResource("values-example.json"))
       .setSince("6.3")
-      .setChangelog(new Change("7.1", "The settings from conf/sonar.properties are excluded from results."))
+      .setChangelog(
+        new Change("7.6", String.format("The use of module keys in parameter '%s' is deprecated", PARAM_COMPONENT)),
+        new Change("7.1", "The settings from conf/sonar.properties are excluded from results."))
       .setHandler(this);
     action.createParam(PARAM_KEYS)
       .setDescription("List of setting keys")
index a5774c20d38c6c8b915673b5548b78a6b58d4ee9..469ab761b3d9a48864d0b34293cf0a57d07aded9 100644 (file)
@@ -76,6 +76,7 @@ import static org.sonar.server.user.AbstractUserSession.insufficientPrivilegesEx
 import static org.sonar.server.ws.KeyExamples.KEY_BRANCH_EXAMPLE_001;
 import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
 import static org.sonar.server.ws.KeyExamples.KEY_PULL_REQUEST_EXAMPLE_001;
+import static org.sonar.server.ws.WsUtils.checkComponentNotAModuleAndNotADirectory;
 
 public class ComponentAction implements NavigationWsAction {
 
@@ -121,8 +122,9 @@ public class ComponentAction implements NavigationWsAction {
       .setResponseExample(getClass().getResource("component-example.json"))
       .setSince("5.2")
       .setChangelog(
-        new Change("6.4", "The 'visibility' field is added"),
-        new Change("7.3", "The 'almRepoUrl' and 'almId' fields are added"));
+        new Change("7.6", String.format("The use of module keys in parameter '%s' is deprecated", PARAM_COMPONENT)),
+        new Change("7.3", "The 'almRepoUrl' and 'almId' fields are added"),
+        new Change("6.4", "The 'visibility' field is added"));
 
     action.createParam(PARAM_COMPONENT)
       .setDescription("A component key.")
@@ -132,13 +134,11 @@ public class ComponentAction implements NavigationWsAction {
     action
       .createParam(PARAM_BRANCH)
       .setDescription("Branch key")
-      .setInternal(true)
       .setExampleValue(KEY_BRANCH_EXAMPLE_001);
 
     action
       .createParam(PARAM_PULL_REQUEST)
       .setDescription("Pull request id")
-      .setInternal(true)
       .setExampleValue(KEY_PULL_REQUEST_EXAMPLE_001);
   }
 
@@ -149,6 +149,7 @@ public class ComponentAction implements NavigationWsAction {
       String branch = request.param(PARAM_BRANCH);
       String pullRequest = request.param(PARAM_PULL_REQUEST);
       ComponentDto component = componentFinder.getByKeyAndOptionalBranchOrPullRequest(session, componentKey, branch, pullRequest);
+      checkComponentNotAModuleAndNotADirectory(component);
       ComponentDto rootProjectOrBranch = getRootProjectOrBranch(component, session);
       ComponentDto rootProject = rootProjectOrBranch.getMainBranchProjectUuid() == null ? rootProjectOrBranch
         : componentFinder.getByUuid(session, rootProjectOrBranch.getMainBranchProjectUuid());
index 2a198a26b7499cc9218ce4a2e9120033fcd799db..9c144754ba38be9f1ee662415bf7143c4d40b20c 100644 (file)
 package org.sonar.server.ws;
 
 import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableSet;
 import com.google.protobuf.Message;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.util.List;
+import java.util.Set;
 import javax.annotation.Nullable;
 import org.apache.commons.io.IOUtils;
+import org.sonar.api.resources.Qualifiers;
 import org.sonar.api.server.ws.Request;
 import org.sonar.api.server.ws.Response;
 import org.sonar.api.utils.text.JsonWriter;
 import org.sonar.core.util.ProtobufJsonFormat;
+import org.sonar.db.component.ComponentDto;
 import org.sonar.server.exceptions.BadRequestException;
 import org.sonar.server.exceptions.NotFoundException;
 
@@ -40,6 +44,8 @@ import static org.sonarqube.ws.MediaTypes.PROTOBUF;
 
 public class WsUtils {
 
+  private static final Set<String> MODULE_OR_DIR_QUALIFIERS = ImmutableSet.of(Qualifiers.MODULE, Qualifiers.DIRECTORY);
+
   private WsUtils() {
     // only statics
   }
@@ -117,4 +123,8 @@ public class WsUtils {
 
     return value.get();
   }
+
+  public static void checkComponentNotAModuleAndNotADirectory(ComponentDto component) {
+    checkRequest(!MODULE_OR_DIR_QUALIFIERS.contains(component.qualifier()), "Operation not supported for module or directory components");
+  }
 }
index 4811ba96637c706a192ebd1d61cb2fc131e9550a..c717cc3631ea2abd4eb3575e3e0c5b70d4c5b23a 100644 (file)
@@ -2,7 +2,7 @@
   "paging": {
     "pageIndex": 1,
     "pageSize": 100,
-    "total": 4
+    "total": 3
   },
   "components": [
     {
       "language": "java",
       "project": "project-key"
     },
-    {
-      "organization": "my-org-1",
-      "id": "module-uuid",
-      "key": "module-key",
-      "qualifier": "BRC",
-      "name": "Module Name",
-      "project": "project-key"
-    },
     {
       "organization": "my-org-1",
       "id": "project-uuid",
index 3c7bbd4445412248b020dfdfdc0244fbc076a938..48a24e137b79decd64e14cfa196123ae8400d6d2 100644 (file)
       ],
       "more": 0
     },
-    {
-      "q": "BRC",
-      "items": [],
-      "more": 0
-    },
     {
       "q": "FIL",
       "items": [],
index 3a968673e60c8d06bb096dbece588e84d037aabc..8838d5cdda7c6cf11547362da240fe4abfd3aa9a 100644 (file)
@@ -266,7 +266,7 @@ public class SearchActionTest {
     String response = ws.newRequest()
       .setMediaType(MediaTypes.JSON)
       .setParam(PARAM_ORGANIZATION, organizationDto.getKey())
-      .setParam(PARAM_QUALIFIERS, Joiner.on(",").join(PROJECT, MODULE, DIRECTORY, FILE))
+      .setParam(PARAM_QUALIFIERS, Joiner.on(",").join(PROJECT, DIRECTORY, FILE))
       .execute().getInput();
     assertJson(response).isSimilarTo(ws.getDef().responseExampleAsString());
   }
index 0053e1a5d4d46aedc7a03bc9007409aac0d99216..cfffc69da66dbe17a760afa41f8ce83bea25fa09 100644 (file)
@@ -81,7 +81,8 @@ public class ShowActionTest {
       tuple("6.4", "The 'visibility' field is added to the response"),
       tuple("6.5", "Leak period date is added to the response"),
       tuple("6.6", "'branch' is added to the response"),
-      tuple("6.6", "'version' is added to the response"));
+      tuple("6.6", "'version' is added to the response"),
+      tuple("7.6", "The use of module keys in parameter 'component' is deprecated"));
     assertThat(action.params()).extracting(WebService.Param::key).containsExactlyInAnyOrder("component", "componentId", "branch", "pullRequest");
 
     WebService.Param componentId = action.param(PARAM_COMPONENT_ID);
index a98c328f65b9a3d8bb4d31d39ff654556328670f..f1348372ef2733ad69a602696bf1c08954208a33 100644 (file)
@@ -347,7 +347,8 @@ public class SuggestionsActionTest {
 
     assertThat(response.getResultsList())
       .extracting(Category::getQ, Category::getItemsCount)
-      .containsExactlyInAnyOrder(tuple("VW", 0), tuple("APP", 0), tuple("SVW", 0), tuple("TRK", 1), tuple("BRC", 0), tuple("FIL", 0), tuple("UTS", 0));
+      .containsExactlyInAnyOrder(tuple("VW", 0), tuple("APP", 0), tuple("SVW", 0), tuple("TRK", 1), tuple("FIL", 0), tuple("UTS", 0))
+      .doesNotContain(tuple("BRC", 0));
   }
 
   @Test
@@ -364,7 +365,7 @@ public class SuggestionsActionTest {
 
     assertThat(response.getResultsList())
       .extracting(Category::getQ)
-      .containsExactlyInAnyOrder(PROJECT, MODULE, FILE);
+      .containsExactlyInAnyOrder(PROJECT, FILE).doesNotContain(MODULE);
   }
 
   @Test
@@ -503,8 +504,8 @@ public class SuggestionsActionTest {
   }
 
   @Test
-  public void should_contain_project_names() {
-    ComponentDto project = db.components().insertComponent(newPrivateProjectDto(organization));
+  public void should_not_return_modules() {
+    ComponentDto project = db.components().insertComponent(newPrivateProjectDto(organization).setName("ProjectWithModules"));
     db.components().insertComponent(newModuleDto(project).setName("Module1"));
     db.components().insertComponent(newModuleDto(project).setName("Module2"));
     componentIndexer.indexOnAnalysis(project.projectUuid());
@@ -517,18 +518,13 @@ public class SuggestionsActionTest {
 
     assertThat(response.getResultsList())
       .flatExtracting(Category::getItemsList)
-      .extracting(Suggestion::getProject)
+      .extracting(Suggestion::getKey)
       .containsOnly(project.getDbKey());
-
-    assertThat(response.getProjectsList())
-      .extracting(Project::getKey, Project::getName)
-      .containsExactlyInAnyOrder(
-        tuple(project.getDbKey(), project.longName()));
   }
 
   @Test
   public void should_mark_recently_browsed_items() {
-    ComponentDto project = db.components().insertComponent(newPrivateProjectDto(organization));
+    ComponentDto project = db.components().insertComponent(newPrivateProjectDto(organization).setName("ProjectModule"));
     ComponentDto module1 = newModuleDto(project).setName("Module1");
     db.components().insertComponent(module1);
     ComponentDto module2 = newModuleDto(project).setName("Module2");
@@ -539,36 +535,34 @@ public class SuggestionsActionTest {
     SuggestionsWsResponse response = ws.newRequest()
       .setMethod("POST")
       .setParam(PARAM_QUERY, "Module")
-      .setParam(PARAM_RECENTLY_BROWSED, Stream.of(module1.getDbKey()).collect(joining(",")))
+      .setParam(PARAM_RECENTLY_BROWSED, Stream.of(module1.getDbKey(), project.getDbKey()).collect(joining(",")))
       .executeProtobuf(SuggestionsWsResponse.class);
 
     assertThat(response.getResultsList())
       .flatExtracting(Category::getItemsList)
       .extracting(Suggestion::getIsRecentlyBrowsed)
-      .containsExactly(true, false);
+      .containsExactly(true);
   }
 
   @Test
   public void should_mark_favorite_items() {
-    ComponentDto project = db.components().insertComponent(newPrivateProjectDto(organization));
-    ComponentDto favorite = newModuleDto(project).setName("Module1");
-    db.components().insertComponent(favorite);
-    doReturn(singletonList(favorite)).when(favoriteFinder).list();
+    ComponentDto favouriteProject = db.components().insertComponent(newPrivateProjectDto(organization).setName("Project1"));
+    ComponentDto nonFavouriteProject = db.components().insertComponent(newPublicProjectDto(organization).setName("Project2"));
 
-    ComponentDto nonFavorite = newModuleDto(project).setName("Module2");
-    db.components().insertComponent(nonFavorite);
-    componentIndexer.indexOnAnalysis(project.projectUuid());
-    authorizationIndexerTester.allowOnlyAnyone(project);
+    doReturn(singletonList(favouriteProject)).when(favoriteFinder).list();
+    componentIndexer.indexOnAnalysis(favouriteProject.projectUuid());
+    componentIndexer.indexOnAnalysis(nonFavouriteProject.projectUuid());
+    authorizationIndexerTester.allowOnlyAnyone(favouriteProject, nonFavouriteProject);
 
     SuggestionsWsResponse response = ws.newRequest()
       .setMethod("POST")
-      .setParam(PARAM_QUERY, "Module")
+      .setParam(PARAM_QUERY, "Project")
       .executeProtobuf(SuggestionsWsResponse.class);
 
     assertThat(response.getResultsList())
       .flatExtracting(Category::getItemsList)
       .extracting(Suggestion::getKey, Suggestion::getIsFavorite)
-      .containsExactly(tuple(favorite.getDbKey(), true), tuple(nonFavorite.getDbKey(), false));
+      .containsExactly(tuple(favouriteProject.getDbKey(), true), tuple(nonFavouriteProject.getDbKey(), false));
   }
 
   @Test
@@ -584,7 +578,7 @@ public class SuggestionsActionTest {
 
     assertThat(response.getResultsList())
       .extracting(Category::getQ, Category::getItemsCount)
-      .containsExactlyInAnyOrder(tuple("VW", 0), tuple("SVW", 0), tuple("APP", 0), tuple("TRK", 1), tuple("BRC", 0), tuple("FIL", 0), tuple("UTS", 0));
+      .containsExactlyInAnyOrder(tuple("VW", 0), tuple("SVW", 0), tuple("APP", 0), tuple("TRK", 1), tuple("FIL", 0), tuple("UTS", 0));
   }
 
   @Test
@@ -615,7 +609,6 @@ public class SuggestionsActionTest {
         tuple(SuggestionCategory.VIEW.getName(), false),
         tuple(SuggestionCategory.SUBVIEW.getName(), false),
         tuple(SuggestionCategory.PROJECT.getName(), false),
-        tuple(SuggestionCategory.MODULE.getName(), true),
         tuple(SuggestionCategory.FILE.getName(), true),
         tuple(SuggestionCategory.UNIT_TEST_FILE.getName(), true));
   }
@@ -737,7 +730,7 @@ public class SuggestionsActionTest {
   }
 
   private void check_proposal_to_show_more_results(int numberOfProjects, int expectedNumberOfResults, long expectedNumberOfMoreResults, @Nullable SuggestionCategory more,
-                                                   boolean useQuery) {
+    boolean useQuery) {
     String namePrefix = "MyProject";
 
     List<ComponentDto> projects = range(0, numberOfProjects)
index de5d739cc783a6abfc0428a54ddbaee3ca795ec1..ca4e5904ed9864b8b42689e4645d72df2644f41f 100644 (file)
@@ -100,7 +100,8 @@ public class TreeActionTest {
     assertThat(action.description()).isNotNull();
     assertThat(action.responseExample()).isNotNull();
     assertThat(action.changelog()).extracting(Change::getVersion, Change::getDescription).containsExactlyInAnyOrder(
-      tuple("6.4", "The field 'id' is deprecated in the response"));
+      tuple("6.4", "The field 'id' is deprecated in the response"),
+      tuple("7.6", "The use of module keys in parameter 'component' is deprecated"));
     assertThat(action.params()).extracting(Param::key).containsExactlyInAnyOrder("component", "componentId", "branch", "pullRequest", "qualifiers", "strategy",
       "q", "s", "p", "asc", "ps");
 
@@ -258,7 +259,9 @@ public class TreeActionTest {
       .setParam(Param.SORT, "qualifier, name")
       .setParam(PARAM_COMPONENT_ID, "project-uuid").executeProtobuf(TreeWsResponse.class);
 
-    assertThat(response.getComponentsList()).extracting("id").containsExactly("module-uuid-1", "path/directory/", "file-uuid-1", "file-uuid-2");
+    assertThat(response.getComponentsList()).extracting("id")
+      .containsExactly("path/directory/", "file-uuid-1", "file-uuid-2")
+      .doesNotContain("module-uuid-1");
   }
 
   @Test
index d4e18f020b22360e4c61e590bca4fbdaf16b004d..89200f810cc5c60bb886514dd323c5d7d3de3b98 100644 (file)
@@ -45,7 +45,6 @@ import org.sonar.db.alm.ALM;
 import org.sonar.db.component.BranchType;
 import org.sonar.db.component.ComponentDbTester;
 import org.sonar.db.component.ComponentDto;
-import org.sonar.db.component.ComponentTesting;
 import org.sonar.db.component.SnapshotDto;
 import org.sonar.db.metric.MetricDto;
 import org.sonar.db.organization.OrganizationDto;
@@ -56,6 +55,7 @@ import org.sonar.db.qualitygate.QualityGateDto;
 import org.sonar.db.qualityprofile.QProfileDto;
 import org.sonar.db.user.UserDto;
 import org.sonar.server.component.ComponentFinder;
+import org.sonar.server.exceptions.BadRequestException;
 import org.sonar.server.exceptions.ForbiddenException;
 import org.sonar.server.exceptions.NotFoundException;
 import org.sonar.server.organization.BillingValidations;
@@ -386,18 +386,6 @@ public class ComponentActionTest {
     executeAndVerify(project.getDbKey(), "return_configuration_with_all_properties.json");
   }
 
-  @Test
-  public void return_breadcrumbs_on_module() {
-    ComponentDto project = insertOrganizationAndProject();
-    ComponentDto module = componentDbTester.insertComponent(newModuleDto("bcde", project).setDbKey("palap").setName("Palap"));
-    userSession.anonymous()
-      .addProjectPermission(UserRole.USER, project)
-      .addProjectPermission(UserRole.ADMIN, project);
-    init();
-
-    executeAndVerify(module.getDbKey(), "return_breadcrumbs_on_module.json");
-  }
-
   @Test
   public void return_configuration_for_quality_profile_admin() {
     ComponentDto project = insertOrganizationAndProject();
@@ -469,21 +457,6 @@ public class ComponentActionTest {
     assertJson(execute(project.getDbKey())).isSimilarTo("{\"visibility\": \"public\"}");
   }
 
-  @Test
-  public void should_not_return_private_flag_for_module() {
-    OrganizationDto org = db.organizations().insert();
-    db.qualityGates().createDefaultQualityGate(org);
-    ComponentDto project = db.components().insertPrivateProject(org);
-    ComponentDto module = db.components().insertComponent(ComponentTesting.newModuleDto(project));
-    init();
-
-    userSession.logIn()
-      .addProjectPermission(UserRole.ADMIN, project)
-      .addPermission(OrganizationPermission.ADMINISTER, org);
-    String json = execute(module.getDbKey());
-    assertThat(json).doesNotContain("visibility");
-  }
-
   @Test
   public void canApplyPermissionTemplate_is_true_if_logged_in_as_organization_administrator() {
     OrganizationDto org = db.organizations().insert();
@@ -588,7 +561,8 @@ public class ComponentActionTest {
     assertThat(action.responseExample()).isNotNull();
     assertThat(action.changelog()).extracting(Change::getVersion, Change::getDescription).containsExactlyInAnyOrder(
       tuple("6.4", "The 'visibility' field is added"),
-      tuple("7.3", "The 'almRepoUrl' and 'almId' fields are added"));
+      tuple("7.3", "The 'almRepoUrl' and 'almId' fields are added"),
+      tuple("7.6", "The use of module keys in parameter 'component' is deprecated"));
 
     WebService.Param componentId = action.param(PARAM_COMPONENT);
     assertThat(componentId.isRequired()).isFalse();
@@ -621,27 +595,24 @@ public class ComponentActionTest {
       "}\n");
   }
 
-  @Test
-  public void return_alm_info_on_module() {
+  @Test(expected = BadRequestException.class)
+  public void fail_on_module_key_as_param() {
     ComponentDto project = insertOrganizationAndProject();
     ComponentDto module = componentDbTester.insertComponent(newModuleDto("bcde", project).setDbKey("palap").setName("Palap"));
-    dbClient.projectAlmBindingsDao().insertOrUpdate(db.getSession(), ALM.BITBUCKETCLOUD, "{123456789}", project.uuid(), null, "http://bitbucket.org/foo/bar");
-    db.getSession().commit();
-    userSession.addProjectPermission(UserRole.USER, project);
     init();
 
-    String json = execute(module.getKey());
+    execute(module.getKey());
+  }
 
-    assertJson(json).isSimilarTo("{\n" +
-      "  \"organization\": \"my-org\",\n" +
-      "  \"key\": \"palap\",\n" +
-      "  \"id\": \"bcde\",\n" +
-      "  \"name\": \"Palap\",\n" +
-      "  \"alm\": {\n" +
-      "     \"key\": \"bitbucketcloud\",\n" +
-      "     \"url\": \"http://bitbucket.org/foo/bar\"\n" +
-      "  }\n" +
-      "}\n");
+  @Test(expected = BadRequestException.class)
+  public void fail_on_directory_key_as_param() {
+    ComponentDto project = insertOrganizationAndProject();
+    ComponentDto module = componentDbTester.insertComponent(newModuleDto("bcde", project).setDbKey("palap").setName("Palap"));
+    ComponentDto directory = componentDbTester.insertComponent(newDirectory(module, "src/main/xoo"));
+    userSession.addProjectPermission(UserRole.USER, project);
+    init();
+
+    execute(directory.getDbKey());
   }
 
   @Test
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/ui/ws/ComponentActionTest/return_breadcrumbs_on_module.json b/server/sonar-server/src/test/resources/org/sonar/server/ui/ws/ComponentActionTest/return_breadcrumbs_on_module.json
deleted file mode 100644 (file)
index 5054f14..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-{
-  "breadcrumbs": [
-    {
-      "key": "polop",
-      "name": "Polop",
-      "qualifier": "TRK"
-    },
-    {
-      "key": "palap",
-      "name": "Palap",
-      "qualifier": "BRC"
-    }
-  ]
-}
index c7d451bc891139fc20cd9efe43a423f75b9c8bca..bfbe35d887f3fd38d415f0219a1146c5aaa23390 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.sonarqube.ws.client.navigation;
 
-import java.util.List;
 import javax.annotation.Generated;
 
 /**