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 ComponentContainerTest method shouldDeclareComponentProperties.
@Test
public void shouldDeclareComponentProperties() {
ComponentContainer container = new ComponentContainer();
container.addSingleton(ComponentWithProperty.class);
PropertyDefinitions propertyDefinitions = container.getComponentByType(PropertyDefinitions.class);
assertThat(propertyDefinitions.get("foo")).isNotNull();
assertThat(propertyDefinitions.get("foo").defaultValue()).isEqualTo("bar");
}
use of org.sonar.api.config.PropertyDefinitions in project sonarqube by SonarSource.
the class ComponentContainerTest method shouldDeclareExtensionWhenAdding.
@Test
public void shouldDeclareExtensionWhenAdding() {
ComponentContainer container = new ComponentContainer();
PluginInfo plugin = mock(PluginInfo.class);
container.addExtension(plugin, ComponentWithProperty.class);
PropertyDefinitions propertyDefinitions = container.getComponentByType(PropertyDefinitions.class);
assertThat(propertyDefinitions.get("foo")).isNotNull();
assertThat(container.getComponentByType(ComponentWithProperty.class)).isNotNull();
assertThat(container.getComponentByKey(ComponentWithProperty.class)).isNotNull();
}
use of org.sonar.api.config.PropertyDefinitions in project sonarqube by SonarSource.
the class GlobalSettingsTest method should_load_global_settings.
@Test
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);
assertThat(batchSettings.getBoolean("sonar.cpd.cross")).isTrue();
}
use of org.sonar.api.config.PropertyDefinitions in project sonarqube by SonarSource.
the class IssueExclusionPatternInitializerTest method init.
@Before
public void init() {
settings = new MapSettings(new PropertyDefinitions(IssueExclusionProperties.all()));
patternsInitializer = new IssueExclusionPatternInitializer(settings);
}
Aggregations