Search in sources :

Example 11 with StorageUpdateCheckResult

use of org.sonarsource.sonarlint.core.client.api.connected.StorageUpdateCheckResult in project sonarlint-intellij by SonarSource.

the class UpdateCheckerTest method do_nothing_if_no_updates.

@Test
public void do_nothing_if_no_updates() {
    StorageUpdateCheckResult result = mock(StorageUpdateCheckResult.class);
    when(result.needUpdate()).thenReturn(false);
    when(engine.checkIfModuleStorageNeedUpdate(any(ServerConfiguration.class), anyString(), isNull())).thenReturn(result);
    when(engine.checkIfGlobalStorageNeedUpdate(any(ServerConfiguration.class), isNull())).thenReturn(result);
    updateChecker.checkForUpdate();
    verify(engine).checkIfGlobalStorageNeedUpdate(any(ServerConfiguration.class), isNull());
    verify(engine).checkIfModuleStorageNeedUpdate(any(ServerConfiguration.class), anyString(), isNull());
    verifyZeroInteractions(notifications);
}
Also used : StorageUpdateCheckResult(org.sonarsource.sonarlint.core.client.api.connected.StorageUpdateCheckResult) ServerConfiguration(org.sonarsource.sonarlint.core.client.api.connected.ServerConfiguration) SonarTest(org.sonarlint.intellij.SonarTest) Test(org.junit.Test)

Example 12 with StorageUpdateCheckResult

use of org.sonarsource.sonarlint.core.client.api.connected.StorageUpdateCheckResult in project sonarlint-intellij by SonarSource.

the class UpdateCheckerTest method global_changes.

@Test
public void global_changes() {
    StorageUpdateCheckResult result = mock(StorageUpdateCheckResult.class);
    when(result.needUpdate()).thenReturn(true);
    when(result.changelog()).thenReturn(Collections.singletonList("change1"));
    when(engine.checkIfModuleStorageNeedUpdate(any(ServerConfiguration.class), anyString(), isNull())).thenReturn(result);
    when(engine.checkIfGlobalStorageNeedUpdate(any(ServerConfiguration.class), isNull())).thenReturn(result);
    updateChecker.checkForUpdate();
    verify(engine).checkIfGlobalStorageNeedUpdate(any(ServerConfiguration.class), isNull());
    verify(engine).checkIfModuleStorageNeedUpdate(any(ServerConfiguration.class), anyString(), isNull());
    verify(notifications).notifyServerHasUpdates("serverId", engine, server, false);
    verifyNoMoreInteractions(engine);
    verifyZeroInteractions(notifications);
}
Also used : StorageUpdateCheckResult(org.sonarsource.sonarlint.core.client.api.connected.StorageUpdateCheckResult) ServerConfiguration(org.sonarsource.sonarlint.core.client.api.connected.ServerConfiguration) SonarTest(org.sonarlint.intellij.SonarTest) Test(org.junit.Test)

Aggregations

StorageUpdateCheckResult (org.sonarsource.sonarlint.core.client.api.connected.StorageUpdateCheckResult)12 Test (org.junit.Test)11 ProgressWrapper (org.sonarsource.sonarlint.core.util.ProgressWrapper)9 ServerConfiguration (org.sonarsource.sonarlint.core.client.api.connected.ServerConfiguration)4 GlobalProperties (org.sonarsource.sonarlint.core.proto.Sonarlint.GlobalProperties)4 List (java.util.List)2 Map (java.util.Map)2 Nullable (javax.annotation.Nullable)2 SonarTest (org.sonarlint.intellij.SonarTest)2 AnalysisResults (org.sonarsource.sonarlint.core.client.api.common.analysis.AnalysisResults)2 ConnectedGlobalConfiguration (org.sonarsource.sonarlint.core.client.api.connected.ConnectedGlobalConfiguration)2 ConnectedSonarLintEngine (org.sonarsource.sonarlint.core.client.api.connected.ConnectedSonarLintEngine)2 Preconditions.checkNotNull (com.google.common.base.Preconditions.checkNotNull)1 Orchestrator (com.sonar.orchestrator.Orchestrator)1 OrchestratorBuilder (com.sonar.orchestrator.OrchestratorBuilder)1 MavenBuild (com.sonar.orchestrator.build.MavenBuild)1 Configuration (com.sonar.orchestrator.config.Configuration)1 FileLocation (com.sonar.orchestrator.locator.FileLocation)1 NetworkUtils (com.sonar.orchestrator.util.NetworkUtils)1 File (java.io.File)1