@Before public void before() { tester.clearDbAndIndexes(); db = tester.get(DbClient.class); dbSession = db.openSession(false); ruleActivator = tester.get(RuleActivator.class); index = tester.get(ActiveRuleIndex.class); copier = tester.get(QProfileCopier.class); // create pre-defined rules RuleDto xooRule1 = RuleTesting.newXooX1().setSeverity("MINOR"); RuleDto xooRule2 = RuleTesting.newXooX2().setSeverity("MAJOR"); db.deprecatedRuleDao().insert(dbSession, xooRule1, xooRule2); db.deprecatedRuleDao() .insertRuleParam( dbSession, xooRule1, RuleParamDto.createFor(xooRule1) .setName("max") .setDefaultValue("10") .setType(RuleParamType.INTEGER.type())); // create pre-defined profile db.qualityProfileDao().insert(dbSession, QProfileTesting.newXooP1()); dbSession.commit(); dbSession.clearCache(); }
private void initRules() { // create pre-defined rules RuleDto xooRule1 = RuleTesting.newXooX1(); RuleDto xooRule2 = RuleTesting.newXooX2(); db.deprecatedRuleDao().insert(dbSession, xooRule1, xooRule2); db.deprecatedRuleDao() .insertRuleParam( dbSession, xooRule1, RuleParamDto.createFor(xooRule1) .setName("max") .setDefaultValue("10") .setType(RuleParamType.INTEGER.type())); dbSession.commit(); dbSession.clearCache(); }