コード例 #1
0
  @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();
  }
コード例 #2
0
ファイル: IndexSynchronizer.java プロジェクト: ihr/sonarqube
 public void executeDeprecated() {
   DbSession session = db.openSession(false);
   try {
     synchronize(session, db.deprecatedRuleDao(), index.get(RuleIndex.class));
     synchronize(session, db.activeRuleDao(), index.get(ActiveRuleIndex.class));
     session.commit();
   } finally {
     session.close();
   }
 }
コード例 #3
0
 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();
 }