Search in sources :

Example 1 with DroppedPropertyChecker

use of org.sonar.scanner.bootstrap.DroppedPropertyChecker in project sonarqube by SonarSource.

the class ProjectReactorBuilder method execute.

public ProjectReactor execute() {
    Profiler profiler = Profiler.create(LOG).startInfo("Process project properties");
    new DroppedPropertyChecker(analysisProps.properties(), DROPPED_PROPERTIES).checkDroppedProperties();
    Map<String, Map<String, String>> propertiesByModuleIdPath = new HashMap<>();
    extractPropertiesByModule(propertiesByModuleIdPath, "", "", analysisProps.properties());
    ProjectDefinition rootProject = defineRootProject(propertiesByModuleIdPath.get(""), null);
    rootProjectWorkDir = rootProject.getWorkDir();
    defineChildren(rootProject, propertiesByModuleIdPath, "");
    cleanAndCheckProjectDefinitions(rootProject);
    // Since task properties are now empty we should add root module properties
    analysisProps.properties().putAll(propertiesByModuleIdPath.get(""));
    profiler.stopDebug();
    return new ProjectReactor(rootProject);
}
Also used : Profiler(org.sonar.api.utils.log.Profiler) HashMap(java.util.HashMap) HashMap(java.util.HashMap) Map(java.util.Map) ImmutableMap(com.google.common.collect.ImmutableMap) ProjectReactor(org.sonar.api.batch.bootstrap.ProjectReactor) DroppedPropertyChecker(org.sonar.scanner.bootstrap.DroppedPropertyChecker) ProjectDefinition(org.sonar.api.batch.bootstrap.ProjectDefinition)

Example 2 with DroppedPropertyChecker

use of org.sonar.scanner.bootstrap.DroppedPropertyChecker in project sonarqube by SonarSource.

the class DroppedPropertyCheckerTest method warn_log_if_settings_contains_any_dropped_property.

@Test
public void warn_log_if_settings_contains_any_dropped_property() {
    new DroppedPropertyChecker(ImmutableMap.of(DROPPED_PROPERTY_1, SOME_VALUE), ImmutableMap.of(DROPPED_PROPERTY_1, DROPPED_PROPERTY_MSG_1)).checkDroppedProperties();
    assertThat(logTester.logs(LoggerLevel.ERROR)).isEmpty();
    assertThat(logTester.logs(LoggerLevel.WARN)).containsOnly("Property '" + DROPPED_PROPERTY_1 + "' is not supported any more. " + DROPPED_PROPERTY_MSG_1);
    assertThat(logTester.logs(LoggerLevel.INFO)).isEmpty();
    assertThat(logTester.logs(LoggerLevel.DEBUG)).isEmpty();
    assertThat(logTester.logs(LoggerLevel.TRACE)).isEmpty();
}
Also used : DroppedPropertyChecker(org.sonar.scanner.bootstrap.DroppedPropertyChecker) Test(org.junit.Test)

Example 3 with DroppedPropertyChecker

use of org.sonar.scanner.bootstrap.DroppedPropertyChecker in project sonarqube by SonarSource.

the class DroppedPropertyCheckerTest method no_log_if_no_dropped_property.

@Test
public void no_log_if_no_dropped_property() {
    new DroppedPropertyChecker(ImmutableMap.of(DROPPED_PROPERTY_1, SOME_VALUE), ImmutableMap.<String, String>of()).checkDroppedProperties();
    assertThat(logTester.logs()).isEmpty();
}
Also used : DroppedPropertyChecker(org.sonar.scanner.bootstrap.DroppedPropertyChecker) Test(org.junit.Test)

Example 4 with DroppedPropertyChecker

use of org.sonar.scanner.bootstrap.DroppedPropertyChecker in project sonarqube by SonarSource.

the class DroppedPropertyCheckerTest method no_log_if_settings_does_not_contain_any_dropped_property.

@Test
public void no_log_if_settings_does_not_contain_any_dropped_property() {
    new DroppedPropertyChecker(ImmutableMap.<String, String>of(), ImmutableMap.of(DROPPED_PROPERTY_1, DROPPED_PROPERTY_MSG_1)).checkDroppedProperties();
    assertThat(logTester.logs()).isEmpty();
}
Also used : DroppedPropertyChecker(org.sonar.scanner.bootstrap.DroppedPropertyChecker) Test(org.junit.Test)

Aggregations

DroppedPropertyChecker (org.sonar.scanner.bootstrap.DroppedPropertyChecker)4 Test (org.junit.Test)3 ImmutableMap (com.google.common.collect.ImmutableMap)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 ProjectDefinition (org.sonar.api.batch.bootstrap.ProjectDefinition)1 ProjectReactor (org.sonar.api.batch.bootstrap.ProjectReactor)1 Profiler (org.sonar.api.utils.log.Profiler)1