Search in sources :

Example 16 with ProgressWrapper

use of org.sonarsource.sonarlint.core.util.ProgressWrapper in project sonarlint-core by SonarSource.

the class WsHelperImpl method listOrganizations.

@Override
public List<RemoteOrganization> listOrganizations(ServerConfiguration serverConfig, @Nullable ProgressMonitor monitor) {
    SonarLintWsClient client = createClient(serverConfig);
    ServerVersionAndStatusChecker serverChecker = new ServerVersionAndStatusChecker(client);
    return listOrganizations(client, serverChecker, new ProgressWrapper(monitor));
}
Also used : ProgressWrapper(org.sonarsource.sonarlint.core.util.ProgressWrapper) ServerVersionAndStatusChecker(org.sonarsource.sonarlint.core.container.connected.validate.ServerVersionAndStatusChecker) SonarLintWsClient(org.sonarsource.sonarlint.core.container.connected.SonarLintWsClient)

Example 17 with ProgressWrapper

use of org.sonarsource.sonarlint.core.util.ProgressWrapper in project sonarlint-core by SonarSource.

the class StorageAnalyzerTest method testStaleModuleStorage.

@Test
public void testStaleModuleStorage() {
    when(globalReader.get()).thenReturn(mock(GlobalStorageStatus.class));
    ModuleStorageStatus moduleStatus = mock(ModuleStorageStatus.class);
    when(moduleStatus.isStale()).thenReturn(true);
    when(moduleReader.apply("module1")).thenReturn(moduleStatus);
    exception.expect(StorageException.class);
    exception.expectMessage("Stored data for module 'module1' is stale");
    analyzer.analyze(mock(StorageContainer.class), config, mock(IssueListener.class), new ProgressWrapper(null));
}
Also used : ProgressWrapper(org.sonarsource.sonarlint.core.util.ProgressWrapper) IssueListener(org.sonarsource.sonarlint.core.client.api.common.analysis.IssueListener) GlobalStorageStatus(org.sonarsource.sonarlint.core.client.api.connected.GlobalStorageStatus) ModuleStorageStatus(org.sonarsource.sonarlint.core.client.api.connected.ModuleStorageStatus) Test(org.junit.Test)

Example 18 with ProgressWrapper

use of org.sonarsource.sonarlint.core.util.ProgressWrapper in project sonarlint-core by SonarSource.

the class PartialUpdaterTest method error_downloading_modules.

@Test
public void error_downloading_modules() {
    when(storagePaths.getGlobalStorageRoot()).thenReturn(temp.getRoot().toPath());
    doThrow(IOException.class).when(moduleListDownloader).fetchModulesListTo(eq(temp.getRoot().toPath()), eq(SERVER_VERSION), any(ProgressWrapper.class));
    exception.expect(DownloadException.class);
    updater.updateModuleList(new ProgressWrapper(null));
}
Also used : ProgressWrapper(org.sonarsource.sonarlint.core.util.ProgressWrapper) Test(org.junit.Test)

Example 19 with ProgressWrapper

use of org.sonarsource.sonarlint.core.util.ProgressWrapper in project sonarlint-core by SonarSource.

the class PartialUpdaterTest method update_module_list.

@Test
public void update_module_list() {
    when(storagePaths.getGlobalStorageRoot()).thenReturn(temp.getRoot().toPath());
    updater.updateModuleList(new ProgressWrapper(null));
    verify(moduleListDownloader).fetchModulesListTo(eq(temp.getRoot().toPath()), eq(SERVER_VERSION), any(ProgressWrapper.class));
}
Also used : ProgressWrapper(org.sonarsource.sonarlint.core.util.ProgressWrapper) Test(org.junit.Test)

Example 20 with ProgressWrapper

use of org.sonarsource.sonarlint.core.util.ProgressWrapper in project sonarlint-core by SonarSource.

the class StorageAnalyzerTest method testNoGlobalStorage.

@Test
public void testNoGlobalStorage() {
    when(globalReader.get()).thenReturn(null);
    exception.expect(StorageException.class);
    exception.expectMessage("Missing global data");
    analyzer.analyze(mock(StorageContainer.class), config, mock(IssueListener.class), new ProgressWrapper(null));
}
Also used : ProgressWrapper(org.sonarsource.sonarlint.core.util.ProgressWrapper) IssueListener(org.sonarsource.sonarlint.core.client.api.common.analysis.IssueListener) Test(org.junit.Test)

Aggregations

ProgressWrapper (org.sonarsource.sonarlint.core.util.ProgressWrapper)38 Test (org.junit.Test)31 SonarLintWsClient (org.sonarsource.sonarlint.core.container.connected.SonarLintWsClient)14 File (java.io.File)11 StorageUpdateCheckResult (org.sonarsource.sonarlint.core.client.api.connected.StorageUpdateCheckResult)9 GlobalProperties (org.sonarsource.sonarlint.core.proto.Sonarlint.GlobalProperties)8 Map (java.util.Map)6 Nullable (javax.annotation.Nullable)6 ServerInfos (org.sonarsource.sonarlint.core.proto.Sonarlint.ServerInfos)6 Path (java.nio.file.Path)5 IssueListener (org.sonarsource.sonarlint.core.client.api.common.analysis.IssueListener)5 IOException (java.io.IOException)4 Arrays (java.util.Arrays)4 Collections (java.util.Collections)4 HashMap (java.util.HashMap)4 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)4 Assertions.entry (org.assertj.core.api.Assertions.entry)4 Before (org.junit.Before)4 Rule (org.junit.Rule)4 ExpectedException (org.junit.rules.ExpectedException)4