use of org.sonarsource.sonarlint.core.client.api.connected.ServerConfiguration in project sonarlint-intellij by SonarSource.
the class ServerDownloadProjectTask method run.
@Override
public void run(@NotNull ProgressIndicator indicator) {
try {
TaskProgressMonitor monitor = new TaskProgressMonitor(indicator);
ServerConfiguration serverConfiguration = SonarLintUtils.getServerConfiguration(server);
this.result = engine.downloadAllModules(serverConfiguration, monitor);
} catch (Exception e) {
LOGGER.info("Failed to download list of projects", e);
this.exception = e;
}
}
use of org.sonarsource.sonarlint.core.client.api.connected.ServerConfiguration in project sonarlint-intellij by SonarSource.
the class ServerUpdateTask method run.
public void run(@NotNull ProgressIndicator indicator) {
indicator.setText("Fetching data...");
try {
TaskProgressMonitor monitor = new TaskProgressMonitor(indicator);
ServerConfiguration serverConfiguration = SonarLintUtils.getServerConfiguration(server);
if (!onlyModules) {
UpdateResult updateResult = engine.update(serverConfiguration, monitor);
Collection<SonarAnalyzer> tooOld = updateResult.analyzers().stream().filter(SonarAnalyzer::sonarlintCompatible).filter(ServerUpdateTask::tooOld).collect(Collectors.toList());
if (!tooOld.isEmpty()) {
ApplicationManager.getApplication().invokeAndWait(() -> Messages.showWarningDialog(buildMinimumVersionFailMessage(tooOld), "Analyzers Not Loaded"), ModalityState.any());
}
log.log("Server binding '" + server.getName() + "' updated", LogOutput.Level.INFO);
}
updateModules(serverConfiguration, monitor);
} catch (CanceledException e) {
LOGGER.info("Update of server '" + server.getName() + "' was cancelled");
log.log("Update of server '" + server.getName() + "' was cancelled", LogOutput.Level.INFO);
} catch (Exception e) {
LOGGER.info("Error updating from server '" + server.getName() + "'", e);
final String msg = (e.getMessage() != null) ? e.getMessage() : ("Failed to update binding for server configuration '" + server.getName() + "'");
ApplicationManager.getApplication().invokeAndWait(new RunnableAdapter() {
@Override
public void doRun() {
Messages.showErrorDialog((Project) null, msg, "Update Failed");
}
}, ModalityState.any());
}
}
use of org.sonarsource.sonarlint.core.client.api.connected.ServerConfiguration in project sonarlint-core by SonarSource.
the class ServerIssueTrackerTest method should_download_issues_from_engine.
@Test
public void should_download_issues_from_engine() {
String moduleKey = "dummy module";
String filePath = "dummy file";
ConnectedSonarLintEngine engine = mock(ConnectedSonarLintEngine.class);
ServerConfiguration serverConfiguration = mock(ServerConfiguration.class);
ServerIssueTracker tracker = new ServerIssueTracker(mock(Logger.class), mock(Console.class), mock(CachingIssueTracker.class));
tracker.update(serverConfiguration, engine, moduleKey, Collections.singleton(filePath));
verify(engine).downloadServerIssues(serverConfiguration, moduleKey, filePath);
verifyNoMoreInteractions(engine);
}
use of org.sonarsource.sonarlint.core.client.api.connected.ServerConfiguration in project sonarlint-core by SonarSource.
the class ConnectedSonarLintImpl method update.
@Override
public void update(ServerConfig request, StreamObserver<Void> response) {
try {
ServerConfiguration config = transformServerConfig(request);
engine.update(config, null);
response.onNext(Void.newBuilder().build());
response.onCompleted();
} catch (Exception e) {
LOGGER.error("update", e);
response.onError(e);
}
}
use of org.sonarsource.sonarlint.core.client.api.connected.ServerConfiguration in project sonarlint-core by SonarSource.
the class ConnectedSonarLintImpl method updateModule.
@Override
public void updateModule(ModuleUpdateReq request, StreamObserver<Void> response) {
try {
ServerConfiguration serverConfig = transformServerConfig(request.getServerConfig());
engine.updateModule(serverConfig, request.getModuleKey(), null);
response.onNext(Void.newBuilder().build());
response.onCompleted();
} catch (Exception e) {
LOGGER.error("updateModule", e);
response.onError(e);
}
}
Aggregations