From: Léo Geoffroy Date: Fri, 27 Jan 2023 11:19:51 +0000 (+0100) Subject: SONAR-17705 Remove deprecated param 'projectKey' from qualityprofiles/search endpoint X-Git-Tag: 10.0.0.68432~271 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b0d6ebefc411023528d266371daaf4d97838e291;p=sonarqube.git SONAR-17705 Remove deprecated param 'projectKey' from qualityprofiles/search endpoint --- diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/SearchAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/SearchAction.java index b711fba6112..f9418ab2f07 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/SearchAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/SearchAction.java @@ -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 diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/SearchActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/SearchActionTest.java index 5ae57b0474e..bd906941c52 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/SearchActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/SearchActionTest.java @@ -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");