Search in sources :

Example 6 with StorageUpdateCheckResult

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

the class GlobalStorageUpdateCheckerTest method testNoChanges.

@Test
public void testNoChanges() {
    StorageUpdateCheckResult result = checker.checkForUpdate(mock(ProgressWrapper.class));
    assertThat(result.needUpdate()).isFalse();
    assertThat(result.changelog()).isEmpty();
}
Also used : ProgressWrapper(org.sonarsource.sonarlint.core.util.ProgressWrapper) StorageUpdateCheckResult(org.sonarsource.sonarlint.core.client.api.connected.StorageUpdateCheckResult) Test(org.junit.Test)

Example 7 with StorageUpdateCheckResult

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

the class ModuleStorageUpdateCheckerTest method testNoChanges.

@Test
public void testNoChanges() {
    StorageUpdateCheckResult result = checker.checkForUpdates(MODULE_KEY, new ProgressWrapper(null));
    assertThat(result.needUpdate()).isFalse();
    assertThat(result.changelog()).isEmpty();
}
Also used : ProgressWrapper(org.sonarsource.sonarlint.core.util.ProgressWrapper) StorageUpdateCheckResult(org.sonarsource.sonarlint.core.client.api.connected.StorageUpdateCheckResult) Test(org.junit.Test)

Example 8 with StorageUpdateCheckResult

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

the class ModuleStorageUpdateCheckerTest method changedQualityProfile.

@Test
public void changedQualityProfile() {
    when(moduleConfigurationDownloader.fetchModuleConfiguration(eq(SERVER_VERSION), eq(MODULE_KEY), any(GlobalProperties.class), any(ProgressWrapper.class))).thenReturn(ModuleConfiguration.newBuilder().putQprofilePerLanguage("java", "sonar-way-456").build());
    when(storageReader.readModuleConfig(MODULE_KEY)).thenReturn(ModuleConfiguration.newBuilder().putQprofilePerLanguage("java", "sonar-way-123").build());
    StorageUpdateCheckResult result = checker.checkForUpdates(MODULE_KEY, new ProgressWrapper(null));
    assertThat(result.needUpdate()).isTrue();
    assertThat(result.changelog()).containsOnly("Quality profiles configuration changed");
    assertThat(logTester.logs(LoggerLevel.DEBUG)).containsOnly("Quality profile for language 'java' changed from 'sonar-way-123' to 'sonar-way-456'");
}
Also used : ProgressWrapper(org.sonarsource.sonarlint.core.util.ProgressWrapper) StorageUpdateCheckResult(org.sonarsource.sonarlint.core.client.api.connected.StorageUpdateCheckResult) GlobalProperties(org.sonarsource.sonarlint.core.proto.Sonarlint.GlobalProperties) Test(org.junit.Test)

Example 9 with StorageUpdateCheckResult

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

the class ModuleStorageUpdateCheckerTest method addedProfile.

@Test
public void addedProfile() {
    when(moduleConfigurationDownloader.fetchModuleConfiguration(eq(SERVER_VERSION), eq(MODULE_KEY), any(GlobalProperties.class), any(ProgressWrapper.class))).thenReturn(ModuleConfiguration.newBuilder().putQprofilePerLanguage("java", "sonar-way-123").build());
    StorageUpdateCheckResult result = checker.checkForUpdates(MODULE_KEY, new ProgressWrapper(null));
    assertThat(result.needUpdate()).isTrue();
    assertThat(result.changelog()).containsOnly("Quality profiles configuration changed");
    assertThat(logTester.logs(LoggerLevel.DEBUG)).containsOnly("Quality profile for language 'java' added with value 'sonar-way-123'");
}
Also used : ProgressWrapper(org.sonarsource.sonarlint.core.util.ProgressWrapper) StorageUpdateCheckResult(org.sonarsource.sonarlint.core.client.api.connected.StorageUpdateCheckResult) GlobalProperties(org.sonarsource.sonarlint.core.proto.Sonarlint.GlobalProperties) Test(org.junit.Test)

Example 10 with StorageUpdateCheckResult

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

the class ModuleStorageUpdateCheckerTest method ignoreRemovedProfile.

@Test
public void ignoreRemovedProfile() {
    when(storageReader.readModuleConfig(MODULE_KEY)).thenReturn(ModuleConfiguration.newBuilder().putQprofilePerLanguage("java", "sonar-way-123").build());
    StorageUpdateCheckResult result = checker.checkForUpdates(MODULE_KEY, new ProgressWrapper(null));
    assertThat(result.needUpdate()).isFalse();
    assertThat(logTester.logs(LoggerLevel.DEBUG)).containsOnly("Quality profile for language 'java' removed");
}
Also used : ProgressWrapper(org.sonarsource.sonarlint.core.util.ProgressWrapper) StorageUpdateCheckResult(org.sonarsource.sonarlint.core.client.api.connected.StorageUpdateCheckResult) 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