diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2015-12-02 14:10:44 +0100 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2015-12-03 09:27:58 +0100 |
commit | 287fbc9aa4a5f78db7dbb42adf422a632b74fa1e (patch) | |
tree | 4e7e31098796af43e86ed552a5a2c2f6087d5b39 /sonar-batch/src/test | |
parent | 45c9896c61d28f064952573dff0e30bee5e08d2f (diff) | |
download | sonarqube-287fbc9aa4a5f78db7dbb42adf422a632b74fa1e.tar.gz sonarqube-287fbc9aa4a5f78db7dbb42adf422a632b74fa1e.zip |
SONAR-7100 Disable WS cache by default in issues mode
Diffstat (limited to 'sonar-batch/src/test')
-rw-r--r-- | sonar-batch/src/test/java/org/sonar/batch/analysis/AnalysisWSLoaderProviderTest.java | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/sonar-batch/src/test/java/org/sonar/batch/analysis/AnalysisWSLoaderProviderTest.java b/sonar-batch/src/test/java/org/sonar/batch/analysis/AnalysisWSLoaderProviderTest.java index b175faa6bc6..5aa31bd64d5 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/analysis/AnalysisWSLoaderProviderTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/analysis/AnalysisWSLoaderProviderTest.java @@ -19,6 +19,8 @@ */ package org.sonar.batch.analysis; +import com.google.common.collect.ImmutableMap; +import org.assertj.core.util.Maps; import org.junit.Test; import org.sonar.api.batch.AnalysisMode; import org.sonar.batch.bootstrap.BatchWsClient; @@ -28,6 +30,7 @@ import org.sonar.home.cache.PersistentCache; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; public class AnalysisWSLoaderProviderTest { @@ -39,7 +42,21 @@ public class AnalysisWSLoaderProviderTest { @Test public void testDefault() { - WSLoader loader = underTest.provide(mode, cache, wsClient); + WSLoader loader = underTest.provide(mode, cache, wsClient, new AnalysisProperties(Maps.<String, String>newHashMap())); assertThat(loader.getDefaultStrategy()).isEqualTo(LoadStrategy.SERVER_ONLY); } + + @Test + public void no_cache_by_default_in_issues_mode() { + when(mode.isIssues()).thenReturn(true); + WSLoader loader = underTest.provide(mode, cache, wsClient, new AnalysisProperties(Maps.<String, String>newHashMap())); + assertThat(loader.getDefaultStrategy()).isEqualTo(LoadStrategy.SERVER_ONLY); + } + + @Test + public void enable_cache_in_issues_mode() { + when(mode.isIssues()).thenReturn(true); + WSLoader loader = underTest.provide(mode, cache, wsClient, new AnalysisProperties(ImmutableMap.of(AnalysisWSLoaderProvider.SONAR_USE_WS_CACHE, "true"))); + assertThat(loader.getDefaultStrategy()).isEqualTo(LoadStrategy.CACHE_ONLY); + } } |