]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9865 Sanitize WS api/qualityprofiles/*
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Fri, 22 Sep 2017 16:52:19 +0000 (18:52 +0200)
committerTeryk Bellahsene <teryk@users.noreply.github.com>
Tue, 26 Sep 2017 09:15:35 +0000 (11:15 +0200)
- functional key of a quality profile is: name, language and organization
- quality profile name is named 'name'
- quality profile key is named 'key'
- quality profile key parameter is deprecated when appropriate

56 files changed:
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ActivateRuleAction.java
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ActivateRulesAction.java
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ChangeParentAction.java
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/CreateAction.java
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/DeactivateRuleAction.java
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/DeactivateRulesAction.java
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ExportAction.java
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProjectsAction.java
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/QProfileReference.java
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/RenameAction.java
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/SearchAction.java
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ShowAction.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ActivateRuleActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ActivateRulesActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/AddProjectActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/BackupActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ChangeParentActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ChangelogActionDatabaseTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ChangelogActionMockTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/CreateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/DeactivateRuleActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/DeactivateRulesActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/DeleteActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ExportActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/InheritanceActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ProjectsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileReferenceTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfilesWsMediumTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfilesWsTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/RemoveProjectActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/RenameActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/SearchActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/SetDefaultActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ShowActionTest.java
sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/ActivateRuleWsRequest.java
sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/AddProjectRequest.java
sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/ChangeParentRequest.java
sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/CreateRequest.java
sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/QualityProfileWsParameters.java
sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/QualityProfilesService.java
sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/RemoveProjectRequest.java
sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/SearchWsRequest.java
sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/SetDefaultRequest.java
sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/ShowRequest.java
sonar-ws/src/test/java/org/sonarqube/ws/client/qualityprofile/AddProjectRequestTest.java
sonar-ws/src/test/java/org/sonarqube/ws/client/qualityprofile/CreateRequestTest.java
sonar-ws/src/test/java/org/sonarqube/ws/client/qualityprofile/QualityProfilesServiceTest.java
sonar-ws/src/test/java/org/sonarqube/ws/client/qualityprofile/RemoveProjectRequestTest.java
tests/src/test/java/org/sonarqube/tests/QProfileTester.java
tests/src/test/java/org/sonarqube/tests/authorisation/QualityProfileAdminPermissionTest.java
tests/src/test/java/org/sonarqube/tests/issue/OrganizationIssueAssignTest.java
tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java
tests/src/test/java/org/sonarqube/tests/qualityProfile/CustomQualityProfilesTest.java
tests/src/test/java/org/sonarqube/tests/qualityProfile/OrganizationQualityProfilesUiTest.java
tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfilesUiTest.java
tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfilesWsTest.java

index efcb4fe8e7bd8201b1f71dd29ee9d83f5ffe38ca..8d1e5d29794a72eb30d4e69ff789fac986dc7695 100644 (file)
@@ -37,7 +37,7 @@ import static java.lang.String.format;
 import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.ACTION_ACTIVATE_RULE;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PARAMS;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_KEY;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_RESET;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_RULE;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_SEVERITY;
@@ -65,7 +65,7 @@ public class ActivateRuleAction implements QProfileWsAction {
       .setPost(true)
       .setSince("4.4");
 
-    activate.createParam(PARAM_PROFILE)
+    activate.createParam(PARAM_KEY)
       .setDescription("Quality Profile key. Can be obtained through <code>api/qualityprofiles/search</code>")
       .setDeprecatedKey("profile_key", "6.5")
       .setRequired(true)
@@ -94,7 +94,7 @@ public class ActivateRuleAction implements QProfileWsAction {
   public void handle(Request request, Response response) throws Exception {
     userSession.checkLoggedIn();
     try (DbSession dbSession = dbClient.openSession(false)) {
-      String profileKey = request.mandatoryParam(PARAM_PROFILE);
+      String profileKey = request.mandatoryParam(PARAM_KEY);
       QProfileDto profile = wsSupport.getProfile(dbSession, QProfileReference.fromKey(profileKey));
       wsSupport.checkPermission(dbSession, profile);
       wsSupport.checkNotBuiltInt(profile);
index fe1b61fc9980ecdd8c485364055c58b4f47ad8ee..cf40a39cf2ff5803bb9e7e2e1fbc202b8921ba2d 100644 (file)
@@ -36,7 +36,7 @@ import static org.sonar.server.qualityprofile.ws.BulkChangeWsResponse.writeRespo
 import static org.sonar.server.qualityprofile.ws.QProfileReference.fromKey;
 import static org.sonar.server.rule.ws.SearchAction.defineRuleSearchParameters;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.ACTION_ACTIVATE_RULES;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_TARGET_PROFILE;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_TARGET_KEY;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_TARGET_SEVERITY;
 
 public class ActivateRulesAction implements QProfileWsAction {
@@ -66,8 +66,8 @@ public class ActivateRulesAction implements QProfileWsAction {
 
     defineRuleSearchParameters(activate);
 
-    activate.createParam(PARAM_TARGET_PROFILE)
-      .setDescription("Quality Profile key on which the rule activation is done. To retrieve a profile key please see <code>api/qualityprofiles/search</code>")
+    activate.createParam(PARAM_TARGET_KEY)
+      .setDescription("Quality Profile key on which the rule activation is done. To retrieve a quality profile key please see <code>api/qualityprofiles/search</code>")
       .setDeprecatedKey("profile_key", "6.5")
       .setRequired(true)
       .setExampleValue(UUID_EXAMPLE_03);
@@ -80,7 +80,7 @@ public class ActivateRulesAction implements QProfileWsAction {
 
   @Override
   public void handle(Request request, Response response) throws Exception {
-    String qualityProfileKey = request.mandatoryParam(PARAM_TARGET_PROFILE);
+    String qualityProfileKey = request.mandatoryParam(PARAM_TARGET_KEY);
     userSession.checkLoggedIn();
     BulkChangeResult result;
     try (DbSession dbSession = dbClient.openSession(false)) {
index 8107ecd1b3f35515109ad40fd2af66a39dd527d9..1e3aad6865bba21443e3fd962de084fc4c118831 100644 (file)
@@ -30,18 +30,17 @@ import org.sonar.db.organization.OrganizationDto;
 import org.sonar.db.qualityprofile.QProfileDto;
 import org.sonar.server.qualityprofile.RuleActivator;
 import org.sonar.server.user.UserSession;
+import org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters;
 
 import static org.apache.commons.lang.StringUtils.isEmpty;
 import static org.sonar.core.util.Uuids.UUID_EXAMPLE_02;
 import static org.sonar.db.permission.OrganizationPermission.ADMINISTER_QUALITY_PROFILES;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_LANGUAGE;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PARENT_PROFILE;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PARENT_KEY;
 
 public class ChangeParentAction implements QProfileWsAction {
 
-  private static final String PARAM_PARENT_NAME = "parentName";
-
-  private DbClient dbClient;
+  private final DbClient dbClient;
   private final RuleActivator ruleActivator;
   private final Languages languages;
   private final QProfileWsSupport wsSupport;
@@ -69,16 +68,15 @@ public class ChangeParentAction implements QProfileWsAction {
       .setSince("6.4");
     QProfileReference.defineParams(inheritance, languages);
 
-    inheritance.createParam(PARAM_PARENT_PROFILE)
+    inheritance.createParam(PARAM_PARENT_KEY)
       .setDescription("New parent profile key.<br> " +
         "If no profile is provided, the inheritance link with current parent profile (if any) is broken, which deactivates all rules " +
         "which come from the parent and are not overridden.")
-      .setDeprecatedKey("parentKey", "6.5")
+      .setDeprecatedSince("6.6")
       .setExampleValue(UUID_EXAMPLE_02);
 
-    inheritance.createParam(PARAM_PARENT_NAME)
-      .setDescription("Quality profile name. If this parameter is set, '%s' must not be set and '%s' must be set to disambiguate.", PARAM_PARENT_PROFILE, PARAM_LANGUAGE)
-      .setDeprecatedSince("6.5")
+    inheritance.createParam(QualityProfileWsParameters.PARAM_PARENT_QUALITY_PROFILE)
+      .setDescription("Quality profile name. If this parameter is set, '%s' must not be set and '%s' must be set to disambiguate.", PARAM_PARENT_KEY, PARAM_LANGUAGE)
       .setExampleValue("Sonar way");
   }
 
@@ -95,8 +93,8 @@ public class ChangeParentAction implements QProfileWsAction {
       userSession.checkPermission(ADMINISTER_QUALITY_PROFILES, organization);
       wsSupport.checkNotBuiltInt(profile);
 
-      String parentKey = request.param(PARAM_PARENT_PROFILE);
-      String parentName = request.param(PARAM_PARENT_NAME);
+      String parentKey = request.param(PARAM_PARENT_KEY);
+      String parentName = request.param(QualityProfileWsParameters.PARAM_PARENT_QUALITY_PROFILE);
       if (isEmpty(parentKey) && isEmpty(parentName)) {
         ruleActivator.setParentAndCommit(dbSession, profile, null);
       } else {
index 26933ceb73d698b21bb9d428077782eb549d24e8..63061c405e9695d483ef93460527f66d6e26ab6c 100644 (file)
@@ -45,8 +45,8 @@ import static org.sonar.server.qualityprofile.ws.QProfileWsSupport.createOrganiz
 import static org.sonar.server.ws.WsUtils.writeProtobuf;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.ACTION_CREATE;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_LANGUAGE;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_NAME;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_ORGANIZATION;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE_NAME;
 
 public class CreateAction implements QProfileWsAction {
 
@@ -91,14 +91,14 @@ public class CreateAction implements QProfileWsAction {
     createOrganizationParam(create)
       .setSince("6.4");
 
-    create.createParam(PARAM_PROFILE_NAME)
-      .setDescription("Name for the new quality profile")
+    create.createParam(PARAM_NAME)
+      .setDescription("Quality profile name")
       .setExampleValue("My Sonar way")
-      .setDeprecatedKey("name", "6.1")
+      .setDeprecatedKey("profileName", "6.6")
       .setRequired(true);
 
     create.createParam(PARAM_LANGUAGE)
-      .setDescription("The language for the quality profile.")
+      .setDescription("Quality profile language")
       .setExampleValue("js")
       .setPossibleValues(LanguageParamUtils.getLanguageKeys(languages))
       .setRequired(true);
@@ -123,7 +123,7 @@ public class CreateAction implements QProfileWsAction {
   private CreateWsResponse doHandle(DbSession dbSession, CreateRequest createRequest, Request request, OrganizationDto organization) {
     QProfileResult result = new QProfileResult();
     QProfileDto profile = profileFactory.checkAndCreateCustom(dbSession, organization,
-      QProfileName.createFor(createRequest.getLanguage(), createRequest.getProfileName()));
+      QProfileName.createFor(createRequest.getLanguage(), createRequest.getName()));
     result.setProfile(profile);
     for (ProfileImporter importer : importers) {
       String importerKey = importer.getKey();
@@ -140,7 +140,7 @@ public class CreateAction implements QProfileWsAction {
     CreateRequest.Builder builder = CreateRequest.builder()
       .setOrganizationKey(organization.getKey())
       .setLanguage(request.mandatoryParam(PARAM_LANGUAGE))
-      .setProfileName(request.mandatoryParam(PARAM_PROFILE_NAME));
+      .setName(request.mandatoryParam(PARAM_NAME));
     return builder.build();
   }
 
index 3bb8ed16dcc90e3dde8cfa7d83b9cff8ad69602b..10b2721f42b11c70ccb15d51b2634b7d8bc5b21b 100644 (file)
@@ -31,7 +31,7 @@ import org.sonar.server.user.UserSession;
 
 import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.ACTION_DEACTIVATE_RULE;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_KEY;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_RULE;
 
 public class DeactivateRuleAction implements QProfileWsAction {
@@ -57,7 +57,7 @@ public class DeactivateRuleAction implements QProfileWsAction {
       .setPost(true)
       .setSince("4.4");
 
-    deactivate.createParam(PARAM_PROFILE)
+    deactivate.createParam(PARAM_KEY)
       .setDescription("Quality Profile key. Can be obtained through <code>api/qualityprofiles/search</code>")
       .setDeprecatedKey("profile_key", "6.5")
       .setRequired(true)
@@ -73,7 +73,7 @@ public class DeactivateRuleAction implements QProfileWsAction {
   @Override
   public void handle(Request request, Response response) throws Exception {
     RuleKey ruleKey = RuleKey.parse(request.mandatoryParam(PARAM_RULE));
-    String qualityProfileKey = request.mandatoryParam(PARAM_PROFILE);
+    String qualityProfileKey = request.mandatoryParam(PARAM_KEY);
     userSession.checkLoggedIn();
     try (DbSession dbSession = dbClient.openSession(false)) {
       QProfileDto profile = wsSupport.getProfile(dbSession, QProfileReference.fromKey(qualityProfileKey));
index cff201af44ca27133273075789509b490fba785e..6d23a6c91d2eaf6aec261eb2242aeb37cdfaf1e0 100644 (file)
@@ -34,7 +34,7 @@ import static org.sonar.core.util.Uuids.UUID_EXAMPLE_04;
 import static org.sonar.server.qualityprofile.ws.BulkChangeWsResponse.writeResponse;
 import static org.sonar.server.rule.ws.SearchAction.defineRuleSearchParameters;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.ACTION_DEACTIVATE_RULES;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_TARGET_PROFILE;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_TARGET_KEY;
 
 public class DeactivateRulesAction implements QProfileWsAction {
   public static final String SEVERITY = "activation_severity";
@@ -64,7 +64,7 @@ public class DeactivateRulesAction implements QProfileWsAction {
 
     defineRuleSearchParameters(deactivate);
 
-    deactivate.createParam(PARAM_TARGET_PROFILE)
+    deactivate.createParam(PARAM_TARGET_KEY)
       .setDescription("Quality Profile key on which the rule deactivation is done. To retrieve a profile key please see <code>api/qualityprofiles/search</code>")
       .setDeprecatedKey("profile_key", "6.5")
       .setRequired(true)
@@ -73,7 +73,7 @@ public class DeactivateRulesAction implements QProfileWsAction {
 
   @Override
   public void handle(Request request, Response response) throws Exception {
-    String qualityProfileKey = request.mandatoryParam(PARAM_TARGET_PROFILE);
+    String qualityProfileKey = request.mandatoryParam(PARAM_TARGET_KEY);
     userSession.checkLoggedIn();
     BulkChangeResult result;
     try (DbSession dbSession = dbClient.openSession(false)) {
index 5194c3c976494da8355edc2124a56a3eb2e8102a..50f907490ebb9ad86083c3cc1e5d74a061e9c61e 100644 (file)
@@ -50,12 +50,12 @@ import static org.sonar.server.qualityprofile.ws.QProfileWsSupport.createOrganiz
 import static org.sonar.server.ws.WsUtils.checkFound;
 import static org.sonar.server.ws.WsUtils.checkRequest;
 import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_ORGANIZATION;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_KEY;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_LANGUAGE;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_QUALITY_PROFILE;
 
 public class ExportAction implements QProfileWsAction {
 
-  private static final String PARAM_NAME = "name";
   private static final String PARAM_EXPORTER_KEY = "exporterKey";
 
   private final DbClient dbClient;
@@ -80,20 +80,20 @@ public class ExportAction implements QProfileWsAction {
       .setResponseExample(getClass().getResource("export-example.xml"))
       .setHandler(this);
 
-    action.createParam(PARAM_PROFILE)
+    action.createParam(PARAM_KEY)
       .setDescription("Quality profile key")
       .setSince("6.5")
+      .setDeprecatedSince("6.6")
       .setExampleValue(UUID_EXAMPLE_01);
 
-    action.createParam(PARAM_NAME)
+    action.createParam(PARAM_QUALITY_PROFILE)
       .setDescription("Quality profile name to export. If left empty, the default profile for the language is exported. If this parameter is set, '%s' must not be set.",
-        PARAM_PROFILE)
-      .setDeprecatedSince("6.5")
+        PARAM_KEY)
+      .setDeprecatedKey("profileName", "6.6")
       .setExampleValue("My Sonar way");
 
     action.createParam(PARAM_LANGUAGE)
-      .setDescription("Quality profile language.  If this parameter is set, '%s' must not be set.", PARAM_PROFILE)
-      .setDeprecatedSince("6.5")
+      .setDescription("Quality profile language.  If this parameter is set, '%s' must not be set.", PARAM_KEY)
       .setExampleValue(LanguageParamUtils.getExampleValue(languages))
       .setPossibleValues(LanguageParamUtils.getLanguageKeys(languages));
 
@@ -117,10 +117,10 @@ public class ExportAction implements QProfileWsAction {
 
   @Override
   public void handle(Request request, Response response) throws Exception {
-    String key = request.param(PARAM_PROFILE);
-    String name = request.param(PARAM_NAME);
+    String key = request.param(PARAM_KEY);
+    String name = request.param(PARAM_QUALITY_PROFILE);
     String language = request.param(PARAM_LANGUAGE);
-    checkRequest(key != null ^ language != null, "Either '%s' or '%s' must be provided.", PARAM_PROFILE, PARAM_LANGUAGE);
+    checkRequest(key != null ^ language != null, "Either '%s' or '%s' must be provided.", PARAM_KEY, PARAM_LANGUAGE);
 
     try (DbSession dbSession = dbClient.openSession(false)) {
       OrganizationDto organization = wsSupport.getOrganizationByKey(dbSession, request.param(PARAM_ORGANIZATION));
index 332b45c6a923132841143b3d13f327da8448fb05..cdb9f246679fdf95b9506ba7650f7980dd46690c 100644 (file)
@@ -45,7 +45,7 @@ import static com.google.common.base.Preconditions.checkArgument;
 import static java.util.Comparator.comparing;
 import static org.sonar.api.utils.Paging.forPageIndex;
 import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_KEY;
 
 public class ProjectsAction implements QProfileWsAction {
 
@@ -74,9 +74,8 @@ public class ProjectsAction implements QProfileWsAction {
       new Change("6.0", "'uuid' response field is deprecated and replaced by 'id'"),
       new Change("6.0", "'key' response field has been added to return the project key"));
 
-    action.createParam(PARAM_PROFILE)
-      .setDescription("Quality profile key.")
-      .setDeprecatedKey("key", "6.5")
+    action.createParam(PARAM_KEY)
+      .setDescription("Quality profile key")
       .setRequired(true)
       .setExampleValue(UUID_EXAMPLE_01);
     action.addSelectionModeParam();
@@ -92,7 +91,7 @@ public class ProjectsAction implements QProfileWsAction {
 
   @Override
   public void handle(Request request, Response response) throws Exception {
-    String profileKey = request.mandatoryParam(PARAM_PROFILE);
+    String profileKey = request.mandatoryParam(PARAM_KEY);
 
     try (DbSession session = dbClient.openSession(false)) {
       checkProfileExists(profileKey, session);
index 9d6d1f4fceedfa156cfe9d1a6d31231cefa64444..ecc4077d74b99a98b2cd91e5e020528031c46252 100644 (file)
@@ -35,8 +35,8 @@ import static org.apache.commons.lang.StringUtils.isEmpty;
 import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01;
 import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_ORGANIZATION;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_LANGUAGE;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE_NAME;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_KEY;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_QUALITY_PROFILE;
 
 /**
  * Reference to a Quality profile as defined by requests to web services api/qualityprofiles.
@@ -150,10 +150,10 @@ public class QProfileReference {
   }
 
   public static QProfileReference from(Request request) {
-    String key = request.param(PARAM_PROFILE);
+    String key = request.param(PARAM_KEY);
     String organizationKey = request.param(PARAM_ORGANIZATION);
     String lang = request.param(PARAM_LANGUAGE);
-    String name = request.param(PARAM_PROFILE_NAME);
+    String name = request.param(PARAM_QUALITY_PROFILE);
     return from(key, organizationKey, lang, name);
   }
 
@@ -175,19 +175,19 @@ public class QProfileReference {
   }
 
   public static void defineParams(WebService.NewAction action, Languages languages) {
-    action.createParam(PARAM_PROFILE)
+    action.createParam(PARAM_KEY)
       .setDescription("Quality profile key")
       .setDeprecatedKey("profileKey", "6.5")
+      .setDeprecatedSince("6.6")
       .setExampleValue(UUID_EXAMPLE_01);
 
-    action.createParam(PARAM_PROFILE_NAME)
-      .setDescription("Quality profile name. If this parameter is set, '%s' must not be set and '%s' must be set to disambiguate.", PARAM_PROFILE, PARAM_LANGUAGE)
-      .setDeprecatedSince("6.5")
+    action.createParam(PARAM_QUALITY_PROFILE)
+      .setDescription("Quality profile name. If this parameter is set, '%s' must not be set and '%s' must be set to disambiguate.", PARAM_KEY, PARAM_LANGUAGE)
+      .setDeprecatedKey("profileName", "6.6")
       .setExampleValue("Sonar way");
 
     action.createParam(PARAM_LANGUAGE)
-      .setDescription("Quality profile language. If this parameter is set, '%s' must not be set and '%s' must be set to disambiguate.", PARAM_PROFILE, PARAM_LANGUAGE)
-      .setDeprecatedSince("6.5")
+      .setDescription("Quality profile language. If this parameter is set, '%s' must not be set and '%s' must be set to disambiguate.", PARAM_KEY, PARAM_LANGUAGE)
       .setPossibleValues(Arrays.stream(languages.all()).map(Language::getKey).collect(MoreCollectors.toSet()));
   }
 }
index 01bb9e6debedd5feb021d22854003d2f929d9c63..3801232ac504188e09e69bc8cd7f72eaf526e6dd 100644 (file)
@@ -37,7 +37,7 @@ import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01;
 import static org.sonar.db.permission.OrganizationPermission.ADMINISTER_QUALITY_PROFILES;
 import static org.sonar.server.ws.WsUtils.checkRequest;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_NAME;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_KEY;
 
 public class RenameAction implements QProfileWsAction {
 
@@ -62,22 +62,22 @@ public class RenameAction implements QProfileWsAction {
       .setPost(true)
       .setHandler(this);
 
+    setDefault.createParam(PARAM_KEY)
+      .setDescription("Quality profile key")
+      .setExampleValue(UUID_EXAMPLE_01)
+      .setRequired(true);
+
     setDefault.createParam(PARAM_NAME)
       .setDescription("New quality profile name")
       .setExampleValue("My Sonar way")
       .setRequired(true);
 
-    setDefault.createParam(PARAM_PROFILE)
-      .setDescription("Quality profile key")
-      .setDeprecatedKey("key", "6.5")
-      .setExampleValue(UUID_EXAMPLE_01)
-      .setRequired(true);
   }
 
   @Override
   public void handle(Request request, Response response) throws Exception {
     String newName = request.mandatoryParam(PARAM_NAME);
-    String profileKey = request.mandatoryParam(PARAM_PROFILE);
+    String profileKey = request.mandatoryParam(PARAM_KEY);
     doHandle(newName, profileKey);
     response.noContent();
   }
index 3f9709faab2962b8a409af11c2fdd398c6129159..b192a68d8839a6fb9cf6713ccb83e0dbe396bd6d 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.sonar.server.qualityprofile.ws;
 
-import com.google.common.annotations.VisibleForTesting;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Comparator;
@@ -65,8 +64,8 @@ import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_DEFAULTS;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_LANGUAGE;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_ORGANIZATION;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE_NAME;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROJECT;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_QUALITY_PROFILE;
 
 public class SearchAction implements QProfileWsAction {
   private static final Comparator<QProfileDto> Q_PROFILE_COMPARATOR = Comparator
@@ -119,8 +118,9 @@ public class SearchAction implements QProfileWsAction {
       .setDescription("Language key. If provided, only profiles for the given language are returned.")
       .setPossibleValues(LanguageParamUtils.getLanguageKeys(languages));
 
-    action.createParam(PARAM_PROFILE_NAME)
-      .setDescription("Profile name")
+    action.createParam(PARAM_QUALITY_PROFILE)
+      .setDescription("Quality profile name")
+      .setDeprecatedKey("profileName", "6.6")
       .setExampleValue("SonarQube Way");
   }
 
@@ -134,13 +134,12 @@ public class SearchAction implements QProfileWsAction {
     return new SearchWsRequest()
       .setOrganizationKey(request.param(PARAM_ORGANIZATION))
       .setProjectKey(request.param(PARAM_PROJECT))
-      .setProfileName(request.param(PARAM_PROFILE_NAME))
+      .setQualityProfile(request.param(PARAM_QUALITY_PROFILE))
       .setDefaults(request.paramAsBoolean(PARAM_DEFAULTS))
       .setLanguage(request.param(PARAM_LANGUAGE));
   }
 
-  @VisibleForTesting
-  SearchWsResponse doHandle(SearchWsRequest request) {
+  private SearchWsResponse doHandle(SearchWsRequest request) {
     SearchData data = load(request);
     return buildResponse(data);
   }
@@ -204,7 +203,7 @@ public class SearchAction implements QProfileWsAction {
   }
 
   private static Predicate<QProfileDto> byName(SearchWsRequest request) {
-    return p -> request.getProfileName() == null || Objects.equals(p.getName(), request.getProfileName());
+    return p -> request.getQualityProfile() == null || Objects.equals(p.getName(), request.getQualityProfile());
   }
 
   private static Predicate<QProfileDto> byLanguage(SearchWsRequest request) {
index 9a293eeb25dae535cd5a16cb149eb111b9c1864c..ce0b4a4ed87d61ce2fc8ed16e64d3203abc89dbf 100644 (file)
@@ -52,7 +52,7 @@ import static org.sonar.server.ws.WsUtils.checkFound;
 import static org.sonar.server.ws.WsUtils.writeProtobuf;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.ACTION_SHOW;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_COMPARE_TO_SONAR_WAY;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_KEY;
 
 public class ShowAction implements QProfileWsAction {
 
@@ -74,15 +74,16 @@ public class ShowAction implements QProfileWsAction {
   @Override
   public void define(WebService.NewController controller) {
     NewAction show = controller.createAction(ACTION_SHOW)
-      .setSince("6.5")
       .setDescription("Show a quality profile")
+      .setSince("6.5")
       .setResponseExample(getClass().getResource("show-example.json"))
       .setInternal(true)
       .setHandler(this);
 
-    show.createParam(PARAM_PROFILE)
+    show.createParam(PARAM_KEY)
       .setDescription("Quality profile key")
       .setExampleValue(UUID_EXAMPLE_01)
+      .setDeprecatedKey("profile", "6.6")
       .setRequired(true);
 
     show.createParam(PARAM_COMPARE_TO_SONAR_WAY)
@@ -95,7 +96,7 @@ public class ShowAction implements QProfileWsAction {
   @Override
   public void handle(Request request, Response response) throws Exception {
     try (DbSession dbSession = dbClient.openSession(false)) {
-      QProfileDto profile = qProfileWsSupport.getProfile(dbSession, QProfileReference.fromKey(request.mandatoryParam(PARAM_PROFILE)));
+      QProfileDto profile = qProfileWsSupport.getProfile(dbSession, QProfileReference.fromKey(request.mandatoryParam(PARAM_KEY)));
       OrganizationDto organization = qProfileWsSupport.getOrganization(dbSession, profile);
       boolean isDefault = dbClient.defaultQProfileDao().isDefault(dbSession, profile.getOrganizationUuid(), profile.getKee());
       ActiveRuleCountQuery.Builder builder = ActiveRuleCountQuery.builder().setOrganization(organization);
index a2bef4dbdb8703176263e59632db9f852fad8011..229a95e4f9c23ea084f96cd02445e5415acd1ae4 100644 (file)
@@ -52,7 +52,7 @@ import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_KEY;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_RULE;
 
 public class ActivateRuleActionTest {
@@ -84,8 +84,8 @@ public class ActivateRuleActionTest {
     WebService.Action definition = ws.getDef();
     assertThat(definition).isNotNull();
     assertThat(definition.isPost()).isTrue();
-    assertThat(definition.params()).extracting(WebService.Param::key).containsExactlyInAnyOrder("severity", "profile", "reset", "rule", "params");
-    WebService.Param profileKey = definition.param("profile");
+    assertThat(definition.params()).extracting(WebService.Param::key).containsExactlyInAnyOrder("severity", "key", "reset", "rule", "params");
+    WebService.Param profileKey = definition.param("key");
     assertThat(profileKey.deprecatedKey()).isEqualTo("profile_key");
     WebService.Param ruleKey = definition.param("rule");
     assertThat(ruleKey.deprecatedKey()).isEqualTo("rule_key");
@@ -96,7 +96,7 @@ public class ActivateRuleActionTest {
     TestRequest request = ws.newRequest()
       .setMethod("POST")
       .setParam(PARAM_RULE, RuleTesting.newRule().getKey().toString())
-      .setParam(PARAM_PROFILE, randomAlphanumeric(UUID_SIZE));
+      .setParam(PARAM_KEY, randomAlphanumeric(UUID_SIZE));
 
     expectedException.expect(UnauthorizedException.class);
     
@@ -110,7 +110,7 @@ public class ActivateRuleActionTest {
     TestRequest request = ws.newRequest()
       .setMethod("POST")
       .setParam(PARAM_RULE, RuleTesting.newRuleDto().getKey().toString())
-      .setParam(PARAM_PROFILE, qualityProfile.getKee());
+      .setParam(PARAM_KEY, qualityProfile.getKee());
 
     expectedException.expect(ForbiddenException.class);
 
@@ -125,7 +125,7 @@ public class ActivateRuleActionTest {
     TestRequest request = ws.newRequest()
       .setMethod("POST")
       .setParam(PARAM_RULE, RuleTesting.newRuleDto().getKey().toString())
-      .setParam(PARAM_PROFILE, qualityProfile.getKee());
+      .setParam(PARAM_KEY, qualityProfile.getKee());
 
     expectedException.expect(BadRequestException.class);
     expectedException.expectMessage("Operation forbidden for built-in Quality Profile 'Xoo profile' with language 'xoo'");
@@ -141,7 +141,7 @@ public class ActivateRuleActionTest {
     TestRequest request = ws.newRequest()
       .setMethod("POST")
       .setParam(PARAM_RULE, ruleKey.toString())
-      .setParam(PARAM_PROFILE, qualityProfile.getKee())
+      .setParam(PARAM_KEY, qualityProfile.getKee())
       .setParam("severity", "BLOCKER")
       .setParam("params", "key1=v1;key2=v2")
       .setParam("reset", "false");
@@ -165,7 +165,7 @@ public class ActivateRuleActionTest {
     TestRequest request = ws.newRequest()
       .setMethod("POST")
       .setParam(PARAM_RULE, ruleKey.toString())
-      .setParam(PARAM_PROFILE, qualityProfile.getKee())
+      .setParam(PARAM_KEY, qualityProfile.getKee())
       .setParam("severity", "BLOCKER")
       .setParam("params", "key1=v1;key2=v2")
       .setParam("reset", "false");
index 0e475029e2367e772e23e67777589875ad25fca1..4caa6f06ce2d6a0720dad55dadd2fd620336dd9d 100644 (file)
@@ -43,7 +43,7 @@ import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.mockito.Mockito.mock;
 import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_TARGET_PROFILE;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_TARGET_KEY;
 
 public class ActivateRulesActionTest {
 
@@ -90,14 +90,14 @@ public class ActivateRulesActionTest {
       "active_severities",
       "s",
       "repositories",
-      "targetProfile",
+      "targetKey",
       "statuses",
       "rule_key",
       "available_since",
       "activation",
       "severities",
       "organization");
-    WebService.Param targetProfile = definition.param("targetProfile");
+    WebService.Param targetProfile = definition.param("targetKey");
     assertThat(targetProfile.deprecatedKey()).isEqualTo("profile_key");
     WebService.Param targetSeverity = definition.param("targetSeverity");
     assertThat(targetSeverity.deprecatedKey()).isEqualTo("activation_severity");
@@ -107,7 +107,7 @@ public class ActivateRulesActionTest {
   public void should_fail_if_not_logged_in() {
     TestRequest request = ws.newRequest()
       .setMethod("POST")
-      .setParam(PARAM_TARGET_PROFILE, randomAlphanumeric(UUID_SIZE));
+      .setParam(PARAM_TARGET_KEY, randomAlphanumeric(UUID_SIZE));
 
     expectedException.expect(UnauthorizedException.class);
 
@@ -120,7 +120,7 @@ public class ActivateRulesActionTest {
     QProfileDto qualityProfile = db.qualityProfiles().insert(defaultOrganization, p -> p.setIsBuiltIn(true));
     TestRequest request = ws.newRequest()
       .setMethod("POST")
-      .setParam(PARAM_TARGET_PROFILE, qualityProfile.getKee());
+      .setParam(PARAM_TARGET_KEY, qualityProfile.getKee());
 
     expectedException.expect(BadRequestException.class);
 
@@ -133,7 +133,7 @@ public class ActivateRulesActionTest {
     QProfileDto qualityProfile = db.qualityProfiles().insert(organization);
     TestRequest request = ws.newRequest()
       .setMethod("POST")
-      .setParam(PARAM_TARGET_PROFILE, qualityProfile.getKee());
+      .setParam(PARAM_TARGET_KEY, qualityProfile.getKee());
 
     expectedException.expect(ForbiddenException.class);
 
index 25f7cb780b62d5f9d4acea261f78b16b5e89ccf4..47cd8cfd4f19ea3875c204f3bb2a2cf88118b936 100644 (file)
@@ -72,15 +72,13 @@ public class AddProjectActionTest {
 
     // parameters
     assertThat(definition.params()).extracting(WebService.Param::key)
-      .containsExactlyInAnyOrder("profile", "profileName", "project", "language", "projectUuid", "organization");
-    WebService.Param profile = definition.param("profile");
+      .containsExactlyInAnyOrder("key", "qualityProfile", "project", "language", "projectUuid", "organization");
+    WebService.Param profile = definition.param("key");
     assertThat(profile.deprecatedKey()).isEqualTo("profileKey");
-    WebService.Param profileName = definition.param("profileName");
-    assertThat(profileName.deprecatedSince()).isEqualTo("6.5");
+    assertThat(profile.deprecatedSince()).isEqualTo("6.6");
     WebService.Param languageParam = definition.param("language");
     assertThat(languageParam.possibleValues()).containsOnly(LANGUAGE_1, LANGUAGE_2);
     assertThat(languageParam.exampleValue()).isNull();
-    assertThat(languageParam.deprecatedSince()).isEqualTo("6.5");
     WebService.Param project = definition.param("project");
     assertThat(project.deprecatedKey()).isEqualTo("projectKey");
     WebService.Param projectUuid = definition.param("projectUuid");
@@ -293,7 +291,7 @@ public class AddProjectActionTest {
   private TestResponse call(ComponentDto project, QProfileDto qualityProfile) {
     TestRequest request = tester.newRequest()
       .setParam("projectUuid", project.uuid())
-      .setParam("profile", qualityProfile.getKee());
+      .setParam("key", qualityProfile.getKee());
     return request.execute();
   }
 
@@ -302,7 +300,7 @@ public class AddProjectActionTest {
       .setParam("organization", organization.getKey())
       .setParam("projectUuid", project.uuid())
       .setParam("language", qualityProfile.getLanguage())
-      .setParam("profileName", qualityProfile.getName());
+      .setParam("qualityProfile", qualityProfile.getName());
     return request.execute();
   }
 }
index a0c81d94451823ae93640965e58441e31e3ad0fc..017f0d091e41f2e73467449aed5fa14f4ee5121b 100644 (file)
@@ -40,7 +40,7 @@ import org.sonar.server.ws.TestResponse;
 import org.sonar.server.ws.WsActionTester;
 
 import static org.assertj.core.api.Assertions.assertThat;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_KEY;
 
 public class BackupActionTest {
 
@@ -69,13 +69,13 @@ public class BackupActionTest {
     assertThat(definition.isPost()).isFalse();
 
     // parameters
-    assertThat(definition.params()).extracting(Param::key).containsExactlyInAnyOrder("profile", "organization", "profileName", "language");
-    Param profile = definition.param("profile");
-    assertThat(profile.deprecatedKey()).isEqualTo("profileKey");
+    assertThat(definition.params()).extracting(Param::key).containsExactlyInAnyOrder("key", "organization", "qualityProfile", "language");
+    Param key = definition.param("key");
+    assertThat(key.deprecatedKey()).isEqualTo("profileKey");
+    assertThat(key.deprecatedSince()).isEqualTo("6.6");
     Param language = definition.param("language");
-    assertThat(language.deprecatedSince()).isEqualTo("6.5");
-    Param profileName = definition.param("profileName");
-    assertThat(profileName.deprecatedSince()).isEqualTo("6.5");
+    assertThat(language.deprecatedSince()).isNullOrEmpty();
+    Param profileName = definition.param("qualityProfile");
     Param orgParam = definition.param("organization");
     assertThat(orgParam.since()).isEqualTo("6.4");
   }
@@ -84,7 +84,7 @@ public class BackupActionTest {
   public void returns_backup_of_profile_with_specified_key() throws Exception {
     QProfileDto profile = db.qualityProfiles().insert(db.getDefaultOrganization());
 
-    TestResponse response = tester.newRequest().setParam(PARAM_PROFILE, profile.getKee()).execute();
+    TestResponse response = tester.newRequest().setParam(PARAM_KEY, profile.getKee()).execute();
     assertThat(response.getMediaType()).isEqualTo("application/xml");
     assertThat(response.getInput()).isXmlEqualTo(xmlForProfileWithoutRules(profile));
     assertThat(response.getHeader("Content-Disposition")).isEqualTo("attachment; filename=" + profile.getKee() + ".xml");
@@ -96,7 +96,7 @@ public class BackupActionTest {
 
     TestResponse response = tester.newRequest()
       .setParam("language", profile.getLanguage())
-      .setParam("profileName", profile.getName())
+      .setParam("qualityProfile", profile.getName())
       .execute();
     assertThat(response.getInput()).isXmlEqualTo(xmlForProfileWithoutRules(profile));
   }
@@ -109,7 +109,7 @@ public class BackupActionTest {
     TestResponse response = tester.newRequest()
       .setParam("organization", org.getKey())
       .setParam("language", profile.getLanguage())
-      .setParam("profileName", profile.getName())
+      .setParam("qualityProfile", profile.getName())
       .execute();
     assertThat(response.getInput()).isXmlEqualTo(xmlForProfileWithoutRules(profile));
   }
@@ -119,7 +119,7 @@ public class BackupActionTest {
     expectedException.expect(NotFoundException.class);
     expectedException.expectMessage("Quality Profile with key 'missing' does not exist");
 
-    tester.newRequest().setParam(PARAM_PROFILE, "missing").execute();
+    tester.newRequest().setParam(PARAM_KEY, "missing").execute();
   }
 
   @Test
@@ -130,7 +130,7 @@ public class BackupActionTest {
     tester.newRequest()
       .setParam("organization", "the-missing-org")
       .setParam("language", A_LANGUAGE)
-      .setParam("profileName", "the-name")
+      .setParam("qualityProfile", "the-name")
       .execute();
   }
 
@@ -147,7 +147,7 @@ public class BackupActionTest {
     tester.newRequest()
       .setParam("organization", org2.getKey())
       .setParam("language", profileInOrg1.getLanguage())
-      .setParam("profileName", profileInOrg1.getName())
+      .setParam("qualityProfile", profileInOrg1.getName())
       .execute();
   }
 
index 8ca0a99b4869e07df5ec22747aa336caf7bbbccd..110b3284175241f95baac27cab8c5b87a7316dfb 100644 (file)
@@ -32,6 +32,7 @@ import org.sonar.api.rule.RuleKey;
 import org.sonar.api.rule.RuleStatus;
 import org.sonar.api.rule.Severity;
 import org.sonar.api.server.ws.WebService;
+import org.sonar.api.server.ws.WebService.Param;
 import org.sonar.api.utils.System2;
 import org.sonar.db.DbClient;
 import org.sonar.db.DbSession;
@@ -61,6 +62,7 @@ import org.sonar.server.tester.UserSessionRule;
 import org.sonar.server.util.TypeValidations;
 import org.sonar.server.ws.TestRequest;
 import org.sonar.server.ws.WsActionTester;
+import org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters;
 
 import static java.util.Arrays.asList;
 import static java.util.Collections.emptySet;
@@ -68,11 +70,11 @@ import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.sonar.db.permission.OrganizationPermission.ADMINISTER_QUALITY_PROFILES;
 import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_ORGANIZATION;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_KEY;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_LANGUAGE;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PARENT_NAME;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PARENT_PROFILE;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE_NAME;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PARENT_KEY;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PARENT_QUALITY_PROFILE;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_QUALITY_PROFILE;
 
 public class ChangeParentActionTest {
 
@@ -134,19 +136,14 @@ public class ChangeParentActionTest {
   public void definition() {
     WebService.Action definition = ws.getDef();
     assertThat(definition.isPost()).isTrue();
-    assertThat(definition.params()).extracting("key").containsExactlyInAnyOrder(
-      "organization", "profile", "profileName", "language", "parentProfile", "parentName");
+    assertThat(definition.params()).extracting(Param::key).containsExactlyInAnyOrder(
+      "organization", "key", "qualityProfile", "language", "parentKey", "parentQualityProfile");
     assertThat(definition.param("organization").since()).isEqualTo("6.4");
-    WebService.Param profile = definition.param("profile");
+    Param profile = definition.param("key");
     assertThat(profile.deprecatedKey()).isEqualTo("profileKey");
-    WebService.Param parentProfile = definition.param("parentProfile");
-    assertThat(parentProfile.deprecatedKey()).isEqualTo("parentKey");
-    WebService.Param profileName = definition.param("profileName");
-    assertThat(profileName.deprecatedSince()).isEqualTo("6.5");
-    WebService.Param language = definition.param("language");
-    assertThat(language.deprecatedSince()).isEqualTo("6.5");
-    WebService.Param parentName = definition.param("parentName");
-    assertThat(parentName.deprecatedSince()).isEqualTo("6.5");
+    assertThat(profile.deprecatedSince()).isEqualTo("6.6");
+    Param parentProfile = definition.param("parentKey");
+    assertThat(parentProfile.deprecatedKey()).isNullOrEmpty();
   }
 
   @Test
@@ -164,8 +161,8 @@ public class ChangeParentActionTest {
     // Set parent
     ws.newRequest()
       .setMethod("POST")
-      .setParam(PARAM_PROFILE, child.getKee())
-      .setParam(PARAM_PARENT_PROFILE, parent1.getKee())
+      .setParam(PARAM_KEY, child.getKee())
+      .setParam(PARAM_PARENT_KEY, parent1.getKee())
       .execute();
 
     // Check rule 1 enabled
@@ -195,8 +192,8 @@ public class ChangeParentActionTest {
     // Set parent 2 through WS
     ws.newRequest()
       .setMethod("POST")
-      .setParam(PARAM_PROFILE, child.getKee())
-      .setParam(PARAM_PARENT_PROFILE, parent2.getKee())
+      .setParam(PARAM_KEY, child.getKee())
+      .setParam(PARAM_PARENT_KEY, parent2.getKee())
       .execute();
 
     // Check rule 2 enabled
@@ -223,7 +220,7 @@ public class ChangeParentActionTest {
     // Remove parent through WS
     ws.newRequest()
       .setMethod("POST")
-      .setParam(PARAM_PROFILE, child.getKee())
+      .setParam(PARAM_KEY, child.getKee())
       .execute();
 
     // Check no rule enabled
@@ -254,9 +251,9 @@ public class ChangeParentActionTest {
     ws.newRequest()
       .setMethod("POST")
       .setParam(PARAM_LANGUAGE, child.getLanguage())
-      .setParam(PARAM_PROFILE_NAME, child.getName())
+      .setParam(PARAM_QUALITY_PROFILE, child.getName())
       .setParam(PARAM_ORGANIZATION, organization.getKey())
-      .setParam(PARAM_PARENT_NAME, parent1.getName())
+      .setParam(PARAM_PARENT_QUALITY_PROFILE, parent1.getName())
       .execute();
 
     // 1. check rule 1 enabled
@@ -269,9 +266,9 @@ public class ChangeParentActionTest {
     ws.newRequest()
       .setMethod("POST")
       .setParam(PARAM_LANGUAGE, child.getLanguage())
-      .setParam(PARAM_PROFILE_NAME, child.getName())
+      .setParam(PARAM_QUALITY_PROFILE, child.getName())
       .setParam(PARAM_ORGANIZATION, organization.getKey())
-      .setParam(PARAM_PARENT_NAME, parent2.getName())
+      .setParam(QualityProfileWsParameters.PARAM_PARENT_QUALITY_PROFILE, parent2.getName())
       .execute();
 
     // 2. check rule 2 enabled
@@ -283,9 +280,9 @@ public class ChangeParentActionTest {
     ws.newRequest()
       .setMethod("POST")
       .setParam(PARAM_LANGUAGE, child.getLanguage())
-      .setParam(PARAM_PROFILE_NAME, child.getName())
+      .setParam(PARAM_QUALITY_PROFILE, child.getName())
       .setParam(PARAM_ORGANIZATION, organization.getKey())
-      .setParam(PARAM_PARENT_NAME, "")
+      .setParam(QualityProfileWsParameters.PARAM_PARENT_QUALITY_PROFILE, "")
       .execute();
 
     // 3. check no rule enabled
@@ -312,8 +309,8 @@ public class ChangeParentActionTest {
     // Remove parent
     ws.newRequest()
       .setMethod("POST")
-      .setParam(PARAM_PROFILE, child.getKee())
-      .setParam(PARAM_PARENT_PROFILE, "")
+      .setParam(PARAM_KEY, child.getKee())
+      .setParam(PARAM_PARENT_KEY, "")
       .execute();
 
     // Check no rule enabled
@@ -332,8 +329,8 @@ public class ChangeParentActionTest {
 
     TestRequest request = ws.newRequest()
       .setMethod("POST")
-      .setParam(PARAM_PROFILE, child.getKee())
-      .setParam(PARAM_PARENT_PROFILE, "palap");
+      .setParam(PARAM_KEY, child.getKee())
+      .setParam(PARAM_PARENT_KEY, "palap");
 
     thrown.expect(BadRequestException.class);
 
@@ -349,9 +346,9 @@ public class ChangeParentActionTest {
 
     TestRequest request = ws.newRequest()
       .setMethod("POST")
-      .setParam(PARAM_PROFILE, child.getKee())
-      .setParam(PARAM_PARENT_NAME, "polop")
-      .setParam(PARAM_PARENT_PROFILE, "palap");
+      .setParam(PARAM_KEY, child.getKee())
+      .setParam(PARAM_PARENT_QUALITY_PROFILE, "polop")
+      .setParam(PARAM_PARENT_KEY, "palap");
     thrown.expect(IllegalArgumentException.class);
     request
       .execute();
@@ -366,10 +363,10 @@ public class ChangeParentActionTest {
 
     TestRequest request = ws.newRequest()
       .setMethod("POST")
-      .setParam(PARAM_PROFILE, child.getKee())
-      .setParam(PARAM_PROFILE_NAME, child.getName())
+      .setParam(PARAM_KEY, child.getKee())
+      .setParam(PARAM_QUALITY_PROFILE, child.getName())
       .setParam(PARAM_ORGANIZATION, organization.getKey())
-      .setParam(PARAM_PARENT_PROFILE, "palap");
+      .setParam(PARAM_PARENT_KEY, "palap");
 
     thrown.expect(IllegalArgumentException.class);
     request.execute();
@@ -383,7 +380,7 @@ public class ChangeParentActionTest {
 
     TestRequest request = ws.newRequest()
       .setMethod("POST")
-      .setParam(PARAM_PROFILE, child.getKee());
+      .setParam(PARAM_KEY, child.getKee());
 
     thrown.expect(ForbiddenException.class);
     thrown.expectMessage("Insufficient privileges");
@@ -399,7 +396,7 @@ public class ChangeParentActionTest {
 
     TestRequest request = ws.newRequest()
       .setMethod("POST")
-      .setParam(PARAM_PROFILE, child.getKee());
+      .setParam(PARAM_KEY, child.getKee());
 
     thrown.expect(ForbiddenException.class);
     thrown.expectMessage("Insufficient privileges");
index 798a30f2206461824dc0f938137afebb240864b6..8f6d7166b66eaa11dfb9df8f8ed96a1c159df12f 100644 (file)
@@ -42,8 +42,8 @@ import org.sonar.server.ws.WsActionTester;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_LANGUAGE;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_ORGANIZATION;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE_NAME;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_KEY;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_QUALITY_PROFILE;
 
 public class ChangelogActionDatabaseTest {
 
@@ -76,13 +76,11 @@ public class ChangelogActionDatabaseTest {
 
     assertThat(definition.responseExampleAsString()).isNotEmpty();
     assertThat(definition.params()).extracting(WebService.Param::key)
-      .containsExactlyInAnyOrder("profile", "profileName", "language", "organization", "since", "to", "p", "ps");
-    WebService.Param profile = definition.param("profile");
-    assertThat(profile.deprecatedKey()).isEqualTo("profileKey");
-    WebService.Param profileName = definition.param("profileName");
-    assertThat(profileName.deprecatedSince()).isEqualTo("6.5");
+      .containsExactlyInAnyOrder("key", "qualityProfile", "language", "organization", "since", "to", "p", "ps");
+    WebService.Param profileName = definition.param("qualityProfile");
+    assertThat(profileName.deprecatedSince()).isNullOrEmpty();
     WebService.Param language = definition.param("language");
-    assertThat(language.deprecatedSince()).isEqualTo("6.5");
+    assertThat(language.deprecatedSince()).isNullOrEmpty();
   }
 
   @Test
@@ -91,7 +89,7 @@ public class ChangelogActionDatabaseTest {
 
     String response = ws.newRequest()
       .setMethod("GET")
-      .setParam(PARAM_PROFILE, profile.getKee())
+      .setParam(PARAM_KEY, profile.getKee())
       .execute()
       .getInput();
 
@@ -105,7 +103,7 @@ public class ChangelogActionDatabaseTest {
     String response = ws.newRequest()
       .setMethod("GET")
       .setParam(PARAM_LANGUAGE, qualityProfile.getLanguage())
-      .setParam(PARAM_PROFILE_NAME, qualityProfile.getName())
+      .setParam(PARAM_QUALITY_PROFILE, qualityProfile.getName())
       .execute()
       .getInput();
 
@@ -119,7 +117,7 @@ public class ChangelogActionDatabaseTest {
     String response = ws.newRequest()
       .setMethod("GET")
       .setParam(PARAM_LANGUAGE, qualityProfile.getLanguage())
-      .setParam(PARAM_PROFILE_NAME, qualityProfile.getName())
+      .setParam(PARAM_QUALITY_PROFILE, qualityProfile.getName())
       .setParam(PARAM_ORGANIZATION, organization.getKey())
       .execute()
       .getInput();
@@ -137,7 +135,7 @@ public class ChangelogActionDatabaseTest {
     TestRequest request = ws.newRequest()
       .setMethod("GET")
       .setParam(PARAM_LANGUAGE, qualityProfile.getLanguage())
-      .setParam(PARAM_PROFILE_NAME, qualityProfile.getName())
+      .setParam(PARAM_QUALITY_PROFILE, qualityProfile.getName())
       .setParam(PARAM_ORGANIZATION, organization2.getKey());
 
     thrown.expect(NotFoundException.class);
@@ -151,7 +149,7 @@ public class ChangelogActionDatabaseTest {
 
     String response = ws.newRequest()
       .setMethod("GET")
-      .setParam(PARAM_PROFILE, qualityProfile.getKee())
+      .setParam(PARAM_KEY, qualityProfile.getKee())
       .execute()
       .getInput();
 
@@ -172,7 +170,7 @@ public class ChangelogActionDatabaseTest {
 
     String response = ws.newRequest()
       .setMethod("GET")
-      .setParam(PARAM_PROFILE, qualityProfile.getKee())
+      .setParam(PARAM_KEY, qualityProfile.getKee())
       .execute()
       .getInput();
 
index 022939bd9f66450de66ac134d9163fa35da06335..736b0b76e0969ff6ca45b3471046eab9b8c0fe79 100644 (file)
@@ -44,7 +44,7 @@ import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 import static org.sonar.api.utils.DateUtils.parseDate;
 import static org.sonar.server.qualityprofile.QProfileTesting.XOO_P1_KEY;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_KEY;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_SINCE;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_TO;
 
@@ -72,7 +72,7 @@ public class ChangelogActionMockTest {
     when(wsSupport.getProfile(any(DbSession.class), eq(QProfileReference.fromKey(XOO_P1_KEY)))).thenReturn(QProfileTesting.newXooP1(organization));
     when(changelogLoader.load(any(DbSession.class), any(QProfileChangeQuery.class))).thenReturn(new ChangelogLoader.Changelog(0, Collections.emptyList()));
 
-    ws.newGetRequest(QProfilesWs.API_ENDPOINT, "changelog").setParam(PARAM_PROFILE, XOO_P1_KEY)
+    ws.newGetRequest(QProfilesWs.API_ENDPOINT, "changelog").setParam(PARAM_KEY, XOO_P1_KEY)
       .execute().assertJson(getClass(), "changelog_empty.json");
   }
 
@@ -84,7 +84,7 @@ public class ChangelogActionMockTest {
     List<ChangelogLoader.Change> changes = asList(change1, change2);
     when(changelogLoader.load(any(DbSession.class), any(QProfileChangeQuery.class))).thenReturn(new ChangelogLoader.Changelog(10, changes));
 
-    ws.newGetRequest(QProfilesWs.API_ENDPOINT, "changelog").setParam(PARAM_PROFILE, XOO_P1_KEY)
+    ws.newGetRequest(QProfilesWs.API_ENDPOINT, "changelog").setParam(PARAM_KEY, XOO_P1_KEY)
       .execute().assertJson(getClass(), "changelog_nominal.json");
   }
 
@@ -97,7 +97,7 @@ public class ChangelogActionMockTest {
     List<ChangelogLoader.Change> changes = asList(change1);
     when(changelogLoader.load(any(DbSession.class), any(QProfileChangeQuery.class))).thenReturn(new ChangelogLoader.Changelog(10, changes));
 
-    ws.newGetRequest(QProfilesWs.API_ENDPOINT, "changelog").setParam(PARAM_PROFILE, XOO_P1_KEY)
+    ws.newGetRequest(QProfilesWs.API_ENDPOINT, "changelog").setParam(PARAM_KEY, XOO_P1_KEY)
       .execute().assertJson(getClass(), "changelog_full.json");
   }
 
@@ -107,7 +107,7 @@ public class ChangelogActionMockTest {
     when(changelogLoader.load(any(DbSession.class), any(QProfileChangeQuery.class))).thenReturn(new ChangelogLoader.Changelog(0, Collections.emptyList()));
 
     ws.newGetRequest(QProfilesWs.API_ENDPOINT, "changelog")
-      .setParam(PARAM_PROFILE, XOO_P1_KEY)
+      .setParam(PARAM_KEY, XOO_P1_KEY)
       .setParam(PARAM_SINCE, "2016-09-01")
       .setParam(PARAM_TO, "2016-09-01")
       .execute();
@@ -122,6 +122,6 @@ public class ChangelogActionMockTest {
   public void fail_on_unknown_profile() throws Exception {
     when(wsSupport.getProfile(any(DbSession.class), eq(QProfileReference.fromKey(XOO_P1_KEY)))).thenThrow(new NotFoundException("Profile not found"));
 
-    ws.newGetRequest(QProfilesWs.API_ENDPOINT, "changelog").setParam(PARAM_PROFILE, XOO_P1_KEY).execute();
+    ws.newGetRequest(QProfilesWs.API_ENDPOINT, "changelog").setParam(PARAM_KEY, XOO_P1_KEY).execute();
   }
 }
index a27c80aebe3a14486b28fc9d9be8f5aac4d851e7..a64522226a9bd70ed8edf079f49ad8abc9d60101 100644 (file)
@@ -117,10 +117,10 @@ public class CreateActionTest {
 
     assertThat(definition.responseExampleAsString()).isNotEmpty();
     assertThat(definition.params()).extracting(Param::key)
-      .containsExactlyInAnyOrder("language", "organization", "profileName", "backup_with_messages", "backup_with_errors", "backup_xoo_lint");
-    Param profileName = definition.param("profileName");
-    assertThat(profileName.deprecatedKey()).isEqualTo("name");
-    assertThat(profileName.deprecatedKeySince()).isEqualTo("6.1");
+      .containsExactlyInAnyOrder("language", "organization", "name", "backup_with_messages", "backup_with_errors", "backup_xoo_lint");
+    Param name = definition.param("name");
+    assertThat(name.deprecatedKey()).isEqualTo("profileName");
+    assertThat(name.deprecatedKeySince()).isEqualTo("6.6");
   }
 
   @Test
index 3c70df775d3d0b75db11d7c8bea4d62e9b39bbb9..c46792036de1d97b83042b21d111084ee509f3e7 100644 (file)
@@ -50,7 +50,7 @@ import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_KEY;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_RULE;
 
 public class DeactivateRuleActionTest {
@@ -80,8 +80,8 @@ public class DeactivateRuleActionTest {
     WebService.Action definition = wsActionTester.getDef();
     assertThat(definition).isNotNull();
     assertThat(definition.isPost()).isTrue();
-    assertThat(definition.params()).extracting(WebService.Param::key).containsExactlyInAnyOrder("profile", "rule");
-    WebService.Param profileKey = definition.param("profile");
+    assertThat(definition.params()).extracting(WebService.Param::key).containsExactlyInAnyOrder("key", "rule");
+    WebService.Param profileKey = definition.param("key");
     assertThat(profileKey.deprecatedKey()).isEqualTo("profile_key");
     WebService.Param ruleKey = definition.param("rule");
     assertThat(ruleKey.deprecatedKey()).isEqualTo("rule_key");
@@ -92,7 +92,7 @@ public class DeactivateRuleActionTest {
     TestRequest request = wsActionTester.newRequest()
       .setMethod("POST")
       .setParam(PARAM_RULE, RuleTesting.newRuleDto().getKey().toString())
-      .setParam(PARAM_PROFILE, randomAlphanumeric(UUID_SIZE));
+      .setParam(PARAM_KEY, randomAlphanumeric(UUID_SIZE));
 
     expectedException.expect(UnauthorizedException.class);
 
@@ -106,7 +106,7 @@ public class DeactivateRuleActionTest {
     TestRequest request = wsActionTester.newRequest()
       .setMethod("POST")
       .setParam(PARAM_RULE, RuleTesting.newRuleDto().getKey().toString())
-      .setParam(PARAM_PROFILE, qualityProfile.getKee());
+      .setParam(PARAM_KEY, qualityProfile.getKee());
 
     expectedException.expect(ForbiddenException.class);
 
@@ -121,7 +121,7 @@ public class DeactivateRuleActionTest {
     TestRequest request = wsActionTester.newRequest()
       .setMethod("POST")
       .setParam(PARAM_RULE, RuleTesting.newRuleDto().getKey().toString())
-      .setParam(PARAM_PROFILE, qualityProfile.getKee());
+      .setParam(PARAM_KEY, qualityProfile.getKee());
 
     expectedException.expect(BadRequestException.class);
 
@@ -136,7 +136,7 @@ public class DeactivateRuleActionTest {
     TestRequest request = wsActionTester.newRequest()
       .setMethod("POST")
       .setParam(PARAM_RULE, ruleKey.toString())
-      .setParam(PARAM_PROFILE, qualityProfile.getKee());
+      .setParam(PARAM_KEY, qualityProfile.getKee());
 
     TestResponse response = request.execute();
 
@@ -157,7 +157,7 @@ public class DeactivateRuleActionTest {
       .setMethod("POST")
       .setParam("organization", organization.getKey())
       .setParam(PARAM_RULE, ruleKey.toString())
-      .setParam(PARAM_PROFILE, qualityProfile.getKee());
+      .setParam(PARAM_KEY, qualityProfile.getKee());
 
     TestResponse response = request.execute();
 
index 0312273fc84ad38b97b5ad683229dec7d49497f9..4ce81b1b275cff742825a1e12c0e8c316539fee8 100644 (file)
@@ -43,7 +43,7 @@ import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.mockito.Mockito.mock;
 import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_TARGET_PROFILE;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_TARGET_KEY;
 
 public class DeactivateRulesActionTest {
 
@@ -88,14 +88,14 @@ public class DeactivateRulesActionTest {
       "active_severities",
       "s",
       "repositories",
-      "targetProfile",
+      "targetKey",
       "statuses",
       "rule_key",
       "available_since",
       "activation",
       "severities",
       "organization");
-    WebService.Param targetProfile = definition.param("targetProfile");
+    WebService.Param targetProfile = definition.param("targetKey");
     assertThat(targetProfile.deprecatedKey()).isEqualTo("profile_key");
   }
 
@@ -103,7 +103,7 @@ public class DeactivateRulesActionTest {
   public void should_fail_if_not_logged_in() {
     TestRequest request = wsActionTester.newRequest()
       .setMethod("POST")
-      .setParam(PARAM_TARGET_PROFILE, randomAlphanumeric(UUID_SIZE));
+      .setParam(PARAM_TARGET_KEY, randomAlphanumeric(UUID_SIZE));
 
     thrown.expect(UnauthorizedException.class);
     request.execute();
@@ -115,7 +115,7 @@ public class DeactivateRulesActionTest {
     QProfileDto qualityProfile = dbTester.qualityProfiles().insert(defaultOrganization, p -> p.setIsBuiltIn(true));
     TestRequest request = wsActionTester.newRequest()
       .setMethod("POST")
-      .setParam(PARAM_TARGET_PROFILE, qualityProfile.getKee());
+      .setParam(PARAM_TARGET_KEY, qualityProfile.getKee());
 
     thrown.expect(BadRequestException.class);
 
@@ -128,7 +128,7 @@ public class DeactivateRulesActionTest {
     QProfileDto qualityProfile = dbTester.qualityProfiles().insert(organization);
     TestRequest request = wsActionTester.newRequest()
       .setMethod("POST")
-      .setParam(PARAM_TARGET_PROFILE, qualityProfile.getKee());
+      .setParam(PARAM_TARGET_KEY, qualityProfile.getKee());
 
     thrown.expect(ForbiddenException.class);
     request.execute();
index 8f9075b95d5443a15a35fac9d7e51a7f60ddf874..1ee7fffe84a4a592fb7a0254e93d4efeee135be4 100644 (file)
@@ -104,7 +104,7 @@ public class DeleteActionTest {
     TestResponse response = ws.newRequest()
       .setMethod("POST")
       .setParam("language", profile1.getLanguage())
-      .setParam("profileName", profile1.getName())
+      .setParam("qualityProfile", profile1.getName())
       .execute();
 
     assertThat(response.getStatus()).isEqualTo(HttpURLConnection.HTTP_NO_CONTENT);
@@ -126,7 +126,7 @@ public class DeleteActionTest {
       .setMethod("POST")
       .setParam("organization", organization.getKey())
       .setParam("language", profile1.getLanguage())
-      .setParam("profileName", profile1.getName())
+      .setParam("qualityProfile", profile1.getName())
       .execute();
     assertThat(response.getStatus()).isEqualTo(HttpURLConnection.HTTP_NO_CONTENT);
 
@@ -292,13 +292,14 @@ public class DeleteActionTest {
   public void definition() {
     WebService.Action definition = ws.getDef();
 
-    assertThat(definition.params()).extracting(Param::key).containsExactlyInAnyOrder("language", "organization", "profile", "profileName");
-    Param profile = definition.param("profile");
-    assertThat(profile.deprecatedKey()).isEqualTo("profileKey");
-    Param profileName = definition.param("profileName");
-    assertThat(profileName.deprecatedSince()).isEqualTo("6.5");
+    assertThat(definition.params()).extracting(Param::key).containsExactlyInAnyOrder("language", "organization", "key", "qualityProfile");
+    Param key = definition.param("key");
+    assertThat(key.deprecatedKey()).isEqualTo("profileKey");
+    assertThat(key.deprecatedSince()).isEqualTo("6.6");
+    Param profileName = definition.param("qualityProfile");
+    assertThat(profileName.deprecatedSince()).isNullOrEmpty();
     Param language = definition.param("language");
-    assertThat(language.deprecatedSince()).isEqualTo("6.5");
+    assertThat(language.deprecatedSince()).isNullOrEmpty();
   }
 
   private void logInAsQProfileAdministrator(OrganizationDto organization) {
index 269debcf3beb6fd82e81c1f962c5d01e304813c4..04774a842f27dca9e82d5e1616eaf72dbad542a4 100644 (file)
@@ -49,7 +49,7 @@ import org.sonar.server.ws.WsActionTester;
 import static java.lang.String.format;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_LANGUAGE;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_KEY;
 
 public class ExportActionTest {
 
@@ -73,16 +73,17 @@ public class ExportActionTest {
 
     assertThat(definition.isPost()).isFalse();
     assertThat(definition.isInternal()).isFalse();
-    assertThat(definition.params()).extracting(WebService.Param::key).containsExactlyInAnyOrder("profile", "language", "name", "organization");
+    assertThat(definition.params()).extracting(WebService.Param::key).containsExactlyInAnyOrder("key", "language", "qualityProfile", "organization");
     WebService.Param organizationParam = definition.param("organization");
     assertThat(organizationParam.since()).isEqualTo("6.4");
     assertThat(organizationParam.isInternal()).isTrue();
-    WebService.Param profile = definition.param("profile");
-    assertThat(profile.since()).isEqualTo("6.5");
-    WebService.Param name = definition.param("name");
-    assertThat(name.deprecatedSince()).isEqualTo("6.5");
+    WebService.Param key = definition.param("key");
+    assertThat(key.since()).isEqualTo("6.5");
+    assertThat(key.deprecatedSince()).isEqualTo("6.6");
+    WebService.Param name = definition.param("qualityProfile");
+    assertThat(name.deprecatedSince()).isNullOrEmpty();
     WebService.Param language = definition.param("language");
-    assertThat(language.deprecatedSince()).isEqualTo("6.5");
+    assertThat(language.deprecatedSince()).isNullOrEmpty();
   }
 
   @Test
@@ -91,7 +92,7 @@ public class ExportActionTest {
 
     assertThat(definition.isPost()).isFalse();
     assertThat(definition.isInternal()).isFalse();
-    assertThat(definition.params()).extracting("key").containsExactlyInAnyOrder("profile", "language", "name", "organization", "exporterKey");
+    assertThat(definition.params()).extracting("key").containsExactlyInAnyOrder("key", "language", "qualityProfile", "organization", "exporterKey");
     WebService.Param exportersParam = definition.param("exporterKey");
     assertThat(exportersParam.possibleValues()).containsOnly("polop", "palap");
     assertThat(exportersParam.deprecatedKey()).isEqualTo("format");
@@ -105,7 +106,7 @@ public class ExportActionTest {
 
     WsActionTester tester = newWsActionTester(newExporter("polop"), newExporter("palap"));
     String result = tester.newRequest()
-      .setParam(PARAM_PROFILE, profile.getKee())
+      .setParam(PARAM_KEY, profile.getKee())
       .setParam("exporterKey", "polop").execute()
       .getInput();
 
@@ -119,7 +120,7 @@ public class ExportActionTest {
 
     WsActionTester ws = newWsActionTester(newExporter("polop"), newExporter("palap"));
     ws.newRequest()
-      .setParam(PARAM_PROFILE, "PROFILE-KEY-404")
+      .setParam(PARAM_KEY, "PROFILE-KEY-404")
       .setParam("exporterKey", "polop").execute()
       .getInput();
   }
@@ -129,11 +130,11 @@ public class ExportActionTest {
     QProfileDto profile = createProfile(db.getDefaultOrganization(), false);
 
     expectedException.expect(BadRequestException.class);
-    expectedException.expectMessage("Either 'profile' or 'language' must be provided.");
+    expectedException.expectMessage("Either 'key' or 'language' must be provided.");
 
     WsActionTester ws = newWsActionTester(newExporter("polop"), newExporter("palap"));
     ws.newRequest()
-      .setParam(PARAM_PROFILE, profile.getKee())
+      .setParam(PARAM_KEY, profile.getKee())
       .setParam(PARAM_LANGUAGE, profile.getLanguage())
       .setParam("exporterKey", "polop").execute()
       .getInput();
@@ -146,7 +147,7 @@ public class ExportActionTest {
     WsActionTester tester = newWsActionTester(newExporter("polop"), newExporter("palap"));
     String result = tester.newRequest()
       .setParam("language", profile.getLanguage())
-      .setParam("name", profile.getName())
+      .setParam("qualityProfile", profile.getName())
       .setParam("exporterKey", "polop").execute()
       .getInput();
 
@@ -162,7 +163,7 @@ public class ExportActionTest {
     String result = tester.newRequest()
       .setParam("organization", organization.getKey())
       .setParam("language", profile.getLanguage())
-      .setParam("name", profile.getName())
+      .setParam("qualityProfile", profile.getName())
       .setParam("exporterKey", "polop").execute()
       .getInput();
 
@@ -227,7 +228,7 @@ public class ExportActionTest {
 
     String result = newWsActionTester(newExporter("polop")).newRequest()
       .setParam("language", profile.getLanguage())
-      .setParam("name", profile.getName())
+      .setParam("qualityProfile", profile.getName())
       .execute()
       .getInput();
 
index beca53c8829570ba690a3d28e4b3d4afe0462062..af5979d4dd9b35a82be732e4482f95591c63e443 100644 (file)
@@ -63,7 +63,7 @@ import static org.assertj.core.api.Assertions.assertThat;
 import static org.sonar.server.qualityprofile.QProfileTesting.newQProfileDto;
 import static org.sonar.test.JsonAssert.assertJson;
 import static org.sonarqube.ws.MediaTypes.PROTOBUF;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_KEY;
 
 public class InheritanceActionTest {
 
@@ -144,7 +144,7 @@ public class InheritanceActionTest {
 
     String response = ws.newRequest()
       .setMethod("GET")
-      .setParam(PARAM_PROFILE, buWide.getKee())
+      .setParam(PARAM_KEY, buWide.getKee())
       .execute()
       .getInput();
 
@@ -172,7 +172,7 @@ public class InheritanceActionTest {
     InputStream response = ws.newRequest()
       .setMethod("GET")
       .setMediaType(PROTOBUF)
-      .setParam(PARAM_PROFILE, child.getKee())
+      .setParam(PARAM_KEY, child.getKee())
       .execute()
       .getInputStream();
 
@@ -199,7 +199,7 @@ public class InheritanceActionTest {
     InputStream response = ws.newRequest()
       .setMethod("GET")
       .setMediaType(PROTOBUF)
-      .setParam(PARAM_PROFILE, profile.getKee())
+      .setParam(PARAM_KEY, profile.getKee())
       .execute()
       .getInputStream();
 
@@ -215,7 +215,7 @@ public class InheritanceActionTest {
 
     String response = ws.newRequest()
       .setMethod("GET")
-      .setParam(PARAM_PROFILE, remi.getKee())
+      .setParam(PARAM_KEY, remi.getKee())
       .execute()
       .getInput();
 
@@ -225,7 +225,7 @@ public class InheritanceActionTest {
   @Test(expected = NotFoundException.class)
   public void fail_if_not_found() throws Exception {
     ws.newRequest()
-      .setMethod("GET").setParam(PARAM_PROFILE, "polop").execute();
+      .setMethod("GET").setParam(PARAM_KEY, "polop").execute();
   }
 
   @Test
@@ -233,13 +233,14 @@ public class InheritanceActionTest {
     WebService.Action definition = ws.getDef();
 
     assertThat(definition.key()).isEqualTo("inheritance");
-    assertThat(definition.params()).extracting(Param::key).containsExactlyInAnyOrder("profile", "language", "profileName", "organization");
-    Param profile = definition.param("profile");
-    assertThat(profile.deprecatedKey()).isEqualTo("profileKey");
-    Param profileName = definition.param("profileName");
-    assertThat(profileName.deprecatedSince()).isEqualTo("6.5");
+    assertThat(definition.params()).extracting(Param::key).containsExactlyInAnyOrder("key", "language", "qualityProfile", "organization");
+    Param key = definition.param("key");
+    assertThat(key.deprecatedKey()).isEqualTo("profileKey");
+    assertThat(key.deprecatedSince()).isEqualTo("6.6");
+    Param profileName = definition.param("qualityProfile");
+    assertThat(profileName.deprecatedSince()).isNullOrEmpty();
     Param language = definition.param("language");
-    assertThat(language.deprecatedSince()).isEqualTo("6.5");
+    assertThat(language.deprecatedSince()).isNullOrEmpty();
   }
 
   private QProfileDto createProfile(String lang, String name, String key) {
index ad57f5db45040f7f5d699dfbdfd9ce465a07143f..7051702e9e45cb4f262ef7e7f99ae7bd0113b276 100644 (file)
@@ -44,7 +44,7 @@ import org.sonar.server.ws.WsTester;
 import org.sonar.server.ws.WsTester.TestRequest;
 
 import static org.assertj.core.api.Assertions.assertThat;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_KEY;
 
 public class ProjectsActionTest {
 
@@ -94,7 +94,7 @@ public class ProjectsActionTest {
 
     dbSession.commit();
 
-    newRequest().setParam(PARAM_PROFILE, xooP1.getKee()).setParam("selected", "selected").execute().assertJson(this.getClass(), "authorized_selected.json");
+    newRequest().setParam(PARAM_KEY, xooP1.getKee()).setParam("selected", "selected").execute().assertJson(this.getClass(), "authorized_selected.json");
   }
 
   @Test
@@ -109,20 +109,20 @@ public class ProjectsActionTest {
 
     dbSession.commit();
 
-    newRequest().setParam(PARAM_PROFILE, xooP1.getKee()).setParam("selected", "selected").setParam(Param.PAGE_SIZE, "2")
+    newRequest().setParam(PARAM_KEY, xooP1.getKee()).setParam("selected", "selected").setParam(Param.PAGE_SIZE, "2")
       .execute().assertJson(this.getClass(), "selected_page1.json");
-    newRequest().setParam(PARAM_PROFILE, xooP1.getKee()).setParam("selected", "selected").setParam(Param.PAGE_SIZE, "2").setParam(Param.PAGE, "2")
+    newRequest().setParam(PARAM_KEY, xooP1.getKee()).setParam("selected", "selected").setParam(Param.PAGE_SIZE, "2").setParam(Param.PAGE, "2")
       .execute().assertJson(this.getClass(), "selected_page2.json");
-    newRequest().setParam(PARAM_PROFILE, xooP1.getKee()).setParam("selected", "selected").setParam(Param.PAGE_SIZE, "2").setParam(Param.PAGE, "3")
+    newRequest().setParam(PARAM_KEY, xooP1.getKee()).setParam("selected", "selected").setParam(Param.PAGE_SIZE, "2").setParam(Param.PAGE, "3")
       .execute().assertJson(this.getClass(), "empty.json");
-    newRequest().setParam(PARAM_PROFILE, xooP1.getKee()).setParam("selected", "selected").setParam(Param.PAGE_SIZE, "2").setParam(Param.PAGE, "4")
+    newRequest().setParam(PARAM_KEY, xooP1.getKee()).setParam("selected", "selected").setParam(Param.PAGE_SIZE, "2").setParam(Param.PAGE, "4")
       .execute().assertJson(this.getClass(), "empty.json");
 
-    newRequest().setParam(PARAM_PROFILE, xooP1.getKee()).setParam("selected", "selected").setParam(Param.PAGE_SIZE, "3").setParam(Param.PAGE, "1")
+    newRequest().setParam(PARAM_KEY, xooP1.getKee()).setParam("selected", "selected").setParam(Param.PAGE_SIZE, "3").setParam(Param.PAGE, "1")
       .execute().assertJson(this.getClass(), "selected_ps3_page1.json");
-    newRequest().setParam(PARAM_PROFILE, xooP1.getKee()).setParam("selected", "selected").setParam(Param.PAGE_SIZE, "3").setParam(Param.PAGE, "2")
+    newRequest().setParam(PARAM_KEY, xooP1.getKee()).setParam("selected", "selected").setParam(Param.PAGE_SIZE, "3").setParam(Param.PAGE, "2")
       .execute().assertJson(this.getClass(), "selected_ps3_page2.json");
-    newRequest().setParam(PARAM_PROFILE, xooP1.getKee()).setParam("selected", "selected").setParam(Param.PAGE_SIZE, "3").setParam(Param.PAGE, "3")
+    newRequest().setParam(PARAM_KEY, xooP1.getKee()).setParam("selected", "selected").setParam(Param.PAGE_SIZE, "3").setParam(Param.PAGE, "3")
       .execute().assertJson(this.getClass(), "empty.json");
   }
 
@@ -138,7 +138,7 @@ public class ProjectsActionTest {
 
     dbSession.commit();
 
-    newRequest().setParam(PARAM_PROFILE, xooP1.getKee()).setParam("selected", "deselected").execute().assertJson(this.getClass(), "deselected.json");
+    newRequest().setParam(PARAM_KEY, xooP1.getKee()).setParam("selected", "deselected").execute().assertJson(this.getClass(), "deselected.json");
   }
 
   @Test
@@ -155,7 +155,7 @@ public class ProjectsActionTest {
 
     dbSession.commit();
 
-    newRequest().setParam(PARAM_PROFILE, xooP1.getKee()).setParam("selected", "all").execute().assertJson(this.getClass(), "all.json");
+    newRequest().setParam(PARAM_KEY, xooP1.getKee()).setParam("selected", "all").execute().assertJson(this.getClass(), "all.json");
   }
 
   @Test
@@ -170,14 +170,14 @@ public class ProjectsActionTest {
 
     dbSession.commit();
 
-    newRequest().setParam(PARAM_PROFILE, xooP1.getKee()).setParam("selected", "all").setParam(Param.TEXT_QUERY, "project t").execute().assertJson(this.getClass(), "all_filtered.json");
+    newRequest().setParam(PARAM_KEY, xooP1.getKee()).setParam("selected", "all").setParam(Param.TEXT_QUERY, "project t").execute().assertJson(this.getClass(), "all_filtered.json");
   }
 
   @Test
   public void should_fail_on_nonexistent_profile() throws Exception {
     expectedException.expect(NotFoundException.class);
 
-    newRequest().setParam(PARAM_PROFILE, "unknown").setParam("selected", "all").execute();
+    newRequest().setParam(PARAM_KEY, "unknown").setParam("selected", "all").execute();
   }
 
   @Test
@@ -194,7 +194,7 @@ public class ProjectsActionTest {
 
     dbSession.commit();
 
-    newRequest().setParam(PARAM_PROFILE, xooP1.getKee()).setParam("selected", "all").execute().assertJson(this.getClass(), "return_deprecated_uuid_field.json");
+    newRequest().setParam(PARAM_KEY, xooP1.getKee()).setParam("selected", "all").execute().assertJson(this.getClass(), "return_deprecated_uuid_field.json");
   }
 
   @Test
@@ -202,7 +202,7 @@ public class ProjectsActionTest {
     expectedException.expect(IllegalArgumentException.class);
     expectedException.expectMessage("The 'ps' parameter must be less than 500");
 
-    newRequest().setParam(PARAM_PROFILE, xooP1.getKee()).setParam(Param.PAGE_SIZE, "501").execute();
+    newRequest().setParam(PARAM_KEY, xooP1.getKee()).setParam(Param.PAGE_SIZE, "501").execute();
   }
 
   @Test
@@ -211,9 +211,9 @@ public class ProjectsActionTest {
 
     assertThat(definition.key()).isEqualTo("projects");
     assertThat(definition.responseExampleAsString()).isNotEmpty();
-    assertThat(definition.params()).extracting(Param::key).containsExactlyInAnyOrder("profile", "p", "ps", "q", "selected");
-    Param profile = definition.param("profile");
-    assertThat(profile.deprecatedKey()).isEqualTo("key");
+    assertThat(definition.params()).extracting(Param::key).containsExactlyInAnyOrder("key", "p", "ps", "q", "selected");
+    Param profile = definition.param("key");
+    assertThat(profile.deprecatedKey()).isNullOrEmpty();
     Param page = definition.param("p");
     assertThat(page.deprecatedKey()).isEqualTo("page");
     Param pageSize = definition.param("ps");
index 18b8aa9e2afb30b103be1133080a6a33e2485b4e..71bce7be8de79542dcd97119cd05d00de2062696 100644 (file)
@@ -101,7 +101,7 @@ public class QProfileReferenceTest {
   @Test
   public void from_reads_request_parameters_and_creates_reference_by_key() {
     SimpleGetRequest req = new SimpleGetRequest();
-    req.setParam("profile", "foo");
+    req.setParam("key", "foo");
 
     QProfileReference ref = QProfileReference.from(req);
     assertThat(ref.getKey()).isEqualTo("foo");
@@ -111,7 +111,7 @@ public class QProfileReferenceTest {
   public void from_reads_request_parameters_and_creates_reference_by_name_on_default_organization() {
     SimpleGetRequest req = new SimpleGetRequest();
     req.setParam("language", "js");
-    req.setParam("profileName", "Sonar way");
+    req.setParam("qualityProfile", "Sonar way");
 
     QProfileReference ref = QProfileReference.from(req);
     assertThat(ref.getOrganizationKey()).isEmpty();
@@ -124,7 +124,7 @@ public class QProfileReferenceTest {
     SimpleGetRequest req = new SimpleGetRequest();
     req.setParam("organization", "my-org");
     req.setParam("language", "js");
-    req.setParam("profileName", "Sonar way");
+    req.setParam("qualityProfile", "Sonar way");
 
     QProfileReference ref = QProfileReference.from(req);
     assertThat(ref.getOrganizationKey()).hasValue("my-org");
@@ -165,8 +165,8 @@ public class QProfileReferenceTest {
     WebService.Action action = wsTester.controller("api/qualityprofiles").action("do");
     assertThat(action.param("language")).isNotNull();
     assertThat(action.param("language").possibleValues()).containsOnly("java", "js");
-    assertThat(action.param("profile")).isNotNull();
-    assertThat(action.param("profileName")).isNotNull();
+    assertThat(action.param("key")).isNotNull();
+    assertThat(action.param("qualityProfile")).isNotNull();
   }
 
   @Test
index f51b8ddcbe003cf302026651fd74292899918725..4c7be42f5cf360eb7ff9d4030c12ab07ab687767 100644 (file)
@@ -63,11 +63,11 @@ import org.sonar.server.ws.WsActionTester;
 import static java.util.Arrays.asList;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.junit.Assert.fail;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_KEY;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_RESET;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_RULE;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_SEVERITY;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_TARGET_PROFILE;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_TARGET_KEY;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_TARGET_SEVERITY;
 import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_LANGUAGES;
 import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_QPROFILE;
@@ -119,7 +119,7 @@ public class QProfilesWsMediumTest {
 
     // 1. Deactivate Rule
     wsDeactivateRule.newRequest().setMethod("POST")
-      .setParam(PARAM_PROFILE, profile.getKee())
+      .setParam(PARAM_KEY, profile.getKee())
       .setParam(PARAM_RULE, rule.getKey().toString())
       .execute();
     dbSession.clearCache();
@@ -147,7 +147,7 @@ public class QProfilesWsMediumTest {
 
     // 1. Deactivate Rule
     wsDeactivateRules.newRequest().setMethod("POST")
-      .setParam(PARAM_TARGET_PROFILE, profile.getKee())
+      .setParam(PARAM_TARGET_KEY, profile.getKee())
       .execute();
     dbSession.clearCache();
 
@@ -173,7 +173,7 @@ public class QProfilesWsMediumTest {
 
     // 1. Deactivate Rule
     wsDeactivateRules.newRequest().setMethod("POST")
-      .setParam(PARAM_TARGET_PROFILE, profile.getKee())
+      .setParam(PARAM_TARGET_KEY, profile.getKee())
       .execute();
     dbSession.clearCache();
 
@@ -197,7 +197,7 @@ public class QProfilesWsMediumTest {
 
     // 1. Deactivate Rule
     wsDeactivateRules.newRequest().setMethod("POST")
-      .setParam(PARAM_TARGET_PROFILE, profile.getKee())
+      .setParam(PARAM_TARGET_KEY, profile.getKee())
       .setParam(Param.TEXT_QUERY, "hello")
       .execute();
     dbSession.clearCache();
@@ -217,7 +217,7 @@ public class QProfilesWsMediumTest {
 
     // 1. Activate Rule
     wsActivateRule.newRequest().setMethod("POST")
-      .setParam(PARAM_PROFILE, profile.getKee())
+      .setParam(PARAM_KEY, profile.getKee())
       .setParam(PARAM_RULE, rule.getKey().toString())
       .execute();
     dbSession.clearCache();
@@ -238,7 +238,7 @@ public class QProfilesWsMediumTest {
     try {
       // 1. Activate Rule
       wsActivateRule.newRequest().setMethod("POST")
-        .setParam(PARAM_PROFILE, profile.getKee())
+        .setParam(PARAM_KEY, profile.getKee())
         .setParam(PARAM_RULE, rule.getKey().toString())
         .execute();
       dbSession.clearCache();
@@ -259,7 +259,7 @@ public class QProfilesWsMediumTest {
 
     // 1. Activate Rule
     wsActivateRule.newRequest().setMethod("POST")
-      .setParam(PARAM_PROFILE, profile.getKee())
+      .setParam(PARAM_KEY, profile.getKee())
       .setParam(PARAM_RULE, rule.getKey().toString())
       .setParam(PARAM_SEVERITY, "MINOR")
       .execute();
@@ -287,7 +287,7 @@ public class QProfilesWsMediumTest {
 
     // 1. Activate Rule
     wsActivateRules.newRequest().setMethod("POST")
-      .setParam(PARAM_TARGET_PROFILE, profile.getKee())
+      .setParam(PARAM_TARGET_KEY, profile.getKee())
       .setParam(PARAM_LANGUAGES, "java")
       .execute()
       .assertJson(getClass(), "bulk_activate_rule.json");
@@ -312,7 +312,7 @@ public class QProfilesWsMediumTest {
 
     // 1. Activate Rule
     wsActivateRules.newRequest().setMethod("POST")
-      .setParam(PARAM_TARGET_PROFILE, php.getKee())
+      .setParam(PARAM_TARGET_KEY, php.getKee())
       .setParam(PARAM_LANGUAGES, "php")
       .execute()
       .assertJson(getClass(), "bulk_activate_rule_not_all.json");
@@ -336,7 +336,7 @@ public class QProfilesWsMediumTest {
 
     // 1. Activate Rule with query returning 0 hits
     wsActivateRules.newRequest().setMethod("POST")
-      .setParam(PARAM_TARGET_PROFILE, profile.getKee())
+      .setParam(PARAM_TARGET_KEY, profile.getKee())
       .setParam(Param.TEXT_QUERY, "php")
       .execute();
     dbSession.clearCache();
@@ -346,7 +346,7 @@ public class QProfilesWsMediumTest {
 
     // 1. Activate Rule with query returning 1 hits
     wsActivateRules.newRequest().setMethod("POST")
-      .setParam(PARAM_TARGET_PROFILE, profile.getKee())
+      .setParam(PARAM_TARGET_KEY, profile.getKee())
       .setParam(Param.TEXT_QUERY, "world")
       .execute();
     dbSession.commit();
@@ -372,7 +372,7 @@ public class QProfilesWsMediumTest {
 
     // 1. Activate Rule with query returning 2 hits
     wsActivateRules.newRequest().setMethod("POST")
-      .setParam(PARAM_TARGET_PROFILE, profile.getKee())
+      .setParam(PARAM_TARGET_KEY, profile.getKee())
       .setParam(PARAM_TARGET_SEVERITY, "MINOR")
       .execute();
     dbSession.commit();
@@ -398,7 +398,7 @@ public class QProfilesWsMediumTest {
 
     // 1. Activate Rule
     wsActivateRules.newRequest().setMethod("POST")
-      .setParam(PARAM_TARGET_PROFILE, javaProfile.getKee())
+      .setParam(PARAM_TARGET_KEY, javaProfile.getKee())
       .setParam(PARAM_QPROFILE, javaProfile.getKee())
       .setParam("activation", "false")
       .execute()
@@ -433,7 +433,7 @@ public class QProfilesWsMediumTest {
 
     // 1. reset child rule
     wsActivateRule.newRequest().setMethod("POST")
-      .setParam(PARAM_PROFILE, subProfile.getKee())
+      .setParam(PARAM_KEY, subProfile.getKee())
       .setParam(PARAM_RULE, rule.getKey().toString())
       .setParam(PARAM_RESET, "true")
       .execute();
index 40fc22c8f41f07693905a2eaf60e25e6967f94fc..1797e4935a073f6ed38bed623e3d87f6200d53c8 100644 (file)
@@ -28,6 +28,7 @@ import org.sonar.api.profiles.RulesProfile;
 import org.sonar.api.resources.Language;
 import org.sonar.api.resources.Languages;
 import org.sonar.api.server.ws.WebService;
+import org.sonar.api.server.ws.WebService.Param;
 import org.sonar.api.utils.ValidationMessages;
 import org.sonar.db.DbClient;
 import org.sonar.server.language.LanguageTesting;
@@ -106,8 +107,8 @@ public class QProfilesWsTest {
     assertThat(create.param("organization")).isNotNull();
     assertThat(create.param("organization").isRequired()).isFalse();
     assertThat(create.param("organization").isInternal()).isTrue();
-    assertThat(create.param("profileName")).isNotNull();
-    assertThat(create.param("profileName").isRequired()).isTrue();
+    assertThat(create.param("name")).isNotNull();
+    assertThat(create.param("name").isRequired()).isTrue();
     assertThat(create.param("language").possibleValues()).containsOnly(xoo1Key, xoo2Key);
     assertThat(create.param("language").isRequired()).isTrue();
     assertThat(create.param("backup_" + xoo1Key)).isNotNull();
@@ -152,8 +153,8 @@ public class QProfilesWsTest {
     WebService.Action delete = controller.action("delete");
     assertThat(delete).isNotNull();
     assertThat(delete.isPost()).isTrue();
-    assertThat(delete.params()).hasSize(4).extracting("key").containsOnly(
-      "organization", "profile", "language", "profileName");
+    assertThat(delete.params()).hasSize(4).extracting(Param::key).containsOnly(
+      "organization", "key", "language", "qualityProfile");
   }
 
   @Test
@@ -170,8 +171,8 @@ public class QProfilesWsTest {
     WebService.Action inheritance = controller.action("inheritance");
     assertThat(inheritance).isNotNull();
     assertThat(inheritance.isPost()).isFalse();
-    assertThat(inheritance.params()).hasSize(4).extracting("key").containsExactlyInAnyOrder(
-      "organization", "profile", "language", "profileName");
+    assertThat(inheritance.params()).hasSize(4).extracting(Param::key).containsExactlyInAnyOrder(
+      "organization", "key", "language", "qualityProfile");
     assertThat(inheritance.responseExampleAsString()).isNotEmpty();
   }
 }
index b08b83cc2b7cf4b9b8ec33155ae1eabc16a7bd16..50576a44a1b727cb2a8995f993daba67367108af 100644 (file)
@@ -75,18 +75,18 @@ public class RemoveProjectActionTest {
     assertThat(definition.isPost()).isTrue();
     assertThat(definition.key()).isEqualTo("remove_project");
 
-    assertThat(definition.params()).extracting(WebService.Param::key).containsOnly("profile", "profileName", "project", "language", "projectUuid", "organization");
+    assertThat(definition.params()).extracting(WebService.Param::key).containsOnly("key", "qualityProfile", "project", "language", "projectUuid", "organization");
     WebService.Param languageParam = definition.param("language");
     assertThat(languageParam.possibleValues()).containsOnly(LANGUAGE_1, LANGUAGE_2);
     assertThat(languageParam.exampleValue()).isNull();
-    assertThat(languageParam.deprecatedSince()).isEqualTo("6.5");
+    assertThat(languageParam.deprecatedSince()).isNullOrEmpty();
     WebService.Param organizationParam = definition.param("organization");
     assertThat(organizationParam.since()).isEqualTo("6.4");
     assertThat(organizationParam.isInternal()).isTrue();
-    WebService.Param profile = definition.param("profile");
+    WebService.Param profile = definition.param("key");
     assertThat(profile.deprecatedKey()).isEqualTo("profileKey");
-    WebService.Param profileName = definition.param("profileName");
-    assertThat(profileName.deprecatedSince()).isEqualTo("6.5");
+    WebService.Param profileName = definition.param("qualityProfile");
+    assertThat(profileName.deprecatedSince()).isNullOrEmpty();
     WebService.Param project = definition.param("project");
     assertThat(project.deprecatedKey()).isEqualTo("projectKey");
     WebService.Param projectUuid = definition.param("projectUuid");
index 2208956d27547aa9a09eef432906169e7522a591..8211b0d87df12911cfc91f74b6a9e49171eeade7 100644 (file)
@@ -140,7 +140,7 @@ public class RenameActionTest {
     logInAsQProfileAdministrator();
 
     expectedException.expect(IllegalArgumentException.class);
-    expectedException.expectMessage("The 'profile' parameter is missing");
+    expectedException.expectMessage("The 'key' parameter is missing");
 
     call(null, "Other Sonar Way");
   }
@@ -242,9 +242,9 @@ public class RenameActionTest {
 
     assertThat(definition.key()).isEqualTo("rename");
     assertThat(definition.isPost()).isTrue();
-    assertThat(definition.params()).extracting(Param::key).containsExactlyInAnyOrder("profile", "name");
-    Param profile = definition.param("profile");
-    assertThat(profile.deprecatedKey()).isEqualTo("key");
+    assertThat(definition.params()).extracting(Param::key).containsExactlyInAnyOrder("key", "name");
+    Param profile = definition.param("key");
+    assertThat(profile.deprecatedKey()).isNullOrEmpty();
   }
 
   private String createNewValidQualityProfileKey() {
@@ -272,7 +272,7 @@ public class RenameActionTest {
     TestRequest request = ws.newRequest()
       .setMethod("POST");
 
-    setNullable(key, k -> request.setParam("profile", k));
+    setNullable(key, k -> request.setParam("key", k));
     setNullable(name, n -> request.setParam("name", n));
 
     request.execute();
index becad7fc7cb7b44e0e2c88e16a1ef43817e4043e..9616039f8a9dd7f7d393eecd33a40eee8b372a1c 100644 (file)
@@ -61,7 +61,7 @@ import static org.sonar.test.JsonAssert.assertJson;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_DEFAULTS;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_LANGUAGE;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_ORGANIZATION;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE_NAME;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_QUALITY_PROFILE;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROJECT_KEY;
 
 public class SearchActionTest {
@@ -116,9 +116,9 @@ public class SearchActionTest {
     assertThat(language.deprecatedSince()).isNull();
     assertThat(language.description()).isEqualTo("Language key. If provided, only profiles for the given language are returned.");
 
-    WebService.Param profileName = definition.param("profileName");
+    WebService.Param profileName = definition.param("qualityProfile");
     assertThat(profileName.deprecatedSince()).isNull();
-    assertThat(profileName.description()).isEqualTo("Profile name");
+    assertThat(profileName.description()).isEqualTo("Quality profile name");
   }
 
   @Test
@@ -228,7 +228,7 @@ public class SearchActionTest {
     QProfileDto sonarWayInCamelCase = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setName("Sonar Way").setLanguage(XOO2.getKey()));
     QProfileDto anotherProfile = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setName("Another").setLanguage(XOO2.getKey()));
 
-    SearchWsResponse result = call(ws.newRequest().setParam(PARAM_PROFILE_NAME, "Sonar way"));
+    SearchWsResponse result = call(ws.newRequest().setParam(PARAM_QUALITY_PROFILE, "Sonar way"));
 
     assertThat(result.getProfilesList()).extracting(QualityProfile::getKey)
       .containsExactlyInAnyOrder(sonarWayOnXoo1.getKee(), sonarWayOnXoo2.getKee())
@@ -244,7 +244,7 @@ public class SearchActionTest {
 
     SearchWsResponse result = call(ws.newRequest()
       .setParam(PARAM_DEFAULTS, "true")
-      .setParam(PARAM_PROFILE_NAME, "Sonar way"));
+      .setParam(PARAM_QUALITY_PROFILE, "Sonar way"));
 
     assertThat(result.getProfilesList()).extracting(QualityProfile::getKey)
       .containsExactlyInAnyOrder(sonarWayOnXoo1.getKee())
index 48f294868094d221c93cde5622a2c3822669eaf8..90a1e1ab5f305db307a39b8c1071ccae59b81a56 100644 (file)
@@ -44,7 +44,7 @@ import org.sonar.server.ws.WsActionTester;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.sonar.db.permission.OrganizationPermission.ADMINISTER_QUALITY_PROFILES;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_KEY;
 
 public class SetDefaultActionTest {
 
@@ -106,12 +106,12 @@ public class SetDefaultActionTest {
 
     assertThat(definition).isNotNull();
     assertThat(definition.isPost()).isTrue();
-    assertThat(definition.params()).extracting(Param::key).containsExactlyInAnyOrder("profile", "profileName", "language", "organization");
+    assertThat(definition.params()).extracting(Param::key).containsExactlyInAnyOrder("key", "qualityProfile", "language", "organization");
     assertThat(definition.param("organization").since()).isEqualTo("6.4");
-    Param profile = definition.param("profile");
+    Param profile = definition.param("key");
     assertThat(profile.deprecatedKey()).isEqualTo("profileKey");
-    assertThat(definition.param("profileName").deprecatedSince()).isEqualTo("6.5");
-    assertThat(definition.param("language").deprecatedSince()).isEqualTo("6.5");
+    assertThat(definition.param("qualityProfile").deprecatedSince()).isNullOrEmpty();
+    assertThat(definition.param("language").deprecatedSince()).isNullOrEmpty();
   }
 
   @Test
@@ -123,7 +123,7 @@ public class SetDefaultActionTest {
 
     TestResponse response = ws.newRequest()
       .setMethod("POST")
-      .setParam(PARAM_PROFILE, xoo2Profile.getKee()).execute();
+      .setParam(PARAM_KEY, xoo2Profile.getKee()).execute();
 
     assertThat(response.getInput()).isEmpty();
 
@@ -133,7 +133,7 @@ public class SetDefaultActionTest {
     // One more time!
     TestResponse response2 = ws.newRequest()
       .setMethod("POST")
-      .setParam(PARAM_PROFILE, xoo2Profile.getKee()).execute();
+      .setParam(PARAM_KEY, xoo2Profile.getKee()).execute();
 
     assertThat(response2.getInput()).isEmpty();
     checkDefaultProfile(organization, XOO_1_KEY, xoo1Profile.getKee());
@@ -149,7 +149,7 @@ public class SetDefaultActionTest {
 
     TestResponse response = ws.newRequest().setMethod("POST")
       .setParam("language", xoo2Profile.getLanguage())
-      .setParam("profileName", xoo2Profile.getName())
+      .setParam("qualityProfile", xoo2Profile.getName())
       .setParam("organization", organization.getKey())
       .execute();
 
@@ -185,7 +185,7 @@ public class SetDefaultActionTest {
 
     TestResponse response = ws.newRequest().setMethod("POST")
       .setParam("language", profileOrg1New.getLanguage())
-      .setParam("profileName", profileOrg1New.getName())
+      .setParam("qualityProfile", profileOrg1New.getName())
       .setParam("organization", organization1.getKey())
       .execute();
 
@@ -204,7 +204,7 @@ public class SetDefaultActionTest {
     expectedException.expectMessage("Quality Profile with key 'unknown-profile-666' does not exist");
 
     ws.newRequest().setMethod("POST")
-      .setParam(PARAM_PROFILE, "unknown-profile-666")
+      .setParam(PARAM_KEY, "unknown-profile-666")
       .execute();
 
     checkDefaultProfile(organization, XOO_1_KEY, xoo1Profile.getKee());
@@ -218,7 +218,7 @@ public class SetDefaultActionTest {
     try {
       TestResponse response = ws.newRequest().setMethod("POST")
         .setParam("language", XOO_2_KEY)
-        .setParam("profileName", "Unknown")
+        .setParam("qualityProfile", "Unknown")
         .execute();
       Fail.failBecauseExceptionWasNotThrown(NotFoundException.class);
     } catch (NotFoundException nfe) {
@@ -236,7 +236,7 @@ public class SetDefaultActionTest {
     expectedException.expectMessage("When providing a quality profile key, neither of organization/language/name must be set");
 
     ws.newRequest().setMethod("POST")
-      .setParam(PARAM_PROFILE, xoo2Profile.getKee())
+      .setParam(PARAM_KEY, xoo2Profile.getKee())
       .setParam("organization", organization.getKey())
       .execute();
   }
@@ -249,7 +249,7 @@ public class SetDefaultActionTest {
     expectedException.expectMessage("Insufficient privileges");
 
     ws.newRequest().setMethod("POST")
-      .setParam(PARAM_PROFILE, xoo2Profile.getKee())
+      .setParam(PARAM_KEY, xoo2Profile.getKee())
       .execute();
   }
 
@@ -259,7 +259,7 @@ public class SetDefaultActionTest {
     expectedException.expectMessage("Authentication is required");
 
     ws.newRequest().setMethod("POST")
-      .setParam(PARAM_PROFILE, xoo2Profile.getKee())
+      .setParam(PARAM_KEY, xoo2Profile.getKee())
       .execute();
   }
 
index 8e605e8191977aa356a9d1092b0aa60bea905443..52d23cd5a7cd7f92cd5d91b12c705f8e2271f53e 100644 (file)
@@ -54,7 +54,7 @@ import static org.sonar.api.utils.DateUtils.parseDateTime;
 import static org.sonar.server.language.LanguageTesting.newLanguage;
 import static org.sonar.test.JsonAssert.assertJson;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_COMPARE_TO_SONAR_WAY;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_KEY;
 
 public class ShowActionTest {
 
@@ -86,7 +86,7 @@ public class ShowActionTest {
     assertThat(action.isPost()).isFalse();
     assertThat(action.since()).isEqualTo("6.5");
 
-    WebService.Param profile = action.param("profile");
+    WebService.Param profile = action.param("key");
     assertThat(profile.isRequired()).isTrue();
     assertThat(profile.isInternal()).isFalse();
     assertThat(profile.description()).isNotEmpty();
@@ -103,7 +103,7 @@ public class ShowActionTest {
   public void profile_info() {
     QProfileDto profile = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setLanguage(XOO1.getKey()));
 
-    QualityProfiles.ShowResponse result = call(ws.newRequest().setParam(PARAM_PROFILE, profile.getKee()));
+    QualityProfiles.ShowResponse result = call(ws.newRequest().setParam(PARAM_KEY, profile.getKee()));
 
     assertThat(result.getProfile())
       .extracting(QualityProfile::getKey, QualityProfile::getName, QualityProfile::getIsBuiltIn, QualityProfile::getLanguage, QualityProfile::getLanguageName,
@@ -116,7 +116,7 @@ public class ShowActionTest {
     QProfileDto profile = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setLanguage(XOO1.getKey()));
     db.qualityProfiles().setAsDefault(profile);
 
-    QualityProfiles.ShowResponse result = call(ws.newRequest().setParam(PARAM_PROFILE, profile.getKee()));
+    QualityProfiles.ShowResponse result = call(ws.newRequest().setParam(PARAM_KEY, profile.getKee()));
 
     assertThat(result.getProfile().getIsDefault()).isTrue();
   }
@@ -127,7 +127,7 @@ public class ShowActionTest {
     QProfileDto defaultProfile = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setLanguage(XOO1.getKey()));
     db.qualityProfiles().setAsDefault(defaultProfile);
 
-    ShowResponse result = call(ws.newRequest().setParam(PARAM_PROFILE, profile.getKee()));
+    ShowResponse result = call(ws.newRequest().setParam(PARAM_KEY, profile.getKee()));
 
     assertThat(result.getProfile().getIsDefault()).isFalse();
   }
@@ -141,7 +141,7 @@ public class ShowActionTest {
       .setLastUsed(time)
       .setUserUpdatedAt(time));
 
-    QualityProfiles.ShowResponse result = call(ws.newRequest().setParam(PARAM_PROFILE, profile.getKee()));
+    QualityProfiles.ShowResponse result = call(ws.newRequest().setParam(PARAM_KEY, profile.getKee()));
 
     assertThat(result.getProfile().getRulesUpdatedAt()).isEqualTo("2016-12-21T19:10:03+0100");
     assertThat(parseDateTime(result.getProfile().getLastUsed()).getTime()).isEqualTo(time);
@@ -164,7 +164,7 @@ public class ShowActionTest {
       .mapToObj(i -> db.components().insertPrivateProject())
       .forEach(project -> db.qualityProfiles().associateWithProject(project, profile));
 
-    QualityProfiles.ShowResponse result = call(ws.newRequest().setParam(PARAM_PROFILE, profile.getKee()));
+    QualityProfiles.ShowResponse result = call(ws.newRequest().setParam(PARAM_KEY, profile.getKee()));
 
     assertThat(result.getProfile())
       .extracting(QualityProfile::getActiveRuleCount, QualityProfile::getActiveDeprecatedRuleCount, QualityProfile::getProjectCount)
@@ -192,7 +192,7 @@ public class ShowActionTest {
     activeRuleIndexer.indexOnStartup(activeRuleIndexer.getIndexTypes());
 
     CompareToSonarWay result = call(ws.newRequest()
-      .setParam(PARAM_PROFILE, profile.getKee())
+      .setParam(PARAM_KEY, profile.getKee())
       .setParam(PARAM_COMPARE_TO_SONAR_WAY, "true"))
         .getCompareToSonarWay();
 
@@ -212,7 +212,7 @@ public class ShowActionTest {
     activeRuleIndexer.indexOnStartup(activeRuleIndexer.getIndexTypes());
 
     CompareToSonarWay result = call(ws.newRequest()
-      .setParam(PARAM_PROFILE, profile.getKee())
+      .setParam(PARAM_KEY, profile.getKee())
       .setParam(PARAM_COMPARE_TO_SONAR_WAY, "true"))
         .getCompareToSonarWay();
 
@@ -228,7 +228,7 @@ public class ShowActionTest {
     QProfileDto profile = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setLanguage(XOO1.getKey()));
 
     ShowResponse result = call(ws.newRequest()
-      .setParam(PARAM_PROFILE, profile.getKee())
+      .setParam(PARAM_KEY, profile.getKee())
       .setParam(PARAM_COMPARE_TO_SONAR_WAY, "true"));
 
     assertThat(result.hasCompareToSonarWay()).isFalse();
@@ -240,7 +240,7 @@ public class ShowActionTest {
     QProfileDto anotherBuiltInProfile = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setIsBuiltIn(true).setLanguage(XOO1.getKey()));
 
     QualityProfiles.ShowResponse result = call(ws.newRequest()
-      .setParam(PARAM_PROFILE, anotherBuiltInProfile.getKee())
+      .setParam(PARAM_KEY, anotherBuiltInProfile.getKee())
       .setParam(PARAM_COMPARE_TO_SONAR_WAY, "true"));
 
     assertThat(result.hasCompareToSonarWay()).isFalse();
@@ -252,7 +252,7 @@ public class ShowActionTest {
     QProfileDto profile = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setLanguage(XOO1.getKey()));
 
     QualityProfiles.ShowResponse result = call(ws.newRequest()
-      .setParam(PARAM_PROFILE, profile.getKee())
+      .setParam(PARAM_KEY, profile.getKee())
       .setParam(PARAM_COMPARE_TO_SONAR_WAY, "true"));
 
     assertThat(result.hasCompareToSonarWay()).isFalse();
@@ -264,7 +264,7 @@ public class ShowActionTest {
     QProfileDto profile = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setLanguage(XOO1.getKey()));
 
     QualityProfiles.ShowResponse result = call(ws.newRequest()
-      .setParam(PARAM_PROFILE, profile.getKee())
+      .setParam(PARAM_KEY, profile.getKee())
       .setParam(PARAM_COMPARE_TO_SONAR_WAY, "false"));
 
     assertThat(result.hasCompareToSonarWay()).isFalse();
@@ -276,7 +276,7 @@ public class ShowActionTest {
     QProfileDto profile = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setLanguage(XOO1.getKey()));
 
     CompareToSonarWay result = call(ws.newRequest()
-      .setParam(PARAM_PROFILE, profile.getKee())
+      .setParam(PARAM_KEY, profile.getKee())
       .setParam(PARAM_COMPARE_TO_SONAR_WAY, "true"))
         .getCompareToSonarWay();
 
@@ -292,7 +292,7 @@ public class ShowActionTest {
     QProfileDto profile = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setLanguage(XOO1.getKey()));
 
     CompareToSonarWay result = call(ws.newRequest()
-      .setParam(PARAM_PROFILE, profile.getKee())
+      .setParam(PARAM_KEY, profile.getKee())
       .setParam(PARAM_COMPARE_TO_SONAR_WAY, "true"))
         .getCompareToSonarWay();
 
@@ -308,7 +308,7 @@ public class ShowActionTest {
     expectedException.expect(NotFoundException.class);
     expectedException.expectMessage("Quality Profile with key 'unknown-profile' does not exist");
 
-    call(ws.newRequest().setParam(PARAM_PROFILE, profile.getKee()));
+    call(ws.newRequest().setParam(PARAM_KEY, profile.getKee()));
   }
 
   @Test
@@ -316,7 +316,7 @@ public class ShowActionTest {
     expectedException.expect(NotFoundException.class);
     expectedException.expectMessage("Quality Profile with key 'unknown-profile' does not exist");
 
-    call(ws.newRequest().setParam(PARAM_PROFILE, "unknown-profile"));
+    call(ws.newRequest().setParam(PARAM_KEY, "unknown-profile"));
   }
 
   @Test
@@ -344,7 +344,7 @@ public class ShowActionTest {
 
     ws = new WsActionTester(
       new ShowAction(db.getDbClient(), new QProfileWsSupport(db.getDbClient(), userSession, TestDefaultOrganizationProvider.from(db)), new Languages(cs), ruleIndex));
-    String result = ws.newRequest().setParam(PARAM_PROFILE, profile.getKee()).execute().getInput();
+    String result = ws.newRequest().setParam(PARAM_KEY, profile.getKee()).execute().getInput();
 
     assertJson(result).ignoreFields("rulesUpdatedAt", "lastUsed", "userUpdatedAt").isSimilarTo(ws.getDef().responseExampleAsString());
   }
index 368f8512018cacad6f8c6ba51d3be728ae4dc72c..e98b2b396e227bf4624841684fc8c83b3aedabb1 100644 (file)
@@ -27,7 +27,7 @@ import static java.util.Objects.requireNonNull;
 
 public class ActivateRuleWsRequest {
   private final Optional<String> params;
-  private final String profileKey;
+  private final String key;
   private final Optional<Boolean> reset;
   private final String ruleKey;
   private final Optional<Severity> severity;
@@ -36,7 +36,7 @@ public class ActivateRuleWsRequest {
   private ActivateRuleWsRequest(Builder builder) {
     organization = requireNonNull(builder.organization);
     params = requireNonNull(builder.params);
-    profileKey = requireNonNull(builder.profileKey);
+    key = requireNonNull(builder.key);
     reset = requireNonNull(builder.reset);
     ruleKey = requireNonNull(builder.ruleKey);
     severity = requireNonNull(builder.severity);
@@ -50,8 +50,8 @@ public class ActivateRuleWsRequest {
     return params;
   }
 
-  public String getProfileKey() {
-    return profileKey;
+  public String getKey() {
+    return key;
   }
 
   public Optional<Boolean> getReset() {
@@ -73,7 +73,7 @@ public class ActivateRuleWsRequest {
   public static class Builder {
     private Optional<String> organization = Optional.empty();
     private Optional<String> params = Optional.empty();
-    private String profileKey;
+    private String key;
     private Optional<Boolean> reset = Optional.empty();
     private String ruleKey;
     private Optional<Severity> severity = Optional.empty();
@@ -91,8 +91,8 @@ public class ActivateRuleWsRequest {
       return this;
     }
 
-    public Builder setProfileKey(String profileKey) {
-      this.profileKey = profileKey;
+    public Builder setKey(String key) {
+      this.key = key;
       return this;
     }
 
index 2b764d8caba2acee4f472bceef9296d10532cbe6..fc852433d5c5d6c2ee58b177df2b5da37e69e1d5 100644 (file)
@@ -31,16 +31,16 @@ public class AddProjectRequest {
 
   private final String language;
   private final Optional<String> organization;
-  private final String profileName;
-  private final String profileKey;
+  private final String qualityProfile;
+  private final String key;
   private final String projectKey;
   private final String projectUuid;
 
   private AddProjectRequest(Builder builder) {
     this.language = builder.language;
     this.organization = requireNonNull(builder.organization);
-    this.profileName = builder.profileName;
-    this.profileKey = builder.profileKey;
+    this.qualityProfile = builder.qualityProfile;
+    this.key = builder.key;
     this.projectKey = builder.projectKey;
     this.projectUuid = builder.projectUuid;
   }
@@ -55,13 +55,13 @@ public class AddProjectRequest {
   }
 
   @CheckForNull
-  public String getProfileName() {
-    return profileName;
+  public String getQualityProfile() {
+    return qualityProfile;
   }
 
   @CheckForNull
-  public String getProfileKey() {
-    return profileKey;
+  public String getKey() {
+    return key;
   }
 
   @CheckForNull
@@ -81,8 +81,8 @@ public class AddProjectRequest {
   public static class Builder {
     private String language;
     private Optional<String> organization = Optional.empty();
-    private String profileName;
-    private String profileKey;
+    private String qualityProfile;
+    private String key;
     private String projectKey;
     private String projectUuid;
 
@@ -100,13 +100,13 @@ public class AddProjectRequest {
       return this;
     }
 
-    public Builder setProfileName(@Nullable String profileName) {
-      this.profileName = profileName;
+    public Builder setQualityProfile(@Nullable String qualityProfile) {
+      this.qualityProfile = qualityProfile;
       return this;
     }
 
-    public Builder setProfileKey(@Nullable String profileKey) {
-      this.profileKey = profileKey;
+    public Builder setKey(@Nullable String key) {
+      this.key = key;
       return this;
     }
 
index 1f3cc16fc9bd70cbaf88194c73a5b009b967b83d..9b1b6a3ddca6f0c754b7c54a0dc402386466f0a0 100644 (file)
@@ -25,17 +25,17 @@ import javax.annotation.Nullable;
 public class ChangeParentRequest {
   private final String language;
   private final String parentKey;
-  private final String parentName;
-  private final String profileKey;
-  private final String profileName;
+  private final String parentQualityProfile;
+  private final String key;
+  private final String qualityProfile;
   private final String organization;
 
   public ChangeParentRequest(Builder builder) {
     this.language = builder.language;
     this.parentKey = builder.parentKey;
-    this.parentName = builder.parentName;
-    this.profileKey = builder.profileKey;
-    this.profileName = builder.profileName;
+    this.parentQualityProfile = builder.parentName;
+    this.key = builder.profileKey;
+    this.qualityProfile = builder.profileName;
     this.organization = builder.organization;
   }
 
@@ -47,16 +47,16 @@ public class ChangeParentRequest {
     return parentKey;
   }
 
-  public String getParentName() {
-    return parentName;
+  public String getParentQualityProfile() {
+    return parentQualityProfile;
   }
 
-  public String getProfileKey() {
-    return profileKey;
+  public String getKey() {
+    return key;
   }
 
-  public String getProfileName() {
-    return profileName;
+  public String getQualityProfile() {
+    return qualityProfile;
   }
 
   public String getOrganization() {
index 85319cb1c3589dd5e2acb7718cfbc18af89e8303..abf35e1c1710b0e425df83452d295c0e9d48fe93 100644 (file)
@@ -27,12 +27,12 @@ import static com.google.common.base.Preconditions.checkArgument;
 @Immutable
 public class CreateRequest {
 
-  private final String profileName;
+  private final String name;
   private final String language;
   private final String organizationKey;
 
   private CreateRequest(Builder builder) {
-    this.profileName = builder.profileName;
+    this.name = builder.name;
     this.language = builder.language;
     this.organizationKey = builder.organizationKey;
   }
@@ -41,8 +41,8 @@ public class CreateRequest {
     return language;
   }
 
-  public String getProfileName() {
-    return profileName;
+  public String getName() {
+    return name;
   }
 
   public String getOrganizationKey() {
@@ -55,7 +55,7 @@ public class CreateRequest {
 
   public static class Builder {
     private String language;
-    private String profileName;
+    private String name;
     private String organizationKey;
 
     private Builder() {
@@ -67,8 +67,8 @@ public class CreateRequest {
       return this;
     }
 
-    public Builder setProfileName(@Nullable String profileName) {
-      this.profileName = profileName;
+    public Builder setName(@Nullable String profileName) {
+      this.name = profileName;
       return this;
     }
 
@@ -79,7 +79,7 @@ public class CreateRequest {
 
     public CreateRequest build() {
       checkArgument(language != null && !language.isEmpty(), "Language is mandatory and must not be empty.");
-      checkArgument(profileName != null && !profileName.isEmpty(), "Profile name is mandatory and must not be empty.");
+      checkArgument(name != null && !name.isEmpty(), "Profile name is mandatory and must not be empty.");
       checkArgument(organizationKey == null || !organizationKey.isEmpty(), "Organization key may be either null or not empty. Empty organization key is invalid.");
       return new CreateRequest(this);
     }
index 96b2d45c2043f6537ed4b0c691e3e52d8b49696f..f4314b7a8d0115e8763d2e56681f3009e6868b0a 100644 (file)
@@ -22,6 +22,7 @@ package org.sonarqube.ws.client.qualityprofile;
 public class QualityProfileWsParameters {
 
   public static final String CONTROLLER_QUALITY_PROFILES = "api/qualityprofiles";
+
   public interface RestoreActionParameters {
 
     String PARAM_BACKUP = "backup";
@@ -48,11 +49,10 @@ public class QualityProfileWsParameters {
   public static final String PARAM_LANGUAGE = "language";
   public static final String PARAM_NAME = "name";
   public static final String PARAM_PARAMS = "params";
-  public static final String PARAM_PARENT_NAME = "parentName";
-  public static final String PARAM_PARENT_PROFILE = "parentProfile";
-  public static final String PARAM_PROFILE = "profile";
-  public static final String PARAM_PROFILE_KEY = "profileKey";
-  public static final String PARAM_PROFILE_NAME = "profileName";
+  public static final String PARAM_PARENT_KEY = "parentKey";
+  public static final String PARAM_PARENT_QUALITY_PROFILE = "parentQualityProfile";
+  public static final String PARAM_KEY = "key";
+  public static final String PARAM_QUALITY_PROFILE = "qualityProfile";
   public static final String PARAM_PROJECT = "project";
   public static final String PARAM_PROJECT_KEY = "projectKey";
   public static final String PARAM_PROJECT_UUID = "projectUuid";
@@ -60,7 +60,7 @@ public class QualityProfileWsParameters {
   public static final String PARAM_RULE = "rule";
   public static final String PARAM_SEVERITY = "severity";
   public static final String PARAM_SINCE = "since";
-  public static final String PARAM_TARGET_PROFILE = "targetProfile";
+  public static final String PARAM_TARGET_KEY = "targetKey";
   public static final String PARAM_TARGET_SEVERITY = "targetSeverity";
   public static final String PARAM_TO = "to";
   public static final String PARAM_TO_NAME = "toName";
index 431f310be56c02267f87ed0b1d54ed6a635704db..ea9ad29636a7f3ec6dc9f01164c2bd4045ea688e 100644 (file)
@@ -47,13 +47,13 @@ import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_DEFAULTS;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_FROM_KEY;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_LANGUAGE;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_NAME;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_ORGANIZATION;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PARAMS;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PARENT_NAME;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PARENT_PROFILE;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE_KEY;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE_NAME;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PARENT_QUALITY_PROFILE;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PARENT_KEY;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_KEY;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_QUALITY_PROFILE;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROJECT_KEY;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROJECT_UUID;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_RESET;
@@ -72,7 +72,7 @@ public class QualityProfilesService extends BaseService {
     PostRequest httpRequest = new PostRequest(path(ACTION_ACTIVATE_RULE));
     httpRequest.setParam(PARAM_ORGANIZATION, request.getOrganization().orElse(null));
     httpRequest.setParam(PARAM_PARAMS, request.getParams().orElse(null));
-    httpRequest.setParam(PARAM_PROFILE, request.getProfileKey());
+    httpRequest.setParam(PARAM_KEY, request.getKey());
     httpRequest.setParam(PARAM_RESET, request.getReset().orElse(null));
     httpRequest.setParam(PARAM_RULE, request.getRuleKey());
     httpRequest.setParam(PARAM_SEVERITY, request.getSeverity().map(Enum::name).orElse(null));
@@ -81,7 +81,7 @@ public class QualityProfilesService extends BaseService {
 
   public void deactivateRule(String profileKey, String ruleKey) {
     PostRequest httpRequest = new PostRequest(path(ACTION_DEACTIVATE_RULE));
-    httpRequest.setParam(PARAM_PROFILE, profileKey);
+    httpRequest.setParam(PARAM_KEY, profileKey);
     httpRequest.setParam(PARAM_RULE, ruleKey);
     call(httpRequest);
   }
@@ -98,7 +98,7 @@ public class QualityProfilesService extends BaseService {
       new GetRequest(path(ACTION_SEARCH))
         .setParam(PARAM_DEFAULTS, request.getDefaults())
         .setParam(PARAM_LANGUAGE, request.getLanguage())
-        .setParam(PARAM_PROFILE_NAME, request.getProfileName())
+        .setParam(PARAM_QUALITY_PROFILE, request.getQualityProfile())
         .setParam(PARAM_PROJECT_KEY, request.getProjectKey())
         .setParam(PARAM_ORGANIZATION, request.getOrganizationKey()),
       SearchWsResponse.parser());
@@ -107,7 +107,7 @@ public class QualityProfilesService extends BaseService {
   public QualityProfiles.ShowResponse show(ShowRequest request) {
     return call(
       new GetRequest(path(ACTION_SHOW))
-        .setParam(PARAM_PROFILE, request.getProfile())
+        .setParam(PARAM_KEY, request.getKey())
         .setParam(PARAM_COMPARE_TO_SONAR_WAY, request.getCompareToSonarWay()),
       ShowResponse.parser());
   }
@@ -116,8 +116,8 @@ public class QualityProfilesService extends BaseService {
     call(new PostRequest(path(ACTION_ADD_PROJECT))
       .setParam(PARAM_LANGUAGE, request.getLanguage())
       .setParam(PARAM_ORGANIZATION, request.getOrganization().orElse(null))
-      .setParam(PARAM_PROFILE_NAME, request.getProfileName())
-      .setParam(PARAM_PROFILE_KEY, request.getProfileKey())
+      .setParam(PARAM_QUALITY_PROFILE, request.getQualityProfile())
+      .setParam(QualityProfileWsParameters.PARAM_KEY, request.getKey())
       .setParam(PARAM_PROJECT_KEY, request.getProjectKey())
       .setParam(PARAM_PROJECT_UUID, request.getProjectUuid()));
   }
@@ -125,8 +125,8 @@ public class QualityProfilesService extends BaseService {
   public void removeProject(RemoveProjectRequest request) {
     call(new PostRequest(path(ACTION_REMOVE_PROJECT))
       .setParam(PARAM_LANGUAGE, request.getLanguage())
-      .setParam(PARAM_PROFILE_NAME, request.getProfileName())
-      .setParam(PARAM_PROFILE_KEY, request.getProfileKey())
+      .setParam(PARAM_QUALITY_PROFILE, request.getQualityProfile())
+      .setParam(QualityProfileWsParameters.PARAM_KEY, request.getKey())
       .setParam(PARAM_PROJECT_KEY, request.getProjectKey())
       .setParam(PARAM_PROJECT_UUID, request.getProjectUuid()));
   }
@@ -135,7 +135,7 @@ public class QualityProfilesService extends BaseService {
     PostRequest postRequest = new PostRequest(path(ACTION_CREATE))
       .setParam(PARAM_ORGANIZATION, request.getOrganizationKey())
       .setParam(PARAM_LANGUAGE, request.getLanguage())
-      .setParam(PARAM_PROFILE_NAME, request.getProfileName());
+      .setParam(PARAM_NAME, request.getName());
     return call(postRequest, CreateWsResponse.parser());
   }
 
@@ -150,23 +150,23 @@ public class QualityProfilesService extends BaseService {
   public void changeParent(ChangeParentRequest request) {
     call(new PostRequest(path(ACTION_CHANGE_PARENT))
       .setParam(PARAM_LANGUAGE, request.getLanguage())
-      .setParam(PARAM_PARENT_PROFILE, request.getParentKey())
-      .setParam(PARAM_PARENT_NAME, request.getParentName())
-      .setParam(PARAM_PROFILE, request.getProfileKey())
-      .setParam(PARAM_PROFILE_NAME, request.getProfileName())
+      .setParam(PARAM_PARENT_KEY, request.getParentKey())
+      .setParam(PARAM_PARENT_QUALITY_PROFILE, request.getParentQualityProfile())
+      .setParam(PARAM_KEY, request.getKey())
+      .setParam(PARAM_QUALITY_PROFILE, request.getQualityProfile())
       .setParam(PARAM_ORGANIZATION, request.getOrganization()));
   }
 
   public void setDefault(SetDefaultRequest request) {
     PostRequest postRequest = new PostRequest(path(ACTION_SET_DEFAULT))
-      .setParam(PARAM_PROFILE_KEY, request.getProfileKey());
+      .setParam(QualityProfileWsParameters.PARAM_KEY, request.getKey());
 
     call(postRequest);
   }
 
   public void delete(String profileKey) {
     PostRequest postRequest = new PostRequest(path(ACTION_DELETE))
-      .setParam(PARAM_PROFILE_KEY, profileKey);
+      .setParam(QualityProfileWsParameters.PARAM_KEY, profileKey);
 
     call(postRequest);
   }
index f3d297c8c841d9d7403c64642b7abb115fa61716..ccc35577b4b3f01fa052749f748af6949b729bdc 100644 (file)
@@ -27,15 +27,15 @@ import javax.annotation.concurrent.Immutable;
 public class RemoveProjectRequest {
 
   private final String language;
-  private final String profileName;
-  private final String profileKey;
+  private final String qualityProfile;
+  private final String key;
   private final String projectKey;
   private final String projectUuid;
 
   private RemoveProjectRequest(Builder builder) {
     this.language = builder.language;
-    this.profileName = builder.profileName;
-    this.profileKey = builder.profileKey;
+    this.qualityProfile = builder.qualityProfile;
+    this.key = builder.key;
     this.projectKey = builder.projectKey;
     this.projectUuid = builder.projectUuid;
   }
@@ -46,13 +46,13 @@ public class RemoveProjectRequest {
   }
 
   @CheckForNull
-  public String getProfileName() {
-    return profileName;
+  public String getQualityProfile() {
+    return qualityProfile;
   }
 
   @CheckForNull
-  public String getProfileKey() {
-    return profileKey;
+  public String getKey() {
+    return key;
   }
 
   @CheckForNull
@@ -71,8 +71,8 @@ public class RemoveProjectRequest {
 
   public static class Builder {
     private String language;
-    private String profileName;
-    private String profileKey;
+    private String qualityProfile;
+    private String key;
     private String projectKey;
     private String projectUuid;
 
@@ -85,13 +85,13 @@ public class RemoveProjectRequest {
       return this;
     }
 
-    public Builder setProfileName(@Nullable String profileName) {
-      this.profileName = profileName;
+    public Builder setQualityProfile(@Nullable String qualityProfile) {
+      this.qualityProfile = qualityProfile;
       return this;
     }
 
-    public Builder setProfileKey(@Nullable String profileKey) {
-      this.profileKey = profileKey;
+    public Builder setKey(@Nullable String key) {
+      this.key = key;
       return this;
     }
 
index 16d82999f074f8e378da1d678267971c92434d67..7cf4b966993ce0c51a0b44085b60fc177e96f825 100644 (file)
@@ -26,7 +26,7 @@ public class SearchWsRequest {
   private String organizationKey;
   private boolean defaults;
   private String language;
-  private String profileName;
+  private String qualityProfile;
   private String projectKey;
 
   public String getOrganizationKey() {
@@ -58,12 +58,12 @@ public class SearchWsRequest {
   }
 
   @CheckForNull
-  public String getProfileName() {
-    return profileName;
+  public String getQualityProfile() {
+    return qualityProfile;
   }
 
-  public SearchWsRequest setProfileName(@Nullable String profileName) {
-    this.profileName = profileName;
+  public SearchWsRequest setQualityProfile(@Nullable String qualityProfile) {
+    this.qualityProfile = qualityProfile;
     return this;
   }
 
index fd11fd24e92e8bd365a80013d4d49224ca1501f8..57a7bd419bbbf53193d6cfd0d5b54aaeb0a7e218 100644 (file)
 package org.sonarqube.ws.client.qualityprofile;
 
 public class SetDefaultRequest {
-  private final String profileKey;
+  private final String key;
 
-  public SetDefaultRequest(String profileKey) {
-    this.profileKey = profileKey;
+  public SetDefaultRequest(String key) {
+    this.key = key;
   }
 
-  public String getProfileKey() {
-    return profileKey;
+  public String getKey() {
+    return key;
   }
 }
index 2cbcfe95dcd194e1d6c9c69309166533c7c33030..0e267e65e16e2f8f2f878b99260eb91c95fdc9d1 100644 (file)
@@ -24,16 +24,16 @@ import javax.annotation.CheckForNull;
 import javax.annotation.Nullable;
 
 public class ShowRequest {
-  private String profile;
+  private String key;
   private Boolean compareToSonarWay;
 
   @CheckForNull
-  public String getProfile() {
-    return profile;
+  public String getKey() {
+    return key;
   }
 
-  public ShowRequest setProfile(@Nullable String profile) {
-    this.profile = profile;
+  public ShowRequest setKey(@Nullable String key) {
+    this.key = key;
     return this;
   }
 
index cb3a52f987e6ee903e5d7880f8618e8448a97247..7f0fcde543f8fb24b2971325eaf94524a2284d63 100644 (file)
@@ -34,33 +34,33 @@ public class AddProjectRequestTest {
 
   @Test
   public void create_request_from_profile_key_and_project_key() {
-    AddProjectRequest result = underTest.setProfileKey("SonarWay").setProjectKey("sample").build();
+    AddProjectRequest result = underTest.setKey("SonarWay").setProjectKey("sample").build();
 
     assertThat(result.getLanguage()).isNull();
-    assertThat(result.getProfileKey()).isEqualTo("SonarWay");
-    assertThat(result.getProfileName()).isNull();
+    assertThat(result.getKey()).isEqualTo("SonarWay");
+    assertThat(result.getQualityProfile()).isNull();
     assertThat(result.getProjectKey()).isEqualTo("sample");
     assertThat(result.getProjectUuid()).isNull();
   }
 
   @Test
   public void create_request_from_profile_name_and_language_and_project_key() {
-    AddProjectRequest result = underTest.setLanguage("xoo").setProfileName("Sonar Way").setProjectKey("sample").build();
+    AddProjectRequest result = underTest.setLanguage("xoo").setQualityProfile("Sonar Way").setProjectKey("sample").build();
 
     assertThat(result.getLanguage()).isEqualTo("xoo");
-    assertThat(result.getProfileKey()).isNull();
-    assertThat(result.getProfileName()).isEqualTo("Sonar Way");
+    assertThat(result.getKey()).isNull();
+    assertThat(result.getQualityProfile()).isEqualTo("Sonar Way");
     assertThat(result.getProjectKey()).isEqualTo("sample");
     assertThat(result.getProjectUuid()).isNull();
   }
 
   @Test
   public void create_request_from_profile_key_and_project_uuid() {
-    AddProjectRequest result = underTest.setProfileKey("SonarWay").setProjectUuid("123").build();
+    AddProjectRequest result = underTest.setKey("SonarWay").setProjectUuid("123").build();
 
     assertThat(result.getLanguage()).isNull();
-    assertThat(result.getProfileKey()).isEqualTo("SonarWay");
-    assertThat(result.getProfileName()).isNull();
+    assertThat(result.getKey()).isEqualTo("SonarWay");
+    assertThat(result.getQualityProfile()).isNull();
     assertThat(result.getProjectKey()).isNull();
     assertThat(result.getProjectUuid()).isEqualTo("123");
   }
index ab86203518fb81571c87995830efd0976cf002bd..7aff1d888d5afcbabae9a48d05e48ce35d7e7448 100644 (file)
@@ -36,17 +36,17 @@ public class CreateRequestTest {
   public void create_set_request() {
     CreateRequest result = underTest
       .setLanguage("java")
-      .setProfileName("Sonar way")
+      .setName("Sonar way")
       .build();
 
     assertThat(result.getLanguage()).isEqualTo("java");
-    assertThat(result.getProfileName()).isEqualTo("Sonar way");
+    assertThat(result.getName()).isEqualTo("Sonar way");
   }
 
   @Test
   public void fail_when_no_language() {
     expectedException.expect(IllegalArgumentException.class);
-    underTest.setProfileName("Sonar way").build();
+    underTest.setName("Sonar way").build();
   }
 
   @Test
index 1ea8262b646b5526efd44d46e5ce4a471c407883..a3add919ea7432282a08fce40bbfa594beb69258 100644 (file)
@@ -35,11 +35,11 @@ import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_DEFAULTS;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_FROM_KEY;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_LANGUAGE;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_NAME;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_ORGANIZATION;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PARAMS;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE_KEY;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROFILE_NAME;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_KEY;
+import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_QUALITY_PROFILE;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROJECT_KEY;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_RULE;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_SEVERITY;
@@ -58,7 +58,7 @@ public class QualityProfilesServiceTest {
       .setDefaults(true)
       .setProjectKey("project")
       .setLanguage("language")
-      .setProfileName("profile"));
+      .setQualityProfile("profile"));
     GetRequest getRequest = serviceTester.getGetRequest();
 
     assertThat(serviceTester.getGetParser()).isSameAs(SearchWsResponse.parser());
@@ -67,21 +67,21 @@ public class QualityProfilesServiceTest {
       .hasParam(PARAM_DEFAULTS, true)
       .hasParam(PARAM_PROJECT_KEY, "project")
       .hasParam(PARAM_LANGUAGE, "language")
-      .hasParam(PARAM_PROFILE_NAME, "profile")
+      .hasParam(PARAM_QUALITY_PROFILE, "profile")
       .andNoOtherParam();
   }
 
   @Test
   public void show() {
     underTest.show(new ShowRequest()
-      .setProfile("profile")
+      .setKey("profile")
       .setCompareToSonarWay(true));
     GetRequest getRequest = serviceTester.getGetRequest();
 
     assertThat(serviceTester.getGetParser()).isSameAs(ShowResponse.parser());
     serviceTester.assertThat(getRequest)
       .hasPath("show")
-      .hasParam(PARAM_PROFILE, "profile")
+      .hasParam(PARAM_KEY, "profile")
       .hasParam(PARAM_COMPARE_TO_SONAR_WAY, true)
       .andNoOtherParam();
   }
@@ -90,14 +90,14 @@ public class QualityProfilesServiceTest {
   public void add_project() throws Exception {
     underTest.addProject(AddProjectRequest.builder()
       .setLanguage("xoo")
-      .setProfileName("Sonar Way")
+      .setQualityProfile("Sonar Way")
       .setProjectKey("sample")
       .build());
 
     serviceTester.assertThat(serviceTester.getPostRequest())
       .hasPath("add_project")
       .hasParam(PARAM_LANGUAGE, "xoo")
-      .hasParam(PARAM_PROFILE_NAME, "Sonar Way")
+      .hasParam(PARAM_QUALITY_PROFILE, "Sonar Way")
       .hasParam(PARAM_PROJECT_KEY, "sample")
       .andNoOtherParam();
   }
@@ -106,14 +106,14 @@ public class QualityProfilesServiceTest {
   public void remove_project() throws Exception {
     underTest.removeProject(RemoveProjectRequest.builder()
       .setLanguage("xoo")
-      .setProfileName("Sonar Way")
+      .setQualityProfile("Sonar Way")
       .setProjectKey("sample")
       .build());
 
     serviceTester.assertThat(serviceTester.getPostRequest())
       .hasPath("remove_project")
       .hasParam(PARAM_LANGUAGE, "xoo")
-      .hasParam(PARAM_PROFILE_NAME, "Sonar Way")
+      .hasParam(PARAM_QUALITY_PROFILE, "Sonar Way")
       .hasParam(PARAM_PROJECT_KEY, "sample")
       .andNoOtherParam();
   }
@@ -122,13 +122,13 @@ public class QualityProfilesServiceTest {
   public void create() throws Exception {
     underTest.create(CreateRequest.builder()
       .setLanguage("xoo")
-      .setProfileName("Sonar Way")
+      .setName("Sonar Way")
       .build());
 
     serviceTester.assertThat(serviceTester.getPostRequest())
       .hasPath("create")
       .hasParam(PARAM_LANGUAGE, "xoo")
-      .hasParam(PARAM_PROFILE_NAME, "Sonar Way")
+      .hasParam(PARAM_NAME, "Sonar Way")
       .andNoOtherParam();
   }
 
@@ -149,7 +149,7 @@ public class QualityProfilesServiceTest {
 
     serviceTester.assertThat(serviceTester.getPostRequest())
       .hasPath("set_default")
-      .hasParam(PARAM_PROFILE_KEY, "sample")
+      .hasParam(QualityProfileWsParameters.PARAM_KEY, "sample")
       .andNoOtherParam();
   }
 
@@ -159,7 +159,7 @@ public class QualityProfilesServiceTest {
 
     serviceTester.assertThat(serviceTester.getPostRequest())
       .hasPath("delete")
-      .hasParam(PARAM_PROFILE_KEY, "sample")
+      .hasParam(QualityProfileWsParameters.PARAM_KEY, "sample")
       .andNoOtherParam();
   }
 
@@ -170,7 +170,7 @@ public class QualityProfilesServiceTest {
 
     serviceTester.assertThat(request)
       .hasPath("deactivate_rule")
-      .hasParam(PARAM_PROFILE, "P1")
+      .hasParam(PARAM_KEY, "P1")
       .hasParam(PARAM_RULE, "R1")
       .andNoOtherParam();
   }
@@ -179,7 +179,7 @@ public class QualityProfilesServiceTest {
   public void activate_rule() {
     underTest.activateRule(ActivateRuleWsRequest.builder()
       .setRuleKey("R1")
-      .setProfileKey("P1")
+      .setKey("P1")
       .setOrganization("O1")
       .setParams("PS1")
       .setSeverity(Severity.INFO)
@@ -188,7 +188,7 @@ public class QualityProfilesServiceTest {
 
     serviceTester.assertThat(request)
       .hasPath("activate_rule")
-      .hasParam(PARAM_PROFILE, "P1")
+      .hasParam(PARAM_KEY, "P1")
       .hasParam(PARAM_RULE, "R1")
       .hasParam(PARAM_ORGANIZATION, "O1")
       .hasParam(PARAM_PARAMS, "PS1")
index b169d375d887f9bb06c34d86457599cb8916e7f9..e6735e2e2713b5599365357daa7a163bf8f7d1ad 100644 (file)
@@ -34,33 +34,33 @@ public class RemoveProjectRequestTest {
 
   @Test
   public void create_request_from_profile_key_and_project_key() {
-    RemoveProjectRequest result = underTest.setProfileKey("SonarWay").setProjectKey("sample").build();
+    RemoveProjectRequest result = underTest.setKey("SonarWay").setProjectKey("sample").build();
 
     assertThat(result.getLanguage()).isNull();
-    assertThat(result.getProfileKey()).isEqualTo("SonarWay");
-    assertThat(result.getProfileName()).isNull();
+    assertThat(result.getKey()).isEqualTo("SonarWay");
+    assertThat(result.getQualityProfile()).isNull();
     assertThat(result.getProjectKey()).isEqualTo("sample");
     assertThat(result.getProjectUuid()).isNull();
   }
 
   @Test
   public void create_request_from_profile_name_and_language_and_project_key() {
-    RemoveProjectRequest result = underTest.setLanguage("xoo").setProfileName("Sonar Way").setProjectKey("sample").build();
+    RemoveProjectRequest result = underTest.setLanguage("xoo").setQualityProfile("Sonar Way").setProjectKey("sample").build();
 
     assertThat(result.getLanguage()).isEqualTo("xoo");
-    assertThat(result.getProfileKey()).isNull();
-    assertThat(result.getProfileName()).isEqualTo("Sonar Way");
+    assertThat(result.getKey()).isNull();
+    assertThat(result.getQualityProfile()).isEqualTo("Sonar Way");
     assertThat(result.getProjectKey()).isEqualTo("sample");
     assertThat(result.getProjectUuid()).isNull();
   }
 
   @Test
   public void create_request_from_profile_key_and_project_uuid() {
-    RemoveProjectRequest result = underTest.setProfileKey("SonarWay").setProjectUuid("123").build();
+    RemoveProjectRequest result = underTest.setKey("SonarWay").setProjectUuid("123").build();
 
     assertThat(result.getLanguage()).isNull();
-    assertThat(result.getProfileKey()).isEqualTo("SonarWay");
-    assertThat(result.getProfileName()).isNull();
+    assertThat(result.getKey()).isEqualTo("SonarWay");
+    assertThat(result.getQualityProfile()).isNull();
     assertThat(result.getProjectKey()).isNull();
     assertThat(result.getProjectUuid()).isEqualTo("123");
   }
index c2d163151c684f340b7fe1f2fce7f1e4a997243f..29656d65c952501d8bc62b3515dd5998e5a77389 100644 (file)
@@ -58,7 +58,7 @@ public class QProfileTester {
     CreateRequest.Builder request = CreateRequest.builder()
       .setOrganizationKey(organization.getKey())
       .setLanguage("xoo")
-      .setProfileName("Profile" + id);
+      .setName("Profile" + id);
     stream(populators).forEach(p -> p.accept(request));
     return service().create(request.build()).getProfile();
   }
@@ -69,7 +69,7 @@ public class QProfileTester {
 
   public QProfileTester activateRule(String profileKey, String ruleKey) {
     ActivateRuleWsRequest request = ActivateRuleWsRequest.builder()
-      .setProfileKey(profileKey)
+      .setKey(profileKey)
       .setRuleKey(ruleKey)
       .build();
     service().activateRule(request);
@@ -84,7 +84,7 @@ public class QProfileTester {
   public QProfileTester assignQProfileToProject(QualityProfile profile, Project project) {
     service().addProject(AddProjectRequest.builder()
       .setProjectKey(project.getKey())
-      .setProfileKey(profile.getKey())
+      .setKey(profile.getKey())
       .build());
     return this;
   }
index 6983a6757a34d0cad40b8b38627aad11162d5d5a..11fe9c49637c8df6d0231d4448972017ce2d7e49 100644 (file)
@@ -60,7 +60,7 @@ public class QualityProfileAdminPermissionTest {
   private void createProfile(String language, String name) {
     tester.wsClient().qualityProfiles().create(CreateRequest.builder()
       .setLanguage(language)
-      .setProfileName(name)
+      .setName(name)
       .build());
   }
 
index 436e466454d58b963ab3f2bec20736a57a4b569b..683b808fbbed334760636b57320649f71a1ad753 100644 (file)
@@ -209,7 +209,7 @@ public class OrganizationIssueAssignTest {
         .setProjectKey(projectKey)
         .setOrganization(organization)
         .setLanguage("xoo")
-        .setProfileName("one-issue-per-file-profile")
+        .setQualityProfile("one-issue-per-file-profile")
         .build());
   }
 
index 8593dc17a08710b8dc6fe928ea37ea87f77336ee..2ab31f1f1de61e68d595bfedc635c41dd57b31a3 100644 (file)
@@ -110,7 +110,7 @@ public class BuiltInQualityProfilesNotificationTest {
     WsUsers.CreateWsResponse.User noProfileAdmin = userRule.generate();
 
     // Create a child profile on the built-in profile => The notification should not take into account updates of this profile
-    wsClient.qualityProfiles().create(CreateRequest.builder().setLanguage("foo").setProfileName("child").build());
+    wsClient.qualityProfiles().create(CreateRequest.builder().setLanguage("foo").setName("child").build());
     wsClient.qualityProfiles().changeParent(ChangeParentRequest.builder().setProfileName("child").setParentName("Basic").setLanguage("foo").build());
 
     // uninstall plugin V1
index 0be4b07d90ff8e3ea3a0a1f5c2b6bc0b491f3d99..76d707b38c62d1df0995319b191c665f9a4bd181 100644 (file)
@@ -65,8 +65,8 @@ public class CustomQualityProfilesTest {
     // create two profiles with same names in two organizations
     Organization org1 = tester.organizations().generate();
     Organization org2 = tester.organizations().generate();
-    QualityProfile profileInOrg1 = tester.qProfiles().createXooProfile(org1, p -> p.setProfileName("foo"));
-    QualityProfile profileInOrg2 = tester.qProfiles().createXooProfile(org2, p -> p.setProfileName("foo"));
+    QualityProfile profileInOrg1 = tester.qProfiles().createXooProfile(org1, p -> p.setName("foo"));
+    QualityProfile profileInOrg2 = tester.qProfiles().createXooProfile(org2, p -> p.setName("foo"));
 
     tester.qProfiles()
       .assertThatNumberOfActiveRulesEqualsTo(profileInOrg1, 0)
@@ -133,7 +133,7 @@ public class CustomQualityProfilesTest {
       CreateRequest.builder()
         .setLanguage(parentProfile.getLanguage())
         .setOrganizationKey(org.getKey())
-        .setProfileName("inherited_profile")
+        .setName("inherited_profile")
         .build())
       .getProfile();
 
@@ -145,7 +145,7 @@ public class CustomQualityProfilesTest {
       CreateRequest.builder()
         .setLanguage(parentProfile.getLanguage())
         .setOrganizationKey(org.getKey())
-        .setProfileName("inherited_profile2")
+        .setName("inherited_profile2")
         .build())
       .getProfile();
 
@@ -223,7 +223,7 @@ public class CustomQualityProfilesTest {
       CreateRequest.builder()
         .setLanguage(parentProfile.getLanguage())
         .setOrganizationKey(org.getKey())
-        .setProfileName("inherited_profile")
+        .setName("inherited_profile")
         .build())
       .getProfile();
 
@@ -295,7 +295,7 @@ public class CustomQualityProfilesTest {
       .setParam("organization", org.getKey()));
 
     adminSession.qProfiles().service().addProject(AddProjectRequest.builder()
-      .setProfileKey(newXooProfile.getKey())
+      .setKey(newXooProfile.getKey())
       .setProjectKey(projectKey)
       .build());
 
index ad75bcdf9d90d9dfbf125d9c946b42c649d1fe6c..1414b129683f2de0475440added5d3c23b47c2ba 100644 (file)
@@ -188,7 +188,7 @@ public class OrganizationQualityProfilesUiTest {
   private void addProfileToProject(String language, String profileName, String projectKey) {
     tester.wsClient().qualityProfiles().addProject(AddProjectRequest.builder()
       .setLanguage(language)
-      .setProfileName(profileName)
+      .setQualityProfile(profileName)
       .setProjectKey(projectKey)
       .setOrganization(organization.getKey())
       .build());
index a1583020954e7723d1186edc3d553b3a846fedf7..f67a20b0acd60f99d864661c1f8c31190cba9065 100644 (file)
@@ -153,7 +153,7 @@ public class QualityProfilesUiTest {
   private void createProfile(String language, String name) {
     tester.wsClient().qualityProfiles().create(CreateRequest.builder()
       .setLanguage(language)
-      .setProfileName(name)
+      .setName(name)
       .build());
   }
 
@@ -172,7 +172,7 @@ public class QualityProfilesUiTest {
   private void addProfileToProject(String language, String profileName, String projectKey) {
     tester.wsClient().qualityProfiles().addProject(AddProjectRequest.builder()
       .setLanguage(language)
-      .setProfileName(profileName)
+      .setQualityProfile(profileName)
       .setProjectKey(projectKey)
       .build());
   }
index 9abacf1bf2981bf4fdf281b290cd426b5b640017..6047ae1230d1f4b7f0148e1d1ed3dc166cb60481 100644 (file)
@@ -57,7 +57,7 @@ public class QualityProfilesWsTest {
     tester.qProfiles().activateRule(xooProfile, RULE_ONE_BUG_PER_LINE);
     tester.qProfiles().activateRule(xooProfile, RULE_ONE_ISSUE_PER_LINE);
 
-    ShowResponse result = tester.qProfiles().service().show(new ShowRequest().setProfile(xooProfile.getKey()));
+    ShowResponse result = tester.qProfiles().service().show(new ShowRequest().setKey(xooProfile.getKey()));
 
     assertThat(result.getProfile())
       .extracting(QualityProfile::getName, QualityProfile::getLanguage, QualityProfile::getIsBuiltIn, QualityProfile::getIsDefault,
@@ -74,7 +74,7 @@ public class QualityProfilesWsTest {
     SearchWsResponse.QualityProfile sonarWay = getProfile(org, p -> "Sonar way".equals(p.getName()) && "xoo".equals(p.getLanguage()) && p.getIsBuiltIn());
 
     CompareToSonarWay result = tester.qProfiles().service().show(new ShowRequest()
-      .setProfile(xooProfile.getKey())
+      .setKey(xooProfile.getKey())
       .setCompareToSonarWay(true)).getCompareToSonarWay();
 
     assertThat(result)
@@ -92,14 +92,14 @@ public class QualityProfilesWsTest {
 
     // Bulk activate missing rules from the Sonar way profile
     tester.wsClient().wsConnector().call(new PostRequest("api/qualityprofiles/activate_rules")
-      .setParam("targetProfile", xooProfile.getKey())
+      .setParam("targetKey", xooProfile.getKey())
       .setParam("qprofile", xooProfile.getKey())
       .setParam("activation", "false")
       .setParam("compareToProfile", sonarWay.getKey())).failIfNotSuccessful();
 
     // Check that the profile has no missing rule from the Sonar way profile
     assertThat(tester.qProfiles().service().show(new ShowRequest()
-      .setProfile(xooProfile.getKey())
+      .setKey(xooProfile.getKey())
       .setCompareToSonarWay(true)).getCompareToSonarWay())
       .extracting(CompareToSonarWay::getProfile, CompareToSonarWay::getProfileName, CompareToSonarWay::getMissingRuleCount)
       .containsExactly(sonarWay.getKey(), sonarWay.getName(), 0L);
@@ -113,7 +113,9 @@ public class QualityProfilesWsTest {
     assertThat(response.content()).isEqualTo("xoo -> Basic -> 1");
 
     // Check 'name' parameter is taken into account
-    assertThat(tester.wsClient().wsConnector().call(new GetRequest("profiles/export?language=xoo&name=empty&format=XooFakeExporter")).content()).isEqualTo("xoo -> empty -> 0");
+    assertThat(tester.wsClient().wsConnector()
+      .call(new GetRequest("profiles/export?language=xoo&qualityProfile=empty&format=XooFakeExporter")).content())
+      .isEqualTo("xoo -> empty -> 0");
   }
 
   private SearchWsResponse.QualityProfile getProfile(Organization organization, Predicate<SearchWsResponse.QualityProfile> filter) {