use of org.sonar.api.SonarRuntime in project sonarqube by SonarSource.
the class WebhookCallerImplTest method newSender.
private WebhookCaller newSender(boolean validateWebhook) {
SonarRuntime runtime = SonarRuntimeImpl.forSonarQube(Version.parse("6.2"), SonarQubeSide.SERVER, SonarEdition.COMMUNITY);
when(configuration.getBoolean(SONAR_VALIDATE_WEBHOOKS_PROPERTY)).thenReturn(Optional.of(validateWebhook));
WebhookCustomDns webhookCustomDns = new WebhookCustomDns(configuration, networkInterfaceProvider);
return new WebhookCallerImpl(system, new OkHttpClientProvider().provide(new MapSettings().asConfig(), runtime), webhookCustomDns);
}
use of org.sonar.api.SonarRuntime in project sonarqube by SonarSource.
the class StartupMetadataProviderTest method load_from_database_if_compute_engine_of_startup_leader_server.
@Test
public void load_from_database_if_compute_engine_of_startup_leader_server() {
SonarRuntime runtime = SonarRuntimeImpl.forSonarQube(Version.create(6, 1), SonarQubeSide.COMPUTE_ENGINE, SonarEdition.COMMUNITY);
testLoadingFromDatabase(runtime, true);
}
use of org.sonar.api.SonarRuntime in project sonarqube by SonarSource.
the class StartupMetadataProviderTest method load_from_database_if_compute_engine_of_startup_follower_server.
@Test
public void load_from_database_if_compute_engine_of_startup_follower_server() {
SonarRuntime runtime = SonarRuntimeImpl.forSonarQube(Version.create(6, 1), SonarQubeSide.COMPUTE_ENGINE, SonarEdition.COMMUNITY);
testLoadingFromDatabase(runtime, false);
}
use of org.sonar.api.SonarRuntime in project sonarqube by SonarSource.
the class StartupMetadataProviderTest method fail_to_load_from_database_if_properties_are_not_persisted.
@Test
public void fail_to_load_from_database_if_properties_are_not_persisted() {
SonarRuntime runtime = SonarRuntimeImpl.forSonarQube(Version.create(6, 1), SonarQubeSide.COMPUTE_ENGINE, SonarEdition.COMMUNITY);
when(webServer.isStartupLeader()).thenReturn(false);
assertThatThrownBy(() -> underTest.provide(system, runtime, webServer, dbTester.getDbClient())).isInstanceOf(IllegalStateException.class).hasMessage("Property sonar.core.startTime is missing in database");
}
use of org.sonar.api.SonarRuntime in project sonarqube by SonarSource.
the class SonarRuntimeImplTest method sonarLint_environment.
@Test
public void sonarLint_environment() {
SonarRuntime apiVersion = SonarRuntimeImpl.forSonarLint(A_VERSION);
assertThat(apiVersion.getApiVersion()).isEqualTo(A_VERSION);
assertThat(apiVersion.getProduct()).isEqualTo(SonarProduct.SONARLINT);
try {
apiVersion.getSonarQubeSide();
Assertions.fail("Expected exception");
} catch (Exception e) {
assertThat(e).isInstanceOf(UnsupportedOperationException.class);
}
}
Aggregations