use of org.sonar.db.qualityprofile.QualityProfileDto in project sonarqube by SonarSource.
the class CompareActionMediumTest method compare_nominal.
@Test
public void compare_nominal() throws Exception {
createRepository("blah", "xoo", "Blah");
RuleDto rule1 = createRule("xoo", "rule1");
RuleDto rule2 = createRule("xoo", "rule2");
RuleDto rule3 = createRule("xoo", "rule3");
RuleDto rule4 = createRuleWithParam("xoo", "rule4");
RuleDto rule5 = createRule("xoo", "rule5");
/*
* Profile 1:
* - rule 1 active (on both profiles) => "same"
* - rule 2 active (only in this profile) => "inLeft"
* - rule 4 active with different parameters => "modified"
* - rule 5 active with different severity => "modified"
*/
QualityProfileDto profile1 = createProfile("xoo", "Profile 1", "xoo-profile-1-01234");
createActiveRule(rule1, profile1);
createActiveRule(rule2, profile1);
createActiveRuleWithParam(rule4, profile1, "polop");
createActiveRuleWithSeverity(rule5, profile1, Severity.MINOR);
session.commit();
/*
* Profile 1:
* - rule 1 active (on both profiles) => "same"
* - rule 3 active (only in this profile) => "inRight"
* - rule 4 active with different parameters => "modified"
*/
QualityProfileDto profile2 = createProfile("xoo", "Profile 2", "xoo-profile-2-12345");
createActiveRule(rule1, profile2);
createActiveRule(rule3, profile2);
createActiveRuleWithParam(rule4, profile2, "palap");
createActiveRuleWithSeverity(rule5, profile2, Severity.MAJOR);
session.commit();
wsTester.newGetRequest("api/qualityprofiles", "compare").setParam("leftKey", profile1.getKey()).setParam("rightKey", profile2.getKey()).execute().assertJson(this.getClass(), "compare_nominal.json");
}
use of org.sonar.db.qualityprofile.QualityProfileDto in project sonarqube by SonarSource.
the class RuleActivatorMediumTest method assertProfileHasBeenUpdatedManually.
private void assertProfileHasBeenUpdatedManually(String profileKey) {
QualityProfileDto profile = db.qualityProfileDao().selectByKey(dbSession, profileKey);
assertThat(profile.getRulesUpdatedAt()).isNotEmpty();
assertThat(profile.getUserUpdatedAt()).isNotNull();
}
use of org.sonar.db.qualityprofile.QualityProfileDto in project sonarqube by SonarSource.
the class DeleteActionTest method delete_nominal_with_key.
@Test
public void delete_nominal_with_key() throws Exception {
String profileKey = "sonar-way-xoo1-12345";
ComponentDto project = ComponentTesting.newProjectDto(dbTester.organizations().insert(), "polop");
componentDao.insert(session, project);
QualityProfileDto qualityProfile = QualityProfileDto.createFor(profileKey).setOrganizationUuid(defaultOrganizationProvider.get().getUuid()).setLanguage(xoo1.getKey()).setName("Sonar way");
qualityProfileDao.insert(session, qualityProfile);
qualityProfileDao.insertProjectProfileAssociation(project.uuid(), profileKey, session);
session.commit();
logInAsQProfileAdministrator();
tester.newPostRequest("api/qualityprofiles", "delete").setParam("profileKey", "sonar-way-xoo1-12345").execute().assertNoContent();
assertThat(qualityProfileDao.selectByKey(session, "sonar-way-xoo1-12345")).isNull();
assertThat(qualityProfileDao.selectProjects("Sonar way", xoo1.getName(), session)).isEmpty();
}
use of org.sonar.db.qualityprofile.QualityProfileDto in project sonarqube by SonarSource.
the class ExportActionTest method export_with_format.
@Test
public void export_with_format() throws Exception {
QualityProfileDto profile = db.qualityProfiles().insertQualityProfile(QProfileTesting.newXooP1("org-123"));
String result = newWsActionTester(newExporter("polop"), newExporter("palap")).newRequest().setParam("language", profile.getLanguage()).setParam("name", profile.getName()).setParam("exporterKey", "polop").execute().getInput();
assertThat(result).isEqualTo("Profile " + profile.getName() + " exported by polop");
}
use of org.sonar.db.qualityprofile.QualityProfileDto in project sonarqube by SonarSource.
the class InheritanceActionMediumTest method inheritance_no_family.
@Test
public void inheritance_no_family() throws Exception {
// Simple profile, no parent, no child
QualityProfileDto remi = createProfile("xoo", "Nobodys Boy", "xoo-nobody-s-boy-01234");
wsTester.newGetRequest("api/qualityprofiles", "inheritance").setParam("profileKey", remi.getKee()).execute().assertJson(getClass(), "inheritance-simple.json");
}
Aggregations