summaryrefslogtreecommitdiffstats
path: root/sonar-batch/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-batch/src/test')
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/analysis/AnalysisWSLoaderProviderTest.java19
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);
+ }
}