QualityProfileDto profile = QProfileTesting.newXooP1();
QualityProfileDto subProfile = QProfileTesting.newXooP2().setParentKee(QProfileTesting.XOO_P1_KEY);
db.qualityProfileDao().insert(session, profile, subProfile);
RuleDto rule = createRule(profile.getLanguage(), "rule");
ActiveRuleDto active1 = ActiveRuleDto.createFor(profile, rule)
.setSeverity(rule.getSeverityString());
ActiveRuleDto active2 = ActiveRuleDto.createFor(subProfile, rule)
.setSeverity("MINOR");
db.activeRuleDao().insert(session, active1, active2);
session.commit();
// 0. assert rule child rule is minor
assertThat(db.activeRuleDao().getByKey(session, active2.getKey()).getSeverityString()).isEqualTo("MINOR");
// 1. reset child rule
WsTester.TestRequest request = wsTester.newGetRequest(QProfilesWs.API_ENDPOINT, RuleActivationActions.ACTIVATE_ACTION);
request.setParam("profile_key", subProfile.getKey());
request.setParam("rule_key", rule.getKey().toString());
request.setParam("reset", "true");
request.execute();
session.clearCache();
// 2. assert rule child rule is NOT minor
assertThat(db.activeRuleDao().getByKey(session, active2.getKey()).getSeverityString()).isNotEqualTo("MINOR");
}