use of org.sonar.db.property.PropertyDto in project sonarqube by SonarSource.
the class ProjectDataLoaderMediumTest method return_sub_module_settings.
@Test
public void return_sub_module_settings() {
OrganizationDto organizationDto = OrganizationTesting.newOrganizationDto();
dbClient.organizationDao().insert(dbSession, organizationDto);
ComponentDto project = ComponentTesting.newProjectDto(organizationDto);
dbClient.componentDao().insert(dbSession, project);
addDefaultProfile();
// No project properties
ComponentDto module = ComponentTesting.newModuleDto(project);
dbClient.componentDao().insert(dbSession, module);
// No module properties
ComponentDto subModule = ComponentTesting.newModuleDto(module);
userSessionRule.logIn().addProjectUuidPermissions(SCAN_EXECUTION, project.uuid());
dbClient.componentDao().insert(dbSession, subModule);
// Sub module properties
dbClient.propertiesDao().saveProperty(dbSession, new PropertyDto().setKey("sonar.jira.project.key").setValue("SONAR").setResourceId(subModule.getId()));
dbClient.propertiesDao().saveProperty(dbSession, new PropertyDto().setKey("sonar.jira.login.secured").setValue("john").setResourceId(subModule.getId()));
dbClient.propertiesDao().saveProperty(dbSession, new PropertyDto().setKey("sonar.coverage.exclusions").setValue("**/*.java").setResourceId(subModule.getId()));
dbSession.commit();
ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(subModule.key()));
assertThat(ref.settings(project.key())).isEmpty();
assertThat(ref.settings(module.key())).isEmpty();
assertThat(ref.settings(subModule.key())).isEqualTo(ImmutableMap.of("sonar.jira.project.key", "SONAR", "sonar.jira.login.secured", "john", "sonar.coverage.exclusions", "**/*.java"));
}
use of org.sonar.db.property.PropertyDto in project sonarqube by SonarSource.
the class SettingsRepositoryTest method get_project_settings_from_db.
@Test
public void get_project_settings_from_db() {
ComponentDto project = ComponentTesting.newProjectDto(dbTester.organizations().insert()).setKey(ROOT.getKey());
dbClient.componentDao().insert(session, project);
dbClient.propertiesDao().saveProperty(session, new PropertyDto().setResourceId(project.getId()).setKey("key").setValue("value"));
session.commit();
Settings settings = underTest.getSettings(ROOT);
assertThat(settings.getString("key")).isEqualTo("value");
}
use of org.sonar.db.property.PropertyDto in project sonarqube by SonarSource.
the class AddActionTest method add_a_file.
@Test
public void add_a_file() {
ComponentDto project = insertProjectAndPermissions();
ComponentDto file = db.components().insertComponent(newFileDto(project));
userSession.addComponentUuidPermission(UserRole.USER, PROJECT_UUID, file.uuid());
call(file.key());
List<PropertyDto> favorites = dbClient.propertiesDao().selectByQuery(PropertyQuery.builder().setUserId(USER_ID).setKey("favourite").build(), dbSession);
assertThat(favorites).hasSize(1);
PropertyDto favorite = favorites.get(0);
assertThat(favorite).extracting(PropertyDto::getResourceId, PropertyDto::getUserId, PropertyDto::getKey).containsOnly(file.getId(), USER_ID, "favourite");
}
use of org.sonar.db.property.PropertyDto in project sonarqube by SonarSource.
the class StartupMetadataPersisterTest method assertPersistedProperty.
private void assertPersistedProperty(String propertyKey, String expectedValue) {
PropertyDto prop = dbTester.getDbClient().propertiesDao().selectGlobalProperty(dbTester.getSession(), propertyKey);
assertThat(prop.getValue()).isEqualTo(expectedValue);
}
use of org.sonar.db.property.PropertyDto in project sonarqube by SonarSource.
the class GetByProjectActionTest method setDefaultQualityGate.
private void setDefaultQualityGate(long qualityGateId) {
dbClient.propertiesDao().saveProperty(dbSession, new PropertyDto().setKey("sonar.qualitygate").setValue(String.valueOf(qualityGateId)));
db.commit();
}
Aggregations