use of org.sonarsource.sonarlint.core.client.api.exceptions.DownloadException in project sonarlint-core by SonarSource.
the class PartialUpdater method updateFileIssues.
public void updateFileIssues(String moduleKey, String filePath) {
Path serverIssuesPath = storagePaths.getServerIssuesPath(moduleKey);
IssueStore issueStore = issueStoreFactory.apply(serverIssuesPath);
String fileKey = issueStoreReader.getFileKey(moduleKey, filePath);
List<ServerIssue> issues;
try {
issues = downloader.apply(fileKey);
} catch (Exception e) {
// null as cause so that it doesn't get wrapped
throw new DownloadException("Failed to update file issues: " + e.getMessage(), null);
}
issueStore.save(issues);
}
use of org.sonarsource.sonarlint.core.client.api.exceptions.DownloadException in project sonarlint-core by SonarSource.
the class ServerIssueTrackerTest method should_get_issues_from_engine_if_download_failed.
@Test
public void should_get_issues_from_engine_if_download_failed() {
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));
when(engine.downloadServerIssues(serverConfiguration, moduleKey, filePath)).thenThrow(new DownloadException());
tracker.update(serverConfiguration, engine, moduleKey, Collections.singleton(filePath));
verify(engine).downloadServerIssues(serverConfiguration, moduleKey, filePath);
verify(engine).getServerIssues(moduleKey, filePath);
verifyNoMoreInteractions(engine);
}
Aggregations