use of org.sonar.db.property.PropertyDto in project sonarqube by SonarSource.
the class ProjectDataLoaderMediumTest method not_returned_secured_settings_when_lgged_but_no_scan_permission.
@Test
public void not_returned_secured_settings_when_lgged_but_no_scan_permission() {
OrganizationDto organizationDto = OrganizationTesting.newOrganizationDto();
dbClient.organizationDao().insert(dbSession, organizationDto);
ComponentDto project = ComponentTesting.newProjectDto(organizationDto);
userSessionRule.logIn("john").addProjectUuidPermissions(UserRole.USER, project.uuid());
dbClient.componentDao().insert(dbSession, project);
addDefaultProfile();
// Project properties
dbClient.propertiesDao().saveProperty(dbSession, new PropertyDto().setKey("sonar.jira.project.key").setValue("SONAR").setResourceId(project.getId()));
dbClient.propertiesDao().saveProperty(dbSession, new PropertyDto().setKey("sonar.jira.login.secured").setValue("john").setResourceId(project.getId()));
dbSession.commit();
ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(project.key()).setIssuesMode(true));
Map<String, String> projectSettings = ref.settings(project.key());
assertThat(projectSettings).isEqualTo(ImmutableMap.of("sonar.jira.project.key", "SONAR"));
}
use of org.sonar.db.property.PropertyDto in project sonarqube by SonarSource.
the class AddActionTest method add_a_project.
@Test
public void add_a_project() {
ComponentDto project = insertProjectAndPermissions();
TestResponse result = call(PROJECT_KEY);
assertThat(result.getStatus()).isEqualTo(HTTP_NO_CONTENT);
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(project.getId(), USER_ID, "favourite");
}
use of org.sonar.db.property.PropertyDto in project sonarqube by SonarSource.
the class ServerIdManagerTest method insertPropertyCoreId.
private void insertPropertyCoreId(String value) {
dbClient.propertiesDao().saveProperty(dbSession, new PropertyDto().setKey(CoreProperties.SERVER_ID).setValue(value));
dbSession.commit();
}
use of org.sonar.db.property.PropertyDto in project sonarqube by SonarSource.
the class StartupMetadataProviderTest method assertNotPersistedProperty.
private void assertNotPersistedProperty(String propertyKey) {
PropertyDto prop = dbTester.getDbClient().propertiesDao().selectGlobalProperty(dbTester.getSession(), propertyKey);
assertThat(prop).isNull();
}
use of org.sonar.db.property.PropertyDto in project sonarqube by SonarSource.
the class StartupMetadataProviderTest method assertPersistedProperty.
private void assertPersistedProperty(String propertyKey, String expectedValue) {
PropertyDto prop = dbTester.getDbClient().propertiesDao().selectGlobalProperty(dbTester.getSession(), propertyKey);
assertThat(prop.getValue()).isEqualTo(expectedValue);
}
Aggregations