aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch/src/test
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2015-12-08 10:37:44 +0100
committerJulien HENRY <julien.henry@sonarsource.com>2015-12-08 10:52:24 +0100
commit7f680d2af8f27bfb3c63813c66203c621c65d6ae (patch)
tree5118552bbc48e1e2d327f0f7197da0a6db8b6f63 /sonar-batch/src/test
parent72cec54788255865cff4e857ed1d1a926242d197 (diff)
downloadsonarqube-7f680d2af8f27bfb3c63813c66203c621c65d6ae.tar.gz
sonarqube-7f680d2af8f27bfb3c63813c66203c621c65d6ae.zip
SONAR-6818 Restore warning when using sonar.profile
Diffstat (limited to 'sonar-batch/src/test')
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/repository/QualityProfileProviderTest.java42
1 files changed, 27 insertions, 15 deletions
diff --git a/sonar-batch/src/test/java/org/sonar/batch/repository/QualityProfileProviderTest.java b/sonar-batch/src/test/java/org/sonar/batch/repository/QualityProfileProviderTest.java
index 567dcd1380d..af65f530131 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/repository/QualityProfileProviderTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/repository/QualityProfileProviderTest.java
@@ -19,31 +19,37 @@
*/
package org.sonar.batch.repository;
-import static org.mockito.Mockito.when;
-
+import com.google.common.collect.ImmutableMap;
+import java.util.ArrayList;
+import java.util.List;
import org.apache.commons.lang.mutable.MutableBoolean;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
import org.sonar.api.batch.bootstrap.ProjectKey;
+import org.sonar.api.utils.log.LogTester;
+import org.sonar.api.utils.log.LoggerLevel;
+import org.sonar.batch.analysis.AnalysisProperties;
import org.sonar.batch.analysis.DefaultAnalysisMode;
+import org.sonar.batch.rule.ModuleQProfiles;
import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile;
-import java.util.ArrayList;
-import java.util.List;
-
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.isNull;
import static org.mockito.Matchers.eq;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.verifyNoMoreInteractions;
+import static org.mockito.Matchers.isNull;
import static org.mockito.Mockito.verify;
-import static org.assertj.core.api.Assertions.assertThat;
-import org.sonar.batch.rule.ModuleQProfiles;
-import org.junit.Test;
-import org.sonar.batch.analysis.AnalysisProperties;
-import org.mockito.MockitoAnnotations;
-import org.mockito.Mock;
-import org.junit.Before;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+import static org.mockito.Mockito.when;
public class QualityProfileProviderTest {
+
+ @Rule
+ public LogTester logTester = new LogTester();
+
private QualityProfileProvider qualityProfileProvider;
@Mock
@@ -110,12 +116,15 @@ public class QualityProfileProviderTest {
when(mode.isNotAssociated()).thenReturn(false);
when(loader.load(eq("project"), eq("custom"), any(MutableBoolean.class))).thenReturn(response);
when(props.property(ModuleQProfiles.SONAR_PROFILE_PROP)).thenReturn("custom");
+ when(props.properties()).thenReturn(ImmutableMap.of(ModuleQProfiles.SONAR_PROFILE_PROP, "custom"));
ModuleQProfiles qps = qualityProfileProvider.provide(key, loader, projectRepo, props, mode);
assertResponse(qps);
verify(loader).load(eq("project"), eq("custom"), any(MutableBoolean.class));
verifyNoMoreInteractions(loader);
+ assertThat(logTester.logs(LoggerLevel.WARN)).contains("Ability to set quality profile from command line using '" + ModuleQProfiles.SONAR_PROFILE_PROP
+ + "' is deprecated and will be dropped in a future SonarQube version. Please configure quality profile used by your project on SonarQube server.");
}
@Test
@@ -137,12 +146,15 @@ public class QualityProfileProviderTest {
when(mode.isNotAssociated()).thenReturn(true);
when(loader.loadDefault(eq("custom"), any(MutableBoolean.class))).thenReturn(response);
when(props.property(ModuleQProfiles.SONAR_PROFILE_PROP)).thenReturn("custom");
+ when(props.properties()).thenReturn(ImmutableMap.of(ModuleQProfiles.SONAR_PROFILE_PROP, "custom"));
ModuleQProfiles qps = qualityProfileProvider.provide(key, loader, projectRepo, props, mode);
assertResponse(qps);
verify(loader).loadDefault(eq("custom"), any(MutableBoolean.class));
verifyNoMoreInteractions(loader);
+ assertThat(logTester.logs(LoggerLevel.WARN)).contains("Ability to set quality profile from command line using '" + ModuleQProfiles.SONAR_PROFILE_PROP
+ + "' is deprecated and will be dropped in a future SonarQube version. Please configure quality profile used by your project on SonarQube server.");
}
private void assertResponse(ModuleQProfiles qps) {