]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-17705 Remove deprecated param 'projectKey' from qualityprofiles/search endpoint
authorLéo Geoffroy <leo.geoffroy@sonarsource.com>
Fri, 27 Jan 2023 11:19:51 +0000 (12:19 +0100)
committersonartech <sonartech@sonarsource.com>
Fri, 3 Feb 2023 14:26:00 +0000 (14:26 +0000)
server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/SearchAction.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/SearchActionTest.java

index b711fba61129a59a3bb933c2616c6b80d3eecfb2..f9418ab2f0703bbbc7d6f3412f192aa28cb067a1 100644 (file)
@@ -66,7 +66,6 @@ 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_PROJECT;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROJECT_KEY;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_QUALITY_PROFILE;
 
 public class SearchAction implements QProfileWsAction {
@@ -95,7 +94,8 @@ public class SearchAction implements QProfileWsAction {
       .setChangelog(
         new Change("6.5", format("The parameters '%s', '%s' and '%s' can be combined without any constraint", PARAM_DEFAULTS, PARAM_PROJECT, PARAM_LANGUAGE)),
         new Change("6.6", "Add available actions 'edit', 'copy' and 'setAsDefault' and global action 'create'"),
-        new Change("7.0", "Add available actions 'delete' and 'associateProjects'"))
+        new Change("7.0", "Add available actions 'delete' and 'associateProjects'"),
+        new Change("10.0", "Remove deprecated parameter 'project_key'. Please use 'project' instead."))
       .setResponseExample(getClass().getResource("search-example.json"));
 
     action
@@ -106,8 +106,6 @@ public class SearchAction implements QProfileWsAction {
 
     action.createParam(PARAM_PROJECT)
       .setDescription("Project key")
-      // still used by Scanner for MSBuild 4.7.1
-      .setDeprecatedKey(PARAM_PROJECT_KEY, "6.5")
       .setExampleValue(KEY_PROJECT_EXAMPLE_001);
 
     action
index 5ae57b0474e7735c8e66dedd431cac57c7e6f4ed..bd906941c52421198c732101a2793803863ef9e6 100644 (file)
@@ -59,7 +59,6 @@ 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_PROJECT;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROJECT_KEY;
 import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_QUALITY_PROFILE;
 
 public class SearchActionTest {
@@ -214,25 +213,6 @@ public class SearchActionTest {
       .doesNotContain(defaultProfileOnXoo1.getKee(), profileOnXoo1.getKee());
   }
 
-  @Test
-  public void filter_on_deprecated_project_key_and_default() {
-    ProjectDto project = db.components().insertPrivateProjectDto();
-    QProfileDto profileOnXoo1 = db.qualityProfiles().insert(q -> q.setLanguage(XOO1.getKey()));
-    QProfileDto defaultProfileOnXoo1 = db.qualityProfiles().insert(q -> q.setLanguage(XOO1.getKey()));
-    QProfileDto defaultProfileOnXoo2 = db.qualityProfiles().insert(q -> q.setLanguage(XOO2.getKey()));
-    db.qualityProfiles().associateWithProject(project, profileOnXoo1);
-    db.qualityProfiles().setAsDefault(defaultProfileOnXoo1, defaultProfileOnXoo2);
-
-    SearchWsResponse result = call(ws.newRequest()
-      .setParam(PARAM_PROJECT_KEY, project.getKey())
-      .setParam(PARAM_DEFAULTS, "true"));
-
-    assertThat(result.getProfilesList())
-      .extracting(QualityProfile::getKey)
-      .containsExactlyInAnyOrder(defaultProfileOnXoo2.getKee())
-      .doesNotContain(defaultProfileOnXoo1.getKee(), profileOnXoo1.getKee());
-  }
-
   @Test
   public void empty_when_filtering_on_project_and_no_language_installed() {
     WsActionTester ws = new WsActionTester(new SearchAction(userSession, new Languages(), dbClient, new ComponentFinder(dbClient, null)));
@@ -430,7 +410,8 @@ public class SearchActionTest {
       .containsExactlyInAnyOrder(
         tuple("6.5", "The parameters 'defaults', 'project' and 'language' can be combined without any constraint"),
         tuple("6.6", "Add available actions 'edit', 'copy' and 'setAsDefault' and global action 'create'"),
-        tuple("7.0", "Add available actions 'delete' and 'associateProjects'"));
+        tuple("7.0", "Add available actions 'delete' and 'associateProjects'"),
+        tuple("10.0", "Remove deprecated parameter 'project_key'. Please use 'project' instead."));
 
     WebService.Param defaults = definition.param("defaults");
     assertThat(defaults.defaultValue()).isEqualTo("false");
@@ -438,7 +419,7 @@ public class SearchActionTest {
 
     WebService.Param projectKey = definition.param("project");
     assertThat(projectKey.description()).isEqualTo("Project key");
-    assertThat(projectKey.deprecatedKey()).isEqualTo("projectKey");
+    assertThat(projectKey.deprecatedKey()).isNull();
 
     WebService.Param language = definition.param("language");
     assertThat(language.possibleValues()).containsExactly("xoo1", "xoo2");