use of org.sonarsource.sonarlint.core.serverapi.ServerApiHelper in project sonarlint-core by SonarSource.
the class ConnectionValidatorTests method testConnectionOrganizationNotFound.
@Test
void testConnectionOrganizationNotFound() throws Exception {
var underTest = new ConnectionValidator(new ServerApiHelper(mockServer.endpointParams("myOrg"), MockWebServerExtension.httpClient()));
mockServer.addStringResponse("/api/system/status", "{\"id\": \"20160308094653\",\"version\": \"7.9\",\"status\": \"UP\"}");
mockServer.addStringResponse("/api/authentication/validate?format=json", "{\"valid\": true}");
mockServer.addResponseFromResource("/api/organizations/search.protobuf?organizations=myOrg&ps=500&p=1", "/orgs/empty.pb");
var futureValidation = underTest.validateConnection();
var validation = futureValidation.get();
assertThat(validation.success()).isFalse();
assertThat(validation.message()).isEqualTo("No organizations found for key: myOrg");
}
use of org.sonarsource.sonarlint.core.serverapi.ServerApiHelper 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();
}
use of org.sonarsource.sonarlint.core.serverapi.ServerApiHelper 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();
}
use of org.sonarsource.sonarlint.core.serverapi.ServerApiHelper in project sonarlint-core by SonarSource.
the class ConnectedSonarLintEngineImpl method downloadServerIssues.
private void downloadServerIssues(EndpointParams endpoint, HttpClient client, String projectKey, boolean fetchTaintVulnerabilities, @Nullable String branchName, ProgressMonitor progress) {
var updater = partialUpdaterFactory.create();
var configuration = storageReader.readProjectConfig(projectKey);
updater.updateFileIssues(new ServerApiHelper(endpoint, client), projectKey, configuration, fetchTaintVulnerabilities, branchName, progress);
}
use of org.sonarsource.sonarlint.core.serverapi.ServerApiHelper in project sonarlint-core by SonarSource.
the class ConnectedSonarLintEngineImpl method sync.
@Override
public void sync(EndpointParams endpoint, HttpClient client, Set<String> projectKeys, @Nullable ClientProgressMonitor monitor) {
var serverApi = new ServerApi(new ServerApiHelper(endpoint, client));
var result = storageSynchronizer.synchronize(serverApi, projectKeys, new ProgressMonitor(monitor));
if (result.hasAnalyzerBeenUpdated()) {
restartAnalysisEngine();
}
}
Aggregations