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_PROJECT_KEY;
public class SearchAction implements QProfileWsAction {
public void define(WebService.NewController controller) {
NewAction action = controller.createAction(ACTION_SEARCH)
.setSince("5.2")
- .setDescription("List quality profiles.")
+ .setDescription("Search quality profiles")
.setHandler(this)
.setResponseExample(getClass().getResource("search-example.json"));
action
.createParam(PARAM_DEFAULTS)
- .setDescription(format("If set to true, return only the quality profile marked as default for each language, the '%s' parameter must not be set.", PARAM_PROJECT_KEY))
+ .setDescription(format("If set to true, return only the quality profile marked as default for each language, the '%s' parameter must not be set.", PARAM_PROJECT))
.setDefaultValue(false)
.setBooleanPossibleValues();
- action.createParam(PARAM_PROJECT_KEY)
+ action.createParam(PARAM_PROJECT)
.setDescription(format("Project or module key. If provided, the '%s' parameter should not be provided.", PARAM_DEFAULTS))
+ .setDeprecatedKey("projectKey", "6.5")
.setExampleValue("my-project-key");
action
action.createParam(PARAM_PROFILE_NAME)
.setDeprecatedSince("6.4")
- .setDescription(format("Profile name. It should be always used with the '%s' or '%s' parameter.", PARAM_PROJECT_KEY, PARAM_DEFAULTS))
+ .setDescription(format("Profile name. It should be always used with the '%s' or '%s' parameter.", PARAM_PROJECT, PARAM_DEFAULTS))
.setExampleValue("SonarQube Way");
}
private static SearchWsRequest toSearchWsRequest(Request request) {
return new SearchWsRequest()
.setOrganizationKey(request.param(PARAM_ORGANIZATION))
- .setProjectKey(request.param(PARAM_PROJECT_KEY))
+ .setProjectKey(request.param(PARAM_PROJECT))
.setProfileName(request.param(PARAM_PROFILE_NAME))
.setDefaults(request.paramAsBoolean(PARAM_DEFAULTS))
.setLanguage(request.param(PARAM_LANGUAGE));
private ComponentDbTester componentDb = new ComponentDbTester(db);
private DbClient dbClient = db.getDbClient();
private DbSession dbSession = db.getSession();
- private QualityProfileDao qualityProfileDao = dbClient.qualityProfileDao();
private DefaultOrganizationProvider defaultOrganizationProvider = TestDefaultOrganizationProvider.from(db);
private QProfileWsSupport qProfileWsSupport = new QProfileWsSupport(dbClient, userSession, defaultOrganizationProvider);
Languages languages = new Languages(xoo1, xoo2);
underTest = new SearchAction(
- new SearchDataLoader(
- languages,
- new QProfileLookup(dbClient),
- dbClient),
+ new SearchDataLoader(languages, new QProfileLookup(dbClient), dbClient),
languages,
dbClient,
qProfileWsSupport);
WebService.Param defaults = action.param("defaults");
assertThat(defaults.description()).isEqualTo("If set to true, return only the quality profile marked as default for each language, " +
- "the 'projectKey' parameter must not be set.");
+ "the 'project' parameter must not be set.");
- WebService.Param projectKey = action.param("projectKey");
+ WebService.Param projectKey = action.param("project");
assertThat(projectKey.description()).isEqualTo("Project or module key. If provided, the 'defaults' parameter should not be provided.");
+ assertThat(projectKey.deprecatedKey()).isEqualTo("projectKey");
WebService.Param language = action.param("language");
assertThat(language.possibleValues()).containsExactly("xoo1", "xoo2");
WebService.Param profileName = action.param("profileName");
assertThat(profileName.deprecatedSince()).isEqualTo("6.4");
- assertThat(profileName.description()).isEqualTo("Profile name. It should be always used with the 'projectKey' or 'defaults' parameter.");
+ assertThat(profileName.description()).isEqualTo("Profile name. It should be always used with the 'project' or 'defaults' parameter.");
}
@Test