use of org.sonar.api.config.Configuration in project sonarqube by SonarSource.
the class ConfigurationRepositoryTest method project_settings_override_global_settings.
@Test
public void project_settings_override_global_settings() {
globalSettings.setProperty("key", "value1");
ComponentDto project = db.components().insertPrivateProject();
insertProjectProperty(project, "key", "value2");
analysisMetadataHolder.setProject(Project.from(project));
Configuration config = underTest.getConfiguration();
assertThat(config.get("key")).hasValue("value2");
}
use of org.sonar.api.config.Configuration in project sonarqube by SonarSource.
the class ConfigurationRepositoryTest method get_project_settings_from_db.
@Test
public void get_project_settings_from_db() {
ComponentDto project = db.components().insertPrivateProject();
analysisMetadataHolder.setProject(Project.from(project));
insertProjectProperty(project, "key", "value");
Configuration config = underTest.getConfiguration();
assertThat(config.get("key")).hasValue("value");
}
use of org.sonar.api.config.Configuration in project sonarqube by SonarSource.
the class ConfigurationRepositoryTest method get_project_settings_from_global_settings.
@Test
public void get_project_settings_from_global_settings() {
analysisMetadataHolder.setProject(PROJECT);
globalSettings.setProperty("key", "value");
Configuration config = underTest.getConfiguration();
assertThat(config.get("key")).hasValue("value");
}
use of org.sonar.api.config.Configuration in project sonarqube by SonarSource.
the class ProjectConfigurationLoaderImplTest method return_configuration_with_just_global_settings_when_no_component_settings.
@Test
public void return_configuration_with_just_global_settings_when_no_component_settings() {
String key = randomAlphanumeric(3);
String value = randomAlphanumeric(4);
String componentDbKey = randomAlphanumeric(5);
String componentUuid = randomAlphanumeric(6);
globalSettings.setProperty(key, value);
when(propertiesDao.selectProjectProperties(dbSession, componentDbKey)).thenReturn(emptyList());
ComponentDto component = newComponentDto(componentDbKey, componentUuid);
Map<String, Configuration> configurations = underTest.loadProjectConfigurations(dbSession, singleton(component));
assertThat(configurations).containsOnlyKeys(componentUuid);
assertThat(configurations.get(componentUuid).get(key)).contains(value);
}
use of org.sonar.api.config.Configuration in project sonarqube by SonarSource.
the class ProjectConfigurationLoaderImplTest method returns_single_configuration_for_single_project_load.
@Test
public void returns_single_configuration_for_single_project_load() {
String key = randomAlphanumeric(3);
String value = randomAlphanumeric(4);
String componentDbKey = randomAlphanumeric(5);
String componentUuid = randomAlphanumeric(6);
globalSettings.setProperty(key, value);
when(propertiesDao.selectProjectProperties(dbSession, componentDbKey)).thenReturn(emptyList());
ComponentDto component = newComponentDto(componentDbKey, componentUuid);
Configuration configuration = underTest.loadProjectConfiguration(dbSession, component);
assertThat(configuration.get(key)).hasValue(value);
}
Aggregations