import org.sonar.server.util.LanguageParamUtils;
import org.sonarqube.ws.QualityProfiles.SearchWsResponse;
import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile;
+import org.sonarqube.ws.client.component.ComponentsWsParameters;
import org.sonarqube.ws.client.qualityprofile.SearchWsRequest;
import static java.lang.String.format;
.setHandler(this)
.setResponseExample(getClass().getResource("search-example.json"));
- QProfileWsSupport.createOrganizationParam(action)
+ action
+ .createParam(ComponentsWsParameters.PARAM_ORGANIZATION)
+ .setDescription("Organization key. If no organization key is provided, this defaults to the organization of the specified project. If neither organization nor project are" +
+ "specified, the default organization will be used.")
+ .setRequired(false)
+ .setInternal(true)
+ .setExampleValue("my-org")
.setSince("6.4");
action
assertThat(controller.actions()).isNotEmpty();
}
- @Test
- public void define_search() {
- WebService.Action search = controller.action("search");
- assertThat(search).isNotNull();
- assertThat(search.isPost()).isFalse();
- assertThat(search.params()).hasSize(5);
- assertThat(search.param("language").possibleValues()).containsOnly(xoo1Key, xoo2Key);
- assertThat(search.param("language").deprecatedSince()).isEqualTo("6.4");
- assertThat(search.param("profileName").deprecatedSince()).isEqualTo("6.4");
- assertThat(search.param("organization").since()).isEqualTo("6.4");
- }
-
@Test
public void define_set_default_action() {
WebService.Action setDefault = controller.action("set_default");
import org.sonar.api.resources.Language;
import org.sonar.api.resources.Languages;
import org.sonar.api.rule.RuleStatus;
+import org.sonar.api.server.ws.WebService;
import org.sonar.api.utils.DateUtils;
import org.sonar.api.utils.System2;
import org.sonar.db.DbClient;
ws = new WsActionTester(underTest);
}
+ @Test
+ public void define_search() {
+ WebService.Action search = ws.getDef();
+ assertThat(search).isNotNull();
+ assertThat(search.isPost()).isFalse();
+ assertThat(search.param("language").possibleValues()).containsExactly("xoo1", "xoo2");
+ assertThat(search.param("language").deprecatedSince()).isEqualTo("6.4");
+ assertThat(search.param("profileName").deprecatedSince()).isEqualTo("6.4");
+ assertThat(search.param("projectKey")).isNotNull();
+ assertThat(search.param("defaults")).isNotNull();
+ assertThat(search.param("organization")).isNotNull();
+ assertThat(search.param("organization").isRequired()).isFalse();
+ assertThat(search.param("organization").isInternal()).isTrue();
+ assertThat(search.param("organization").description()).isNotEmpty();
+ assertThat(search.param("organization").since()).isEqualTo("6.4");
+ }
+
@Test
public void ws_returns_the_profiles_of_default_organization() throws Exception {
OrganizationDto organization = getDefaultOrganization();