Search in sources :

Example 6 with RuleInspector

use of org.drools.workbench.services.verifier.core.cache.inspectors.RuleInspector in project drools-wb by kiegroup.

the class CheckRunManagerTest method setUp.

@Before
public void setUp() throws Exception {
    configuration = new AnalyzerConfigurationMock();
    checkStorage = new CheckStorage(new CheckFactory(configuration) {

        @Override
        public HashSet<Check> makeSingleChecks(final RuleInspector ruleInspector) {
            final HashSet<Check> result = new HashSet<>();
            result.add(new MockSingleCheck(ruleInspector));
            return result;
        }
    });
    ruleInspectors = new ArrayList<>();
    when(cache.all()).thenReturn(ruleInspectors);
    ruleInspector1 = mockRowInspector(1);
    ruleInspectors.add(ruleInspector1);
    ruleInspector2 = mockRowInspector(2);
    ruleInspectors.add(ruleInspector2);
    ruleInspector3 = mockRowInspector(3);
    ruleInspectors.add(ruleInspector3);
    checkRunManager.addChecks(ruleInspector1.getChecks());
    checkRunManager.addChecks(ruleInspector2.getChecks());
    checkRunManager.addChecks(ruleInspector3.getChecks());
}
Also used : RuleInspector(org.drools.workbench.services.verifier.core.cache.inspectors.RuleInspector) SingleCheck(org.drools.workbench.services.verifier.core.checks.base.SingleCheck) Check(org.drools.workbench.services.verifier.core.checks.base.Check) CheckFactory(org.drools.workbench.services.verifier.core.checks.base.CheckFactory) CheckStorage(org.drools.workbench.services.verifier.core.checks.base.CheckStorage) HashSet(java.util.HashSet) Before(org.junit.Before)

Example 7 with RuleInspector

use of org.drools.workbench.services.verifier.core.cache.inspectors.RuleInspector in project drools-wb by kiegroup.

the class RuleInspectorCache method reset.

public void reset() {
    for (final RuleInspector ruleInspector : ruleInspectors.values()) {
        ruleInspector.clearChecks();
    }
    ruleInspectors.clear();
    generalChecks.clear();
    for (final Rule rule : index.getRules().where(Rule.uuid().any()).select().all()) {
        add(new RuleInspector(rule, checkStorage, this, configuration));
    }
    generalChecks.add(new SingleRangeCheck(configuration, ruleInspectors.values()));
}
Also used : RuleInspector(org.drools.workbench.services.verifier.core.cache.inspectors.RuleInspector) SingleRangeCheck(org.drools.workbench.services.verifier.core.checks.SingleRangeCheck) Rule(org.drools.workbench.services.verifier.api.client.index.Rule)

Example 8 with RuleInspector

use of org.drools.workbench.services.verifier.core.cache.inspectors.RuleInspector in project drools-wb by kiegroup.

the class RuleInspectorCache method removeRow.

public RuleInspector removeRow(final int rowNumber) {
    final Rule rule = getRule(rowNumber);
    final RuleInspector remove = ruleInspectors.remove(rule);
    index.getRules().remove(rule);
    return remove;
}
Also used : RuleInspector(org.drools.workbench.services.verifier.core.cache.inspectors.RuleInspector) Rule(org.drools.workbench.services.verifier.api.client.index.Rule)

Example 9 with RuleInspector

use of org.drools.workbench.services.verifier.core.cache.inspectors.RuleInspector in project drools-wb by kiegroup.

the class CheckStorage method makeChecks.

public void makeChecks(final RuleInspector ruleInspector) {
    makeSingleRowChecks(ruleInspector);
    final Set<RuleInspector> knownRuleInspectors = ruleInspectorChecks.keys();
    makePairRowChecks(ruleInspector, knownRuleInspectors);
    for (final RuleInspector other : knownRuleInspectors) {
        if (!other.equals(ruleInspector)) {
            // Add pair inspector for old values.
            checkFactory.makePairRowCheck(other, ruleInspector).ifPresent(pairCheckStorage::add);
        }
    }
}
Also used : RuleInspector(org.drools.workbench.services.verifier.core.cache.inspectors.RuleInspector)

Example 10 with RuleInspector

use of org.drools.workbench.services.verifier.core.cache.inspectors.RuleInspector in project drools-wb by kiegroup.

the class Analyzer method newRule.

public void newRule(final Rule rule) {
    final RuleInspector ruleInspector = cache.addRule(rule);
    checkRunManager.addChecks(ruleInspector.getChecks());
}
Also used : RuleInspector(org.drools.workbench.services.verifier.core.cache.inspectors.RuleInspector)

Aggregations

RuleInspector (org.drools.workbench.services.verifier.core.cache.inspectors.RuleInspector)10 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 Rule (org.drools.workbench.services.verifier.api.client.index.Rule)2 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Comparator (java.util.Comparator)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Map (java.util.Map)1 Entry (java.util.Map.Entry)1 Objects (java.util.Objects)1 Set (java.util.Set)1 SortedSet (java.util.SortedSet)1 TreeSet (java.util.TreeSet)1 Consumer (java.util.function.Consumer)1 Function (java.util.function.Function)1 Collectors.groupingBy (java.util.stream.Collectors.groupingBy)1 Collectors.toList (java.util.stream.Collectors.toList)1