Search in sources :

Example 1 with AnalyzerConfigurationMock

use of org.drools.verifier.core.AnalyzerConfigurationMock in project drools 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 : AnalyzerConfigurationMock(org.drools.verifier.core.AnalyzerConfigurationMock) RuleInspector(org.drools.verifier.core.cache.inspectors.RuleInspector) Check(org.drools.verifier.core.checks.base.Check) SingleCheck(org.drools.verifier.core.checks.base.SingleCheck) CheckFactory(org.drools.verifier.core.checks.base.CheckFactory) CheckStorage(org.drools.verifier.core.checks.base.CheckStorage) HashSet(java.util.HashSet) Before(org.junit.Before)

Example 2 with AnalyzerConfigurationMock

use of org.drools.verifier.core.AnalyzerConfigurationMock in project drools by kiegroup.

the class CheckFactoryTest method emptyWhiteList.

@Test
public void emptyWhiteList() throws Exception {
    final AnalyzerConfigurationMock configuration = new AnalyzerConfigurationMock(CheckConfiguration.newEmpty());
    assertTrue(new CheckFactory(configuration).makeSingleChecks(mock(RuleInspector.class)).isEmpty());
    assertFalse(new CheckFactory(configuration).makePairRowCheck(mock(RuleInspector.class), mock(RuleInspector.class)).isPresent());
}
Also used : AnalyzerConfigurationMock(org.drools.verifier.core.AnalyzerConfigurationMock) RuleInspector(org.drools.verifier.core.cache.inspectors.RuleInspector) Test(org.junit.Test)

Example 3 with AnalyzerConfigurationMock

use of org.drools.verifier.core.AnalyzerConfigurationMock in project drools by kiegroup.

the class ConditionsInspectorTest method setUp.

@Before
public void setUp() throws Exception {
    configurationMock = new AnalyzerConfigurationMock();
    field = new Field(new ObjectField("Person", "Integer", "age", configurationMock), "Person", "Integer", "age", configurationMock);
}
Also used : ObjectField(org.drools.verifier.core.index.model.ObjectField) Field(org.drools.verifier.core.index.model.Field) AnalyzerConfigurationMock(org.drools.verifier.core.AnalyzerConfigurationMock) ObjectField(org.drools.verifier.core.index.model.ObjectField) Before(org.junit.Before)

Example 4 with AnalyzerConfigurationMock

use of org.drools.verifier.core.AnalyzerConfigurationMock in project drools by kiegroup.

the class ActionInspectorConflictResolverTest method testRedundancy006.

@Test
public void testRedundancy006() throws Exception {
    ActionInspector a = createSetActionInspector(new Field(mock(ObjectField.class), "Person", "Integer", "age", new AnalyzerConfigurationMock()), 20);
    ActionInspector b = createSetActionInspector(new Field(mock(ObjectField.class), "Person", "Integer", "age", new AnalyzerConfigurationMock()), "20");
    assertTrue(a.isRedundant(b));
    assertTrue(b.isRedundant(a));
}
Also used : ObjectField(org.drools.verifier.core.index.model.ObjectField) Field(org.drools.verifier.core.index.model.Field) AnalyzerConfigurationMock(org.drools.verifier.core.AnalyzerConfigurationMock) Test(org.junit.Test)

Example 5 with AnalyzerConfigurationMock

use of org.drools.verifier.core.AnalyzerConfigurationMock in project drools by kiegroup.

the class ActionInspectorConflictResolverTest method testRedundancy008.

@Test
public void testRedundancy008() throws Exception {
    Date date = new Date();
    ActionInspector a = createSetActionInspector(new Field(mock(ObjectField.class), "Person", "Integer", "birthDay", new AnalyzerConfigurationMock()), date);
    ActionInspector b = createSetActionInspector(new Field(mock(ObjectField.class), "Person", "Integer", "birthDay", new AnalyzerConfigurationMock()), format(date));
    assertTrue(a.isRedundant(b));
    assertTrue(b.isRedundant(a));
}
Also used : ObjectField(org.drools.verifier.core.index.model.ObjectField) Field(org.drools.verifier.core.index.model.Field) AnalyzerConfigurationMock(org.drools.verifier.core.AnalyzerConfigurationMock) Date(java.util.Date) Test(org.junit.Test)

Aggregations

AnalyzerConfigurationMock (org.drools.verifier.core.AnalyzerConfigurationMock)29 Field (org.drools.verifier.core.index.model.Field)17 ObjectField (org.drools.verifier.core.index.model.ObjectField)17 Test (org.junit.Test)16 Before (org.junit.Before)13 RuleInspector (org.drools.verifier.core.cache.inspectors.RuleInspector)3 Date (java.util.Date)2 ObjectType (org.drools.verifier.core.index.model.ObjectType)2 InspectorList (org.drools.verifier.core.maps.InspectorList)2 HashSet (java.util.HashSet)1 Check (org.drools.verifier.core.checks.base.Check)1 CheckFactory (org.drools.verifier.core.checks.base.CheckFactory)1 CheckStorage (org.drools.verifier.core.checks.base.CheckStorage)1 SingleCheck (org.drools.verifier.core.checks.base.SingleCheck)1 Values (org.drools.verifier.core.index.keys.Values)1 Column (org.drools.verifier.core.index.model.Column)1 Columns (org.drools.verifier.core.index.model.Columns)1 Conditions (org.drools.verifier.core.index.model.Conditions)1 FieldAction (org.drools.verifier.core.index.model.FieldAction)1 ObjectTypes (org.drools.verifier.core.index.model.ObjectTypes)1