Search in sources :

Example 56 with PropertyDto

use of org.sonar.db.property.PropertyDto in project sonarqube by SonarSource.

the class ProjectSettingsFactoryTest method return_project_settings.

@Test
public void return_project_settings() {
    when(dbClient.propertiesDao().selectProjectProperties(PROJECT_KEY)).thenReturn(newArrayList(new PropertyDto().setKey("1").setValue("val1"), new PropertyDto().setKey("2").setValue("val2"), new PropertyDto().setKey("3").setValue("val3")));
    Settings projectSettings = underTest.newProjectSettings(PROJECT_KEY);
    assertThat(projectSettings.getString("1")).isEqualTo("val1");
    assertThat(projectSettings.getString("2")).isEqualTo("val2");
    assertThat(projectSettings.getString("3")).isEqualTo("val3");
}
Also used : PropertyDto(org.sonar.db.property.PropertyDto) Settings(org.sonar.api.config.Settings) MapSettings(org.sonar.api.config.MapSettings) Test(org.junit.Test)

Example 57 with PropertyDto

use of org.sonar.db.property.PropertyDto in project sonarqube by SonarSource.

the class ProjectSettingsFactoryTest method project_settings_override_global_settings.

@Test
public void project_settings_override_global_settings() {
    settings.setProperty("key", "value");
    when(dbClient.propertiesDao().selectProjectProperties(PROJECT_KEY)).thenReturn(newArrayList(new PropertyDto().setKey("key").setValue("value2")));
    Settings projectSettings = underTest.newProjectSettings(PROJECT_KEY);
    assertThat(projectSettings.getString("key")).isEqualTo("value2");
}
Also used : PropertyDto(org.sonar.db.property.PropertyDto) Settings(org.sonar.api.config.Settings) MapSettings(org.sonar.api.config.MapSettings) Test(org.junit.Test)

Aggregations

PropertyDto (org.sonar.db.property.PropertyDto)57 Test (org.junit.Test)25 ComponentDto (org.sonar.db.component.ComponentDto)23 OrganizationDto (org.sonar.db.organization.OrganizationDto)13 ProjectRepositories (org.sonar.scanner.protocol.input.ProjectRepositories)13 DbSession (org.sonar.db.DbSession)8 QualityGateDto (org.sonar.db.qualitygate.QualityGateDto)6 MapSettings (org.sonar.api.config.MapSettings)3 Settings (org.sonar.api.config.Settings)3 PropertyTesting.newComponentPropertyDto (org.sonar.db.property.PropertyTesting.newComponentPropertyDto)2 PropertyTesting.newGlobalPropertyDto (org.sonar.db.property.PropertyTesting.newGlobalPropertyDto)2 UserDto (org.sonar.db.user.UserDto)2 Date (java.util.Date)1 Matchers.anyString (org.mockito.Matchers.anyString)1 PropertyDefinition (org.sonar.api.config.PropertyDefinition)1 FilePathWithHashDto (org.sonar.db.component.FilePathWithHashDto)1 SnapshotDto (org.sonar.db.component.SnapshotDto)1 PropertyQuery (org.sonar.db.property.PropertyQuery)1 UserTesting.newUserDto (org.sonar.db.user.UserTesting.newUserDto)1 TestResponse (org.sonar.server.ws.TestResponse)1