aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine/src/test
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2017-06-29 15:08:28 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2017-07-04 23:47:46 +0200
commit875e23e29f4ed2d41146d8bba8b22448b23df113 (patch)
treee100819edca0bc4c2d75adce8ba760f4fef87059 /sonar-scanner-engine/src/test
parentd7f436725b0172217ff8156f1425b4a4a702529c (diff)
downloadsonarqube-875e23e29f4ed2d41146d8bba8b22448b23df113.tar.gz
sonarqube-875e23e29f4ed2d41146d8bba8b22448b23df113.zip
SONAR-9478 Deprecate Settings and introduce new Configuration interface
Diffstat (limited to 'sonar-scanner-engine/src/test')
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/BatchTest.java3
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/EnvironmentInformationTest.java1
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/LogCallbackAppenderTest.java2
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/ProjectAnalysisInfoTest.java14
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/WsTestUtil.java5
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/analysis/AnalysisTempFolderProviderTest.java17
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/analysis/DefaultAnalysisModeTest.java10
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/DroppedPropertyCheckerTest.java1
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ExtensionUtilsTest.java1
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/FileCacheProviderTest.java15
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalConfigurationProviderTest.java (renamed from sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalSettingsTest.java)8
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalContainerTest.java1
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalModeTest.java9
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalPropertiesTest.java3
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalTempFolderProviderTest.java19
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/MetricProviderTest.java5
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginJarExploderTest.java2
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginPredicateTest.java21
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginRepositoryTest.java2
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/CpdComponentsTest.java1
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/CpdExecutorTest.java16
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/DuplicationPredicatesTest.java1
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/deprecated/DefaultCpdBlockIndexerTest.java7
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/deprecated/JavaCpdBlockIndexerTest.java9
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/events/BatchStepEventTest.java2
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/events/EventBusTest.java2
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/genericcoverage/GenericCoverageSensorTest.java2
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/genericcoverage/GenericTestExecutionSensorTest.java2
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/index/AbstractCachesTest.java12
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/index/DefaultIndexTest.java1
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DefaultFilterableIssueTest.java1
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DefaultIssueCallbackTest.java26
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DefaultIssueFilterChainTest.java4
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DefaultProjectIssuesTest.java11
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DeprecatedIssueAdapterForFilterTest.java1
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DeprecatedIssueFilterChainTest.java1
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ModuleIssuesTest.java2
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/TrackedIssueAdapterTest.java1
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/EnforceIssuesFilterTest.java6
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/IgnoreIssuesFilterTest.java8
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/IssueExclusionPatternInitializerTest.java19
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/IssueInclusionPatternInitializerTest.java7
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/IssuePatternTest.java7
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/LineRangeTest.java1
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/PatternDecoderTest.java1
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/PatternMatcherTest.java11
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/scanner/IssueExclusionsLoaderTest.java1
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/scanner/IssueExclusionsRegexpScannerTest.java20
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/tracking/RollingFileHashesTest.java2
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/tracking/SourceHashHolderTest.java1
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/tracking/TrackedIssueTest.java6
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/LogOutputRecorder.java5
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumTest.java7
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/NoLanguagesPluginsMediumTest.java8
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/ProjectBuilderMediumTest.java8
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/IssuesIssuesModeMediumTest.java16
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/EmptyFileTest.java13
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/IssueModeAndReportsMediumTest.java2
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/NoPreviousAnalysisTest.java10
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/ScanOnlyChangedTest.java4
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/scm/ScmMediumTest.java3
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/tests/CoveragePerTestMediumTest.java14
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/phases/PostJobsExecutorTest.java7
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/phases/SensorsExecutorTest.java9
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/platform/DefaultServerTest.java2
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/postjob/DefaultPostJobContextTest.java7
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/postjob/PostJobOptimizerTest.java2
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/profiling/PhasesSumUpTimeProfilerTest.java6
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ActiveRulesPublisherTest.java1
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/report/AnalysisContextReportPublisherTest.java6
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ComponentsPublisherTest.java4
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ContextPropertiesPublisherTest.java23
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/report/MetadataPublisherTest.java7
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ReportPublisherTest.java21
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultQualityProfileLoaderTest.java7
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/ProjectRepositoriesProviderTest.java8
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/QualityProfileProviderTest.java3
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/ActiveRulesProviderTest.java4
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/QProfileTest.java3
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/QProfileVerifierTest.java13
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/RuleFinderCompatibilityTest.java6
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/RulesProfileProviderTest.java15
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/RulesProviderTest.java8
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/DefaultComponentTreeTest.java4
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/DefaultInputModuleHierarchyTest.java4
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/MutableModuleSettingsTest.java (renamed from sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ModuleSettingsTest.java)32
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/MutableProjectSettingsTest.java (renamed from sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectSettingsTest.java)21
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectBuildersExecutorTest.java8
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectLockTest.java17
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectReactorValidatorTest.java2
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectScanContainerTest.java1
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/WorkDirectoryCleanerTest.java5
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/AdditionalFilePredicatesTest.java1
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/ByteCharsetDetectorTest.java15
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/CharsetDetectorTest.java15
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/CharsetValidationTest.java5
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/ExclusionFiltersTest.java22
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/InputFileBuilderTest.java14
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/LanguageDetectionTest.java36
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/MetadataGeneratorTest.java11
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/StatusDetectionFactoryTest.java2
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/StatusDetectionTest.java1
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/report/ConsoleReportTest.java7
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/report/JSONReportTest.java17
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/report/RuleNameProviderTest.java26
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scm/DefaultBlameOutputTest.java1
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/DefaultSensorContextTest.java7
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/DefaultSensorStorageTest.java7
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/SensorOptimizerTest.java11
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/coverage/CoverageExclusionsTest.java7
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/source/DefaultHighlightableTest.java1
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/source/DefaultSymbolizableTest.java1
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/source/DeprecatedDefaultSymbolTableTest.java1
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/storage/StorageTest.java1
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/storage/StoragesManagerTest.java2
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/storage/StoragesTest.java5
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/task/ListTaskTest.java2
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/task/TasksTest.java3
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/util/ScannerUtilsTest.java1
119 files changed, 375 insertions, 524 deletions
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/BatchTest.java b/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/BatchTest.java
index 5709fd8d33f..fd0f6842150 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/BatchTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/BatchTest.java
@@ -20,9 +20,6 @@
package org.sonar.batch.bootstrapper;
import org.junit.Test;
-import org.sonar.batch.bootstrapper.Batch;
-import org.sonar.batch.bootstrapper.EnvironmentInformation;
-import org.sonar.batch.bootstrapper.LogOutput;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertNotNull;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/EnvironmentInformationTest.java b/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/EnvironmentInformationTest.java
index 45e5aef44aa..a5a53519833 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/EnvironmentInformationTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/EnvironmentInformationTest.java
@@ -20,7 +20,6 @@
package org.sonar.batch.bootstrapper;
import org.junit.Test;
-import org.sonar.batch.bootstrapper.EnvironmentInformation;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/LogCallbackAppenderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/LogCallbackAppenderTest.java
index bdd9ec58f96..3baa1d2c240 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/LogCallbackAppenderTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/LogCallbackAppenderTest.java
@@ -23,8 +23,6 @@ import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.spi.ILoggingEvent;
import org.junit.Before;
import org.junit.Test;
-import org.sonar.batch.bootstrapper.LogCallbackAppender;
-import org.sonar.batch.bootstrapper.LogOutput;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.reset;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/ProjectAnalysisInfoTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/ProjectAnalysisInfoTest.java
index 71ce99fca72..0e0cdb0f3f5 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/ProjectAnalysisInfoTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/ProjectAnalysisInfoTest.java
@@ -19,27 +19,25 @@
*/
package org.sonar.scanner;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.Date;
-
import org.junit.Test;
import org.sonar.api.CoreProperties;
-import org.sonar.api.config.MapSettings;
-import org.sonar.api.config.Settings;
+import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.utils.System2;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+
public class ProjectAnalysisInfoTest {
@Test
public void testSimpleDate() {
- Settings settings = new MapSettings();
+ MapSettings settings = new MapSettings();
settings.appendProperty(CoreProperties.PROJECT_DATE_PROPERTY, "2017-01-01");
settings.appendProperty(CoreProperties.PROJECT_VERSION_PROPERTY, "version");
System2 system = mock(System2.class);
- ProjectAnalysisInfo info = new ProjectAnalysisInfo(settings, system);
+ ProjectAnalysisInfo info = new ProjectAnalysisInfo(settings.asConfig(), system);
info.start();
LocalDate date = LocalDate.of(2017, 1, 1);
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/WsTestUtil.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/WsTestUtil.java
index 88b2c7d05eb..694830ad918 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/WsTestUtil.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/WsTestUtil.java
@@ -19,6 +19,8 @@
*/
package org.sonar.scanner;
+import java.io.InputStream;
+import java.io.Reader;
import org.apache.commons.lang.StringUtils;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
@@ -26,9 +28,6 @@ import org.sonar.scanner.bootstrap.ScannerWsClient;
import org.sonarqube.ws.client.WsRequest;
import org.sonarqube.ws.client.WsResponse;
-import java.io.InputStream;
-import java.io.Reader;
-
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.argThat;
import static org.mockito.Mockito.mock;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/analysis/AnalysisTempFolderProviderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/analysis/AnalysisTempFolderProviderTest.java
index c7ff8309577..60a8f7140bb 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/analysis/AnalysisTempFolderProviderTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/analysis/AnalysisTempFolderProviderTest.java
@@ -19,22 +19,19 @@
*/
package org.sonar.scanner.analysis;
-import org.sonar.api.batch.bootstrap.ProjectDefinition;
-
-import org.sonar.api.batch.bootstrap.ProjectReactor;
+import java.io.File;
+import java.io.IOException;
import org.junit.Before;
-import org.sonar.api.utils.TempFolder;
-import org.sonar.scanner.analysis.AnalysisTempFolderProvider;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
+import org.sonar.api.batch.bootstrap.ProjectDefinition;
+import org.sonar.api.batch.bootstrap.ProjectReactor;
+import org.sonar.api.utils.TempFolder;
-import java.io.File;
-import java.io.IOException;
-
-import static org.mockito.Mockito.when;
-import static org.mockito.Mockito.mock;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
public class AnalysisTempFolderProviderTest {
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/analysis/DefaultAnalysisModeTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/analysis/DefaultAnalysisModeTest.java
index 095da114e93..b7544e1f0ce 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/analysis/DefaultAnalysisModeTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/analysis/DefaultAnalysisModeTest.java
@@ -19,16 +19,14 @@
*/
package org.sonar.scanner.analysis;
-import org.junit.Rule;
-import org.junit.rules.ExpectedException;
+import java.util.HashMap;
+import java.util.Map;
import javax.annotation.Nullable;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.ExpectedException;
import org.sonar.api.CoreProperties;
-import org.sonar.scanner.analysis.AnalysisProperties;
-import org.sonar.scanner.analysis.DefaultAnalysisMode;
import org.sonar.scanner.bootstrap.GlobalProperties;
-import java.util.HashMap;
-import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/DroppedPropertyCheckerTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/DroppedPropertyCheckerTest.java
index 8126f43c29a..e4d9168a288 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/DroppedPropertyCheckerTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/DroppedPropertyCheckerTest.java
@@ -24,7 +24,6 @@ import org.junit.Rule;
import org.junit.Test;
import org.sonar.api.utils.log.LogTester;
import org.sonar.api.utils.log.LoggerLevel;
-import org.sonar.scanner.bootstrap.DroppedPropertyChecker;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ExtensionUtilsTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ExtensionUtilsTest.java
index 2c867b61bce..8b2baaf57e1 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ExtensionUtilsTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ExtensionUtilsTest.java
@@ -26,7 +26,6 @@ import org.sonar.api.batch.InstantiationStrategy;
import org.sonar.api.batch.ScannerSide;
import org.sonar.api.ce.ComputeEngineSide;
import org.sonar.api.server.ServerSide;
-import org.sonar.scanner.bootstrap.ExtensionUtils;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/FileCacheProviderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/FileCacheProviderTest.java
index 06bde834a69..f86ef04f4a2 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/FileCacheProviderTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/FileCacheProviderTest.java
@@ -24,8 +24,7 @@ import java.io.IOException;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
-import org.sonar.api.config.Settings;
-import org.sonar.api.config.MapSettings;
+import org.sonar.api.config.internal.MapSettings;
import org.sonar.home.cache.FileCache;
import static org.assertj.core.api.Assertions.assertThat;
@@ -37,7 +36,7 @@ public class FileCacheProviderTest {
@Test
public void provide() {
FileCacheProvider provider = new FileCacheProvider();
- FileCache cache = provider.provide(new MapSettings());
+ FileCache cache = provider.provide(new MapSettings().asConfig());
assertThat(cache).isNotNull();
assertThat(cache.getDir()).isNotNull().exists();
@@ -46,9 +45,9 @@ public class FileCacheProviderTest {
@Test
public void keep_singleton_instance() {
FileCacheProvider provider = new FileCacheProvider();
- Settings settings = new MapSettings();
- FileCache cache1 = provider.provide(settings);
- FileCache cache2 = provider.provide(settings);
+ MapSettings settings = new MapSettings();
+ FileCache cache1 = provider.provide(settings.asConfig());
+ FileCache cache2 = provider.provide(settings.asConfig());
assertThat(cache1).isSameAs(cache2);
}
@@ -56,10 +55,10 @@ public class FileCacheProviderTest {
@Test
public void honor_sonarUserHome() throws IOException {
FileCacheProvider provider = new FileCacheProvider();
- Settings settings = new MapSettings();
+ MapSettings settings = new MapSettings();
File f = temp.newFolder();
settings.appendProperty("sonar.userHome", f.getAbsolutePath());
- FileCache cache = provider.provide(settings);
+ FileCache cache = provider.provide(settings.asConfig());
assertThat(cache.getDir()).isEqualTo(new File(f, "cache"));
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalSettingsTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalConfigurationProviderTest.java
index 7d9bf07ab0a..0ee71d91ecf 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalSettingsTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalConfigurationProviderTest.java
@@ -34,7 +34,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-public class GlobalSettingsTest {
+public class GlobalConfigurationProviderTest {
public static final String SOME_VALUE = "some_value";
@Rule
@@ -58,9 +58,9 @@ public class GlobalSettingsTest {
public void should_load_global_settings() {
when(settingsLoader.load(null)).thenReturn(ImmutableMap.of("sonar.cpd.cross", "true"));
- GlobalSettings batchSettings = new GlobalSettings(bootstrapProps, new PropertyDefinitions(), settingsLoader, mode);
+ GlobalConfiguration globalConfig = new GlobalConfigurationProvider().provide(settingsLoader, bootstrapProps, new PropertyDefinitions(), mode);
- assertThat(batchSettings.getBoolean("sonar.cpd.cross")).isTrue();
+ assertThat(globalConfig.get("sonar.cpd.cross")).hasValue("true");
}
@Test
@@ -69,7 +69,7 @@ public class GlobalSettingsTest {
"sonar.jdbc.username", SOME_VALUE,
"sonar.jdbc.password", SOME_VALUE));
- new GlobalSettings(bootstrapProps, new PropertyDefinitions(), settingsLoader, mode);
+ new GlobalConfigurationProvider().provide(settingsLoader, bootstrapProps, new PropertyDefinitions(), mode);
assertThat(logTester.logs(LoggerLevel.WARN)).containsOnly(
"Property 'sonar.jdbc.url' is not supported any more. It will be ignored. There is no longer any DB connection to the SQ database.",
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalContainerTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalContainerTest.java
index 7333a707144..26e8d1e912f 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalContainerTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalContainerTest.java
@@ -31,7 +31,6 @@ import org.sonar.api.CoreProperties;
import org.sonar.api.batch.BatchSide;
import org.sonar.api.utils.TempFolder;
import org.sonar.core.util.UuidFactory;
-import org.sonar.scanner.bootstrap.GlobalContainer;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalModeTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalModeTest.java
index 4bbab8408f7..fed2ba5aa92 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalModeTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalModeTest.java
@@ -19,15 +19,12 @@
*/
package org.sonar.scanner.bootstrap;
+import java.util.HashMap;
+import java.util.Map;
import org.junit.Rule;
+import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.sonar.api.CoreProperties;
-import org.sonar.scanner.bootstrap.GlobalMode;
-import org.sonar.scanner.bootstrap.GlobalProperties;
-import org.junit.Test;
-
-import java.util.HashMap;
-import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalPropertiesTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalPropertiesTest.java
index d6f544b1a6c..d459e7303b6 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalPropertiesTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalPropertiesTest.java
@@ -20,9 +20,8 @@
package org.sonar.scanner.bootstrap;
import com.google.common.collect.Maps;
-import org.junit.Test;
-import org.sonar.scanner.bootstrap.GlobalProperties;
import java.util.Map;
+import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.entry;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalTempFolderProviderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalTempFolderProviderTest.java
index 23218bf7092..5585545241b 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalTempFolderProviderTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalTempFolderProviderTest.java
@@ -19,14 +19,7 @@
*/
package org.sonar.scanner.bootstrap;
-import org.sonar.api.utils.System2;
-import org.apache.commons.io.FileUtils;
-import org.sonar.api.utils.TempFolder;
-import org.sonar.scanner.bootstrap.GlobalProperties;
-import org.sonar.scanner.bootstrap.GlobalTempFolderProvider;
import com.google.common.collect.ImmutableMap;
-import org.sonar.api.CoreProperties;
-
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
@@ -34,13 +27,17 @@ import java.nio.file.attribute.BasicFileAttributeView;
import java.nio.file.attribute.FileTime;
import java.util.Collections;
import java.util.concurrent.TimeUnit;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import static org.assertj.core.api.Assertions.assertThat;
+import org.apache.commons.io.FileUtils;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
+import org.sonar.api.CoreProperties;
+import org.sonar.api.utils.System2;
+import org.sonar.api.utils.TempFolder;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
public class GlobalTempFolderProviderTest {
@Rule
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/MetricProviderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/MetricProviderTest.java
index 2babecd6585..88555e6775b 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/MetricProviderTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/MetricProviderTest.java
@@ -19,13 +19,12 @@
*/
package org.sonar.scanner.bootstrap;
+import java.util.Arrays;
+import java.util.List;
import org.junit.Test;
import org.sonar.api.measures.CoreMetrics;
import org.sonar.api.measures.Metric;
import org.sonar.api.measures.Metrics;
-import org.sonar.scanner.bootstrap.MetricProvider;
-import java.util.Arrays;
-import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginJarExploderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginJarExploderTest.java
index f5f7f20f684..3f799a74815 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginJarExploderTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginJarExploderTest.java
@@ -30,8 +30,6 @@ import org.sonar.core.platform.ExplodedPlugin;
import org.sonar.core.platform.PluginInfo;
import org.sonar.home.cache.FileCache;
import org.sonar.home.cache.FileCacheBuilder;
-import org.sonar.scanner.bootstrap.ScannerPluginJarExploder;
-import org.sonar.scanner.bootstrap.Slf4jLogger;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginPredicateTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginPredicateTest.java
index fbc7ee0f4ea..6ae96de59e8 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginPredicateTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginPredicateTest.java
@@ -21,8 +21,7 @@ package org.sonar.scanner.bootstrap;
import org.junit.Test;
import org.sonar.api.CoreProperties;
-import org.sonar.api.config.Settings;
-import org.sonar.api.config.MapSettings;
+import org.sonar.api.config.internal.MapSettings;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
@@ -30,12 +29,12 @@ import static org.mockito.Mockito.when;
public class ScannerPluginPredicateTest {
- Settings settings = new MapSettings();
- GlobalMode mode = mock(GlobalMode.class);
+ private MapSettings settings = new MapSettings();
+ private GlobalMode mode = mock(GlobalMode.class);
@Test
public void accept_if_no_inclusions_nor_exclusions() {
- ScannerPluginPredicate predicate = new ScannerPluginPredicate(settings, mode);
+ ScannerPluginPredicate predicate = new ScannerPluginPredicate(settings.asConfig(), mode);
assertThat(predicate.getWhites()).isEmpty();
assertThat(predicate.getBlacks()).isEmpty();
assertThat(predicate.apply("pmd")).isTrue();
@@ -45,7 +44,7 @@ public class ScannerPluginPredicateTest {
@Test
public void exclude_buildbreaker_in_preview_mode() {
when(mode.isPreview()).thenReturn(true);
- ScannerPluginPredicate predicate = new ScannerPluginPredicate(settings, mode);
+ ScannerPluginPredicate predicate = new ScannerPluginPredicate(settings.asConfig(), mode);
assertThat(predicate.apply("buildbreaker")).isFalse();
}
@@ -55,7 +54,7 @@ public class ScannerPluginPredicateTest {
settings
.setProperty(CoreProperties.PREVIEW_INCLUDE_PLUGINS, "checkstyle,pmd,findbugs")
.setProperty(CoreProperties.PREVIEW_EXCLUDE_PLUGINS, "cobertura,pmd");
- ScannerPluginPredicate predicate = new ScannerPluginPredicate(settings, mode);
+ ScannerPluginPredicate predicate = new ScannerPluginPredicate(settings.asConfig(), mode);
assertThat(predicate.apply("pmd")).isTrue();
}
@@ -65,7 +64,7 @@ public class ScannerPluginPredicateTest {
settings
.setProperty(CoreProperties.PREVIEW_INCLUDE_PLUGINS, "checkstyle,pmd,findbugs")
.setProperty(CoreProperties.PREVIEW_EXCLUDE_PLUGINS, "cobertura");
- ScannerPluginPredicate predicate = new ScannerPluginPredicate(settings, mode);
+ ScannerPluginPredicate predicate = new ScannerPluginPredicate(settings.asConfig(), mode);
assertThat(predicate.apply("checkstyle")).isTrue();
assertThat(predicate.apply("pmd")).isTrue();
assertThat(predicate.apply("cobertura")).isFalse();
@@ -77,7 +76,7 @@ public class ScannerPluginPredicateTest {
settings
.setProperty(CoreProperties.PREVIEW_INCLUDE_PLUGINS, "checkstyle,pmd,findbugs")
.setProperty(CoreProperties.PREVIEW_EXCLUDE_PLUGINS, "cobertura");
- ScannerPluginPredicate predicate = new ScannerPluginPredicate(settings, mode);
+ ScannerPluginPredicate predicate = new ScannerPluginPredicate(settings.asConfig(), mode);
assertThat(predicate.apply("checkstyle")).isTrue();
assertThat(predicate.apply("pmd")).isTrue();
assertThat(predicate.apply("cobertura")).isFalse();
@@ -87,7 +86,7 @@ public class ScannerPluginPredicateTest {
public void test_exclusions_without_any_inclusions() {
when(mode.isPreview()).thenReturn(true);
settings.setProperty(CoreProperties.PREVIEW_EXCLUDE_PLUGINS, "checkstyle,pmd,findbugs");
- ScannerPluginPredicate predicate = new ScannerPluginPredicate(settings, mode);
+ ScannerPluginPredicate predicate = new ScannerPluginPredicate(settings.asConfig(), mode);
assertThat(predicate.apply("checkstyle")).isFalse();
assertThat(predicate.apply("pmd")).isFalse();
assertThat(predicate.apply("cobertura")).isTrue();
@@ -98,7 +97,7 @@ public class ScannerPluginPredicateTest {
settings
.setProperty(CoreProperties.PREVIEW_INCLUDE_PLUGINS, "checkstyle, pmd, findbugs")
.setProperty(CoreProperties.PREVIEW_EXCLUDE_PLUGINS, "cobertura, pmd");
- ScannerPluginPredicate predicate = new ScannerPluginPredicate(settings, mode);
+ ScannerPluginPredicate predicate = new ScannerPluginPredicate(settings.asConfig(), mode);
assertThat(predicate.apply("pmd")).isTrue();
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginRepositoryTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginRepositoryTest.java
index 9750e7cec60..967c5c8f351 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginRepositoryTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginRepositoryTest.java
@@ -24,8 +24,6 @@ import org.junit.Test;
import org.sonar.api.Plugin;
import org.sonar.core.platform.PluginInfo;
import org.sonar.core.platform.PluginLoader;
-import org.sonar.scanner.bootstrap.ScannerPluginRepository;
-import org.sonar.scanner.bootstrap.PluginInstaller;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.fail;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/CpdComponentsTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/CpdComponentsTest.java
index 465200012bf..e885192a59f 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/CpdComponentsTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/CpdComponentsTest.java
@@ -20,7 +20,6 @@
package org.sonar.scanner.cpd;
import org.junit.Test;
-import org.sonar.scanner.cpd.CpdComponents;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/CpdExecutorTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/CpdExecutorTest.java
index 708f5ac97bc..e46702cb90e 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/CpdExecutorTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/CpdExecutorTest.java
@@ -33,8 +33,7 @@ import org.junit.rules.TemporaryFolder;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.fs.internal.DefaultInputFile;
import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
-import org.sonar.api.config.MapSettings;
-import org.sonar.api.config.Settings;
+import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.scan.filesystem.PathResolver;
import org.sonar.api.utils.log.LogTester;
import org.sonar.api.utils.log.LoggerLevel;
@@ -56,11 +55,6 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class CpdExecutorTest {
- private CpdExecutor executor;
- private Settings settings;
- private SonarCpdBlockIndex index;
- private ReportPublisher publisher;
-
@Rule
public LogTester logTester = new LogTester();
@@ -70,6 +64,10 @@ public class CpdExecutorTest {
@Rule
public ExpectedException thrown = ExpectedException.none();
+ private CpdExecutor executor;
+ private MapSettings settings;
+ private SonarCpdBlockIndex index;
+ private ReportPublisher publisher;
private ScannerReportReader reader;
private DefaultInputFile batchComponent1;
private DefaultInputFile batchComponent2;
@@ -85,9 +83,9 @@ public class CpdExecutorTest {
settings = new MapSettings();
publisher = mock(ReportPublisher.class);
when(publisher.getWriter()).thenReturn(new ScannerReportWriter(outputDir));
- index = new SonarCpdBlockIndex(publisher, settings);
+ index = new SonarCpdBlockIndex(publisher, settings.asConfig());
componentStore = new InputComponentStore(new PathResolver());
- executor = new CpdExecutor(settings, index, publisher, componentStore);
+ executor = new CpdExecutor(settings.asConfig(), index, publisher, componentStore);
reader = new ScannerReportReader(outputDir);
componentStore.put(TestInputFileBuilder.newDefaultInputModule("foo", baseDir));
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/DuplicationPredicatesTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/DuplicationPredicatesTest.java
index d02dff61853..6b961772daa 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/DuplicationPredicatesTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/DuplicationPredicatesTest.java
@@ -22,7 +22,6 @@ package org.sonar.scanner.cpd;
import com.google.common.base.Predicate;
import org.junit.Test;
import org.sonar.duplications.index.CloneGroup;
-import org.sonar.scanner.cpd.DuplicationPredicates;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/deprecated/DefaultCpdBlockIndexerTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/deprecated/DefaultCpdBlockIndexerTest.java
index 616a7c66e7a..6446aa1822f 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/deprecated/DefaultCpdBlockIndexerTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/deprecated/DefaultCpdBlockIndexerTest.java
@@ -22,8 +22,7 @@ package org.sonar.scanner.cpd.deprecated;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
-import org.sonar.api.config.MapSettings;
-import org.sonar.api.config.Settings;
+import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.utils.log.LogTester;
import static org.assertj.core.api.Assertions.assertThat;
@@ -31,7 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class DefaultCpdBlockIndexerTest {
private DefaultCpdBlockIndexer engine;
- private Settings settings;
+ private MapSettings settings;
@Rule
public LogTester logTester = new LogTester();
@@ -39,7 +38,7 @@ public class DefaultCpdBlockIndexerTest {
@Before
public void init() {
settings = new MapSettings();
- engine = new DefaultCpdBlockIndexer(null, null, settings, null);
+ engine = new DefaultCpdBlockIndexer(null, null, settings.asConfig(), null);
}
@Test
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/deprecated/JavaCpdBlockIndexerTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/deprecated/JavaCpdBlockIndexerTest.java
index 325bb08789b..4952e1cab2d 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/deprecated/JavaCpdBlockIndexerTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/deprecated/JavaCpdBlockIndexerTest.java
@@ -37,8 +37,7 @@ import org.sonar.api.batch.fs.FileSystem;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.fs.internal.DefaultFileSystem;
import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
-import org.sonar.api.config.MapSettings;
-import org.sonar.api.config.Settings;
+import org.sonar.api.config.internal.MapSettings;
import org.sonar.duplications.block.Block;
import org.sonar.scanner.cpd.index.SonarCpdBlockIndex;
@@ -57,7 +56,7 @@ public class JavaCpdBlockIndexerTest {
@Captor
private ArgumentCaptor<List<Block>> blockCaptor;
- private Settings settings;
+ private MapSettings settings;
private JavaCpdBlockIndexer engine;
private InputFile file;
@@ -79,12 +78,12 @@ public class JavaCpdBlockIndexerTest {
FileUtils.copyURLToFile(this.getClass().getResource("ManyStatements.java"), ioFile);
settings = new MapSettings();
- engine = new JavaCpdBlockIndexer(fs, settings, index);
+ engine = new JavaCpdBlockIndexer(fs, settings.asConfig(), index);
}
@Test
public void languageSupported() {
- JavaCpdBlockIndexer engine = new JavaCpdBlockIndexer(mock(FileSystem.class), new MapSettings(), index);
+ JavaCpdBlockIndexer engine = new JavaCpdBlockIndexer(mock(FileSystem.class), new MapSettings().asConfig(), index);
assertThat(engine.isLanguageSupported(JAVA)).isTrue();
assertThat(engine.isLanguageSupported("php")).isFalse();
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/events/BatchStepEventTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/events/BatchStepEventTest.java
index 7c714e0231e..7385e3af1e6 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/events/BatchStepEventTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/events/BatchStepEventTest.java
@@ -20,8 +20,6 @@
package org.sonar.scanner.events;
import org.junit.Test;
-import org.sonar.scanner.events.BatchStepEvent;
-import org.sonar.scanner.events.BatchStepHandler;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/events/EventBusTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/events/EventBusTest.java
index 1ccae4fe949..4608be2638f 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/events/EventBusTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/events/EventBusTest.java
@@ -21,8 +21,6 @@ package org.sonar.scanner.events;
import org.junit.Test;
import org.sonar.api.batch.events.EventHandler;
-import org.sonar.scanner.events.BatchEvent;
-import org.sonar.scanner.events.EventBus;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/genericcoverage/GenericCoverageSensorTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/genericcoverage/GenericCoverageSensorTest.java
index 4bae1ec3135..a23a5d6499f 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/genericcoverage/GenericCoverageSensorTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/genericcoverage/GenericCoverageSensorTest.java
@@ -21,9 +21,9 @@ package org.sonar.scanner.genericcoverage;
import org.junit.Rule;
import org.junit.Test;
-import org.sonar.api.config.MapSettings;
import org.sonar.api.config.PropertyDefinitions;
import org.sonar.api.config.Settings;
+import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.utils.log.LogTester;
import org.sonar.api.utils.log.LoggerLevel;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/genericcoverage/GenericTestExecutionSensorTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/genericcoverage/GenericTestExecutionSensorTest.java
index 99af4485fe1..356db75b3e6 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/genericcoverage/GenericTestExecutionSensorTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/genericcoverage/GenericTestExecutionSensorTest.java
@@ -26,9 +26,9 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.sonar.api.batch.sensor.internal.SensorContextTester;
-import org.sonar.api.config.MapSettings;
import org.sonar.api.config.PropertyDefinitions;
import org.sonar.api.config.Settings;
+import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.utils.log.LogTester;
import org.sonar.api.utils.log.LoggerLevel;
import org.sonar.scanner.deprecated.test.TestPlanBuilder;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/index/AbstractCachesTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/index/AbstractCachesTest.java
index b9a3d19fd11..72b5b501d4f 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/index/AbstractCachesTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/index/AbstractCachesTest.java
@@ -19,21 +19,19 @@
*/
package org.sonar.scanner.index;
+import com.google.common.collect.ImmutableMap;
+import java.util.Map;
import org.junit.After;
-
-import org.junit.Before;
import org.junit.AfterClass;
+import org.junit.Before;
import org.junit.BeforeClass;
-import com.google.common.collect.ImmutableMap;
+import org.junit.ClassRule;
+import org.junit.rules.TemporaryFolder;
import org.sonar.api.CoreProperties;
import org.sonar.scanner.bootstrap.GlobalProperties;
import org.sonar.scanner.bootstrap.GlobalTempFolderProvider;
import org.sonar.scanner.storage.Storages;
import org.sonar.scanner.storage.StoragesManager;
-import java.util.Map;
-
-import org.junit.ClassRule;
-import org.junit.rules.TemporaryFolder;
public abstract class AbstractCachesTest {
@ClassRule
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/index/DefaultIndexTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/index/DefaultIndexTest.java
index 1ddf03b28ed..d82bb5d20b1 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/index/DefaultIndexTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/index/DefaultIndexTest.java
@@ -21,7 +21,6 @@ package org.sonar.scanner.index;
import java.io.IOException;
import java.util.Collections;
-
import org.junit.Before;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DefaultFilterableIssueTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DefaultFilterableIssueTest.java
index 9553dfaa659..24c36cda115 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DefaultFilterableIssueTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DefaultFilterableIssueTest.java
@@ -24,7 +24,6 @@ import org.junit.Before;
import org.junit.Test;
import org.sonar.api.batch.fs.internal.DefaultInputModule;
import org.sonar.scanner.ProjectAnalysisInfo;
-import org.sonar.scanner.issue.DefaultFilterableIssue;
import org.sonar.scanner.protocol.Constants.Severity;
import org.sonar.scanner.protocol.output.ScannerReport.Issue;
import org.sonar.scanner.protocol.output.ScannerReport.TextRange;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DefaultIssueCallbackTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DefaultIssueCallbackTest.java
index c6c7f1b7aec..c5f606f7739 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DefaultIssueCallbackTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DefaultIssueCallbackTest.java
@@ -19,28 +19,24 @@
*/
package org.sonar.scanner.issue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
+import com.google.common.collect.ImmutableList;
+import java.util.LinkedList;
+import java.util.List;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
import org.sonar.api.batch.rule.Rule;
+import org.sonar.api.batch.rule.Rules;
import org.sonar.api.rule.RuleKey;
import org.sonar.batch.bootstrapper.IssueListener;
import org.sonar.batch.bootstrapper.IssueListener.Issue;
-import org.mockito.MockitoAnnotations;
-import org.mockito.Mock;
-import org.sonar.api.batch.rule.Rules;
-import org.sonar.scanner.issue.DefaultIssueCallback;
-import org.sonar.scanner.issue.IssueCache;
import org.sonar.scanner.issue.tracking.TrackedIssue;
-import org.junit.Before;
-import com.google.common.collect.ImmutableList;
-
-import java.util.LinkedList;
-import java.util.List;
-import static org.mockito.Matchers.any;
import static org.assertj.core.api.Assertions.assertThat;
-import org.junit.Test;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
public class DefaultIssueCallbackTest {
@Mock
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DefaultIssueFilterChainTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DefaultIssueFilterChainTest.java
index d91fa2ed0e4..b7120772896 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DefaultIssueFilterChainTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DefaultIssueFilterChainTest.java
@@ -19,12 +19,10 @@
*/
package org.sonar.scanner.issue;
-import org.sonar.api.scan.issue.filter.FilterableIssue;
-
import org.junit.Test;
+import org.sonar.api.scan.issue.filter.FilterableIssue;
import org.sonar.api.scan.issue.filter.IssueFilter;
import org.sonar.api.scan.issue.filter.IssueFilterChain;
-import org.sonar.scanner.issue.DefaultIssueFilterChain;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.fail;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DefaultProjectIssuesTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DefaultProjectIssuesTest.java
index 0a2b6be76ff..9ecef3b1f21 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DefaultProjectIssuesTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DefaultProjectIssuesTest.java
@@ -20,17 +20,14 @@
package org.sonar.scanner.issue;
import com.google.common.collect.Lists;
+import java.util.Arrays;
+import java.util.List;
import org.junit.Test;
import org.sonar.api.issue.Issue;
-import org.sonar.core.issue.DefaultIssue;
-import org.sonar.scanner.issue.DefaultProjectIssues;
-import org.sonar.scanner.issue.IssueCache;
-import org.sonar.scanner.issue.tracking.TrackedIssue;
import org.sonar.api.rule.RuleKey;
import org.sonar.api.rule.Severity;
-
-import java.util.Arrays;
-import java.util.List;
+import org.sonar.core.issue.DefaultIssue;
+import org.sonar.scanner.issue.tracking.TrackedIssue;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DeprecatedIssueAdapterForFilterTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DeprecatedIssueAdapterForFilterTest.java
index abe6fcf2dee..19585cbab08 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DeprecatedIssueAdapterForFilterTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DeprecatedIssueAdapterForFilterTest.java
@@ -25,7 +25,6 @@ import org.sonar.api.batch.fs.internal.DefaultInputModule;
import org.sonar.api.issue.Issue;
import org.sonar.api.rule.RuleKey;
import org.sonar.scanner.ProjectAnalysisInfo;
-import org.sonar.scanner.issue.DeprecatedIssueAdapterForFilter;
import org.sonar.scanner.protocol.Constants.Severity;
import org.sonar.scanner.protocol.output.ScannerReport.TextRange;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DeprecatedIssueFilterChainTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DeprecatedIssueFilterChainTest.java
index 4297d6e3a4d..41908eed508 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DeprecatedIssueFilterChainTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DeprecatedIssueFilterChainTest.java
@@ -23,7 +23,6 @@ import org.junit.Test;
import org.sonar.api.issue.Issue;
import org.sonar.api.issue.batch.IssueFilter;
import org.sonar.api.issue.batch.IssueFilterChain;
-import org.sonar.scanner.issue.DeprecatedIssueFilterChain;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.fail;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ModuleIssuesTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ModuleIssuesTest.java
index c180e8e1da6..8bbdee15b59 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ModuleIssuesTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ModuleIssuesTest.java
@@ -33,8 +33,6 @@ import org.sonar.api.batch.sensor.issue.internal.DefaultIssueLocation;
import org.sonar.api.rule.RuleKey;
import org.sonar.api.rule.Severity;
import org.sonar.api.utils.MessageException;
-import org.sonar.scanner.issue.IssueFilters;
-import org.sonar.scanner.issue.ModuleIssues;
import org.sonar.scanner.protocol.output.ScannerReport;
import org.sonar.scanner.report.ReportPublisher;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/TrackedIssueAdapterTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/TrackedIssueAdapterTest.java
index 8d7fdead717..5b7396c959c 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/TrackedIssueAdapterTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/TrackedIssueAdapterTest.java
@@ -23,7 +23,6 @@ import java.util.Date;
import org.junit.Test;
import org.sonar.api.issue.Issue;
import org.sonar.api.rule.RuleKey;
-import org.sonar.scanner.issue.TrackedIssueAdapter;
import org.sonar.scanner.issue.tracking.TrackedIssue;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/EnforceIssuesFilterTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/EnforceIssuesFilterTest.java
index d3089b298fa..a0aae458ed9 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/EnforceIssuesFilterTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/EnforceIssuesFilterTest.java
@@ -19,17 +19,15 @@
*/
package org.sonar.scanner.issue.ignore;
-import org.sonar.api.scan.issue.filter.FilterableIssue;
-
import com.google.common.collect.ImmutableList;
import org.junit.Before;
import org.junit.Test;
-import org.sonar.api.scan.issue.filter.IssueFilterChain;
import org.sonar.api.batch.fs.InputComponent;
import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
import org.sonar.api.rule.RuleKey;
+import org.sonar.api.scan.issue.filter.FilterableIssue;
+import org.sonar.api.scan.issue.filter.IssueFilterChain;
import org.sonar.api.utils.WildcardPattern;
-import org.sonar.scanner.issue.ignore.EnforceIssuesFilter;
import org.sonar.scanner.issue.ignore.pattern.IssueInclusionPatternInitializer;
import org.sonar.scanner.issue.ignore.pattern.IssuePattern;
import org.sonar.scanner.scan.filesystem.InputComponentStore;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/IgnoreIssuesFilterTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/IgnoreIssuesFilterTest.java
index ccf1ed016c6..5dc8a09e511 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/IgnoreIssuesFilterTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/IgnoreIssuesFilterTest.java
@@ -19,20 +19,18 @@
*/
package org.sonar.scanner.issue.ignore;
-import org.sonar.api.rule.RuleKey;
-import org.sonar.api.scan.issue.filter.FilterableIssue;
-
import org.junit.Before;
import org.junit.Test;
+import org.sonar.api.rule.RuleKey;
+import org.sonar.api.scan.issue.filter.FilterableIssue;
import org.sonar.api.scan.issue.filter.IssueFilterChain;
-import org.sonar.scanner.issue.ignore.IgnoreIssuesFilter;
import org.sonar.scanner.issue.ignore.pattern.IssuePattern;
import org.sonar.scanner.issue.ignore.pattern.PatternMatcher;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class IgnoreIssuesFilterTest {
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/IssueExclusionPatternInitializerTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/IssueExclusionPatternInitializerTest.java
index 7fadd593235..3a8e6ca8b3c 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/IssueExclusionPatternInitializerTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/IssueExclusionPatternInitializerTest.java
@@ -22,15 +22,14 @@ package org.sonar.scanner.issue.ignore.pattern;
import org.junit.Before;
import org.junit.Test;
import org.sonar.api.config.PropertyDefinitions;
-import org.sonar.api.config.Settings;
-import org.sonar.api.config.MapSettings;
+import org.sonar.api.config.internal.MapSettings;
import org.sonar.core.config.IssueExclusionProperties;
import static org.assertj.core.api.Assertions.assertThat;
public class IssueExclusionPatternInitializerTest {
private IssueExclusionPatternInitializer patternsInitializer;
- private Settings settings;
+ private MapSettings settings;
@Before
public void init() {
@@ -39,7 +38,7 @@ public class IssueExclusionPatternInitializerTest {
@Test
public void testNoConfiguration() {
- patternsInitializer = new IssueExclusionPatternInitializer(settings);
+ patternsInitializer = new IssueExclusionPatternInitializer(settings.asConfig());
assertThat(patternsInitializer.hasConfiguredPatterns()).isFalse();
assertThat(patternsInitializer.getMulticriteriaPatterns().size()).isEqualTo(0);
}
@@ -49,7 +48,7 @@ public class IssueExclusionPatternInitializerTest {
settings.setProperty("sonar.issue.ignore" + ".multicriteria", "1");
settings.setProperty("sonar.issue.ignore" + ".multicriteria" + ".1." + "resourceKey", "");
settings.setProperty("sonar.issue.ignore" + ".multicriteria" + ".1." + "ruleKey", "*");
- patternsInitializer = new IssueExclusionPatternInitializer(settings);
+ patternsInitializer = new IssueExclusionPatternInitializer(settings.asConfig());
}
@Test(expected = IllegalStateException.class)
@@ -57,7 +56,7 @@ public class IssueExclusionPatternInitializerTest {
settings.setProperty("sonar.issue.ignore" + ".multicriteria", "1");
settings.setProperty("sonar.issue.ignore" + ".multicriteria" + ".1." + "resourceKey", "*");
settings.setProperty("sonar.issue.ignore" + ".multicriteria" + ".1." + "ruleKey", "");
- patternsInitializer = new IssueExclusionPatternInitializer(settings);
+ patternsInitializer = new IssueExclusionPatternInitializer(settings.asConfig());
}
@Test
@@ -69,7 +68,7 @@ public class IssueExclusionPatternInitializerTest {
settings.setProperty(IssueExclusionProperties.PATTERNS_BLOCK_KEY + ".2." + IssueExclusionProperties.END_BLOCK_REGEXP, "// FOO-ON");
settings.setProperty(IssueExclusionProperties.PATTERNS_BLOCK_KEY + ".3." + IssueExclusionProperties.BEGIN_BLOCK_REGEXP, "// IGNORE-TO-EOF");
settings.setProperty(IssueExclusionProperties.PATTERNS_BLOCK_KEY + ".3." + IssueExclusionProperties.END_BLOCK_REGEXP, "");
- patternsInitializer = new IssueExclusionPatternInitializer(settings);
+ patternsInitializer = new IssueExclusionPatternInitializer(settings.asConfig());
assertThat(patternsInitializer.hasConfiguredPatterns()).isTrue();
assertThat(patternsInitializer.hasFileContentPattern()).isTrue();
@@ -84,7 +83,7 @@ public class IssueExclusionPatternInitializerTest {
settings.setProperty(IssueExclusionProperties.PATTERNS_BLOCK_KEY, "1");
settings.setProperty(IssueExclusionProperties.PATTERNS_BLOCK_KEY + ".1." + IssueExclusionProperties.BEGIN_BLOCK_REGEXP, "");
settings.setProperty(IssueExclusionProperties.PATTERNS_BLOCK_KEY + ".1." + IssueExclusionProperties.END_BLOCK_REGEXP, "// SONAR-ON");
- patternsInitializer = new IssueExclusionPatternInitializer(settings);
+ patternsInitializer = new IssueExclusionPatternInitializer(settings.asConfig());
}
@Test
@@ -92,7 +91,7 @@ public class IssueExclusionPatternInitializerTest {
settings.setProperty(IssueExclusionProperties.PATTERNS_ALLFILE_KEY, "1,2");
settings.setProperty(IssueExclusionProperties.PATTERNS_ALLFILE_KEY + ".1." + IssueExclusionProperties.FILE_REGEXP, "@SONAR-IGNORE-ALL");
settings.setProperty(IssueExclusionProperties.PATTERNS_ALLFILE_KEY + ".2." + IssueExclusionProperties.FILE_REGEXP, "//FOO-IGNORE-ALL");
- patternsInitializer = new IssueExclusionPatternInitializer(settings);
+ patternsInitializer = new IssueExclusionPatternInitializer(settings.asConfig());
assertThat(patternsInitializer.hasConfiguredPatterns()).isTrue();
assertThat(patternsInitializer.hasFileContentPattern()).isTrue();
@@ -106,6 +105,6 @@ public class IssueExclusionPatternInitializerTest {
public void shouldLogInvalidAllFilePattern() {
settings.setProperty(IssueExclusionProperties.PATTERNS_ALLFILE_KEY, "1");
settings.setProperty(IssueExclusionProperties.PATTERNS_ALLFILE_KEY + ".1." + IssueExclusionProperties.FILE_REGEXP, "");
- patternsInitializer = new IssueExclusionPatternInitializer(settings);
+ patternsInitializer = new IssueExclusionPatternInitializer(settings.asConfig());
}
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/IssueInclusionPatternInitializerTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/IssueInclusionPatternInitializerTest.java
index 6feecb28637..a8522146039 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/IssueInclusionPatternInitializerTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/IssueInclusionPatternInitializerTest.java
@@ -22,8 +22,7 @@ package org.sonar.scanner.issue.ignore.pattern;
import org.junit.Before;
import org.junit.Test;
import org.sonar.api.config.PropertyDefinitions;
-import org.sonar.api.config.Settings;
-import org.sonar.api.config.MapSettings;
+import org.sonar.api.config.internal.MapSettings;
import org.sonar.core.config.IssueExclusionProperties;
import static org.assertj.core.api.Assertions.assertThat;
@@ -31,12 +30,12 @@ import static org.assertj.core.api.Assertions.assertThat;
public class IssueInclusionPatternInitializerTest {
private IssueInclusionPatternInitializer patternsInitializer;
- private Settings settings;
+ private MapSettings settings;
@Before
public void init() {
settings = new MapSettings(new PropertyDefinitions(IssueExclusionProperties.all()));
- patternsInitializer = new IssueInclusionPatternInitializer(settings);
+ patternsInitializer = new IssueInclusionPatternInitializer(settings.asConfig());
}
@Test
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/IssuePatternTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/IssuePatternTest.java
index d6c6f778b53..a20dcd7c81a 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/IssuePatternTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/IssuePatternTest.java
@@ -19,16 +19,15 @@
*/
package org.sonar.scanner.issue.ignore.pattern;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
import org.junit.Test;
import org.sonar.api.rule.RuleKey;
import org.sonar.api.rules.Rule;
import static org.assertj.core.api.Assertions.assertThat;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
public class IssuePatternTest {
@Test
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/LineRangeTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/LineRangeTest.java
index 0d610f1ffeb..45a2a5f74af 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/LineRangeTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/LineRangeTest.java
@@ -20,7 +20,6 @@
package org.sonar.scanner.issue.ignore.pattern;
import org.junit.Test;
-import org.sonar.scanner.issue.ignore.pattern.LineRange;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/PatternDecoderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/PatternDecoderTest.java
index f4ca8b9c745..3d4bfa3ab84 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/PatternDecoderTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/PatternDecoderTest.java
@@ -20,7 +20,6 @@
package org.sonar.scanner.issue.ignore.pattern;
import org.junit.Test;
-import org.sonar.scanner.issue.ignore.pattern.PatternDecoder;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/PatternMatcherTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/PatternMatcherTest.java
index ea9cdb5606c..a474e349f2a 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/PatternMatcherTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/PatternMatcherTest.java
@@ -19,18 +19,13 @@
*/
package org.sonar.scanner.issue.ignore.pattern;
-import org.sonar.scanner.issue.ignore.pattern.IssuePattern;
-import org.sonar.scanner.issue.ignore.pattern.LineRange;
-import org.sonar.scanner.issue.ignore.pattern.PatternMatcher;
import com.google.common.collect.Sets;
-import org.junit.Before;
-import org.junit.Test;
-import org.sonar.api.rules.Rule;
-
import java.util.Collections;
import java.util.Set;
-
import javax.annotation.Nullable;
+import org.junit.Before;
+import org.junit.Test;
+import org.sonar.api.rules.Rule;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/scanner/IssueExclusionsLoaderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/scanner/IssueExclusionsLoaderTest.java
index 638e504b6ce..2e15da1999c 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/scanner/IssueExclusionsLoaderTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/scanner/IssueExclusionsLoaderTest.java
@@ -22,7 +22,6 @@ package org.sonar.scanner.issue.ignore.scanner;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
-
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/scanner/IssueExclusionsRegexpScannerTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/scanner/IssueExclusionsRegexpScannerTest.java
index e3a322e6938..f90c384bcb6 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/scanner/IssueExclusionsRegexpScannerTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/scanner/IssueExclusionsRegexpScannerTest.java
@@ -20,17 +20,6 @@
package org.sonar.scanner.issue.ignore.scanner;
import com.google.common.io.Resources;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.sonar.api.batch.fs.internal.FileMetadata;
-import org.sonar.scanner.issue.ignore.pattern.IssueExclusionPatternInitializer;
-import org.sonar.scanner.issue.ignore.pattern.LineRange;
-import org.sonar.scanner.issue.ignore.pattern.PatternMatcher;
-import org.sonar.scanner.issue.ignore.scanner.IssueExclusionsRegexpScanner;
-import org.sonar.scanner.issue.ignore.scanner.IssueExclusionsLoader.DoubleRegexpMatcher;
-
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
@@ -42,6 +31,15 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.regex.Pattern;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.sonar.api.batch.fs.internal.FileMetadata;
+import org.sonar.scanner.issue.ignore.pattern.IssueExclusionPatternInitializer;
+import org.sonar.scanner.issue.ignore.pattern.LineRange;
+import org.sonar.scanner.issue.ignore.pattern.PatternMatcher;
+import org.sonar.scanner.issue.ignore.scanner.IssueExclusionsLoader.DoubleRegexpMatcher;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.mockito.Mockito.times;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/tracking/RollingFileHashesTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/tracking/RollingFileHashesTest.java
index 67f5076556b..2efd24dc7db 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/tracking/RollingFileHashesTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/tracking/RollingFileHashesTest.java
@@ -20,8 +20,6 @@
package org.sonar.scanner.issue.tracking;
import org.junit.Test;
-import org.sonar.scanner.issue.tracking.FileHashes;
-import org.sonar.scanner.issue.tracking.RollingFileHashes;
import static org.apache.commons.codec.digest.DigestUtils.md5Hex;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/tracking/SourceHashHolderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/tracking/SourceHashHolderTest.java
index b0465a5ce40..0cf540f0b7a 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/tracking/SourceHashHolderTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/tracking/SourceHashHolderTest.java
@@ -22,7 +22,6 @@ package org.sonar.scanner.issue.tracking;
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
-
import org.apache.commons.io.FileUtils;
import org.junit.Before;
import org.junit.Rule;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/tracking/TrackedIssueTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/tracking/TrackedIssueTest.java
index 7fc7146c622..cd24905d493 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/tracking/TrackedIssueTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/tracking/TrackedIssueTest.java
@@ -19,11 +19,9 @@
*/
package org.sonar.scanner.issue.tracking;
-import static org.assertj.core.api.Assertions.assertThat;
-
import org.junit.Test;
-import org.sonar.scanner.issue.tracking.FileHashes;
-import org.sonar.scanner.issue.tracking.TrackedIssue;
+
+import static org.assertj.core.api.Assertions.assertThat;
public class TrackedIssueTest {
@Test
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/LogOutputRecorder.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/LogOutputRecorder.java
index 5f980c04ade..443f4cb09fb 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/LogOutputRecorder.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/LogOutputRecorder.java
@@ -19,15 +19,14 @@
*/
package org.sonar.scanner.mediumtest;
+import com.google.common.collect.HashMultimap;
+import com.google.common.collect.Multimap;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;
-
import org.sonar.batch.bootstrapper.LogOutput;
-import com.google.common.collect.Multimap;
-import com.google.common.collect.HashMultimap;
public class LogOutputRecorder implements LogOutput {
private final Multimap<String, String> recordedByLevel = HashMultimap.create();
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumTest.java
index f7860cd3db0..e369aefeb05 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumTest.java
@@ -20,13 +20,13 @@
package org.sonar.scanner.mediumtest.fs;
import com.google.common.collect.ImmutableMap;
-
+import java.io.File;
+import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Random;
-
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.junit.After;
@@ -46,9 +46,6 @@ import org.sonar.scanner.mediumtest.TaskResult;
import org.sonar.xoo.XooPlugin;
import org.sonar.xoo.rule.XooRulesDefinition;
-import java.io.File;
-import java.io.IOException;
-
import static org.assertj.core.api.Assertions.assertThat;
public class FileSystemMediumTest {
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/NoLanguagesPluginsMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/NoLanguagesPluginsMediumTest.java
index 52a99d7408a..721e4a7af6b 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/NoLanguagesPluginsMediumTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/NoLanguagesPluginsMediumTest.java
@@ -19,16 +19,14 @@
*/
package org.sonar.scanner.mediumtest.fs;
-import org.junit.rules.ExpectedException;
-
+import java.io.File;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.filefilter.FileFilterUtils;
-import java.io.File;
-
import org.junit.After;
import org.junit.Before;
-import org.junit.Test;
import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
import org.junit.rules.TemporaryFolder;
import org.sonar.scanner.mediumtest.ScannerMediumTester;
import org.sonar.scanner.mediumtest.issuesmode.IssueModeAndReportsMediumTest;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/ProjectBuilderMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/ProjectBuilderMediumTest.java
index 3b9c0bc4dfe..ea16deec3cc 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/ProjectBuilderMediumTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/ProjectBuilderMediumTest.java
@@ -31,11 +31,6 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.mock;
-
import org.junit.rules.ExpectedException;
import org.junit.rules.TemporaryFolder;
import org.sonar.api.batch.bootstrap.ProjectBuilder;
@@ -48,6 +43,9 @@ import org.sonar.xoo.rule.XooRulesDefinition;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.tuple;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.mock;
public class ProjectBuilderMediumTest {
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/IssuesIssuesModeMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/IssuesIssuesModeMediumTest.java
index 96bf0996b82..7eb43a3b100 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/IssuesIssuesModeMediumTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/IssuesIssuesModeMediumTest.java
@@ -19,22 +19,22 @@
*/
package org.sonar.scanner.mediumtest.issues;
-import org.junit.rules.TemporaryFolder;
+import com.google.common.collect.ImmutableMap;
+import java.io.File;
+import java.util.Date;
+import java.util.LinkedList;
+import java.util.List;
+import org.apache.commons.io.FileUtils;
import org.junit.After;
import org.junit.Before;
-import com.google.common.collect.ImmutableMap;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
import org.sonar.api.CoreProperties;
import org.sonar.batch.bootstrapper.IssueListener;
import org.sonar.scanner.mediumtest.ScannerMediumTester;
import org.sonar.scanner.mediumtest.TaskResult;
import org.sonar.xoo.XooPlugin;
import org.sonar.xoo.rule.XooRulesDefinition;
-import org.apache.commons.io.FileUtils;
-import org.junit.Test;
-import java.io.File;
-import java.util.Date;
-import java.util.LinkedList;
-import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/EmptyFileTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/EmptyFileTest.java
index 2379b4e081a..84434b7f8cb 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/EmptyFileTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/EmptyFileTest.java
@@ -19,10 +19,11 @@
*/
package org.sonar.scanner.mediumtest.issuesmode;
-import org.apache.commons.io.filefilter.FileFilterUtils;
-import org.apache.commons.io.FileUtils;
-import org.sonar.xoo.rule.XooRulesDefinition;
import com.google.common.collect.ImmutableMap;
+import java.io.File;
+import java.util.Date;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.filefilter.FileFilterUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
@@ -30,13 +31,11 @@ import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.sonar.api.CoreProperties;
import org.sonar.api.utils.log.LogTester;
-import org.sonar.scanner.mediumtest.ScannerMediumTester;
import org.sonar.scanner.issue.tracking.TrackedIssue;
+import org.sonar.scanner.mediumtest.ScannerMediumTester;
import org.sonar.scanner.mediumtest.TaskResult;
import org.sonar.xoo.XooPlugin;
-
-import java.io.File;
-import java.util.Date;
+import org.sonar.xoo.rule.XooRulesDefinition;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/IssueModeAndReportsMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/IssueModeAndReportsMediumTest.java
index d53074e0463..6eb4283c0cf 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/IssueModeAndReportsMediumTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/IssueModeAndReportsMediumTest.java
@@ -40,8 +40,8 @@ import org.sonar.api.CoreProperties;
import org.sonar.api.utils.log.LogTester;
import org.sonar.api.utils.log.LoggerLevel;
import org.sonar.batch.bootstrapper.IssueListener;
-import org.sonar.scanner.mediumtest.ScannerMediumTester;
import org.sonar.scanner.issue.tracking.TrackedIssue;
+import org.sonar.scanner.mediumtest.ScannerMediumTester;
import org.sonar.scanner.mediumtest.TaskResult;
import org.sonar.scanner.protocol.Constants.Severity;
import org.sonar.scanner.protocol.input.ScannerInput.ServerIssue;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/NoPreviousAnalysisTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/NoPreviousAnalysisTest.java
index 8fcf882a5e0..4a81c797e21 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/NoPreviousAnalysisTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/NoPreviousAnalysisTest.java
@@ -19,14 +19,10 @@
*/
package org.sonar.scanner.mediumtest.issuesmode;
+import com.google.common.collect.ImmutableMap;
+import java.io.File;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.filefilter.FileFilterUtils;
-
-import java.io.File;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import com.google.common.collect.ImmutableMap;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
@@ -39,6 +35,8 @@ import org.sonar.scanner.mediumtest.TaskResult;
import org.sonar.xoo.XooPlugin;
import org.sonar.xoo.rule.XooRulesDefinition;
+import static org.assertj.core.api.Assertions.assertThat;
+
public class NoPreviousAnalysisTest {
@Rule
public TemporaryFolder temp = new TemporaryFolder();
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/ScanOnlyChangedTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/ScanOnlyChangedTest.java
index dafd2fedfb2..c0043f1ef24 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/ScanOnlyChangedTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/ScanOnlyChangedTest.java
@@ -49,10 +49,10 @@ import org.junit.runners.Parameterized.Parameters;
import org.sonar.api.CoreProperties;
import org.sonar.api.batch.fs.internal.FileMetadata;
import org.sonar.api.utils.log.LogTester;
-import org.sonar.scanner.mediumtest.ScannerMediumTester;
import org.sonar.scanner.issue.tracking.TrackedIssue;
-import org.sonar.scanner.mediumtest.TaskResult;
+import org.sonar.scanner.mediumtest.ScannerMediumTester;
import org.sonar.scanner.mediumtest.ScannerMediumTester.TaskBuilder;
+import org.sonar.scanner.mediumtest.TaskResult;
import org.sonar.scanner.protocol.Constants.Severity;
import org.sonar.scanner.protocol.input.ScannerInput.ServerIssue;
import org.sonar.scanner.repository.FileData;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/scm/ScmMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/scm/ScmMediumTest.java
index bea4f440735..dc411eb2e08 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/scm/ScmMediumTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/scm/ScmMediumTest.java
@@ -24,7 +24,6 @@ import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.charset.StandardCharsets;
-
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.io.FileUtils;
import org.assertj.core.util.Files;
@@ -40,9 +39,9 @@ import org.sonar.scanner.mediumtest.ScannerMediumTester;
import org.sonar.scanner.mediumtest.ScannerMediumTester.TaskBuilder;
import org.sonar.scanner.protocol.output.ScannerReport;
import org.sonar.scanner.protocol.output.ScannerReport.Changesets.Changeset;
-import org.sonar.scanner.repository.FileData;
import org.sonar.scanner.protocol.output.ScannerReport.Component;
import org.sonar.scanner.protocol.output.ScannerReportReader;
+import org.sonar.scanner.repository.FileData;
import org.sonar.xoo.XooPlugin;
import org.sonar.xoo.rule.XooRulesDefinition;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/tests/CoveragePerTestMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/tests/CoveragePerTestMediumTest.java
index 8ed5309684a..a949587caa1 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/tests/CoveragePerTestMediumTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/tests/CoveragePerTestMediumTest.java
@@ -19,25 +19,23 @@
*/
package org.sonar.scanner.mediumtest.tests;
-import org.hamcrest.Description;
-
-import org.hamcrest.TypeSafeMatcher;
-import org.junit.Rule;
-import org.junit.rules.ExpectedException;
import com.google.common.collect.ImmutableMap;
+import java.io.File;
+import java.io.IOException;
import org.apache.commons.io.FileUtils;
+import org.hamcrest.Description;
+import org.hamcrest.TypeSafeMatcher;
import org.junit.After;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.ExpectedException;
import org.junit.rules.TemporaryFolder;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.scanner.mediumtest.ScannerMediumTester;
import org.sonar.scanner.mediumtest.TaskResult;
import org.sonar.xoo.XooPlugin;
-import java.io.File;
-import java.io.IOException;
-
import static org.assertj.core.api.Assertions.assertThat;
public class CoveragePerTestMediumTest {
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/phases/PostJobsExecutorTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/phases/PostJobsExecutorTest.java
index 06f9bff6afe..488d9694763 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/phases/PostJobsExecutorTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/phases/PostJobsExecutorTest.java
@@ -19,6 +19,7 @@
*/
package org.sonar.scanner.phases;
+import java.util.Arrays;
import org.junit.Before;
import org.junit.Test;
import org.sonar.api.batch.PostJob;
@@ -27,14 +28,12 @@ import org.sonar.api.batch.fs.internal.DefaultInputModule;
import org.sonar.api.resources.Project;
import org.sonar.scanner.bootstrap.ScannerExtensionDictionnary;
import org.sonar.scanner.events.EventBus;
-import org.sonar.scanner.phases.PostJobsExecutor;
-import java.util.Arrays;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import static org.mockito.Mockito.eq;
-import static org.mockito.Mockito.any;
public class PostJobsExecutorTest {
PostJobsExecutor executor;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/phases/SensorsExecutorTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/phases/SensorsExecutorTest.java
index b7431b1ac7d..5afcb9ee1f5 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/phases/SensorsExecutorTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/phases/SensorsExecutorTest.java
@@ -21,7 +21,9 @@ package org.sonar.scanner.phases;
import java.io.IOException;
import java.util.Collections;
-import org.junit.*;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.sonar.api.batch.Sensor;
import org.sonar.api.batch.SensorContext;
@@ -33,7 +35,10 @@ import org.sonar.scanner.events.EventBus;
import org.sonar.scanner.sensor.SensorStrategy;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.*;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
public class SensorsExecutorTest {
@Rule
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/platform/DefaultServerTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/platform/DefaultServerTest.java
index 47a09228471..2af9a10feab 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/platform/DefaultServerTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/platform/DefaultServerTest.java
@@ -22,8 +22,8 @@ package org.sonar.scanner.platform;
import org.junit.Test;
import org.sonar.api.CoreProperties;
import org.sonar.api.SonarQubeSide;
-import org.sonar.api.config.MapSettings;
import org.sonar.api.config.Settings;
+import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.internal.SonarRuntimeImpl;
import org.sonar.api.utils.Version;
import org.sonar.scanner.bootstrap.ScannerWsClient;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/postjob/DefaultPostJobContextTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/postjob/DefaultPostJobContextTest.java
index 64a87b2295d..47ceca94888 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/postjob/DefaultPostJobContextTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/postjob/DefaultPostJobContextTest.java
@@ -29,8 +29,7 @@ import org.sonar.api.batch.AnalysisMode;
import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
import org.sonar.api.batch.postjob.issue.PostJobIssue;
import org.sonar.api.batch.rule.Severity;
-import org.sonar.api.config.MapSettings;
-import org.sonar.api.config.Settings;
+import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.scan.filesystem.PathResolver;
import org.sonar.scanner.issue.IssueCache;
import org.sonar.scanner.issue.tracking.TrackedIssue;
@@ -48,7 +47,7 @@ public class DefaultPostJobContextTest {
private IssueCache issueCache;
private InputComponentStore componentStore;
private DefaultPostJobContext context;
- private Settings settings;
+ private MapSettings settings;
private AnalysisMode analysisMode;
@Before
@@ -57,7 +56,7 @@ public class DefaultPostJobContextTest {
componentStore = new InputComponentStore(new PathResolver());
settings = new MapSettings();
analysisMode = mock(AnalysisMode.class);
- context = new DefaultPostJobContext(settings, issueCache, componentStore, analysisMode);
+ context = new DefaultPostJobContext(settings.asConfig(), settings, issueCache, componentStore, analysisMode);
}
@Test
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/postjob/PostJobOptimizerTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/postjob/PostJobOptimizerTest.java
index b23fdc402c5..85f62407d34 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/postjob/PostJobOptimizerTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/postjob/PostJobOptimizerTest.java
@@ -25,7 +25,7 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.sonar.api.batch.postjob.internal.DefaultPostJobDescriptor;
import org.sonar.api.config.Settings;
-import org.sonar.api.config.MapSettings;
+import org.sonar.api.config.internal.MapSettings;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/profiling/PhasesSumUpTimeProfilerTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/profiling/PhasesSumUpTimeProfilerTest.java
index 68804f5891e..a3d55dfa855 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/profiling/PhasesSumUpTimeProfilerTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/profiling/PhasesSumUpTimeProfilerTest.java
@@ -19,11 +19,9 @@
*/
package org.sonar.scanner.profiling;
-import static org.assertj.core.api.Assertions.assertThat;
-
+import com.google.common.collect.Maps;
import java.util.List;
import java.util.Map;
-
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -49,7 +47,7 @@ import org.sonar.api.utils.System2;
import org.sonar.scanner.bootstrap.GlobalProperties;
import org.sonar.scanner.events.BatchStepEvent;
-import com.google.common.collect.Maps;
+import static org.assertj.core.api.Assertions.assertThat;
public class PhasesSumUpTimeProfilerTest {
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ActiveRulesPublisherTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ActiveRulesPublisherTest.java
index 6af4cda0881..b7d8a0d6328 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ActiveRulesPublisherTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ActiveRulesPublisherTest.java
@@ -34,7 +34,6 @@ import org.sonar.scanner.protocol.Constants;
import org.sonar.scanner.protocol.output.ScannerReport;
import org.sonar.scanner.protocol.output.ScannerReportReader;
import org.sonar.scanner.protocol.output.ScannerReportWriter;
-import org.sonar.scanner.report.ActiveRulesPublisher;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/AnalysisContextReportPublisherTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/AnalysisContextReportPublisherTest.java
index cce73c7dc8d..3c65a91b598 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/AnalysisContextReportPublisherTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/AnalysisContextReportPublisherTest.java
@@ -35,7 +35,7 @@ import org.sonar.api.utils.System2;
import org.sonar.api.utils.log.LogTester;
import org.sonar.api.utils.log.LoggerLevel;
import org.sonar.core.platform.PluginInfo;
-import org.sonar.scanner.bootstrap.GlobalSettings;
+import org.sonar.scanner.bootstrap.GlobalConfiguration;
import org.sonar.scanner.bootstrap.ScannerPluginRepository;
import org.sonar.scanner.protocol.output.ScannerReportWriter;
import org.sonar.scanner.repository.ProjectRepositories;
@@ -64,7 +64,7 @@ public class AnalysisContextReportPublisherTest {
private AnalysisMode analysisMode = mock(AnalysisMode.class);
private System2 system2;
private ProjectRepositories projectRepos;
- private GlobalSettings globalSettings;
+ private GlobalConfiguration globalSettings;
@Before
public void prepare() throws Exception {
@@ -72,7 +72,7 @@ public class AnalysisContextReportPublisherTest {
system2 = mock(System2.class);
when(system2.properties()).thenReturn(new Properties());
projectRepos = mock(ProjectRepositories.class);
- globalSettings = mock(GlobalSettings.class);
+ globalSettings = mock(GlobalConfiguration.class);
publisher = new AnalysisContextReportPublisher(analysisMode, pluginRepo, system2, projectRepos, globalSettings);
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ComponentsPublisherTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ComponentsPublisherTest.java
index 60a85ab6d22..2f1a13d1d94 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ComponentsPublisherTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ComponentsPublisherTest.java
@@ -22,7 +22,6 @@ package org.sonar.scanner.report;
import java.io.File;
import java.io.IOException;
import java.util.Collections;
-
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -41,10 +40,9 @@ import org.sonar.scanner.protocol.output.FileStructure;
import org.sonar.scanner.protocol.output.ScannerReport;
import org.sonar.scanner.protocol.output.ScannerReport.Component;
import org.sonar.scanner.protocol.output.ScannerReport.ComponentLink.ComponentLinkType;
-import org.sonar.scanner.report.ComponentsPublisher;
-import org.sonar.scanner.scan.DefaultComponentTree;
import org.sonar.scanner.protocol.output.ScannerReportReader;
import org.sonar.scanner.protocol.output.ScannerReportWriter;
+import org.sonar.scanner.scan.DefaultComponentTree;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ContextPropertiesPublisherTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ContextPropertiesPublisherTest.java
index 4760295a4c9..a767182c6a7 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ContextPropertiesPublisherTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ContextPropertiesPublisherTest.java
@@ -21,14 +21,16 @@ package org.sonar.scanner.report;
import com.google.common.collect.Lists;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.hamcrest.Description;
import org.hamcrest.TypeSafeMatcher;
+import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import org.sonar.api.config.MapSettings;
-import org.sonar.api.config.Settings;
+import org.sonar.scanner.config.DefaultConfiguration;
import org.sonar.scanner.protocol.output.ScannerReport;
import org.sonar.scanner.protocol.output.ScannerReportWriter;
import org.sonar.scanner.repository.ContextPropertiesCache;
@@ -37,6 +39,7 @@ import static java.util.Collections.emptyList;
import static org.mockito.Matchers.argThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
public class ContextPropertiesPublisherTest {
@Rule
@@ -44,8 +47,14 @@ public class ContextPropertiesPublisherTest {
private ScannerReportWriter writer = mock(ScannerReportWriter.class);
private ContextPropertiesCache cache = new ContextPropertiesCache();
- private Settings settings = new MapSettings();
- private ContextPropertiesPublisher underTest = new ContextPropertiesPublisher(cache, settings);
+ private DefaultConfiguration config = mock(DefaultConfiguration.class);
+ private Map<String, String> props = new HashMap<>();
+ private ContextPropertiesPublisher underTest = new ContextPropertiesPublisher(cache, config);
+
+ @Before
+ public void prepareMock() {
+ when(config.getProperties()).thenReturn(props);
+ }
@Test
public void publish_writes_properties_to_report() {
@@ -69,9 +78,9 @@ public class ContextPropertiesPublisherTest {
@Test
public void publish_settings_prefixed_with_sonar_analysis_for_webhooks() {
- settings.setProperty("foo", "should not be exported");
- settings.setProperty("sonar.analysis.revision", "ab45b3");
- settings.setProperty("sonar.analysis.build.number", "B123");
+ props.put("foo", "should not be exported");
+ props.put("sonar.analysis.revision", "ab45b3");
+ props.put("sonar.analysis.build.number", "B123");
underTest.publish(writer);
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/MetadataPublisherTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/MetadataPublisherTest.java
index a8e0795f18c..e59cbd47ee4 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/MetadataPublisherTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/MetadataPublisherTest.java
@@ -27,11 +27,10 @@ import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.sonar.api.CoreProperties;
import org.sonar.api.batch.bootstrap.ProjectDefinition;
-import org.sonar.api.config.MapSettings;
-import org.sonar.api.config.Settings;
import org.sonar.api.batch.fs.internal.DefaultInputModule;
import org.sonar.api.batch.fs.internal.InputModuleHierarchy;
import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
+import org.sonar.api.config.internal.MapSettings;
import org.sonar.scanner.ProjectAnalysisInfo;
import org.sonar.scanner.protocol.output.ScannerReport;
import org.sonar.scanner.protocol.output.ScannerReportReader;
@@ -53,7 +52,7 @@ public class MetadataPublisherTest {
private ProjectDefinition projectDef;
private DefaultInputModule rootModule;
private MetadataPublisher underTest;
- private Settings settings;
+ private MapSettings settings;
private ModuleQProfiles qProfiles;
private ProjectAnalysisInfo projectAnalysisInfo;
private InputModuleHierarchy inputModuleHierarchy;
@@ -68,7 +67,7 @@ public class MetadataPublisherTest {
when(inputModuleHierarchy.root()).thenReturn(rootModule);
settings = new MapSettings();
qProfiles = mock(ModuleQProfiles.class);
- underTest = new MetadataPublisher(projectAnalysisInfo, inputModuleHierarchy, settings, qProfiles);
+ underTest = new MetadataPublisher(projectAnalysisInfo, inputModuleHierarchy, settings.asConfig(), qProfiles);
}
@Test
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ReportPublisherTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ReportPublisherTest.java
index a47550ba721..7b93925349e 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ReportPublisherTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ReportPublisherTest.java
@@ -34,9 +34,8 @@ import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;
import org.sonar.api.CoreProperties;
import org.sonar.api.batch.bootstrap.ProjectDefinition;
-import org.sonar.api.config.MapSettings;
import org.sonar.api.config.PropertyDefinitions;
-import org.sonar.api.config.Settings;
+import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.platform.Server;
import org.sonar.api.utils.MessageException;
import org.sonar.api.utils.TempFolder;
@@ -71,7 +70,7 @@ public class ReportPublisherTest {
public ExpectedException exception = ExpectedException.none();
DefaultAnalysisMode mode = mock(DefaultAnalysisMode.class);
- Settings settings = new MapSettings(new PropertyDefinitions(CorePropertyDefinitions.all()));
+ MapSettings settings = new MapSettings(new PropertyDefinitions(CorePropertyDefinitions.all()));
ScannerWsClient wsClient;
Server server = mock(Server.class);
ImmutableProjectReactor reactor = mock(ImmutableProjectReactor.class);
@@ -89,7 +88,7 @@ public class ReportPublisherTest {
@Test
public void log_and_dump_information_about_report_uploading() throws IOException {
- ReportPublisher underTest = new ReportPublisher(settings, wsClient, server, contextPublisher, reactor, mode, mock(TempFolder.class), new ReportPublisherStep[0]);
+ ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, reactor, mode, mock(TempFolder.class), new ReportPublisherStep[0]);
settings.setProperty(CoreProperties.PROJECT_ORGANIZATION_PROPERTY, "MyOrg");
underTest.logSuccess("TASK-123");
@@ -112,7 +111,7 @@ public class ReportPublisherTest {
@Test
public void parse_upload_error_message() throws IOException {
- ReportPublisher underTest = new ReportPublisher(settings, wsClient, server, contextPublisher, reactor, mode, mock(TempFolder.class), new ReportPublisherStep[0]);
+ ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, reactor, mode, mock(TempFolder.class), new ReportPublisherStep[0]);
HttpException ex = new HttpException("url", 404, "{\"errors\":[{\"msg\":\"Organization with key 'MyOrg' does not exist\"}]}");
WsResponse response = mock(WsResponse.class);
when(response.failIfNotSuccessful()).thenThrow(ex);
@@ -126,7 +125,7 @@ public class ReportPublisherTest {
@Test
public void log_public_url_if_defined() throws IOException {
when(server.getPublicRootUrl()).thenReturn("https://publicserver/sonarqube");
- ReportPublisher underTest = new ReportPublisher(settings, wsClient, server, contextPublisher, reactor, mode, mock(TempFolder.class), new ReportPublisherStep[0]);
+ ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, reactor, mode, mock(TempFolder.class), new ReportPublisherStep[0]);
underTest.logSuccess("TASK-123");
@@ -147,7 +146,7 @@ public class ReportPublisherTest {
@Test
public void fail_if_public_url_malformed() throws IOException {
when(server.getPublicRootUrl()).thenReturn("invalid");
- ReportPublisher underTest = new ReportPublisher(settings, wsClient, server, contextPublisher, reactor, mode, mock(TempFolder.class), new ReportPublisherStep[0]);
+ ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, reactor, mode, mock(TempFolder.class), new ReportPublisherStep[0]);
exception.expect(MessageException.class);
exception.expectMessage("Failed to parse public URL set in SonarQube server: invalid");
@@ -156,7 +155,7 @@ public class ReportPublisherTest {
@Test
public void log_but_not_dump_information_when_report_is_not_uploaded() {
- ReportPublisher underTest = new ReportPublisher(settings, wsClient, server, contextPublisher, reactor, mode, mock(TempFolder.class), new ReportPublisherStep[0]);
+ ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, reactor, mode, mock(TempFolder.class), new ReportPublisherStep[0]);
underTest.logSuccess(/* report not uploaded, no server task */null);
@@ -173,7 +172,7 @@ public class ReportPublisherTest {
settings.setProperty("sonar.batch.keepReport", true);
Path reportDir = temp.getRoot().toPath().resolve("batch-report");
Files.createDirectory(reportDir);
- ReportPublisher underTest = new ReportPublisher(settings, wsClient, server, contextPublisher, reactor, mode, mock(TempFolder.class), new ReportPublisherStep[0]);
+ ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, reactor, mode, mock(TempFolder.class), new ReportPublisherStep[0]);
underTest.start();
underTest.stop();
@@ -184,7 +183,7 @@ public class ReportPublisherTest {
public void should_delete_report_by_default() throws IOException {
Path reportDir = temp.getRoot().toPath().resolve("batch-report");
Files.createDirectory(reportDir);
- ReportPublisher job = new ReportPublisher(settings, wsClient, server, contextPublisher, reactor, mode, mock(TempFolder.class), new ReportPublisherStep[0]);
+ ReportPublisher job = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, reactor, mode, mock(TempFolder.class), new ReportPublisherStep[0]);
job.start();
job.stop();
@@ -193,7 +192,7 @@ public class ReportPublisherTest {
@Test
public void test_ws_parameters() throws Exception {
- ReportPublisher underTest = new ReportPublisher(settings, wsClient, server, contextPublisher, reactor, mode, mock(TempFolder.class), new ReportPublisherStep[0]);
+ ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, reactor, mode, mock(TempFolder.class), new ReportPublisherStep[0]);
settings.setProperty(CoreProperties.PROJECT_ORGANIZATION_PROPERTY, "MyOrg");
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultQualityProfileLoaderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultQualityProfileLoaderTest.java
index 7a2982e77f1..c02c6d05a40 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultQualityProfileLoaderTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultQualityProfileLoaderTest.java
@@ -26,8 +26,7 @@ import java.io.InputStream;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import org.sonar.api.config.MapSettings;
-import org.sonar.api.config.Settings;
+import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.utils.MessageException;
import org.sonar.scanner.WsTestUtil;
import org.sonar.scanner.bootstrap.ScannerWsClient;
@@ -42,8 +41,8 @@ public class DefaultQualityProfileLoaderTest {
public ExpectedException exception = ExpectedException.none();
private ScannerWsClient wsClient = mock(ScannerWsClient.class);
- private Settings settings = new MapSettings();
- private DefaultQualityProfileLoader underTest = new DefaultQualityProfileLoader(settings, wsClient);
+ private MapSettings settings = new MapSettings();
+ private DefaultQualityProfileLoader underTest = new DefaultQualityProfileLoader(settings.asConfig(), wsClient);
@Test
public void load_gets_profiles_for_specified_project_and_profile_name() throws IOException {
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/ProjectRepositoriesProviderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/ProjectRepositoriesProviderTest.java
index c49c76423fa..2db06e5ad68 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/ProjectRepositoriesProviderTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/ProjectRepositoriesProviderTest.java
@@ -19,19 +19,15 @@
*/
package org.sonar.scanner.repository;
-import java.util.Date;
-import com.google.common.collect.Table;
import com.google.common.collect.HashBasedTable;
+import com.google.common.collect.Table;
+import java.util.Date;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.sonar.api.batch.bootstrap.ProjectKey;
import org.sonar.scanner.analysis.DefaultAnalysisMode;
-import org.sonar.scanner.repository.FileData;
-import org.sonar.scanner.repository.ProjectRepositories;
-import org.sonar.scanner.repository.ProjectRepositoriesLoader;
-import org.sonar.scanner.repository.ProjectRepositoriesProvider;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Matchers.eq;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/QualityProfileProviderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/QualityProfileProviderTest.java
index a36abe70f4a..aaea7dde877 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/QualityProfileProviderTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/QualityProfileProviderTest.java
@@ -31,9 +31,6 @@ import org.sonar.api.batch.bootstrap.ProjectKey;
import org.sonar.api.utils.log.LogTester;
import org.sonar.api.utils.log.LoggerLevel;
import org.sonar.scanner.analysis.AnalysisProperties;
-import org.sonar.scanner.repository.ProjectRepositories;
-import org.sonar.scanner.repository.QualityProfileLoader;
-import org.sonar.scanner.repository.QualityProfileProvider;
import org.sonar.scanner.rule.ModuleQProfiles;
import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/ActiveRulesProviderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/ActiveRulesProviderTest.java
index 18a6fa9ec78..d6ff0c61f3e 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/ActiveRulesProviderTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/ActiveRulesProviderTest.java
@@ -28,10 +28,6 @@ import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.sonar.api.batch.rule.ActiveRules;
import org.sonar.api.rule.RuleKey;
-import org.sonar.scanner.rule.ActiveRulesProvider;
-import org.sonar.scanner.rule.DefaultActiveRulesLoader;
-import org.sonar.scanner.rule.LoadedActiveRule;
-import org.sonar.scanner.rule.ModuleQProfiles;
import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/QProfileTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/QProfileTest.java
index c605cf7a54d..a21efc17c55 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/QProfileTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/QProfileTest.java
@@ -20,7 +20,8 @@
package org.sonar.scanner.rule;
import org.junit.Test;
-import static org.assertj.core.api.Assertions.*;
+
+import static org.assertj.core.api.Assertions.assertThat;
public class QProfileTest {
@Test
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/QProfileVerifierTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/QProfileVerifierTest.java
index bfb438c3fb6..f68303521a5 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/QProfileVerifierTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/QProfileVerifierTest.java
@@ -27,8 +27,7 @@ import org.junit.rules.TemporaryFolder;
import org.slf4j.Logger;
import org.sonar.api.batch.fs.internal.DefaultFileSystem;
import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
-import org.sonar.api.config.Settings;
-import org.sonar.api.config.MapSettings;
+import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.utils.MessageException;
import static org.mockito.Mockito.mock;
@@ -45,7 +44,7 @@ public class QProfileVerifierTest {
private DefaultFileSystem fs;
private ModuleQProfiles profiles;
- private Settings settings = new MapSettings();
+ private MapSettings settings = new MapSettings();
@Before
public void before() throws Exception {
@@ -62,7 +61,7 @@ public class QProfileVerifierTest {
fs.add(new TestInputFileBuilder("foo", "src/Bar.java").setLanguage("java").build());
fs.add(new TestInputFileBuilder("foo", "src/Baz.cbl").setLanguage("cobol").build());
- QProfileVerifier profileLogger = new QProfileVerifier(settings, fs, profiles);
+ QProfileVerifier profileLogger = new QProfileVerifier(settings.asConfig(), fs, profiles);
Logger logger = mock(Logger.class);
profileLogger.execute(logger);
@@ -76,7 +75,7 @@ public class QProfileVerifierTest {
settings.setProperty("sonar.profile", "Unknown");
- QProfileVerifier profileLogger = new QProfileVerifier(settings, fs, profiles);
+ QProfileVerifier profileLogger = new QProfileVerifier(settings.asConfig(), fs, profiles);
thrown.expect(MessageException.class);
thrown.expectMessage("sonar.profile was set to 'Unknown' but didn't match any profile for any language. Please check your configuration.");
@@ -88,7 +87,7 @@ public class QProfileVerifierTest {
public void should_not_fail_if_no_language_on_project() {
settings.setProperty("sonar.profile", "Unknown");
- QProfileVerifier profileLogger = new QProfileVerifier(settings, fs, profiles);
+ QProfileVerifier profileLogger = new QProfileVerifier(settings.asConfig(), fs, profiles);
profileLogger.execute();
@@ -100,7 +99,7 @@ public class QProfileVerifierTest {
settings.setProperty("sonar.profile", "My Java profile");
- QProfileVerifier profileLogger = new QProfileVerifier(settings, fs, profiles);
+ QProfileVerifier profileLogger = new QProfileVerifier(settings.asConfig(), fs, profiles);
profileLogger.execute();
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/RuleFinderCompatibilityTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/RuleFinderCompatibilityTest.java
index 37133509508..097a1caf4b8 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/RuleFinderCompatibilityTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/RuleFinderCompatibilityTest.java
@@ -19,16 +19,14 @@
*/
package org.sonar.scanner.rule;
-import org.sonar.api.batch.rule.internal.RulesBuilder;
-
-import org.sonar.api.batch.rule.Rules;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
+import org.sonar.api.batch.rule.Rules;
+import org.sonar.api.batch.rule.internal.RulesBuilder;
import org.sonar.api.rule.RuleKey;
import org.sonar.api.rules.RuleQuery;
-import org.sonar.scanner.rule.RuleFinderCompatibility;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/RulesProfileProviderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/RulesProfileProviderTest.java
index 029f7847177..8dff3fadef3 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/RulesProfileProviderTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/RulesProfileProviderTest.java
@@ -22,8 +22,7 @@ package org.sonar.scanner.rule;
import java.util.Arrays;
import org.junit.Test;
import org.sonar.api.batch.rule.internal.ActiveRulesBuilder;
-import org.sonar.api.config.Settings;
-import org.sonar.api.config.MapSettings;
+import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.profiles.RulesProfile;
import org.sonar.api.rule.RuleKey;
@@ -34,16 +33,16 @@ import static org.mockito.Mockito.when;
public class RulesProfileProviderTest {
- ModuleQProfiles qProfiles = mock(ModuleQProfiles.class);
- Settings settings = new MapSettings();
- RulesProfileProvider provider = new RulesProfileProvider();
+ private ModuleQProfiles qProfiles = mock(ModuleQProfiles.class);
+ private MapSettings settings = new MapSettings();
+ private RulesProfileProvider provider = new RulesProfileProvider();
@Test
public void merge_profiles() {
QProfile qProfile = new QProfile().setKey("java-sw").setName("Sonar way").setLanguage("java");
when(qProfiles.findAll()).thenReturn(Arrays.asList(qProfile));
- RulesProfile profile = provider.provide(qProfiles, new ActiveRulesBuilder().build(), settings);
+ RulesProfile profile = provider.provide(qProfiles, new ActiveRulesBuilder().build(), settings.asConfig());
// merge of all profiles
assertThat(profile).isNotNull().isInstanceOf(RulesProfileWrapper.class);
@@ -65,7 +64,7 @@ public class RulesProfileProviderTest {
QProfile qProfile = new QProfile().setKey("java-sw").setName("Sonar way").setLanguage("java");
when(qProfiles.findByLanguage("java")).thenReturn(qProfile);
- RulesProfile profile = provider.provide(qProfiles, new ActiveRulesBuilder().build(), settings);
+ RulesProfile profile = provider.provide(qProfiles, new ActiveRulesBuilder().build(), settings.asConfig());
// no merge, directly the old hibernate profile
assertThat(profile).isNotNull();
@@ -80,7 +79,7 @@ public class RulesProfileProviderTest {
ActiveRulesBuilder activeRulesBuilder = new ActiveRulesBuilder();
activeRulesBuilder.create(RuleKey.of("java", "S001")).setTemplateRuleKey("T001").setLanguage("java").activate();
- RulesProfile profile = provider.provide(qProfiles, activeRulesBuilder.build(), settings);
+ RulesProfile profile = provider.provide(qProfiles, activeRulesBuilder.build(), settings.asConfig());
assertThat(profile.getActiveRule("java", "S001").getRule().getTemplate().getKey()).isEqualTo("T001");
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/RulesProviderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/RulesProviderTest.java
index 38272dc68e7..918471d8e97 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/RulesProviderTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/RulesProviderTest.java
@@ -20,15 +20,13 @@
package org.sonar.scanner.rule;
import com.google.common.collect.Lists;
+import org.junit.Test;
import org.sonar.api.batch.rule.Rules;
-import org.sonar.scanner.rule.RulesLoader;
-import org.sonar.scanner.rule.RulesProvider;
+import org.sonarqube.ws.Rules.ListResponse.Rule;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.when;
import static org.mockito.Mockito.mock;
-import org.sonarqube.ws.Rules.ListResponse.Rule;
-import org.junit.Test;
+import static org.mockito.Mockito.when;
public class RulesProviderTest {
@Test
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/DefaultComponentTreeTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/DefaultComponentTreeTest.java
index 538a4b50879..e60b3303d40 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/DefaultComponentTreeTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/DefaultComponentTreeTest.java
@@ -19,13 +19,13 @@
*/
package org.sonar.scanner.scan;
-import static org.assertj.core.api.Assertions.assertThat;
-
import org.junit.Before;
import org.junit.Test;
import org.sonar.api.batch.fs.internal.DefaultInputComponent;
import org.sonar.api.batch.fs.internal.DefaultInputModule;
+import static org.assertj.core.api.Assertions.assertThat;
+
public class DefaultComponentTreeTest {
private DefaultComponentTree tree;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/DefaultInputModuleHierarchyTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/DefaultInputModuleHierarchyTest.java
index 4febcb225fe..be0f7773038 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/DefaultInputModuleHierarchyTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/DefaultInputModuleHierarchyTest.java
@@ -19,12 +19,12 @@
*/
package org.sonar.scanner.scan;
-import static org.assertj.core.api.Assertions.assertThat;
-
import org.junit.Before;
import org.junit.Test;
import org.sonar.api.batch.fs.internal.DefaultInputModule;
+import static org.assertj.core.api.Assertions.assertThat;
+
public class DefaultInputModuleHierarchyTest {
private DefaultInputModuleHierarchy moduleHierarchy;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ModuleSettingsTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/MutableModuleSettingsTest.java
index 4b2b371c507..f1a150d800f 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ModuleSettingsTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/MutableModuleSettingsTest.java
@@ -33,10 +33,11 @@ import org.sonar.api.batch.bootstrap.ProjectDefinition;
import org.sonar.api.config.PropertyDefinitions;
import org.sonar.api.utils.MessageException;
import org.sonar.scanner.analysis.DefaultAnalysisMode;
+import org.sonar.scanner.bootstrap.GlobalConfiguration;
+import org.sonar.scanner.bootstrap.GlobalConfigurationProvider;
import org.sonar.scanner.bootstrap.GlobalMode;
import org.sonar.scanner.bootstrap.GlobalProperties;
-import org.sonar.scanner.bootstrap.GlobalSettings;
-import org.sonar.scanner.report.AnalysisContextReportPublisher;
+import org.sonar.scanner.bootstrap.MutableGlobalSettings;
import org.sonar.scanner.repository.FileData;
import org.sonar.scanner.repository.ProjectRepositories;
import org.sonar.scanner.repository.settings.SettingsLoader;
@@ -45,7 +46,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-public class ModuleSettingsTest {
+public class MutableModuleSettingsTest {
@Rule
public ExpectedException thrown = ExpectedException.none();
@@ -75,7 +76,7 @@ public class ModuleSettingsTest {
grandParent.addSubProject(parent);
parent.addSubProject(child);
- List<ProjectDefinition> hierarchy = ModuleSettings.getTopDownParentProjects(child);
+ List<ProjectDefinition> hierarchy = MutableModuleSettings.getTopDownParentProjects(child);
assertThat(hierarchy.get(0)).isEqualTo(grandParent);
assertThat(hierarchy.get(1)).isEqualTo(parent);
assertThat(hierarchy.get(2)).isEqualTo(child);
@@ -83,7 +84,7 @@ public class ModuleSettingsTest {
@Test
public void test_loading_of_module_settings() {
- GlobalSettings globalSettings = newGlobalSettings(ImmutableMap.of(
+ GlobalConfiguration globalSettings = newGlobalSettings(ImmutableMap.of(
"overridding", "batch",
"on-batch", "true"));
@@ -91,7 +92,7 @@ public class ModuleSettingsTest {
ProjectDefinition module = ProjectDefinition.create().setKey("struts-core");
- ModuleSettings moduleSettings = new ModuleSettings(globalSettings, module, projRepos, mode, mock(AnalysisContextReportPublisher.class));
+ MutableModuleSettings moduleSettings = new MutableModuleSettings(new MutableGlobalSettings(globalSettings), module, projRepos, mode);
assertThat(moduleSettings.getString("overridding")).isEqualTo("module");
assertThat(moduleSettings.getString("on-batch")).isEqualTo("true");
@@ -101,7 +102,7 @@ public class ModuleSettingsTest {
// SONAR-6386
@Test
public void test_loading_of_parent_module_settings_for_new_module() {
- GlobalSettings globalSettings = newGlobalSettings(ImmutableMap.of(
+ GlobalConfiguration globalSettings = newGlobalSettings(ImmutableMap.of(
"overridding", "batch",
"on-batch", "true"));
@@ -110,7 +111,7 @@ public class ModuleSettingsTest {
ProjectDefinition module = ProjectDefinition.create().setKey("struts-core");
ProjectDefinition.create().setKey("struts").addSubProject(module);
- ModuleSettings moduleSettings = new ModuleSettings(globalSettings, module, projRepos, mode, mock(AnalysisContextReportPublisher.class));
+ MutableModuleSettings moduleSettings = new MutableModuleSettings(new MutableGlobalSettings(globalSettings), module, projRepos, mode);
assertThat(moduleSettings.getString("overridding")).isEqualTo("module");
assertThat(moduleSettings.getString("on-batch")).isEqualTo("true");
@@ -119,14 +120,13 @@ public class ModuleSettingsTest {
@Test
public void should_not_fail_when_accessing_secured_properties() {
- GlobalSettings globalSettings = newGlobalSettings(ImmutableMap.of(
- "sonar.foo.secured", "bar"));
+ GlobalConfiguration globalSettings = newGlobalSettings(ImmutableMap.of("sonar.foo.secured", "bar"));
ProjectRepositories projSettingsRepo = createSettings("struts-core", ImmutableMap.of("sonar.foo.license.secured", "bar2"));
ProjectDefinition module = ProjectDefinition.create().setKey("struts-core");
- ModuleSettings moduleSettings = new ModuleSettings(globalSettings, module, projSettingsRepo, mode, mock(AnalysisContextReportPublisher.class));
+ MutableModuleSettings moduleSettings = new MutableModuleSettings(new MutableGlobalSettings(globalSettings), module, projSettingsRepo, mode);
assertThat(moduleSettings.getString("sonar.foo.license.secured")).isEqualTo("bar2");
assertThat(moduleSettings.getString("sonar.foo.secured")).isEqualTo("bar");
@@ -134,7 +134,7 @@ public class ModuleSettingsTest {
@Test
public void should_fail_when_accessing_secured_properties_in_issues() {
- GlobalSettings globalSettings = newGlobalSettings(ImmutableMap.of(
+ GlobalConfiguration globalSettings = newGlobalSettings(ImmutableMap.of(
"sonar.foo.secured", "bar"));
ProjectRepositories projSettingsRepo = createSettings("struts-core", ImmutableMap.of("sonar.foo.license.secured", "bar2"));
@@ -143,7 +143,7 @@ public class ModuleSettingsTest {
ProjectDefinition module = ProjectDefinition.create().setKey("struts-core");
- ModuleSettings moduleSettings = new ModuleSettings(globalSettings, module, projSettingsRepo, mode, mock(AnalysisContextReportPublisher.class));
+ MutableModuleSettings moduleSettings = new MutableModuleSettings(new MutableGlobalSettings(globalSettings), module, projSettingsRepo, mode);
assertThat(moduleSettings.getString("sonar.foo.license.secured")).isEqualTo("bar2");
@@ -154,9 +154,9 @@ public class ModuleSettingsTest {
moduleSettings.getString("sonar.foo.secured");
}
- private GlobalSettings newGlobalSettings(Map<String, String> props) {
+ private GlobalConfiguration newGlobalSettings(Map<String, String> props) {
GlobalProperties globalProps = new GlobalProperties(props);
- return new GlobalSettings(globalProps, new PropertyDefinitions(),
- mock(SettingsLoader.class), new GlobalMode(globalProps));
+ return new GlobalConfigurationProvider().provide(mock(SettingsLoader.class), globalProps, new PropertyDefinitions(),
+ new GlobalMode(globalProps));
}
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectSettingsTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/MutableProjectSettingsTest.java
index e0d687a8981..0087e27fede 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectSettingsTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/MutableProjectSettingsTest.java
@@ -34,9 +34,11 @@ import org.sonar.api.config.PropertyDefinitions;
import org.sonar.api.utils.MessageException;
import org.sonar.api.utils.log.LogTester;
import org.sonar.scanner.analysis.DefaultAnalysisMode;
+import org.sonar.scanner.bootstrap.GlobalConfiguration;
+import org.sonar.scanner.bootstrap.GlobalConfigurationProvider;
import org.sonar.scanner.bootstrap.GlobalMode;
import org.sonar.scanner.bootstrap.GlobalProperties;
-import org.sonar.scanner.bootstrap.GlobalSettings;
+import org.sonar.scanner.bootstrap.MutableGlobalSettings;
import org.sonar.scanner.repository.FileData;
import org.sonar.scanner.repository.ProjectRepositories;
import org.sonar.scanner.repository.settings.SettingsLoader;
@@ -45,7 +47,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-public class ProjectSettingsTest {
+public class MutableProjectSettingsTest {
@Rule
public ExpectedException thrown = ExpectedException.none();
@@ -54,7 +56,7 @@ public class ProjectSettingsTest {
private ProjectRepositories projectRef;
private ProjectDefinition project;
- private GlobalSettings bootstrapProps;
+ private GlobalConfiguration bootstrapProps;
private Table<String, String, FileData> emptyFileData;
private Table<String, String, String> emptySettings;
@@ -68,7 +70,8 @@ public class ProjectSettingsTest {
project = ProjectDefinition.create().setKey("struts");
globalMode = mock(GlobalMode.class);
mode = mock(DefaultAnalysisMode.class);
- bootstrapProps = new GlobalSettings(new GlobalProperties(Collections.<String, String>emptyMap()), new PropertyDefinitions(), mock(SettingsLoader.class), globalMode);
+ bootstrapProps = new GlobalConfigurationProvider().provide(mock(SettingsLoader.class), new GlobalProperties(Collections.<String, String>emptyMap()), new PropertyDefinitions(),
+ globalMode);
}
@Test
@@ -76,7 +79,7 @@ public class ProjectSettingsTest {
project.setProperty("project.prop", "project");
projectRef = new ProjectRepositories(emptySettings, emptyFileData, null);
- ProjectSettings batchSettings = new ProjectSettings(new ProjectReactor(project), bootstrapProps, projectRef, mode);
+ MutableProjectSettings batchSettings = new MutableProjectSettings(new ProjectReactor(project), new MutableGlobalSettings(bootstrapProps), projectRef, mode);
assertThat(batchSettings.getString("project.prop")).isEqualTo("project");
}
@@ -88,7 +91,7 @@ public class ProjectSettingsTest {
settings.put("struts", "sonar.java.coveragePlugin", "jacoco");
projectRef = new ProjectRepositories(settings, emptyFileData, null);
- ProjectSettings batchSettings = new ProjectSettings(new ProjectReactor(project), bootstrapProps, projectRef, mode);
+ MutableProjectSettings batchSettings = new MutableProjectSettings(new ProjectReactor(project), new MutableGlobalSettings(bootstrapProps), projectRef, mode);
assertThat(batchSettings.getString("sonar.java.coveragePlugin")).isEqualTo("jacoco");
}
@@ -102,7 +105,7 @@ public class ProjectSettingsTest {
projectRef = new ProjectRepositories(settings, emptyFileData, null);
- ProjectSettings batchSettings = new ProjectSettings(new ProjectReactor(project), bootstrapProps, projectRef, mode);
+ MutableProjectSettings batchSettings = new MutableProjectSettings(new ProjectReactor(project), new MutableGlobalSettings(bootstrapProps), projectRef, mode);
assertThat(batchSettings.getString("sonar.java.coveragePlugin")).isEqualTo("jacoco");
}
@@ -114,7 +117,7 @@ public class ProjectSettingsTest {
settings.put("struts", "sonar.foo.license.secured", "bar2");
projectRef = new ProjectRepositories(settings, emptyFileData, null);
- ProjectSettings batchSettings = new ProjectSettings(new ProjectReactor(project), bootstrapProps, projectRef, mode);
+ MutableProjectSettings batchSettings = new MutableProjectSettings(new ProjectReactor(project), new MutableGlobalSettings(bootstrapProps), projectRef, mode);
assertThat(batchSettings.getString("sonar.foo.license.secured")).isEqualTo("bar2");
assertThat(batchSettings.getString("sonar.foo.secured")).isEqualTo("bar");
@@ -129,7 +132,7 @@ public class ProjectSettingsTest {
when(mode.isIssues()).thenReturn(true);
projectRef = new ProjectRepositories(settings, emptyFileData, null);
- ProjectSettings batchSettings = new ProjectSettings(new ProjectReactor(project), bootstrapProps, projectRef, mode);
+ MutableProjectSettings batchSettings = new MutableProjectSettings(new ProjectReactor(project), new MutableGlobalSettings(bootstrapProps), projectRef, mode);
assertThat(batchSettings.getString("sonar.foo.license.secured")).isEqualTo("bar2");
thrown.expect(MessageException.class);
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectBuildersExecutorTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectBuildersExecutorTest.java
index aaea18a974f..a76ced58419 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectBuildersExecutorTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectBuildersExecutorTest.java
@@ -19,10 +19,6 @@
*/
package org.sonar.scanner.scan;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.mock;
-
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -32,6 +28,10 @@ import org.sonar.api.batch.bootstrap.ProjectBuilder.Context;
import org.sonar.api.batch.bootstrap.ProjectReactor;
import org.sonar.api.utils.MessageException;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.mock;
+
public class ProjectBuildersExecutorTest {
private ProjectReactor reactor;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectLockTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectLockTest.java
index b206d1b0508..cd628bbe8f4 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectLockTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectLockTest.java
@@ -19,22 +19,21 @@
*/
package org.sonar.scanner.scan;
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
import org.junit.rules.ExpectedException;
+import org.junit.rules.TemporaryFolder;
import org.sonar.api.batch.bootstrap.ProjectDefinition;
import org.sonar.api.batch.bootstrap.ProjectReactor;
import org.sonar.home.cache.DirectoryLock;
-import org.sonar.scanner.scan.ProjectLock;
-import java.io.File;
-import java.nio.file.Files;
-import java.nio.file.Path;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-import static org.assertj.core.api.Assertions.assertThat;
-import org.junit.Test;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.rules.TemporaryFolder;
public class ProjectLockTest {
@Rule
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectReactorValidatorTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectReactorValidatorTest.java
index 737db71b599..9f7833fbc75 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectReactorValidatorTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectReactorValidatorTest.java
@@ -27,7 +27,7 @@ import org.sonar.api.CoreProperties;
import org.sonar.api.batch.bootstrap.ProjectDefinition;
import org.sonar.api.batch.bootstrap.ProjectReactor;
import org.sonar.api.config.Settings;
-import org.sonar.api.config.MapSettings;
+import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.utils.MessageException;
import org.sonar.scanner.analysis.DefaultAnalysisMode;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectScanContainerTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectScanContainerTest.java
index 05a0d06f4cd..0d2c247e3e8 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectScanContainerTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectScanContainerTest.java
@@ -24,7 +24,6 @@ import org.sonar.api.BatchExtension;
import org.sonar.api.ServerExtension;
import org.sonar.api.batch.InstantiationStrategy;
import org.sonar.api.task.TaskExtension;
-import org.sonar.scanner.scan.ProjectScanContainer;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/WorkDirectoryCleanerTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/WorkDirectoryCleanerTest.java
index c53512cbd19..58b4acc2823 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/WorkDirectoryCleanerTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/WorkDirectoryCleanerTest.java
@@ -19,6 +19,8 @@
*/
package org.sonar.scanner.scan;
+import java.io.File;
+import java.io.IOException;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -26,9 +28,6 @@ import org.junit.rules.TemporaryFolder;
import org.sonar.api.batch.bootstrap.ProjectDefinition;
import org.sonar.api.batch.bootstrap.ProjectReactor;
import org.sonar.home.cache.DirectoryLock;
-import org.sonar.scanner.scan.WorkDirectoryCleaner;
-import java.io.File;
-import java.io.IOException;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/AdditionalFilePredicatesTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/AdditionalFilePredicatesTest.java
index 230ddbee1ec..d0522adac02 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/AdditionalFilePredicatesTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/AdditionalFilePredicatesTest.java
@@ -23,7 +23,6 @@ import org.junit.Test;
import org.sonar.api.batch.fs.FilePredicate;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
-import org.sonar.scanner.scan.filesystem.AdditionalFilePredicates;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/ByteCharsetDetectorTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/ByteCharsetDetectorTest.java
index ff3f3feb711..911fcc7c7fa 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/ByteCharsetDetectorTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/ByteCharsetDetectorTest.java
@@ -19,13 +19,6 @@
*/
package org.sonar.scanner.scan.filesystem;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyBoolean;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
@@ -33,13 +26,19 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
-
import org.apache.commons.io.ByteOrderMark;
import org.junit.Before;
import org.junit.Test;
import org.sonar.scanner.scan.filesystem.CharsetValidation.Result;
import org.sonar.scanner.scan.filesystem.CharsetValidation.Validation;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyBoolean;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
public class ByteCharsetDetectorTest {
private CharsetValidation validation;
private ByteCharsetDetector charsets;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/CharsetDetectorTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/CharsetDetectorTest.java
index aeb38ee7993..0da6349119b 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/CharsetDetectorTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/CharsetDetectorTest.java
@@ -19,13 +19,6 @@
*/
package org.sonar.scanner.scan.filesystem;
-import static java.nio.charset.StandardCharsets.US_ASCII;
-import static java.nio.charset.StandardCharsets.UTF_16;
-import static java.nio.charset.StandardCharsets.UTF_16BE;
-import static java.nio.charset.StandardCharsets.UTF_16LE;
-import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.assertj.core.api.Assertions.assertThat;
-
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
@@ -35,7 +28,6 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Random;
-
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.junit.Rule;
@@ -43,6 +35,13 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.rules.TemporaryFolder;
+import static java.nio.charset.StandardCharsets.US_ASCII;
+import static java.nio.charset.StandardCharsets.UTF_16;
+import static java.nio.charset.StandardCharsets.UTF_16BE;
+import static java.nio.charset.StandardCharsets.UTF_16LE;
+import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.assertj.core.api.Assertions.assertThat;
+
public class CharsetDetectorTest {
@Rule
public TemporaryFolder temp = new TemporaryFolder();
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/CharsetValidationTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/CharsetValidationTest.java
index 269bb6eef3a..9956a6aa25d 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/CharsetValidationTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/CharsetValidationTest.java
@@ -19,8 +19,6 @@
*/
package org.sonar.scanner.scan.filesystem;
-import static org.assertj.core.api.Assertions.assertThat;
-
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.ByteBuffer;
@@ -35,12 +33,13 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
-
import org.apache.commons.lang.StringUtils;
import org.junit.Before;
import org.junit.Test;
import org.sonar.scanner.scan.filesystem.CharsetValidation.Validation;
+import static org.assertj.core.api.Assertions.assertThat;
+
public class CharsetValidationTest {
private CharsetValidation charsets;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/ExclusionFiltersTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/ExclusionFiltersTest.java
index 20a528ac7a8..9815f2de7f2 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/ExclusionFiltersTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/ExclusionFiltersTest.java
@@ -30,8 +30,7 @@ import org.sonar.api.CoreProperties;
import org.sonar.api.batch.fs.IndexedFile;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.fs.internal.DefaultIndexedFile;
-import org.sonar.api.config.MapSettings;
-import org.sonar.api.config.Settings;
+import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.scan.filesystem.FileExclusions;
import static org.assertj.core.api.Assertions.assertThat;
@@ -41,17 +40,19 @@ public class ExclusionFiltersTest {
@Rule
public TemporaryFolder temp = new TemporaryFolder();
private Path moduleBaseDir;
+ private MapSettings settings;
+ private ExclusionFilters filter;
@Before
public void setUp() throws IOException {
+ settings = new MapSettings();
moduleBaseDir = temp.newFolder().toPath();
+ filter = new ExclusionFilters(new FileExclusions(settings.asConfig()));
}
@Test
public void no_inclusions_nor_exclusions() throws IOException {
- ExclusionFilters filter = new ExclusionFilters(new FileExclusions(new MapSettings()));
filter.prepare();
-
IndexedFile indexedFile = new DefaultIndexedFile("foo", moduleBaseDir, "src/main/java/com/mycompany/FooDao.java");
assertThat(filter.accept(indexedFile, InputFile.Type.MAIN)).isTrue();
assertThat(filter.accept(indexedFile, InputFile.Type.TEST)).isTrue();
@@ -59,9 +60,7 @@ public class ExclusionFiltersTest {
@Test
public void match_inclusion() throws IOException {
- Settings settings = new MapSettings();
settings.setProperty(CoreProperties.PROJECT_INCLUSIONS_PROPERTY, "**/*Dao.java");
- ExclusionFilters filter = new ExclusionFilters(new FileExclusions(settings));
filter.prepare();
IndexedFile indexedFile = new DefaultIndexedFile("foo", moduleBaseDir, "src/main/java/com/mycompany/FooDao.java");
@@ -73,10 +72,7 @@ public class ExclusionFiltersTest {
@Test
public void match_at_least_one_inclusion() throws IOException {
- Settings settings = new MapSettings();
settings.setProperty(CoreProperties.PROJECT_INCLUSIONS_PROPERTY, "**/*Dao.java,**/*Dto.java");
- ExclusionFilters filter = new ExclusionFilters(new FileExclusions(settings));
-
filter.prepare();
IndexedFile indexedFile = new DefaultIndexedFile("foo", moduleBaseDir, "src/main/java/com/mycompany/Foo.java");
@@ -88,12 +84,9 @@ public class ExclusionFiltersTest {
@Test
public void match_exclusions() throws IOException {
- Settings settings = new MapSettings();
settings.setProperty(CoreProperties.PROJECT_INCLUSIONS_PROPERTY, "src/main/java/**/*");
settings.setProperty(CoreProperties.PROJECT_TEST_INCLUSIONS_PROPERTY, "src/test/java/**/*");
settings.setProperty(CoreProperties.PROJECT_EXCLUSIONS_PROPERTY, "**/*Dao.java");
- ExclusionFilters filter = new ExclusionFilters(new FileExclusions(settings));
-
filter.prepare();
IndexedFile indexedFile = new DefaultIndexedFile("foo", moduleBaseDir, "src/main/java/com/mycompany/FooDao.java");
@@ -111,11 +104,8 @@ public class ExclusionFiltersTest {
public void match_exclusion_by_absolute_path() throws IOException {
File excludedFile = new File(moduleBaseDir.toString(), "src/main/java/org/bar/Bar.java");
- Settings settings = new MapSettings();
settings.setProperty(CoreProperties.PROJECT_INCLUSIONS_PROPERTY, "src/main/java/**/*");
settings.setProperty(CoreProperties.PROJECT_EXCLUSIONS_PROPERTY, "file:" + excludedFile.getAbsolutePath());
- ExclusionFilters filter = new ExclusionFilters(new FileExclusions(settings));
-
filter.prepare();
IndexedFile indexedFile = new DefaultIndexedFile("foo", moduleBaseDir, "src/main/java/org/bar/Foo.java");
@@ -127,9 +117,7 @@ public class ExclusionFiltersTest {
@Test
public void trim_pattern() {
- Settings settings = new MapSettings();
settings.setProperty(CoreProperties.PROJECT_EXCLUSIONS_PROPERTY, " **/*Dao.java ");
- ExclusionFilters filter = new ExclusionFilters(new FileExclusions(settings));
assertThat(filter.prepareMainExclusions()[0].toString()).isEqualTo("**/*Dao.java");
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/InputFileBuilderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/InputFileBuilderTest.java
index f3b147e00c4..4a7800668e3 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/InputFileBuilderTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/InputFileBuilderTest.java
@@ -19,13 +19,9 @@
*/
package org.sonar.scanner.scan.filesystem;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
-
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -34,10 +30,12 @@ import org.sonar.api.batch.bootstrap.ProjectDefinition;
import org.sonar.api.batch.fs.InputFile.Type;
import org.sonar.api.batch.fs.internal.DefaultInputFile;
import org.sonar.api.batch.fs.internal.DefaultInputModule;
-import org.sonar.api.config.MapSettings;
-import org.sonar.api.config.Settings;
+import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.scan.filesystem.PathResolver;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+
public class InputFileBuilderTest {
@Rule
public TemporaryFolder temp = new TemporaryFolder();
@@ -56,8 +54,8 @@ public class InputFileBuilderTest {
LanguageDetection langDetection = mock(LanguageDetection.class);
MetadataGenerator metadataGenerator = mock(MetadataGenerator.class);
BatchIdGenerator idGenerator = new BatchIdGenerator();
- Settings settings = new MapSettings();
- builder = new InputFileBuilder(module, pathResolver, langDetection, metadataGenerator, idGenerator, settings);
+ MapSettings settings = new MapSettings();
+ builder = new InputFileBuilder(module, pathResolver, langDetection, metadataGenerator, idGenerator, settings.asConfig());
}
@Test
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/LanguageDetectionTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/LanguageDetectionTest.java
index f59b3bf0632..86d33bb6660 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/LanguageDetectionTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/LanguageDetectionTest.java
@@ -21,14 +21,14 @@ package org.sonar.scanner.scan.filesystem;
import java.io.File;
import java.io.IOException;
+import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.rules.TemporaryFolder;
import org.sonar.api.CoreProperties;
import org.sonar.api.batch.fs.internal.DefaultIndexedFile;
-import org.sonar.api.config.Settings;
-import org.sonar.api.config.MapSettings;
+import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.resources.Language;
import org.sonar.api.resources.Languages;
import org.sonar.api.utils.MessageException;
@@ -47,6 +47,13 @@ public class LanguageDetectionTest {
@Rule
public ExpectedException thrown = ExpectedException.none();
+ private MapSettings settings;
+
+ @Before
+ public void setUp() throws IOException {
+ settings = new MapSettings();
+ }
+
@Test
public void test_sanitizeExtension() throws Exception {
assertThat(LanguageDetection.sanitizeExtension(".cbl")).isEqualTo("cbl");
@@ -58,7 +65,7 @@ public class LanguageDetectionTest {
@Test
public void search_by_file_extension() throws Exception {
LanguagesRepository languages = new DefaultLanguagesRepository(new Languages(new MockLanguage("java", "java", "jav"), new MockLanguage("cobol", "cbl", "cob")));
- LanguageDetection detection = new LanguageDetection(new MapSettings(), languages);
+ LanguageDetection detection = new LanguageDetection(settings.asConfig(), languages);
assertThat(detection.language(newIndexedFile("Foo.java"))).isEqualTo("java");
assertThat(detection.language(newIndexedFile("src/Foo.java"))).isEqualTo("java");
@@ -75,7 +82,7 @@ public class LanguageDetectionTest {
@Test
public void should_not_fail_if_no_language() throws Exception {
- LanguageDetection detection = spy(new LanguageDetection(new MapSettings(), new DefaultLanguagesRepository(new Languages())));
+ LanguageDetection detection = spy(new LanguageDetection(settings.asConfig(), new DefaultLanguagesRepository(new Languages())));
assertThat(detection.language(newIndexedFile("Foo.java"))).isNull();
}
@@ -83,7 +90,7 @@ public class LanguageDetectionTest {
public void plugin_can_declare_a_file_extension_twice_for_case_sensitivity() throws Exception {
LanguagesRepository languages = new DefaultLanguagesRepository(new Languages(new MockLanguage("abap", "abap", "ABAP")));
- LanguageDetection detection = new LanguageDetection(new MapSettings(), languages);
+ LanguageDetection detection = new LanguageDetection(settings.asConfig(), languages);
assertThat(detection.language(newIndexedFile("abc.abap"))).isEqualTo("abap");
}
@@ -94,14 +101,13 @@ public class LanguageDetectionTest {
LanguagesRepository languages = new DefaultLanguagesRepository(new Languages(new MockLanguage("java", "java"), new MockLanguage("abap")));
// No side-effect on non-ABAP projects
- LanguageDetection detection = new LanguageDetection(new MapSettings(), languages);
+ LanguageDetection detection = new LanguageDetection(settings.asConfig(), languages);
assertThat(detection.language(newIndexedFile("abc"))).isNull();
assertThat(detection.language(newIndexedFile("abc.abap"))).isNull();
assertThat(detection.language(newIndexedFile("abc.java"))).isEqualTo("java");
- Settings settings = new MapSettings();
settings.setProperty(CoreProperties.PROJECT_LANGUAGE_PROPERTY, "abap");
- detection = new LanguageDetection(settings, languages);
+ detection = new LanguageDetection(settings.asConfig(), languages);
assertThat(detection.language(newIndexedFile("abc"))).isEqualTo("abap");
assertThat(detection.language(newIndexedFile("abc.txt"))).isEqualTo("abap");
assertThat(detection.language(newIndexedFile("abc.java"))).isEqualTo("abap");
@@ -111,9 +117,8 @@ public class LanguageDetectionTest {
public void force_language_using_deprecated_property() throws Exception {
LanguagesRepository languages = new DefaultLanguagesRepository(new Languages(new MockLanguage("java", "java"), new MockLanguage("php", "php")));
- Settings settings = new MapSettings();
settings.setProperty(CoreProperties.PROJECT_LANGUAGE_PROPERTY, "java");
- LanguageDetection detection = new LanguageDetection(settings, languages);
+ LanguageDetection detection = new LanguageDetection(settings.asConfig(), languages);
assertThat(detection.language(newIndexedFile("abc"))).isNull();
assertThat(detection.language(newIndexedFile("abc.php"))).isNull();
assertThat(detection.language(newIndexedFile("abc.java"))).isEqualTo("java");
@@ -126,15 +131,14 @@ public class LanguageDetectionTest {
thrown.expectMessage("You must install a plugin that supports the language 'unknown'");
LanguagesRepository languages = new DefaultLanguagesRepository(new Languages(new MockLanguage("java", "java"), new MockLanguage("php", "php")));
- Settings settings = new MapSettings();
settings.setProperty(CoreProperties.PROJECT_LANGUAGE_PROPERTY, "unknown");
- new LanguageDetection(settings, languages);
+ new LanguageDetection(settings.asConfig(), languages);
}
@Test
public void fail_if_conflicting_language_suffix() throws Exception {
LanguagesRepository languages = new DefaultLanguagesRepository(new Languages(new MockLanguage("xml", "xhtml"), new MockLanguage("web", "xhtml")));
- LanguageDetection detection = new LanguageDetection(new MapSettings(), languages);
+ LanguageDetection detection = new LanguageDetection(settings.asConfig(), languages);
try {
detection.language(newIndexedFile("abc.xhtml"));
fail();
@@ -150,10 +154,9 @@ public class LanguageDetectionTest {
public void solve_conflict_using_filepattern() throws Exception {
LanguagesRepository languages = new DefaultLanguagesRepository(new Languages(new MockLanguage("xml", "xhtml"), new MockLanguage("web", "xhtml")));
- Settings settings = new MapSettings();
settings.setProperty("sonar.lang.patterns.xml", "xml/**");
settings.setProperty("sonar.lang.patterns.web", "web/**");
- LanguageDetection detection = new LanguageDetection(settings, languages);
+ LanguageDetection detection = new LanguageDetection(settings.asConfig(), languages);
assertThat(detection.language(newIndexedFile("xml/abc.xhtml"))).isEqualTo("xml");
assertThat(detection.language(newIndexedFile("web/abc.xhtml"))).isEqualTo("web");
}
@@ -161,11 +164,10 @@ public class LanguageDetectionTest {
@Test
public void fail_if_conflicting_filepattern() throws Exception {
LanguagesRepository languages = new DefaultLanguagesRepository(new Languages(new MockLanguage("abap", "abap"), new MockLanguage("cobol", "cobol")));
- Settings settings = new MapSettings();
settings.setProperty("sonar.lang.patterns.abap", "*.abap,*.txt");
settings.setProperty("sonar.lang.patterns.cobol", "*.cobol,*.txt");
- LanguageDetection detection = new LanguageDetection(settings, languages);
+ LanguageDetection detection = new LanguageDetection(settings.asConfig(), languages);
assertThat(detection.language(newIndexedFile("abc.abap"))).isEqualTo("abap");
assertThat(detection.language(newIndexedFile("abc.cobol"))).isEqualTo("cobol");
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/MetadataGeneratorTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/MetadataGeneratorTest.java
index ae73b76db13..b9a9723e0eb 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/MetadataGeneratorTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/MetadataGeneratorTest.java
@@ -19,16 +19,10 @@
*/
package org.sonar.scanner.scan.filesystem;
-import static org.apache.commons.codec.digest.DigestUtils.md5Hex;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.nio.file.Paths;
-
import org.apache.commons.io.FileUtils;
import org.junit.Assert;
import org.junit.Before;
@@ -47,6 +41,11 @@ import org.sonar.scanner.issue.ignore.pattern.IssueExclusionPatternInitializer;
import org.sonar.scanner.issue.ignore.pattern.PatternMatcher;
import org.sonar.scanner.issue.ignore.scanner.IssueExclusionsLoader;
+import static org.apache.commons.codec.digest.DigestUtils.md5Hex;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
public class MetadataGeneratorTest {
@Rule
public TemporaryFolder temp = new TemporaryFolder();
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/StatusDetectionFactoryTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/StatusDetectionFactoryTest.java
index 2d6ffaa8449..160580763f0 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/StatusDetectionFactoryTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/StatusDetectionFactoryTest.java
@@ -21,8 +21,6 @@ package org.sonar.scanner.scan.filesystem;
import org.junit.Test;
import org.sonar.scanner.repository.ProjectRepositories;
-import org.sonar.scanner.scan.filesystem.StatusDetection;
-import org.sonar.scanner.scan.filesystem.StatusDetectionFactory;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/StatusDetectionTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/StatusDetectionTest.java
index 0c7eadb86bd..a295fdc08be 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/StatusDetectionTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/StatusDetectionTest.java
@@ -26,7 +26,6 @@ import org.junit.Test;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.scanner.repository.FileData;
import org.sonar.scanner.repository.ProjectRepositories;
-import org.sonar.scanner.scan.filesystem.StatusDetection;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/report/ConsoleReportTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/report/ConsoleReportTest.java
index 572753822cd..0f302bf2161 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/report/ConsoleReportTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/report/ConsoleReportTest.java
@@ -26,8 +26,7 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
-import org.sonar.api.config.Settings;
-import org.sonar.api.config.MapSettings;
+import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.rule.Severity;
import org.sonar.api.utils.log.LogTester;
import org.sonar.scanner.issue.IssueCache;
@@ -43,7 +42,7 @@ public class ConsoleReportTest {
@Rule
public LogTester logTester = new LogTester();
- private Settings settings;
+ private MapSettings settings;
private IssueCache issueCache;
private InputComponentStore inputPathCache;
private ConsoleReport report;
@@ -53,7 +52,7 @@ public class ConsoleReportTest {
settings = new MapSettings();
issueCache = mock(IssueCache.class);
inputPathCache = mock(InputComponentStore.class);
- report = new ConsoleReport(settings, issueCache, inputPathCache);
+ report = new ConsoleReport(settings.asConfig(), issueCache, inputPathCache);
}
@Test
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/report/JSONReportTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/report/JSONReportTest.java
index e999104d907..926b149ef3e 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/report/JSONReportTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/report/JSONReportTest.java
@@ -41,8 +41,7 @@ import org.sonar.api.batch.fs.internal.InputModuleHierarchy;
import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
import org.sonar.api.batch.rule.Rules;
import org.sonar.api.batch.rule.internal.RulesBuilder;
-import org.sonar.api.config.MapSettings;
-import org.sonar.api.config.Settings;
+import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.issue.Issue;
import org.sonar.api.platform.Server;
import org.sonar.api.rule.RuleKey;
@@ -65,12 +64,12 @@ public class JSONReportTest {
@Rule
public TemporaryFolder temp = new TemporaryFolder();
- JSONReport jsonReport;
- DefaultFileSystem fs;
- Server server = mock(Server.class);
- Rules rules = mock(Rules.class);
- Settings settings = new MapSettings();
- IssueCache issueCache = mock(IssueCache.class);
+ private JSONReport jsonReport;
+ private DefaultFileSystem fs;
+ private Server server = mock(Server.class);
+ private Rules rules = mock(Rules.class);
+ private MapSettings settings = new MapSettings();
+ private IssueCache issueCache = mock(IssueCache.class);
private InputModuleHierarchy moduleHierarchy;
@Before
@@ -111,7 +110,7 @@ public class JSONReportTest {
RulesBuilder builder = new RulesBuilder();
builder.add(RuleKey.of("squid", "AvoidCycles")).setName("Avoid Cycles");
rules = builder.build();
- jsonReport = new JSONReport(moduleHierarchy, settings, fs, server, rules, issueCache, rootModule, inputComponentStore, inputComponentTree);
+ jsonReport = new JSONReport(moduleHierarchy, settings.asConfig(), fs, server, rules, issueCache, rootModule, inputComponentStore, inputComponentTree);
}
@Test
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/report/RuleNameProviderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/report/RuleNameProviderTest.java
index d9abc47deea..1284ab03bd2 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/report/RuleNameProviderTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/report/RuleNameProviderTest.java
@@ -19,24 +19,22 @@
*/
package org.sonar.scanner.scan.report;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import static org.assertj.core.api.Assertions.assertThat;
-
-import static org.mockito.Matchers.any;
-
-import org.sonar.api.rule.RuleKey;
-import org.sonar.scanner.scan.report.RuleNameProvider;
-import org.sonar.api.batch.rule.Rule;
-import org.junit.Test;
import org.junit.Before;
+import org.junit.Test;
+import org.sonar.api.batch.rule.Rule;
import org.sonar.api.batch.rule.Rules;
+import org.sonar.api.rule.RuleKey;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
public class RuleNameProviderTest {
- RuleNameProvider provider;
- Rules rules;
- Rule rule;
- RuleKey ruleKey;
+ private RuleNameProvider provider;
+ private Rules rules;
+ private Rule rule;
+ private RuleKey ruleKey;
@Before
public void setUp() {
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scm/DefaultBlameOutputTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scm/DefaultBlameOutputTest.java
index f416dd642aa..8713d8c88a7 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scm/DefaultBlameOutputTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scm/DefaultBlameOutputTest.java
@@ -27,7 +27,6 @@ import org.junit.rules.ExpectedException;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
import org.sonar.api.batch.scm.BlameLine;
-import org.sonar.scanner.scm.DefaultBlameOutput;
public class DefaultBlameOutputTest {
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/DefaultSensorContextTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/DefaultSensorContextTest.java
index 2d5f98780f5..c73b0636e67 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/DefaultSensorContextTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/DefaultSensorContextTest.java
@@ -33,8 +33,7 @@ import org.sonar.api.batch.measure.MetricFinder;
import org.sonar.api.batch.rule.ActiveRules;
import org.sonar.api.batch.rule.internal.ActiveRulesBuilder;
import org.sonar.api.batch.sensor.internal.SensorStorage;
-import org.sonar.api.config.Settings;
-import org.sonar.api.config.MapSettings;
+import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.internal.SonarRuntimeImpl;
import org.sonar.api.measures.CoreMetrics;
import org.sonar.api.utils.Version;
@@ -54,7 +53,7 @@ public class DefaultSensorContextTest {
private ActiveRules activeRules;
private DefaultFileSystem fs;
private DefaultSensorContext adaptor;
- private Settings settings;
+ private MapSettings settings;
private SensorStorage sensorStorage;
private AnalysisMode analysisMode;
private SonarRuntime runtime;
@@ -70,7 +69,7 @@ public class DefaultSensorContextTest {
sensorStorage = mock(SensorStorage.class);
analysisMode = mock(AnalysisMode.class);
runtime = SonarRuntimeImpl.forSonarQube(Version.parse("5.5"), SonarQubeSide.SCANNER);
- adaptor = new DefaultSensorContext(mock(InputModule.class), settings, fs, activeRules, analysisMode, sensorStorage, runtime);
+ adaptor = new DefaultSensorContext(mock(InputModule.class), settings.asConfig(), settings, fs, activeRules, analysisMode, sensorStorage, runtime);
}
@Test
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/DefaultSensorStorageTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/DefaultSensorStorageTest.java
index 75d25e7080b..2c375606ae9 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/DefaultSensorStorageTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/DefaultSensorStorageTest.java
@@ -34,8 +34,7 @@ import org.sonar.api.batch.measure.MetricFinder;
import org.sonar.api.batch.sensor.highlighting.internal.DefaultHighlighting;
import org.sonar.api.batch.sensor.measure.internal.DefaultMeasure;
import org.sonar.api.batch.sensor.symbol.internal.DefaultSymbolTable;
-import org.sonar.api.config.MapSettings;
-import org.sonar.api.config.Settings;
+import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.measures.CoreMetrics;
import org.sonar.api.utils.KeyValueFormat;
import org.sonar.core.metric.ScannerMetrics;
@@ -63,7 +62,7 @@ public class DefaultSensorStorageTest {
public ExpectedException thrown = ExpectedException.none();
private DefaultSensorStorage underTest;
- private Settings settings;
+ private MapSettings settings;
private ModuleIssues moduleIssues;
private MeasureCache measureCache;
private ContextPropertiesCache contextPropertiesCache = new ContextPropertiesCache();
@@ -81,7 +80,7 @@ public class DefaultSensorStorageTest {
ReportPublisher reportPublisher = mock(ReportPublisher.class);
when(reportPublisher.getWriter()).thenReturn(new ScannerReportWriter(temp.newFolder()));
underTest = new DefaultSensorStorage(metricFinder,
- moduleIssues, settings, coverageExclusions, reportPublisher, measureCache,
+ moduleIssues, settings.asConfig(), coverageExclusions, reportPublisher, measureCache,
mock(SonarCpdBlockIndex.class), contextPropertiesCache, new ScannerMetrics());
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/SensorOptimizerTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/SensorOptimizerTest.java
index 748470679cc..76b83f4318e 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/SensorOptimizerTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/SensorOptimizerTest.java
@@ -30,8 +30,7 @@ import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
import org.sonar.api.batch.rule.ActiveRules;
import org.sonar.api.batch.rule.internal.ActiveRulesBuilder;
import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor;
-import org.sonar.api.config.Settings;
-import org.sonar.api.config.MapSettings;
+import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.rule.RuleKey;
import static org.assertj.core.api.Assertions.assertThat;
@@ -46,13 +45,13 @@ public class SensorOptimizerTest {
private DefaultFileSystem fs;
private SensorOptimizer optimizer;
- private Settings settings;
+ private MapSettings settings;
@Before
public void prepare() throws Exception {
fs = new DefaultFileSystem(temp.newFolder().toPath());
settings = new MapSettings();
- optimizer = new SensorOptimizer(fs, new ActiveRulesBuilder().build(), settings);
+ optimizer = new SensorOptimizer(fs, new ActiveRulesBuilder().build(), settings.asConfig());
}
@Test
@@ -110,7 +109,7 @@ public class SensorOptimizerTest {
.create(RuleKey.of("repo1", "foo"))
.activate()
.build();
- optimizer = new SensorOptimizer(fs, activeRules, settings);
+ optimizer = new SensorOptimizer(fs, activeRules, settings.asConfig());
assertThat(optimizer.shouldExecute(descriptor)).isFalse();
@@ -120,7 +119,7 @@ public class SensorOptimizerTest {
.create(RuleKey.of("squid", "rule"))
.activate()
.build();
- optimizer = new SensorOptimizer(fs, activeRules, settings);
+ optimizer = new SensorOptimizer(fs, activeRules, settings.asConfig());
assertThat(optimizer.shouldExecute(descriptor)).isTrue();
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/coverage/CoverageExclusionsTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/coverage/CoverageExclusionsTest.java
index 99e82e68976..7eafee529ef 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/coverage/CoverageExclusionsTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/coverage/CoverageExclusionsTest.java
@@ -23,22 +23,21 @@ import org.junit.Before;
import org.junit.Test;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
-import org.sonar.api.config.MapSettings;
import org.sonar.api.config.PropertyDefinitions;
-import org.sonar.api.config.Settings;
+import org.sonar.api.config.internal.MapSettings;
import org.sonar.core.config.ExclusionProperties;
import static org.assertj.core.api.Assertions.assertThat;
public class CoverageExclusionsTest {
- private Settings settings;
+ private MapSettings settings;
private CoverageExclusions coverageExclusions;
@Before
public void prepare() {
settings = new MapSettings(new PropertyDefinitions(ExclusionProperties.all()));
- coverageExclusions = new CoverageExclusions(settings);
+ coverageExclusions = new CoverageExclusions(settings.asConfig());
}
@Test
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/source/DefaultHighlightableTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/source/DefaultHighlightableTest.java
index 602d139bd84..45bd4fc8a06 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/source/DefaultHighlightableTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/source/DefaultHighlightableTest.java
@@ -28,7 +28,6 @@ import org.sonar.api.batch.fs.internal.DefaultInputFile;
import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
import org.sonar.api.batch.sensor.highlighting.internal.DefaultHighlighting;
import org.sonar.api.batch.sensor.internal.SensorStorage;
-import org.sonar.scanner.source.DefaultHighlightable;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/source/DefaultSymbolizableTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/source/DefaultSymbolizableTest.java
index 80a35c1df7e..0c67f1369b5 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/source/DefaultSymbolizableTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/source/DefaultSymbolizableTest.java
@@ -29,7 +29,6 @@ import org.sonar.api.batch.sensor.symbol.internal.DefaultSymbolTable;
import org.sonar.api.source.Symbol;
import org.sonar.api.source.Symbolizable;
import org.sonar.scanner.sensor.DefaultSensorStorage;
-import org.sonar.scanner.source.DefaultSymbolizable;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/source/DeprecatedDefaultSymbolTableTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/source/DeprecatedDefaultSymbolTableTest.java
index 7e7114edafa..370c6bdb5fd 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/source/DeprecatedDefaultSymbolTableTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/source/DeprecatedDefaultSymbolTableTest.java
@@ -31,7 +31,6 @@ import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
import org.sonar.api.batch.sensor.symbol.internal.DefaultSymbolTable;
import org.sonar.api.source.Symbol;
import org.sonar.api.source.Symbolizable;
-import org.sonar.scanner.source.DeprecatedDefaultSymbolTable;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/storage/StorageTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/storage/StorageTest.java
index 239f761710b..7b1b1791332 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/storage/StorageTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/storage/StorageTest.java
@@ -22,7 +22,6 @@ package org.sonar.scanner.storage;
import com.google.common.collect.Iterables;
import org.junit.Test;
import org.sonar.scanner.index.AbstractCachesTest;
-import org.sonar.scanner.storage.Storage;
import org.sonar.scanner.storage.Storage.Entry;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/storage/StoragesManagerTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/storage/StoragesManagerTest.java
index 612431b5110..03730f412b8 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/storage/StoragesManagerTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/storage/StoragesManagerTest.java
@@ -19,9 +19,9 @@
*/
package org.sonar.scanner.storage;
+import java.io.File;
import org.junit.Test;
import org.sonar.scanner.index.AbstractCachesTest;
-import java.io.File;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/storage/StoragesTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/storage/StoragesTest.java
index 4fd5337872a..4de2db91ee0 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/storage/StoragesTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/storage/StoragesTest.java
@@ -19,13 +19,10 @@
*/
package org.sonar.scanner.storage;
-import java.io.Serializable;
-
import com.persistit.exception.PersistitException;
+import java.io.Serializable;
import org.junit.Test;
import org.sonar.scanner.index.AbstractCachesTest;
-import org.sonar.scanner.storage.Storage;
-import org.sonar.scanner.storage.Storages;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.fail;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/task/ListTaskTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/task/ListTaskTest.java
index 9f7788a37ab..f07e6c8054e 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/task/ListTaskTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/task/ListTaskTest.java
@@ -26,8 +26,6 @@ import org.sonar.api.task.Task;
import org.sonar.api.task.TaskDefinition;
import org.sonar.api.utils.log.LogTester;
import org.sonar.api.utils.log.LoggerLevel;
-import org.sonar.scanner.task.ListTask;
-import org.sonar.scanner.task.Tasks;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/task/TasksTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/task/TasksTest.java
index 93340aeeadf..828f86dfadb 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/task/TasksTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/task/TasksTest.java
@@ -24,9 +24,6 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.sonar.api.task.Task;
import org.sonar.api.task.TaskDefinition;
-import org.sonar.scanner.task.ListTask;
-import org.sonar.scanner.task.ScanTask;
-import org.sonar.scanner.task.Tasks;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/util/ScannerUtilsTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/util/ScannerUtilsTest.java
index 79e4fc3bcea..517cca80743 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/util/ScannerUtilsTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/util/ScannerUtilsTest.java
@@ -20,7 +20,6 @@
package org.sonar.scanner.util;
import org.junit.Test;
-import org.sonar.scanner.util.ScannerUtils;
import static org.assertj.core.api.Assertions.assertThat;