Search in sources :

Example 1 with IntegerTypeValidation

use of org.sonar.server.util.IntegerTypeValidation in project sonarqube by SonarSource.

the class QProfileComparisonTest method before.

@Before
public void before() {
    DbClient db = dbTester.getDbClient();
    dbSession = db.openSession(false);
    RuleIndex ruleIndex = new RuleIndex(es.client(), System2.INSTANCE);
    ActiveRuleIndexer activeRuleIndexer = new ActiveRuleIndexer(db, es.client());
    QualityProfileChangeEventService qualityProfileChangeEventService = mock(QualityProfileChangeEventService.class);
    RuleActivator ruleActivator = new RuleActivator(System2.INSTANCE, db, new TypeValidations(singletonList(new IntegerTypeValidation())), userSession);
    qProfileRules = new QProfileRulesImpl(db, ruleActivator, ruleIndex, activeRuleIndexer, qualityProfileChangeEventService);
    comparison = new QProfileComparison(db);
    xooRule1 = RuleTesting.newXooX1().setSeverity("MINOR").getDefinition();
    xooRule2 = RuleTesting.newXooX2().setSeverity("MAJOR").getDefinition();
    db.ruleDao().insert(dbSession, xooRule1);
    db.ruleDao().insert(dbSession, xooRule2);
    db.ruleDao().insertRuleParam(dbSession, xooRule1, RuleParamDto.createFor(xooRule1).setName("max").setType(RuleParamType.INTEGER.type()));
    db.ruleDao().insertRuleParam(dbSession, xooRule1, RuleParamDto.createFor(xooRule1).setName("min").setType(RuleParamType.INTEGER.type()));
    left = QualityProfileTesting.newQualityProfileDto().setLanguage("xoo");
    right = QualityProfileTesting.newQualityProfileDto().setLanguage("xoo");
    db.qualityProfileDao().insert(dbSession, left, right);
    dbSession.commit();
}
Also used : ActiveRuleIndexer(org.sonar.server.qualityprofile.index.ActiveRuleIndexer) QualityProfileChangeEventService(org.sonar.server.pushapi.qualityprofile.QualityProfileChangeEventService) RuleIndex(org.sonar.server.rule.index.RuleIndex) DbClient(org.sonar.db.DbClient) IntegerTypeValidation(org.sonar.server.util.IntegerTypeValidation) RuleActivator(org.sonar.server.qualityprofile.builtin.RuleActivator) TypeValidations(org.sonar.server.util.TypeValidations) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)1 DbClient (org.sonar.db.DbClient)1 QualityProfileChangeEventService (org.sonar.server.pushapi.qualityprofile.QualityProfileChangeEventService)1 RuleActivator (org.sonar.server.qualityprofile.builtin.RuleActivator)1 ActiveRuleIndexer (org.sonar.server.qualityprofile.index.ActiveRuleIndexer)1 RuleIndex (org.sonar.server.rule.index.RuleIndex)1 IntegerTypeValidation (org.sonar.server.util.IntegerTypeValidation)1 TypeValidations (org.sonar.server.util.TypeValidations)1