Search in sources :

Example 1 with ConnectionValidator

use of org.sonarsource.sonarlint.core.client.api.connected.ConnectionValidator in project sonarlint-core by SonarSource.

the class ConnectedModeExcludeByVersionTest method dontCheckMinimalPluginVersionWhenValidatingConnection.

@Test
public void dontCheckMinimalPluginVersionWhenValidatingConnection() throws ExecutionException, InterruptedException {
    engine = createEngine(e -> e.addEnabledLanguages(Language.PYTHON));
    var result = new ConnectionValidator(new ServerApiHelper(endpointParams(ORCHESTRATOR), sqHttpClient())).validateConnection().get();
    assertThat(result.success()).isTrue();
}
Also used : BeforeClass(org.junit.BeforeClass) ValidationResult(org.sonarsource.sonarlint.core.serverapi.system.ValidationResult) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) ConnectedSonarLintEngineImpl(org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl) Language(org.sonarsource.sonarlint.core.commons.Language) CreateRequest(org.sonarqube.ws.client.users.CreateRequest) ConnectedGlobalConfiguration(org.sonarsource.sonarlint.core.client.api.connected.ConnectedGlobalConfiguration) ServerApiHelper(org.sonarsource.sonarlint.core.serverapi.ServerApiHelper) ArrayList(java.util.ArrayList) UpdateResult(org.sonarsource.sonarlint.core.client.api.connected.UpdateResult) SONAR_VERSION(its.tools.ItUtils.SONAR_VERSION) ConnectionValidator(org.sonarsource.sonarlint.core.client.api.connected.ConnectionValidator) After(org.junit.After) ClassRule(org.junit.ClassRule) Path(java.nio.file.Path) ExpectedException(org.junit.rules.ExpectedException) ConnectedSonarLintEngine(org.sonarsource.sonarlint.core.client.api.connected.ConnectedSonarLintEngine) Before(org.junit.Before) Collections.emptySet(java.util.Collections.emptySet) MavenLocation(com.sonar.orchestrator.locator.MavenLocation) PluginDetails(org.sonarsource.sonarlint.core.client.api.common.PluginDetails) Test(org.junit.Test) ExecutionException(java.util.concurrent.ExecutionException) Consumer(java.util.function.Consumer) List(java.util.List) Rule(org.junit.Rule) Assume.assumeTrue(org.junit.Assume.assumeTrue) Orchestrator(com.sonar.orchestrator.Orchestrator) TemporaryFolder(org.junit.rules.TemporaryFolder) ServerApiHelper(org.sonarsource.sonarlint.core.serverapi.ServerApiHelper) ConnectionValidator(org.sonarsource.sonarlint.core.client.api.connected.ConnectionValidator) Test(org.junit.Test)

Example 2 with ConnectionValidator

use of org.sonarsource.sonarlint.core.client.api.connected.ConnectionValidator in project sonarlint-core by SonarSource.

the class SonarCloudTest method testConnection.

@Test
public void testConnection() throws ExecutionException, InterruptedException {
    assertThat(new ConnectionValidator(new ServerApiHelper(sonarcloudEndpoint(SONARCLOUD_ORGANIZATION), new SonarLintHttpClientOkHttpImpl(SC_CLIENT))).validateConnection().get().success()).isTrue();
    assertThat(new ConnectionValidator(new ServerApiHelper(sonarcloudEndpoint(null), new SonarLintHttpClientOkHttpImpl(SC_CLIENT))).validateConnection().get().success()).isTrue();
    assertThat(new ConnectionValidator(new ServerApiHelper(sonarcloudEndpoint("not-exists"), new SonarLintHttpClientOkHttpImpl(SC_CLIENT))).validateConnection().get().success()).isFalse();
}
Also used : ServerApiHelper(org.sonarsource.sonarlint.core.serverapi.ServerApiHelper) ConnectionValidator(org.sonarsource.sonarlint.core.client.api.connected.ConnectionValidator) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 ConnectionValidator (org.sonarsource.sonarlint.core.client.api.connected.ConnectionValidator)2 ServerApiHelper (org.sonarsource.sonarlint.core.serverapi.ServerApiHelper)2 Orchestrator (com.sonar.orchestrator.Orchestrator)1 MavenLocation (com.sonar.orchestrator.locator.MavenLocation)1 SONAR_VERSION (its.tools.ItUtils.SONAR_VERSION)1 Path (java.nio.file.Path)1 ArrayList (java.util.ArrayList)1 Collections.emptySet (java.util.Collections.emptySet)1 List (java.util.List)1 ExecutionException (java.util.concurrent.ExecutionException)1 Consumer (java.util.function.Consumer)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 After (org.junit.After)1 Assume.assumeTrue (org.junit.Assume.assumeTrue)1 Before (org.junit.Before)1 BeforeClass (org.junit.BeforeClass)1 ClassRule (org.junit.ClassRule)1 Rule (org.junit.Rule)1 ExpectedException (org.junit.rules.ExpectedException)1