use of org.sonarqube.ws.ServerId.ShowWsResponse in project sonarqube by SonarSource.
the class ShowActionTest method return_no_server_id_info_when_no_server_id_but_other_settings.
@Test
public void return_no_server_id_info_when_no_server_id_but_other_settings() throws Exception {
logInAsSystemAdministrator();
insertConfiguration(null, "home", "127.0.0.1");
ShowWsResponse response = executeRequest();
assertThat(response.hasServerId()).isFalse();
assertThat(response.hasOrganization()).isFalse();
assertThat(response.hasIp()).isFalse();
assertThat(response.getValidIpAddressesList()).isEmpty();
assertThat(response.hasInvalidServerId()).isFalse();
}
use of org.sonarqube.ws.ServerId.ShowWsResponse in project sonarqube by SonarSource.
the class ShowActionTest method return_invalid_server_id.
@Test
public void return_invalid_server_id() throws Exception {
logInAsSystemAdministrator();
when(generator.validate("home", "127.0.0.1", "1818a1eefb26f9g")).thenReturn(true);
insertConfiguration("invalid", null, null);
ShowWsResponse response = executeRequest();
assertThat(response.hasInvalidServerId()).isTrue();
assertThat(response.getServerId()).isEqualTo("invalid");
assertThat(response.hasOrganization()).isFalse();
assertThat(response.hasIp()).isFalse();
assertThat(response.getValidIpAddressesList()).isEmpty();
}
use of org.sonarqube.ws.ServerId.ShowWsResponse in project sonarqube by SonarSource.
the class ShowActionTest method return_available_ips_even_if_no_settings.
@Test
public void return_available_ips_even_if_no_settings() throws Exception {
logInAsSystemAdministrator();
setAvailableIpAdresses("192.168.1.1", "127.0.0.1");
ShowWsResponse response = executeRequest();
assertThat(response.hasServerId()).isFalse();
assertThat(response.hasOrganization()).isFalse();
assertThat(response.hasIp()).isFalse();
assertThat(response.getValidIpAddressesList()).containsOnly("192.168.1.1", "127.0.0.1");
assertThat(response.hasInvalidServerId()).isFalse();
}
use of org.sonarqube.ws.ServerId.ShowWsResponse in project sonarqube by SonarSource.
the class ServerSystemTest method getValidIpAddress.
private String getValidIpAddress() throws IOException {
WsClient adminWsClient = newAdminWsClient(orchestrator);
ShowWsResponse response = ShowWsResponse.parseFrom(adminWsClient.wsConnector().call(new GetRequest("api/server_id/show").setMediaType(MediaTypes.PROTOBUF)).contentStream());
assertThat(response.getValidIpAddressesCount()).isGreaterThan(0);
return response.getValidIpAddresses(0);
}
use of org.sonarqube.ws.ServerId.ShowWsResponse in project sonarqube by SonarSource.
the class ShowActionTest method return_no_server_id_info_when_no_settings_and_no_available_ips.
@Test
public void return_no_server_id_info_when_no_settings_and_no_available_ips() throws Exception {
logInAsSystemAdministrator();
ShowWsResponse response = executeRequest();
assertThat(response.hasServerId()).isFalse();
assertThat(response.hasOrganization()).isFalse();
assertThat(response.hasIp()).isFalse();
assertThat(response.getValidIpAddressesList()).isEmpty();
assertThat(response.hasInvalidServerId()).isFalse();
}
Aggregations