use of org.sonarsource.sonarlint.core.container.connected.IssueStoreFactory in project sonarlint-core by SonarSource.
the class IssueStoreReaderTest method setUp.
@Before
public void setUp() {
IssueStoreFactory issueStoreFactory = mock(IssueStoreFactory.class);
issueStore = new InMemoryIssueStore();
storage = mock(StorageReader.class);
storagePaths = mock(StoragePaths.class);
Path storagePath = mock(Path.class);
when(storagePaths.getServerIssuesPath(MODULE_KEY)).thenReturn(storagePath);
when(issueStoreFactory.apply(storagePath)).thenReturn(issueStore);
issueStoreReader = new IssueStoreReader(issueStoreFactory, storage, storagePaths);
}
use of org.sonarsource.sonarlint.core.container.connected.IssueStoreFactory in project sonarlint-core by SonarSource.
the class ModuleStorageUpdateExecutorTest method module_update.
@Test
public void module_update() throws Exception {
File destDir = temp.newFolder();
QProfiles.Builder builder = QProfiles.newBuilder();
builder.putQprofilesByKey("cs-sonar-way-58886", QProfiles.QProfile.newBuilder().build());
builder.putQprofilesByKey("java-empty-74333", QProfiles.QProfile.newBuilder().build());
builder.putQprofilesByKey("js-sonar-way-60746", QProfiles.QProfile.newBuilder().build());
builder.putQprofilesByKey("xoo2-basic-34035", QProfiles.QProfile.newBuilder().build());
when(storageReader.readQProfiles()).thenReturn(builder.build());
when(storagePaths.getModuleStorageRoot(MODULE_KEY_WITH_BRANCH)).thenReturn(destDir.toPath());
moduleUpdate = new ModuleStorageUpdateExecutor(storageReader, storagePaths, wsClient, (key) -> Collections.emptyList(), issueStoreFactory, tempFolder, moduleConfigurationDownloader);
moduleUpdate.update(MODULE_KEY_WITH_BRANCH, new ProgressWrapper(null));
ModuleConfiguration moduleConfiguration = ProtobufUtil.readFile(destDir.toPath().resolve(StoragePaths.MODULE_CONFIGURATION_PB), ModuleConfiguration.parser());
assertThat(moduleConfiguration.getQprofilePerLanguage()).containsOnly(entry("cs", "cs-sonar-way-58886"), entry("java", "java-empty-74333"), entry("js", "js-sonar-way-60746"));
assertThat(moduleConfiguration.getModulePathByKey()).containsOnly(entry(MODULE_KEY_WITH_BRANCH, ""), entry(MODULE_KEY_WITH_BRANCH + "child1", "child 1"));
}
Aggregations