Search in sources :

Example 11 with PropertyDefinitions

use of org.sonar.api.config.PropertyDefinitions in project sonarqube by SonarSource.

the class GenericTestExecutionSensorTest method logWhenDeprecatedPropsAreUsed.

@Test
public void logWhenDeprecatedPropsAreUsed() throws IOException {
    File basedir = temp.newFolder();
    File report = new File(basedir, "report.xml");
    FileUtils.write(report, "<unitTest version=\"1\"><file path=\"A.java\"><testCase name=\"test1\" duration=\"500\"/></file></unitTest>");
    SensorContextTester context = SensorContextTester.create(basedir);
    Settings settings = new MapSettings(new PropertyDefinitions(GenericTestExecutionSensor.properties()));
    settings.setProperty(GenericTestExecutionSensor.OLD_UNIT_TEST_REPORT_PATHS_PROPERTY_KEY, "report.xml");
    context.setSettings(settings);
    new GenericTestExecutionSensor(mock(TestPlanBuilder.class)).execute(context);
    assertThat(logTester.logs(LoggerLevel.WARN)).contains("Using 'unitTest' as root element of the report is deprecated. Please change to 'testExecutions'.", "Property 'sonar.genericcoverage.unitTestReportPaths' is deprecated. Please use 'sonar.testExecutionReportPaths' instead.");
    assertThat(logTester.logs(LoggerLevel.INFO)).contains("Imported test execution data for 0 files", "Test execution data ignored for 1 unknown files, including:\nA.java");
}
Also used : SensorContextTester(org.sonar.api.batch.sensor.internal.SensorContextTester) MapSettings(org.sonar.api.config.MapSettings) PropertyDefinitions(org.sonar.api.config.PropertyDefinitions) File(java.io.File) Settings(org.sonar.api.config.Settings) MapSettings(org.sonar.api.config.MapSettings) Test(org.junit.Test)

Example 12 with PropertyDefinitions

use of org.sonar.api.config.PropertyDefinitions in project sonarqube by SonarSource.

the class GlobalSettingsTest method should_log_warn_msg_for_each_jdbc_property_if_present.

@Test
public void should_log_warn_msg_for_each_jdbc_property_if_present() {
    when(settingsLoader.load(null)).thenReturn(ImmutableMap.of("sonar.jdbc.url", SOME_VALUE, "sonar.jdbc.username", SOME_VALUE, "sonar.jdbc.password", SOME_VALUE));
    new GlobalSettings(bootstrapProps, new PropertyDefinitions(), settingsLoader, 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.", "Property 'sonar.jdbc.username' is not supported any more. It will be ignored. There is no longer any DB connection to the SQ database.", "Property 'sonar.jdbc.password' is not supported any more. It will be ignored. There is no longer any DB connection to the SQ database.");
}
Also used : PropertyDefinitions(org.sonar.api.config.PropertyDefinitions) Test(org.junit.Test)

Example 13 with PropertyDefinitions

use of org.sonar.api.config.PropertyDefinitions in project sonarqube by SonarSource.

the class IssueInclusionPatternInitializerTest method init.

@Before
public void init() {
    settings = new MapSettings(new PropertyDefinitions(IssueExclusionProperties.all()));
    patternsInitializer = new IssueInclusionPatternInitializer(settings);
}
Also used : MapSettings(org.sonar.api.config.MapSettings) PropertyDefinitions(org.sonar.api.config.PropertyDefinitions) Before(org.junit.Before)

Example 14 with PropertyDefinitions

use of org.sonar.api.config.PropertyDefinitions in project sonarqube by SonarSource.

the class CoverageExclusionsTest method prepare.

@Before
public void prepare() {
    settings = new MapSettings(new PropertyDefinitions(ExclusionProperties.all()));
    coverageExclusions = new CoverageExclusions(settings);
}
Also used : MapSettings(org.sonar.api.config.MapSettings) PropertyDefinitions(org.sonar.api.config.PropertyDefinitions) Before(org.junit.Before)

Aggregations

PropertyDefinitions (org.sonar.api.config.PropertyDefinitions)14 Test (org.junit.Test)8 MapSettings (org.sonar.api.config.MapSettings)5 Before (org.junit.Before)4 Settings (org.sonar.api.config.Settings)2 ImmutableSortedMap (com.google.common.collect.ImmutableSortedMap)1 File (java.io.File)1 Map (java.util.Map)1 Properties (java.util.Properties)1 SortedMap (java.util.SortedMap)1 SensorContextTester (org.sonar.api.batch.sensor.internal.SensorContextTester)1 PropertyDefinition (org.sonar.api.config.PropertyDefinition)1 PropertiesDao (org.sonar.db.property.PropertiesDao)1 DefaultAnalysisMode (org.sonar.scanner.analysis.DefaultAnalysisMode)1 GlobalMode (org.sonar.scanner.bootstrap.GlobalMode)1 GlobalProperties (org.sonar.scanner.bootstrap.GlobalProperties)1 GlobalSettings (org.sonar.scanner.bootstrap.GlobalSettings)1