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 {
.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
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
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 {
.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)));
.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");
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");