Search in sources :

Example 1 with AnalysisProperties

use of org.sonar.scanner.analysis.AnalysisProperties in project sonarqube by SonarSource.

the class DefaultAnalysisModeTest method scan_all.

@Test
public void scan_all() {
    Map<String, String> props = new HashMap<>();
    props.put(CoreProperties.ANALYSIS_MODE, CoreProperties.ANALYSIS_MODE_ISSUES);
    GlobalProperties globalProps = new GlobalProperties(props);
    AnalysisProperties analysisProps = new AnalysisProperties(new HashMap<String, String>());
    DefaultAnalysisMode mode = new DefaultAnalysisMode(globalProps, analysisProps);
    assertThat(mode.scanAllFiles()).isFalse();
    props.put("sonar.scanAllFiles", "true");
    analysisProps = new AnalysisProperties(props);
    mode = new DefaultAnalysisMode(globalProps, analysisProps);
    assertThat(mode.scanAllFiles()).isTrue();
    props.put(CoreProperties.ANALYSIS_MODE, CoreProperties.ANALYSIS_MODE_PUBLISH);
    analysisProps = new AnalysisProperties(props);
    mode = new DefaultAnalysisMode(globalProps, analysisProps);
    assertThat(mode.scanAllFiles()).isTrue();
}
Also used : GlobalProperties(org.sonar.scanner.bootstrap.GlobalProperties) HashMap(java.util.HashMap) AnalysisProperties(org.sonar.scanner.analysis.AnalysisProperties) DefaultAnalysisMode(org.sonar.scanner.analysis.DefaultAnalysisMode) Test(org.junit.Test)

Example 2 with AnalysisProperties

use of org.sonar.scanner.analysis.AnalysisProperties in project sonarqube by SonarSource.

the class DefaultAnalysisModeTest method createMode.

private static DefaultAnalysisMode createMode(@Nullable String bootstrapMode, @Nullable String analysisMode) {
    Map<String, String> bootstrapMap = new HashMap<>();
    Map<String, String> analysisMap = new HashMap<>();
    if (bootstrapMode != null) {
        bootstrapMap.put(CoreProperties.ANALYSIS_MODE, bootstrapMode);
    }
    if (analysisMode != null) {
        analysisMap.put(CoreProperties.ANALYSIS_MODE, analysisMode);
    }
    return new DefaultAnalysisMode(new GlobalProperties(bootstrapMap), new AnalysisProperties(analysisMap));
}
Also used : GlobalProperties(org.sonar.scanner.bootstrap.GlobalProperties) HashMap(java.util.HashMap) AnalysisProperties(org.sonar.scanner.analysis.AnalysisProperties) DefaultAnalysisMode(org.sonar.scanner.analysis.DefaultAnalysisMode)

Example 3 with AnalysisProperties

use of org.sonar.scanner.analysis.AnalysisProperties in project sonarqube by SonarSource.

the class ScanTask method execute.

@Override
public void execute() {
    AnalysisProperties props = new AnalysisProperties(taskProps.properties(), taskProps.property(CoreProperties.ENCRYPTION_SECRET_KEY_PATH));
    new ProjectScanContainer(taskContainer, props).execute();
}
Also used : AnalysisProperties(org.sonar.scanner.analysis.AnalysisProperties) ProjectScanContainer(org.sonar.scanner.scan.ProjectScanContainer)

Example 4 with AnalysisProperties

use of org.sonar.scanner.analysis.AnalysisProperties in project sonarqube by SonarSource.

the class ProjectReactorBuilderTest method shouldRemoveModulePropertiesFromTaskProperties.

@Test
public void shouldRemoveModulePropertiesFromTaskProperties() {
    Map<String, String> props = loadProps("big-multi-module-definitions-all-in-root");
    AnalysisProperties taskProperties = new AnalysisProperties(props, null);
    assertThat(taskProperties.property("module1.module11.property")).isEqualTo("My module11 property");
    new ProjectReactorBuilder(taskProperties).execute();
    assertThat(taskProperties.property("module1.module11.property")).isNull();
}
Also used : AnalysisProperties(org.sonar.scanner.analysis.AnalysisProperties) Test(org.junit.Test)

Example 5 with AnalysisProperties

use of org.sonar.scanner.analysis.AnalysisProperties in project sonarqube by SonarSource.

the class ProjectReactorBuilderTest method should_log_a_warning_when_a_dropped_property_is_present.

@Test
public void should_log_a_warning_when_a_dropped_property_is_present() {
    Map<String, String> props = loadProps("simple-project");
    props.put("sonar.qualitygate", "somevalue");
    AnalysisProperties bootstrapProps = new AnalysisProperties(props, null);
    new ProjectReactorBuilder(bootstrapProps).execute();
    assertThat(logTester.logs(LoggerLevel.WARN)).containsOnly("Property 'sonar.qualitygate' is not supported any more. It will be ignored.");
}
Also used : AnalysisProperties(org.sonar.scanner.analysis.AnalysisProperties) Test(org.junit.Test)

Aggregations

AnalysisProperties (org.sonar.scanner.analysis.AnalysisProperties)5 Test (org.junit.Test)3 HashMap (java.util.HashMap)2 DefaultAnalysisMode (org.sonar.scanner.analysis.DefaultAnalysisMode)2 GlobalProperties (org.sonar.scanner.bootstrap.GlobalProperties)2 ProjectScanContainer (org.sonar.scanner.scan.ProjectScanContainer)1