use of org.drools.workbench.services.verifier.core.cache.inspectors.RuleInspector in project drools-wb 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;
}
use of org.drools.workbench.services.verifier.core.cache.inspectors.RuleInspector in project drools-wb by kiegroup.
the class RuleInspectorCacheTest method assertContainsRowNumbers.
private void assertContainsRowNumbers(final Collection<RuleInspector> all, final int... numbers) {
final ArrayList<Integer> rowNumbers = new ArrayList<>();
for (final RuleInspector ruleInspector : all) {
final int rowIndex = ruleInspector.getRowIndex();
rowNumbers.add(rowIndex);
}
for (final int number : numbers) {
assertTrue(rowNumbers.toString(), rowNumbers.contains(number));
}
}
use of org.drools.workbench.services.verifier.core.cache.inspectors.RuleInspector in project drools-wb by kiegroup.
the class PairCheckStorage method removeByOther.
private List<PairCheckBundle> removeByOther(final RuleInspector ruleInspector) {
final MultiSet<RuleInspector, PairCheckBundle> removedMap = pairChecksByOtherRowInspector.remove(ruleInspector);
if (removedMap != null) {
for (final RuleInspector inspector : removedMap.keys()) {
final Collection<PairCheckBundle> collection = removedMap.get(inspector);
pairChecks.get(inspector).removeAll(collection);
getByOther(inspector).remove(ruleInspector);
}
return removedMap.allValues();
} else {
return Collections.EMPTY_LIST;
}
}
use of org.drools.workbench.services.verifier.core.cache.inspectors.RuleInspector in project drools-wb 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());
}
use of org.drools.workbench.services.verifier.core.cache.inspectors.RuleInspector in project drools-wb by kiegroup.
the class SingleRangeCheck method partition.
private Map<PartitionKey, List<RuleInspector>> partition(Collection<ObjectField> partitionFields, Collection<RuleInspector> rules, int conditionIndex) {
List<PartitionKey> keysWithNull = new ArrayList<>();
Map<PartitionKey, List<RuleInspector>> partitions = new HashMap<>();
for (RuleInspector rule : rules) {
PartitionKey key = getPartitionKey(partitionFields, rule, conditionIndex);
partitions.computeIfAbsent(key, k -> {
if (k.hasNulls()) {
keysWithNull.add(k);
}
return new ArrayList<>();
}).add(rule);
}
for (PartitionKey key : keysWithNull) {
for (Map.Entry<PartitionKey, List<RuleInspector>> partition : partitions.entrySet()) {
if (key.subsumes(partition.getKey())) {
partition.getValue().addAll(partitions.get(key));
}
}
}
keysWithNull.forEach(partitions::remove);
return partitions;
}
Aggregations