/** * * 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 POST request. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/system/restart">Further information about this action online (including a response example)</a> * @since 4.3 */ public void restart() { call( new PostRequest(path("restart")) .setMediaType(MediaTypes.JSON) ).content(); }
/** * * This is part of the internal API. * This is a POST request. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/cancel_all">Further information about this action online (including a response example)</a> * @since 5.2 */ public void cancelAll() { call( new PostRequest(path("cancel_all")) .setMediaType(MediaTypes.JSON) ).content(); }
/** * * This is part of the internal API. * This is a POST request. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/pause">Further information about this action online (including a response example)</a> * @since 7.2 */ public void pause() { call( new PostRequest(path("pause")) .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/metrics/types">Further information about this action online (including a response example)</a> * @since 5.2 */ public String types() { return call( new GetRequest(path("types")) .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/navigation/global">Further information about this action online (including a response example)</a> * @since 5.2 */ public String global() { return call( new GetRequest(path("global")) .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/importers">Further information about this action online (including a response example)</a> * @since 5.2 */ public String importers() { return call( new GetRequest(path("importers")) .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/plugins/available">Further information about this action online (including a response example)</a> * @since 5.2 */ public String available() { return call( new GetRequest(path("available")) .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/plugins/pending">Further information about this action online (including a response example)</a> * @since 5.2 */ public String pending() { return call( new GetRequest(path("pending")) .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/views/list">Further information about this action online (including a response example)</a> * @since 1.0 */ public String list() { return call( new GetRequest(path("list")) .setMediaType(MediaTypes.JSON) ).content(); }
/** * * This is part of the internal API. * This is a POST request. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/system/migrate_db">Further information about this action online (including a response example)</a> * @since 5.2 */ public String migrateDb() { return call( new PostRequest(path("migrate_db")) .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/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 POST request. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/skip_onboarding_tutorial">Further information about this action online (including a response example)</a> * @since 6.5 */ public void skipOnboardingTutorial() { call( new PostRequest(path("skip_onboarding_tutorial")) .setMediaType(MediaTypes.JSON) ).content(); }
/** * * This is part of the internal API. * This is a POST request. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/resume">Further information about this action online (including a response example)</a> * @since 7.2 */ public void resume() { call( new PostRequest(path("resume")) .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/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(); }
public void test() throws IOException { GetRequest get = new GetRequest(path("issue")).setMediaType(MediaTypes.JSON); when(wsConnector.call(get)).thenReturn(new MockWsResponse().setContent("ok")); WsResponse response = call(get); assertThat(response.content()).isEqualTo("ok"); }
@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"); }
@Test public void override_timeout_on_post() { underTest = HttpConnector.newBuilder().url(serverUrl).build(); // Headers are not affected by setBodyDelay, let's throttle the answer server.enqueue(new MockResponse().throttleBody(1,100, TimeUnit.MILLISECONDS).setBody("Hello delayed")); expectedException.expect(IllegalStateException.class); expectedException.expectCause(IsInstanceOf.instanceOf(SocketTimeoutException.class)); WsResponse call = underTest.call(new PostRequest("/").setTimeOutInMs(5)); assertThat(call.content()).equals("Hello delayed"); }
@Test public void override_timeout_on_post_with_redirect() { underTest = HttpConnector.newBuilder().url(serverUrl).build(); server.enqueue(new MockResponse().setResponseCode(301).setHeader("Location:", "/redirect")); // Headers are not affected by setBodyDelay, let's throttle the answer server.enqueue(new MockResponse().throttleBody(1,100, TimeUnit.MILLISECONDS).setBody("Hello delayed")); expectedException.expect(IllegalStateException.class); expectedException.expectCause(IsInstanceOf.instanceOf(SocketTimeoutException.class)); WsResponse call = underTest.call(new PostRequest("/").setTimeOutInMs(5)); assertThat(call.content()).equals("Hello delayed"); }