use of org.sonarqube.ws.client.GetRequest in project sonarqube by SonarSource.
the class PermissionsServiceTest method searchGlobalPermissions_does_GET_on_Ws_search_global_permissions.
@Test
public void searchGlobalPermissions_does_GET_on_Ws_search_global_permissions() {
underTest.searchGlobalPermissions();
assertThat(serviceTester.getGetParser()).isSameAs(WsPermissions.WsSearchGlobalPermissionsResponse.parser());
GetRequest getRequest = serviceTester.getGetRequest();
serviceTester.assertThat(getRequest).hasPath("search_global_permissions").andNoOtherParam();
}
use of org.sonarqube.ws.client.GetRequest in project sonarqube by SonarSource.
the class SettingsServiceTest method list_definitions.
@Test
public void list_definitions() {
underTest.listDefinitions(ListDefinitionsRequest.builder().setComponent("KEY").build());
GetRequest getRequest = serviceTester.getGetRequest();
assertThat(serviceTester.getGetParser()).isSameAs(ListDefinitionsWsResponse.parser());
serviceTester.assertThat(getRequest).hasParam(PARAM_COMPONENT, "KEY").andNoOtherParam();
}
use of org.sonarqube.ws.client.GetRequest in project sonarqube by SonarSource.
the class CrossProjectDuplicationsTest method verifyWsResultOnDuplicateFile.
private static void verifyWsResultOnDuplicateFile(String ws, String expectedFilePath) throws Exception {
String duplication = newAdminWsClient(orchestrator).wsConnector().call(new GetRequest(ws).setParam("key", DUPLICATE_FILE)).content();
assertEquals(IOUtils.toString(CrossProjectDuplicationsTest.class.getResourceAsStream("/duplication/CrossProjectDuplicationsTest/" + expectedFilePath), "UTF-8"), duplication, false);
}
use of org.sonarqube.ws.client.GetRequest in project sonarqube by SonarSource.
the class Validation method mustHaveSourceWithAtLeast.
private void mustHaveSourceWithAtLeast(String path, int minLines) {
for (String filePath : toFiles(path)) {
WsResponse response = newAdminWsClient(orchestrator).wsConnector().call(new GetRequest("api/sources/lines").setParam("key", filePathToKey(filePath)));
errorCollector.checkThat("Source is set on file " + filePath, response.isSuccessful(), is(true));
Sources source = Sources.parse(response.content());
if (source != null) {
errorCollector.checkThat("Source is empty on file " + filePath, source.getSources().size(), Matchers.greaterThanOrEqualTo(minLines));
}
}
}
use of org.sonarqube.ws.client.GetRequest in project sonarqube by SonarSource.
the class DeprecatedPropertiesWsTest method getProperty.
@CheckForNull
private static Properties.Property getProperty(WsClient wsClient, String key, @Nullable String componentKey, boolean useIdParameter) throws UnsupportedEncodingException {
GetRequest getRequest = useIdParameter ? new GetRequest("api/properties").setParam("id", encode(key, "UTF-8")).setParam("resource", componentKey) : new GetRequest("api/properties/" + encode(key, "UTF-8")).setParam("resource", componentKey);
WsResponse response = wsClient.wsConnector().call(getRequest).failIfNotSuccessful();
Properties.Property[] properties = Properties.parse(response.content());
return Arrays.stream(properties).findFirst().orElseGet(() -> null);
}
Aggregations