use of org.sonarqube.ws.client.GetRequest in project sonarqube by SonarSource.
the class WsLocalCallTest method gets_protobuf.
@Test
public void gets_protobuf() {
WsResponse response = newWsClient(orchestrator).wsConnector().call(new GetRequest("local_ws_call/protobuf_data"));
assertThat(response.isSuccessful()).isTrue();
}
use of org.sonarqube.ws.client.GetRequest in project sonarqube by SonarSource.
the class ScannerPluginInstaller method loadPluginIndex.
private String loadPluginIndex() {
Profiler profiler = Profiler.create(LOG).startInfo("Load plugins index");
GetRequest getRequest = new GetRequest(PLUGINS_INDEX_URL);
String str;
try (Reader reader = wsClient.call(getRequest).contentReader()) {
str = IOUtils.toString(reader);
} catch (IOException e) {
throw new IllegalStateException(e);
}
profiler.stopInfo();
return str;
}
use of org.sonarqube.ws.client.GetRequest in project sonarqube by SonarSource.
the class DefaultSettingsLoader method load.
@Override
public Map<String, String> load(@Nullable String componentKey) {
String url = "api/settings/values.protobuf";
Profiler profiler = Profiler.create(LOG);
if (componentKey != null) {
url += "?component=" + ScannerUtils.encodeForUrl(componentKey);
profiler.startInfo("Load settings for component '" + componentKey + "'");
} else {
profiler.startInfo("Load global settings");
}
try (InputStream is = wsClient.call(new GetRequest(url)).contentStream()) {
ValuesWsResponse values = ValuesWsResponse.parseFrom(is);
profiler.stopInfo();
return toMap(values.getSettingsList());
} catch (IOException e) {
throw new IllegalStateException("Failed to load server settings", e);
}
}
use of org.sonarqube.ws.client.GetRequest in project sonarqube by SonarSource.
the class ComponentsService method searchProjects.
public SearchProjectsWsResponse searchProjects(SearchProjectsRequest request) {
List<String> additionalFields = request.getAdditionalFields();
GetRequest get = new GetRequest(path(ACTION_SEARCH_PROJECTS)).setParam(PARAM_ORGANIZATION, request.getOrganization()).setParam(PARAM_FILTER, request.getFilter()).setParam(Param.FACETS, request.getFacets()).setParam(Param.SORT, request.getSort()).setParam(Param.ASCENDING, request.getAsc()).setParam(Param.PAGE, request.getPage()).setParam(Param.PAGE_SIZE, request.getPageSize()).setParam(Param.FIELDS, !additionalFields.isEmpty() ? inlineMultipleParamValue(additionalFields) : null);
return call(get, SearchProjectsWsResponse.parser());
}
use of org.sonarqube.ws.client.GetRequest in project sonarqube by SonarSource.
the class MeasuresServiceTest method component_tree.
@Test
public void component_tree() {
ComponentTreeWsRequest componentTreeRequest = new ComponentTreeWsRequest().setBaseComponentId(VALUE_BASE_COMPONENT_ID).setBaseComponentKey(VALUE_BASE_COMPONENT_KEY).setMetricKeys(VALUE_METRIC_KEYS).setStrategy(VALUE_STRATEGY).setQualifiers(VALUE_QUALIFIERS).setAdditionalFields(VALUE_ADDITIONAL_FIELDS).setSort(VALUE_SORT).setAsc(VALUE_ASC).setMetricSort(VALUE_METRIC_SORT).setPage(VALUE_PAGE).setPageSize(VALUE_PAGE_SIZE).setQuery(VALUE_QUERY).setDeveloperId(VALUE_DEVELOPER_ID).setDeveloperKey(VALUE_DEVELOPER_KEY).setMetricSortFilter(VALUE_METRIC_SORT_FILTER);
underTest.componentTree(componentTreeRequest);
GetRequest getRequest = serviceTester.getGetRequest();
assertThat(serviceTester.getGetParser()).isSameAs(ComponentTreeWsResponse.parser());
serviceTester.assertThat(getRequest).hasParam(PARAM_BASE_COMPONENT_ID, VALUE_BASE_COMPONENT_ID).hasParam(PARAM_BASE_COMPONENT_KEY, VALUE_BASE_COMPONENT_KEY).hasParam(PARAM_METRIC_KEYS, "ncloc,complexity").hasParam(PARAM_STRATEGY, VALUE_STRATEGY).hasParam(PARAM_QUALIFIERS, "FIL,PRJ").hasParam(PARAM_ADDITIONAL_FIELDS, "metrics").hasParam("s", "qualifier,metric").hasParam("asc", VALUE_ASC).hasParam(PARAM_METRIC_SORT, VALUE_METRIC_SORT).hasParam("p", VALUE_PAGE).hasParam("ps", VALUE_PAGE_SIZE).hasParam("q", VALUE_QUERY).hasParam(PARAM_DEVELOPER_ID, VALUE_DEVELOPER_ID).hasParam(PARAM_DEVELOPER_KEY, VALUE_DEVELOPER_KEY).hasParam(PARAM_METRIC_SORT_FILTER, VALUE_METRIC_SORT_FILTER).andNoOtherParam();
}
Aggregations