use of org.sonar.db.qualityprofile.QualityProfileDto in project sonarqube by SonarSource.
the class ProjectDataLoaderMediumTest method addDefaultProfile.
private void addDefaultProfile() {
QualityProfileDto profileDto = newQProfileDto("org-123", QProfileName.createFor(ServerTester.Xoo.KEY, "SonarQube way"), "abcd").setRulesUpdatedAt(formatDateTime(new Date())).setDefault(true);
dbClient.qualityProfileDao().insert(dbSession, profileDto);
}
use of org.sonar.db.qualityprofile.QualityProfileDto in project sonarqube by SonarSource.
the class UpdateQualityProfilesLastUsedDateStepTest method ancestor_profiles_are_updated.
@Test
public void ancestor_profiles_are_updated() throws Exception {
// Parent profiles should be updated
QualityProfileDto rootProfile = newQualityProfileDto().setKey("root");
QualityProfileDto parentProfile = newQualityProfileDto().setKey("parent").setParentKee(rootProfile.getKey());
// Current profile => should be updated
QualityProfileDto currentProfile = newQualityProfileDto().setKey("current").setParentKee(parentProfile.getKey());
// Child of current profile => should not be updated
QualityProfileDto childProfile = newQualityProfileDto().setKey("child").setParentKee(currentProfile.getKey());
qualityProfileDb.insertQualityProfiles(rootProfile, parentProfile, currentProfile, childProfile);
measureRepository.addRawMeasure(1, QUALITY_PROFILES_KEY, Measure.newMeasureBuilder().create(toJson(currentProfile.getKey())));
underTest.execute();
assertQualityProfileIsUpdated(rootProfile);
assertQualityProfileIsUpdated(parentProfile);
assertQualityProfileIsUpdated(currentProfile);
assertQualityProfileIsTheSame(childProfile);
}
use of org.sonar.db.qualityprofile.QualityProfileDto in project sonarqube by SonarSource.
the class CompareActionMediumTest method createProfile.
private QualityProfileDto createProfile(String lang, String name, String key) {
QualityProfileDto profile = QProfileTesting.newQProfileDto("org-123", new QProfileName(lang, name), key);
db.qualityProfileDao().insert(session, profile);
session.commit();
return profile;
}
use of org.sonar.db.qualityprofile.QualityProfileDto in project sonarqube by SonarSource.
the class CompareActionMediumTest method compare_param_on_right.
@Test
public void compare_param_on_right() throws Exception {
RuleDto rule1 = createRuleWithParam("xoo", "rule1");
createRepository("blah", "xoo", "Blah");
QualityProfileDto profile1 = createProfile("xoo", "Profile 1", "xoo-profile-1-01234");
createActiveRule(rule1, profile1);
QualityProfileDto profile2 = createProfile("xoo", "Profile 2", "xoo-profile-2-12345");
createActiveRuleWithParam(rule1, profile2, "polop");
session.commit();
wsTester.newGetRequest("api/qualityprofiles", "compare").setParam("leftKey", profile1.getKey()).setParam("rightKey", profile2.getKey()).execute().assertJson(this.getClass(), "compare_param_on_right.json");
}
use of org.sonar.db.qualityprofile.QualityProfileDto in project sonarqube by SonarSource.
the class CompareActionMediumTest method compare_param_on_left.
@Test
public void compare_param_on_left() throws Exception {
RuleDto rule1 = createRuleWithParam("xoo", "rule1");
createRepository("blah", "xoo", "Blah");
QualityProfileDto profile1 = createProfile("xoo", "Profile 1", "xoo-profile-1-01234");
createActiveRuleWithParam(rule1, profile1, "polop");
QualityProfileDto profile2 = createProfile("xoo", "Profile 2", "xoo-profile-2-12345");
createActiveRule(rule1, profile2);
session.commit();
wsTester.newGetRequest("api/qualityprofiles", "compare").setParam("leftKey", profile1.getKey()).setParam("rightKey", profile2.getKey()).execute().assertJson(this.getClass(), "compare_param_on_left.json");
}
Aggregations