Search in sources :

Example 1 with RuleInspector

use of org.drools.verifier.core.cache.inspectors.RuleInspector in project drools 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.verifier.core.cache.inspectors.RuleInspector) Rule(org.drools.verifier.core.index.model.Rule)

Example 2 with RuleInspector

use of org.drools.verifier.core.cache.inspectors.RuleInspector in project drools by kiegroup.

the class RuleInspectorCache method addRule.

public RuleInspector addRule(final Rule rule) {
    this.index.getRules().add(rule);
    final RuleInspector ruleInspector = new RuleInspector(rule, checkStorage, this, configuration);
    add(ruleInspector);
    return ruleInspector;
}
Also used : RuleInspector(org.drools.verifier.core.cache.inspectors.RuleInspector)

Example 3 with RuleInspector

use of org.drools.verifier.core.cache.inspectors.RuleInspector in project drools 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.verifier.core.cache.inspectors.RuleInspector)

Example 4 with RuleInspector

use of org.drools.verifier.core.cache.inspectors.RuleInspector in project drools 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.verifier.core.cache.inspectors.RuleInspector)

Example 5 with RuleInspector

use of org.drools.verifier.core.cache.inspectors.RuleInspector in project drools by kiegroup.

the class CheckRunManagerTest method testOnlyTestChanges.

@Test
public void testOnlyTestChanges() throws Exception {
    // First run
    this.checkRunManager.run(null, null);
    RuleInspector newRuleInspector = mockRowInspector(3);
    ruleInspectors.add(newRuleInspector);
    this.checkRunManager.addChecks(newRuleInspector.getChecks());
    assertNoIssues(newRuleInspector);
    // Second run
    this.checkRunManager.run(null, null);
    assertHasIssues(newRuleInspector);
    assertEquals(7, ruleInspector1.getChecks().size());
    assertEquals(7, newRuleInspector.getChecks().size());
}
Also used : RuleInspector(org.drools.verifier.core.cache.inspectors.RuleInspector) Test(org.junit.Test)

Aggregations

RuleInspector (org.drools.verifier.core.cache.inspectors.RuleInspector)10 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 Rule (org.drools.verifier.core.index.model.Rule)2 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Comparator (java.util.Comparator)1 Date (java.util.Date)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