use of org.sonar.api.config.PropertyDefinitions in project sonarqube by SonarSource.
the class SettingsMonitor method attributes.
@Override
public SortedMap<String, Object> attributes() {
PropertyDefinitions definitions = settings.getDefinitions();
ImmutableSortedMap.Builder<String, Object> builder = ImmutableSortedMap.naturalOrder();
for (Map.Entry<String, String> prop : settings.getProperties().entrySet()) {
String key = prop.getKey();
PropertyDefinition def = definitions.get(key);
if (def == null || def.type() != PropertyType.PASSWORD) {
builder.put(key, abbreviate(prop.getValue(), MAX_VALUE_LENGTH));
}
}
return builder.build();
}
use of org.sonar.api.config.PropertyDefinitions in project sonarqube by SonarSource.
the class RenameDeprecatedPropertyKeysTest method should_rename_deprecated_keys.
@Test
public void should_rename_deprecated_keys() {
PropertiesDao dao = mock(PropertiesDao.class);
PropertyDefinitions definitions = new PropertyDefinitions(FakeExtension.class);
RenameDeprecatedPropertyKeys task = new RenameDeprecatedPropertyKeys(dao, definitions);
task.start();
verify(dao).renamePropertyKey("old_key", "new_key");
verifyNoMoreInteractions(dao);
}
use of org.sonar.api.config.PropertyDefinitions in project sonarqube by SonarSource.
the class ThreadLocalSettingsTest method create.
private ThreadLocalSettings create(Map<String, String> systemProps) {
Properties p = new Properties();
p.putAll(systemProps);
return new ThreadLocalSettings(new PropertyDefinitions(), p, dbSettingLoader);
}
use of org.sonar.api.config.PropertyDefinitions in project sonarqube by SonarSource.
the class ComponentContainerTest method shouldDeclareExtensionWithoutAddingIt.
@Test
public void shouldDeclareExtensionWithoutAddingIt() {
ComponentContainer container = new ComponentContainer();
PluginInfo plugin = mock(PluginInfo.class);
container.declareExtension(plugin, ComponentWithProperty.class);
PropertyDefinitions propertyDefinitions = container.getComponentByType(PropertyDefinitions.class);
assertThat(propertyDefinitions.get("foo")).isNotNull();
assertThat(container.getComponentByType(ComponentWithProperty.class)).isNull();
}
use of org.sonar.api.config.PropertyDefinitions in project sonarqube by SonarSource.
the class GenericCoverageSensorTest method migrateOldProperties.
@Test
public void migrateOldProperties() {
Settings settings = new MapSettings(new PropertyDefinitions(GenericCoverageSensor.properties()));
settings.setProperty(GenericCoverageSensor.OLD_REPORT_PATH_PROPERTY_KEY, "old.xml");
settings.setProperty(GenericCoverageSensor.OLD_COVERAGE_REPORT_PATHS_PROPERTY_KEY, "old1.xml,old2.xml");
settings.setProperty(GenericCoverageSensor.OLD_IT_COVERAGE_REPORT_PATHS_PROPERTY_KEY, "old3.xml,old4.xml,old.xml");
settings.setProperty(GenericCoverageSensor.OLD_OVERALL_COVERAGE_REPORT_PATHS_PROPERTY_KEY, "old5.xml,old6.xml");
new GenericCoverageSensor(settings).execute();
assertThat(logTester.logs(LoggerLevel.WARN)).contains("Property 'sonar.genericcoverage.reportPath' is deprecated. Please use 'sonar.coverageReportPaths' instead.", "Property 'sonar.genericcoverage.reportPaths' is deprecated. Please use 'sonar.coverageReportPaths' instead.", "Property 'sonar.genericcoverage.itReportPaths' is deprecated. Please use 'sonar.coverageReportPaths' instead.", "Property 'sonar.genericcoverage.overallReportPaths' is deprecated. Please use 'sonar.coverageReportPaths' instead.");
assertThat(settings.getStringArray(GenericCoverageSensor.REPORT_PATHS_PROPERTY_KEY)).containsOnly("old.xml", "old1.xml", "old2.xml", "old3.xml", "old4.xml", "old5.xml", "old6.xml");
}
Aggregations