use of org.sonarqube.ws.client.WsResponse in project sonarqube by SonarSource.
the class WsTest method gets_protobuf.
@Test
public void gets_protobuf() {
WsResponse response = newWsClient(orchestrator).wsConnector().call(new GetRequest("api/issues/search.protobuf"));
assertThat(response.isSuccessful()).isTrue();
assertThat(response.contentType()).contains("application/x-protobuf");
}
use of org.sonarqube.ws.client.WsResponse in project sonarqube by SonarSource.
the class AutoAssignTest method createUser.
private void createUser(String login, String password) {
WsResponse response = newAdminWsClient(ORCHESTRATOR).wsConnector().call(new PostRequest("api/users/create").setParam("login", login).setParam("name", login).setParam("password", password));
assertThat(response.code()).isEqualTo(200);
}
use of org.sonarqube.ws.client.WsResponse in project sonarqube by SonarSource.
the class RestartTest method restart_in_prod_mode_requires_sysadmin_permission_and_restarts.
@Test
public void restart_in_prod_mode_requires_sysadmin_permission_and_restarts() throws Exception {
// server classloader locks Jar files on Windows
if (!SystemUtils.IS_OS_WINDOWS) {
orchestrator = Orchestrator.builderEnv().setOrchestratorProperty("orchestrator.keepWorkspace", "true").build();
orchestrator.start();
verifyFailWith403(() -> newWsClient(orchestrator).system().restart());
createNonSystemAdministrator("john", "doe");
verifyFailWith403(() -> ItUtils.newUserWsClient(orchestrator, "john", "doe").system().restart());
createSystemAdministrator("big", "boss");
ItUtils.newUserWsClient(orchestrator, "big", "boss").system().restart();
WsResponse wsResponse = newAdminWsClient(orchestrator).wsConnector().call(new GetRequest("/api/system/status")).failIfNotSuccessful();
assertThat(wsResponse.content()).contains("RESTARTING");
// we just wait five seconds, for a lack of a better approach to waiting for the restart process to start in SQ
Thread.sleep(5000);
assertThat(FileUtils.readFileToString(orchestrator.getServer().getWebLogs())).contains("SonarQube restart requested by big");
}
}
use of org.sonarqube.ws.client.WsResponse in project sonarqube by SonarSource.
the class ServerSystemTest method download_system_info.
@Test
public void download_system_info() throws Exception {
waitForComputeEngineToBeUp(orchestrator);
WsResponse response = newAdminWsClient(orchestrator).wsConnector().call(new GetRequest("api/system/info"));
assertThat(response.code()).isEqualTo(200);
assertThat(response.content()).contains(// SONAR-7436 monitor ES and CE
"\"Compute Engine Database Connection\":", "\"Compute Engine State\":", "\"Compute Engine Tasks\":", "\"Elasticsearch\":", "\"State\":\"GREEN\"", // SONAR-7271 get settings
"\"Settings\":", "\"sonar.jdbc.url\":", "\"sonar.path.data\":");
}
use of org.sonarqube.ws.client.WsResponse in project sonarqube by SonarSource.
the class QualityGateTest method getAnalysisId.
private String getAnalysisId(String taskId) throws IOException {
WsResponse activity = wsClient.wsConnector().call(new GetRequest("api/ce/task").setParam("id", taskId).setMediaType(MediaTypes.PROTOBUF));
WsCe.TaskResponse activityWsResponse = WsCe.TaskResponse.parseFrom(activity.contentStream());
return activityWsResponse.getTask().getAnalysisId();
}
Aggregations