use of org.sonarqube.ws.client.GetRequest in project sonarqube by SonarSource.
the class DefaultServerLineHashesLoader method loadHashesFromWs.
private String loadHashesFromWs(String fileKey) {
Profiler profiler = Profiler.createIfDebug(Loggers.get(getClass())).addContext("file", fileKey).startDebug("Load line hashes");
GetRequest getRequest = new GetRequest("/api/sources/hash?key=" + ScannerUtils.encodeForUrl(fileKey));
Reader reader = wsClient.call(getRequest).contentReader();
try {
return IOUtils.toString(reader);
} catch (IOException e) {
throw new IllegalStateException(e);
} finally {
profiler.stopDebug();
}
}
use of org.sonarqube.ws.client.GetRequest in project sonarqube by SonarSource.
the class DefaultQualityProfileLoader method loadResource.
private List<QualityProfile> loadResource(String url) {
GetRequest getRequest = new GetRequest(url);
InputStream is = wsClient.call(getRequest).contentStream();
SearchWsResponse profiles = null;
try {
profiles = SearchWsResponse.parseFrom(is);
} catch (IOException e) {
throw new IllegalStateException("Failed to load quality profiles", e);
} finally {
IOUtils.closeQuietly(is);
}
List<QualityProfile> profilesList = profiles.getProfilesList();
if (profilesList == null || profilesList.isEmpty()) {
throw MessageException.of("No quality profiles have been found, you probably don't have any language plugin installed.");
}
return profilesList;
}
use of org.sonarqube.ws.client.GetRequest in project sonarqube by SonarSource.
the class DefaultServerIssuesLoader method load.
@Override
public void load(String componentKey, Function<ServerIssue, Void> consumer) {
GetRequest getRequest = new GetRequest("/batch/issues.protobuf?key=" + ScannerUtils.encodeForUrl(componentKey));
InputStream is = wsClient.call(getRequest).contentStream();
parseIssues(is, consumer);
}
use of org.sonarqube.ws.client.GetRequest in project sonarqube by SonarSource.
the class IssuesServiceTest method changelog.
@Test
public void changelog() {
underTest.changelog("ABCD");
GetRequest getRequest = serviceTester.getGetRequest();
assertThat(serviceTester.getGetParser()).isSameAs(Issues.ChangelogWsResponse.parser());
serviceTester.assertThat(getRequest).hasParam("issue", "ABCD").andNoOtherParam();
}
use of org.sonarqube.ws.client.GetRequest in project sonarqube by SonarSource.
the class PermissionsServiceTest method searchProjectPermissions_does_GET_on_Ws_search_project_permissions.
@Test
public void searchProjectPermissions_does_GET_on_Ws_search_project_permissions() {
underTest.searchProjectPermissions(new SearchProjectPermissionsWsRequest().setProjectId(PROJECT_ID_VALUE).setProjectKey(PROJECT_KEY_VALUE).setQualifier(QUALIFIER_VALUE).setPage(PAGE_VALUE).setPageSize(PAGE_SIZE_VALUE).setQuery(QUERY_VALUE));
assertThat(serviceTester.getGetParser()).isSameAs(WsPermissions.SearchProjectPermissionsWsResponse.parser());
GetRequest getRequest = serviceTester.getGetRequest();
serviceTester.assertThat(getRequest).hasPath("search_project_permissions").hasParam(PARAM_PROJECT_ID, PROJECT_ID_VALUE).hasParam(PARAM_PROJECT_KEY, PROJECT_KEY_VALUE).hasParam(PARAM_QUALIFIER, QUALIFIER_VALUE).hasParam(PARAM_P, PAGE_VALUE).hasParam(PARAM_PS, PAGE_SIZE_VALUE).hasParam(PARAM_Q, QUERY_VALUE).andNoOtherParam();
}
Aggregations