/** * * This is part of the internal API. * This is a GET request. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/applications/show_leak">Further information about this action online (including a response example)</a> * @since 7.3 */ public String showLeak(ShowLeakRequest request) { return call( new GetRequest(path("show_leak")) .setParam("application", request.getApplication()) .setParam("branch", request.getBranch()) .setMediaType(MediaTypes.JSON) ).content(); }
/** * * This is part of the internal API. * This is a GET request. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/exporters">Further information about this action online (including a response example)</a> * @since 5.2 */ public String exporters() { return call( new GetRequest(path("exporters")) .setMediaType(MediaTypes.JSON) ).content(); }
/** * * This is part of the internal API. * This is a GET request. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/rules/show">Further information about this action online (including a response example)</a> * @since 4.2 */ public ShowResponse show(ShowRequest request) { return call( new GetRequest(path("show")) .setParam("actives", request.getActives()) .setParam("key", request.getKey()) .setParam("organization", request.getOrganization()), ShowResponse.parser()); }
private Map<String, QualityProfile> call(String url) throws IOException { GetRequest getRequest = new GetRequest(url); try (InputStream is = wsClient.call(getRequest).contentStream()) { SearchWsResponse profiles = SearchWsResponse.parseFrom(is); List<QualityProfile> profilesList = profiles.getProfilesList(); return profilesList.stream().collect(toMap(QualityProfile::getLanguage, identity(), throwingMerger(), LinkedHashMap::new)); } }
public void test() { GetRequest get = new GetRequest(path("issue")).setParam("key", "ABC"); when(wsConnector.call(get)).thenReturn(newProtobufFakeResponse()); Testing.Fake message = call(get, Testing.Fake.parser()); assertThat(message.getLabel()).isEqualTo("ok"); assertThat(get.getPath()).isEqualTo("api/issues/issue"); // media type automatically set to protobuf assertThat(get.getMediaType()).isEqualTo(MediaTypes.PROTOBUF); }
@Test public void add_headers_to_GET_request() throws Exception { answerHelloWorld(); GetRequest request = new GetRequest("api/issues/search") .setHeader("X-Foo", "fooz") .setHeader("X-Bar", "barz"); underTest = HttpConnector.newBuilder().url(serverUrl).build(); underTest.call(request); RecordedRequest recordedRequest = server.takeRequest(); assertThat(recordedRequest.getHeader("X-Foo")).isEqualTo("fooz"); assertThat(recordedRequest.getHeader("X-Bar")).isEqualTo("barz"); }
@Test public void override_timeout_on_get() { underTest = HttpConnector.newBuilder().url(serverUrl).build(); server.enqueue(new MockResponse().setBodyDelay(100, TimeUnit.MILLISECONDS).setBody("Hello delayed")); expectedException.expect(IllegalStateException.class); expectedException.expectCause(IsInstanceOf.instanceOf(SocketTimeoutException.class)); WsResponse call = underTest.call(new GetRequest("/").setTimeOutInMs(5)); assertThat(call.content()).equals("Hello delayed"); }
/** * * This is part of the internal API. * This is a GET request. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/project_status">Further information about this action online (including a response example)</a> * @since 5.3 */ public ProjectStatusResponse projectStatus(ProjectStatusRequest request) { return call( new GetRequest(path("project_status")) .setParam("analysisId", request.getAnalysisId()) .setParam("projectId", request.getProjectId()) .setParam("projectKey", request.getProjectKey()), ProjectStatusResponse.parser()); }
/** * * This is part of the internal API. * This is a GET request. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/system/info">Further information about this action online (including a response example)</a> * @since 5.1 */ public String info() { return call( new GetRequest(path("info")) .setMediaType(MediaTypes.JSON) ).content(); }
/** * * This is part of the internal API. * This is a GET request. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/rules/list">Further information about this action online (including a response example)</a> * @since 5.2 */ public ListResponse list() { return call( new GetRequest(path("list")), ListResponse.parser()); }
/** * * This is part of the internal API. * This is a GET request. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/component_tags">Further information about this action online (including a response example)</a> * @since 5.1 */ public String componentTags(ComponentTagsRequest request) { return call( new GetRequest(path("component_tags")) .setParam("componentUuid", request.getComponentUuid()) .setParam("createdAfter", request.getCreatedAfter()) .setParam("ps", request.getPs()) .setMediaType(MediaTypes.JSON)).content(); }
/** * * This is part of the internal API. * This is a GET request. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/show">Further information about this action online (including a response example)</a> * @since 4.3 */ public ShowWsResponse show(ShowRequest request) { return call( new GetRequest(path("show")) .setParam("id", request.getId()) .setParam("name", request.getName()) .setParam("organization", request.getOrganization()), ShowWsResponse.parser()); }
/** * * This is part of the internal API. * This is a GET request. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/metrics/domains">Further information about this action online (including a response example)</a> * @since 5.2 */ public String domains() { return call( new GetRequest(path("domains")) .setMediaType(MediaTypes.JSON) ).content(); }
/** * * This is part of the internal API. * This is a GET request. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/system/status">Further information about this action online (including a response example)</a> * @since 5.2 */ public StatusResponse status() { return call( new GetRequest(path("status")), StatusResponse.parser()); }
/** * * This is part of the internal API. * This is a GET request. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/rules/repositories">Further information about this action online (including a response example)</a> * @since 4.5 */ public String repositories(RepositoriesRequest request) { return call( new GetRequest(path("repositories")) .setParam("language", request.getLanguage()) .setParam("q", request.getQ()) .setMediaType(MediaTypes.JSON) ).content(); }
/** * * This is part of the internal API. * This is a GET request. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/analysis_status">Further information about this action online (including a response example)</a> * @since 7.4 */ public AnalysisStatusWsResponse analysisStatus(AnalysisStatusRequest request) { return call( new GetRequest(path("analysis_status")) .setParam("branch", request.getBranch()) .setParam("component", request.getComponent()) .setParam("pullRequest", request.getPullRequest()), AnalysisStatusWsResponse.parser()); }
/** * * This is part of the internal API. * This is a GET request. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/batch/index">Further information about this action online (including a response example)</a> * @since 4.4 */ public String index() { return call( new GetRequest(path("index")) .setMediaType(MediaTypes.JSON) ).content(); }
/** * * This is part of the internal API. * This is a GET request. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/current">Further information about this action online (including a response example)</a> * @since 5.2 */ public CurrentWsResponse current() { return call( new GetRequest(path("current")), CurrentWsResponse.parser()); }
/** * * This is part of the internal API. * This is a GET request. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/views/local_views">Further information about this action online (including a response example)</a> * @since 1.0 */ public String localViews(LocalViewsRequest request) { return call( new GetRequest(path("local_views")) .setParam("key", request.getKey()) .setMediaType(MediaTypes.JSON) ).content(); }
/** * * This is part of the internal API. * This is a GET request. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/components/suggestions">Further information about this action online (including a response example)</a> * @since 4.2 */ public SuggestionsWsResponse suggestions(SuggestionsRequest request) { return call( new GetRequest(path("suggestions")) .setParam("more", request.getMore()) .setParam("recentlyBrowsed", request.getRecentlyBrowsed() == null ? null : request.getRecentlyBrowsed().stream().collect(Collectors.joining(","))) .setParam("s", request.getS()), SuggestionsWsResponse.parser()); }