import java.util.Map;
import java.util.Optional;
import java.util.Set;
+import javax.annotation.CheckForNull;
+import javax.annotation.Nullable;
import org.sonar.api.i18n.I18n;
import org.sonar.api.resources.Languages;
import org.sonar.api.resources.ResourceTypes;
import org.sonarqube.ws.Components;
import org.sonarqube.ws.Components.SearchWsResponse;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
import static com.google.common.base.Preconditions.checkArgument;
import static java.util.Objects.requireNonNull;
import static java.util.stream.Collectors.toMap;
import static org.sonar.core.util.Protobuf.setNullable;
import static org.sonar.core.util.stream.MoreCollectors.toHashSet;
+import static org.sonar.server.es.SearchOptions.MAX_LIMIT;
import static org.sonar.server.util.LanguageParamUtils.getExampleValue;
import static org.sonar.server.util.LanguageParamUtils.getLanguageKeys;
-import static org.sonar.server.ws.WsParameterBuilder.QualifierParameterContext.newQualifierParameterContext;
import static org.sonar.server.ws.WsParameterBuilder.createQualifiersParameter;
+import static org.sonar.server.ws.WsParameterBuilder.QualifierParameterContext.newQualifierParameterContext;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
import static org.sonarqube.ws.client.component.ComponentsWsParameters.ACTION_SEARCH;
import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_LANGUAGE;
WebService.NewAction action = context.createAction(ACTION_SEARCH)
.setSince("6.3")
.setDescription("Search for components")
- .addPagingParams(100)
+ .addPagingParams(100, MAX_LIMIT)
.setResponseExample(getClass().getResource("search-components-example.json"))
.setHandler(this);
import org.sonar.server.component.index.ComponentIndex;
import org.sonar.server.component.index.ComponentIndexDefinition;
import org.sonar.server.component.index.ComponentIndexer;
+import org.sonar.server.component.ws.SearchAction.SearchRequest;
import org.sonar.server.es.EsTester;
import org.sonar.server.i18n.I18nRule;
import org.sonar.server.organization.TestDefaultOrganizationProvider;
import org.sonar.server.tester.UserSessionRule;
import org.sonar.server.ws.TestRequest;
import org.sonar.server.ws.WsActionTester;
-import org.sonarqube.ws.MediaTypes;
import org.sonarqube.ws.Components.Component;
import org.sonarqube.ws.Components.SearchWsResponse;
-import org.sonar.server.component.ws.SearchAction.SearchRequest;
+import org.sonarqube.ws.MediaTypes;
import static java.util.Arrays.asList;
import static java.util.Collections.emptySet;
assertThat(action.params()).hasSize(6);
+ WebService.Param pageSize = action.param("ps");
+ assertThat(pageSize.isRequired()).isFalse();
+ assertThat(pageSize.defaultValue()).isEqualTo("100");
+ assertThat(pageSize.maximumValue()).isEqualTo(500);
+ assertThat(pageSize.description()).isEqualTo("Page size. Must be greater than 0 and less than 500");
+
WebService.Param qualifiers = action.param("qualifiers");
assertThat(qualifiers.isRequired()).isTrue();