use of org.sonarsource.sonarlint.core.container.connected.update.IssueDownloader in project sonarlint-core by SonarSource.
the class ModuleStorageUpdateExecutorTest method test_server_issues_are_downloaded_and_stored.
@Test
public void test_server_issues_are_downloaded_and_stored() throws IOException {
WsClientTestUtils.addResponse(wsClient, getQualityProfileUrl(), newEmptyStream());
when(storageReader.readQProfiles()).thenReturn(QProfiles.getDefaultInstance());
when(storagePaths.getModuleStorageRoot(MODULE_KEY_WITH_BRANCH)).thenReturn(temp.newFolder().toPath());
ScannerInput.ServerIssue fileIssue1 = ScannerInput.ServerIssue.newBuilder().setModuleKey("someModuleKey").setPath("some/path").setRuleKey("squid:x").build();
ScannerInput.ServerIssue fileIssue2 = ScannerInput.ServerIssue.newBuilder().setModuleKey("someModuleKey").setPath("some/path").setRuleKey("squid:y").build();
ScannerInput.ServerIssue anotherFileIssue = ScannerInput.ServerIssue.newBuilder().setModuleKey("someModuleKey").setPath("another/path").build();
ScannerInput.ServerIssue notDownloadedIssue = ScannerInput.ServerIssue.newBuilder().setModuleKey("someModuleKey").setPath("yet/another/path").build();
IssueDownloader issueDownloader = moduleKey -> Arrays.asList(fileIssue1, fileIssue2, anotherFileIssue);
moduleUpdate = new ModuleStorageUpdateExecutor(storageReader, storagePaths, wsClient, issueDownloader, issueStoreFactory, tempFolder, moduleConfigurationDownloader);
moduleUpdate.update(MODULE_KEY_WITH_BRANCH, new ProgressWrapper(null));
assertThat(issueStore.load(createFileKey(fileIssue1))).containsOnly(fileIssue1, fileIssue2);
assertThat(issueStore.load(createFileKey(anotherFileIssue))).containsOnly(anotherFileIssue);
assertThat(issueStore.load(createFileKey(notDownloadedIssue))).isEmpty();
}
use of org.sonarsource.sonarlint.core.container.connected.update.IssueDownloader in project sonarlint-core by SonarSource.
the class PartialUpdater method create.
public static PartialUpdater create(StorageReader storageReader, StoragePaths storagePaths, ServerConfiguration serverConfig, IssueStoreReader issueStoreReader) {
SonarLintWsClient client = new SonarLintWsClient(serverConfig);
IssueStoreFactory issueStoreFactory = new IssueStoreFactory();
IssueDownloader downloader = new IssueDownloaderImpl(client);
ModuleListDownloader moduleListDownloader = new ModuleListDownloader(client);
return new PartialUpdater(issueStoreFactory, downloader, storageReader, storagePaths, issueStoreReader, moduleListDownloader);
}
Aggregations