use of org.sonarsource.sonarlint.core.util.ProgressWrapper in project sonarlint-core by SonarSource.
the class ModuleStorageUpdateCheckerTest method removedProp.
@Test
public void removedProp() {
when(storageReader.readModuleConfig(MODULE_KEY)).thenReturn(ModuleConfiguration.newBuilder().putProperties("sonar.cobol.license.secured", "value").build());
StorageUpdateCheckResult result = checker.checkForUpdates(MODULE_KEY, new ProgressWrapper(null));
assertThat(result.needUpdate()).isTrue();
assertThat(result.changelog()).containsOnly("Project settings updated");
assertThat(logTester.logs(LoggerLevel.DEBUG)).containsOnly("Property 'sonar.cobol.license.secured' removed");
}
use of org.sonarsource.sonarlint.core.util.ProgressWrapper in project sonarlint-core by SonarSource.
the class ModuleStorageUpdateCheckerTest method changedProp.
@Test
public void changedProp() {
when(storageReader.readModuleConfig(MODULE_KEY)).thenReturn(ModuleConfiguration.newBuilder().putProperties("sonar.inclusions", "old").build());
when(moduleConfigurationDownloader.fetchModuleConfiguration(eq(SERVER_VERSION), eq(MODULE_KEY), any(GlobalProperties.class), any(ProgressWrapper.class))).thenReturn(ModuleConfiguration.newBuilder().putProperties("sonar.inclusions", "new").build());
StorageUpdateCheckResult result = checker.checkForUpdates(MODULE_KEY, new ProgressWrapper(null));
assertThat(result.needUpdate()).isTrue();
assertThat(result.changelog()).containsOnly("Project settings updated");
assertThat(logTester.logs(LoggerLevel.DEBUG)).containsOnly("Value of property 'sonar.inclusions' changed from 'old' to 'new'");
}
use of org.sonarsource.sonarlint.core.util.ProgressWrapper in project sonarlint-core by SonarSource.
the class ModuleStorageUpdateCheckerTest method addedProp.
@Test
public void addedProp() {
when(moduleConfigurationDownloader.fetchModuleConfiguration(eq(SERVER_VERSION), eq(MODULE_KEY), any(GlobalProperties.class), any(ProgressWrapper.class))).thenReturn(ModuleConfiguration.newBuilder().putProperties("sonar.issue.enforce.allFiles", "value").build());
StorageUpdateCheckResult result = checker.checkForUpdates(MODULE_KEY, new ProgressWrapper(null));
assertThat(result.needUpdate()).isTrue();
assertThat(result.changelog()).containsOnly("Project settings updated");
assertThat(logTester.logs(LoggerLevel.DEBUG)).containsOnly("Property 'sonar.issue.enforce.allFiles' added with value 'value'");
}
use of org.sonarsource.sonarlint.core.util.ProgressWrapper in project sonarlint-core by SonarSource.
the class GlobalStorageUpdateExecutorTest method dontCopyOnError.
@Test
public void dontCopyOnError() throws IOException {
Files.createDirectories(destDir.toPath());
Files.createFile(destDir.toPath().resolve("test"));
doThrow(IllegalStateException.class).when(rulesDownloader).fetchRulesTo(any(Path.class), any(ProgressWrapper.class));
try {
globalUpdate.update(new ProgressWrapper(null));
fail("Expected exception");
} catch (IllegalStateException e) {
// dest left untouched
assertThat(Files.exists(destDir.toPath().resolve("test"))).isTrue();
// tmp cleaned
assertThat(Files.exists(tempDir.toPath())).isFalse();
}
}
use of org.sonarsource.sonarlint.core.util.ProgressWrapper in project sonarlint-core by SonarSource.
the class GlobalStorageUpdateExecutorTest method testUpdate.
@Test
public void testUpdate() throws Exception {
globalUpdate.update(new ProgressWrapper(null));
StorageStatus updateStatus = ProtobufUtil.readFile(destDir.toPath().resolve(StoragePaths.STORAGE_STATUS_PB), StorageStatus.parser());
assertThat(updateStatus.getClientUserAgent()).isEqualTo("UT");
assertThat(updateStatus.getSonarlintCoreVersion()).isEqualTo(VersionUtils.getLibraryVersion());
assertThat(updateStatus.getUpdateTimestamp()).isNotEqualTo(0);
ServerInfos serverInfos = ProtobufUtil.readFile(destDir.toPath().resolve(StoragePaths.SERVER_INFO_PB), ServerInfos.parser());
assertThat(serverInfos.getId()).isEqualTo("20160308094653");
assertThat(serverInfos.getVersion()).isEqualTo("5.6-SNAPSHOT");
}
Aggregations