Search in sources :

Example 6 with ActiveRuleIndexer

use of org.sonar.server.qualityprofile.index.ActiveRuleIndexer in project sonarqube by SonarSource.

the class QProfileBackuperMediumTest method before.

@Before
public void before() {
    tester.clearDbAndIndexes();
    db = tester.get(DbClient.class);
    dbSession = db.openSession(false);
    ruleIndexer = tester.get(RuleIndexer.class);
    activeRuleIndexer = tester.get(ActiveRuleIndexer.class);
    // create pre-defined rules
    RuleDto xooRule1 = newXooX1().setSeverity("MINOR").setLanguage("xoo");
    RuleDto xooRule2 = newXooX2().setSeverity("MAJOR").setLanguage("xoo");
    db.ruleDao().insert(dbSession, xooRule1);
    db.ruleDao().insert(dbSession, xooRule2);
    db.ruleDao().insertRuleParam(dbSession, xooRule1, RuleParamDto.createFor(xooRule1).setName("max").setDefaultValue("10").setType(RuleParamType.INTEGER.type()));
    dbSession.commit();
    dbSession.clearCache();
    ruleIndexer.index();
}
Also used : ActiveRuleIndexer(org.sonar.server.qualityprofile.index.ActiveRuleIndexer) DbClient(org.sonar.db.DbClient) ActiveRuleDto(org.sonar.db.qualityprofile.ActiveRuleDto) RuleDto(org.sonar.db.rule.RuleDto) ActiveRuleIndexer(org.sonar.server.qualityprofile.index.ActiveRuleIndexer) RuleIndexer(org.sonar.server.rule.index.RuleIndexer) Before(org.junit.Before)

Example 7 with ActiveRuleIndexer

use of org.sonar.server.qualityprofile.index.ActiveRuleIndexer in project sonarqube by SonarSource.

the class InheritanceActionMediumTest method setUp.

@Before
public void setUp() {
    tester.clearDbAndIndexes();
    db = tester.get(DbClient.class);
    session = db.openSession(false);
    ruleIndexer = tester.get(RuleIndexer.class);
    activeRuleIndexer = tester.get(ActiveRuleIndexer.class);
    wsTester = new WsTester(tester.get(QProfilesWs.class));
}
Also used : ActiveRuleIndexer(org.sonar.server.qualityprofile.index.ActiveRuleIndexer) DbClient(org.sonar.db.DbClient) WsTester(org.sonar.server.ws.WsTester) ActiveRuleIndexer(org.sonar.server.qualityprofile.index.ActiveRuleIndexer) RuleIndexer(org.sonar.server.rule.index.RuleIndexer) Before(org.junit.Before)

Example 8 with ActiveRuleIndexer

use of org.sonar.server.qualityprofile.index.ActiveRuleIndexer in project sonarqube by SonarSource.

the class RegisterRulesTest method before.

@Before
public void before() {
    ruleIndexer = new RuleIndexer(es.client(), dbClient);
    ruleIndex = new RuleIndex(es.client(), system);
    activeRuleIndexer = new ActiveRuleIndexer(dbClient, es.client());
}
Also used : ActiveRuleIndexer(org.sonar.server.qualityprofile.index.ActiveRuleIndexer) RuleIndex(org.sonar.server.rule.index.RuleIndex) ActiveRuleIndexer(org.sonar.server.qualityprofile.index.ActiveRuleIndexer) RuleIndexer(org.sonar.server.rule.index.RuleIndexer) Before(org.junit.Before)

Example 9 with ActiveRuleIndexer

use of org.sonar.server.qualityprofile.index.ActiveRuleIndexer in project sonarqube by SonarSource.

the class ChangeParentActionTest method setUp.

@Before
public void setUp() {
    dbClient = db.getDbClient();
    dbSession = db.getSession();
    EsClient esClient = es.client();
    ruleIndex = new RuleIndex(esClient, System2.INSTANCE);
    ruleIndexer = new RuleIndexer(esClient, dbClient);
    activeRuleIndexer = new ActiveRuleIndexer(dbClient, esClient);
    TypeValidations typeValidations = new TypeValidations(Collections.emptyList());
    RuleActivator ruleActivator = new RuleActivator(System2.INSTANCE, dbClient, typeValidations, userSession);
    qProfileTree = new QProfileTreeImpl(dbClient, ruleActivator, System2.INSTANCE, activeRuleIndexer, mock(QualityProfileChangeEventService.class));
    ChangeParentAction underTest = new ChangeParentAction(dbClient, qProfileTree, new Languages(), new QProfileWsSupport(dbClient, userSession), userSession);
    ws = new WsActionTester(underTest);
    userSession.logIn().addPermission(ADMINISTER_QUALITY_PROFILES);
}
Also used : ActiveRuleIndexer(org.sonar.server.qualityprofile.index.ActiveRuleIndexer) RuleIndex(org.sonar.server.rule.index.RuleIndex) ActiveRuleIndexer(org.sonar.server.qualityprofile.index.ActiveRuleIndexer) RuleIndexer(org.sonar.server.rule.index.RuleIndexer) TypeValidations(org.sonar.server.util.TypeValidations) RuleActivator(org.sonar.server.qualityprofile.builtin.RuleActivator) QProfileTreeImpl(org.sonar.server.qualityprofile.QProfileTreeImpl) Languages(org.sonar.api.resources.Languages) EsClient(org.sonar.server.es.EsClient) WsActionTester(org.sonar.server.ws.WsActionTester) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)9 ActiveRuleIndexer (org.sonar.server.qualityprofile.index.ActiveRuleIndexer)9 RuleIndexer (org.sonar.server.rule.index.RuleIndexer)6 DbClient (org.sonar.db.DbClient)5 ActiveRuleDto (org.sonar.db.qualityprofile.ActiveRuleDto)4 RuleDto (org.sonar.db.rule.RuleDto)3 TypeValidations (org.sonar.server.util.TypeValidations)3 QualityProfileChangeEventService (org.sonar.server.pushapi.qualityprofile.QualityProfileChangeEventService)2 ActiveRuleIndex (org.sonar.server.qualityprofile.index.ActiveRuleIndex)2 RuleIndex (org.sonar.server.rule.index.RuleIndex)2 IntegerTypeValidation (org.sonar.server.util.IntegerTypeValidation)2 Arrays.asList (java.util.Arrays.asList)1 Collection (java.util.Collection)1 Collections.emptyMap (java.util.Collections.emptyMap)1 Collections.singletonList (java.util.Collections.singletonList)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Nullable (javax.annotation.Nullable)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1