use of org.sonar.db.property.PropertyDto in project sonarqube by SonarSource.
the class SetActionTest method assertComponentSetting.
private void assertComponentSetting(String key, String value, long componentId) {
PropertyDto result = dbClient.propertiesDao().selectProjectProperty(componentId, key);
assertThat(result).extracting(PropertyDto::getKey, PropertyDto::getValue, PropertyDto::getResourceId).containsExactly(key, value, componentId);
}
use of org.sonar.db.property.PropertyDto in project sonarqube by SonarSource.
the class ComponentActionTest method test_example_response.
@Test
public void test_example_response() throws Exception {
init(createPages());
OrganizationDto organizationDto = dbTester.organizations().insertForKey("my-org-1");
ComponentDto project = newProjectDto(organizationDto, "ABCD").setKey("org.codehaus.sonar:sonar").setName("Sonarqube").setDescription("Open source platform for continuous inspection of code quality");
componentDbTester.insertComponent(project);
SnapshotDto analysis = newAnalysis(project).setCreatedAt(DateUtils.parseDateTime("2016-12-06T11:44:00+0200").getTime()).setVersion("6.3").setLast(true);
componentDbTester.insertSnapshot(analysis);
when(resourceTypes.get(project.qualifier())).thenReturn(DefaultResourceTypes.get().getRootType());
UserDto user = dbTester.users().insertUser("obiwan");
propertyDbTester.insertProperty(new PropertyDto().setKey("favourite").setResourceId(project.getId()).setUserId(user.getId()));
addQualityProfiles(project, analysis, createQProfile("qp1", "Sonar Way Java", "java"), createQProfile("qp2", "Sonar Way Xoo", "xoo"));
QualityGateDto qualityGateDto = dbTester.qualityGates().insertQualityGate("Sonar way");
dbTester.qualityGates().associateProjectToQualityGate(project, qualityGateDto);
userSession.logIn(user).addProjectUuidPermissions(UserRole.USER, project.uuid()).addProjectUuidPermissions(UserRole.ADMIN, project.uuid());
String result = execute(project.key());
assertJson(result).ignoreFields("snapshotDate", "key", "qualityGate.key").isSimilarTo(ws.getDef().responseExampleAsString());
}
use of org.sonar.db.property.PropertyDto in project sonarqube by SonarSource.
the class ComponentActionTest method return_component_info_with_favourite.
@Test
public void return_component_info_with_favourite() throws Exception {
init();
UserDto user = dbTester.users().insertUser("obiwan");
componentDbTester.insertComponent(project);
propertyDbTester.insertProperty(new PropertyDto().setKey("favourite").setResourceId(project.getId()).setUserId(user.getId()));
userSession.logIn(user).addProjectUuidPermissions(UserRole.USER, project.uuid());
executeAndVerify(project.key(), "return_component_info_with_favourite.json");
}
use of org.sonar.db.property.PropertyDto in project sonarqube by SonarSource.
the class ComputeEngineContainerImplTest method insertProperty.
private void insertProperty(String key, String value) {
PropertyDto dto = new PropertyDto().setKey(key).setValue(value);
dbTester.getDbClient().propertiesDao().saveProperty(dbTester.getSession(), dto);
dbTester.commit();
}
use of org.sonar.db.property.PropertyDto in project sonarqube by SonarSource.
the class UserDaoTest method insertProperty.
private PropertyDto insertProperty(String key, String value, long componentId) {
PropertyDto dto = new PropertyDto().setKey(key).setValue(value).setResourceId(componentId);
dbClient.propertiesDao().saveProperty(session, dto);
return dto;
}
Aggregations