Search in sources :

Example 1 with DisconnectedWorkingMemoryEntryPoint

use of org.drools.core.common.DisconnectedWorkingMemoryEntryPoint in project drools by kiegroup.

the class TemporalEvaluatorFactoryTest method testStartedBy.

@Test
public void testStartedBy() {
    registry.addEvaluatorDefinition(DuringEvaluatorDefinition.class.getName());
    EventFactHandle foo = new EventFactHandle(1, "foo", 1, 2, 10, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
    EventFactHandle bar = new EventFactHandle(2, "bar", 1, 2, 7, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
    EventFactHandle drool = new EventFactHandle(1, "drool", 1, 2, 10, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
    EventFactHandle mole = new EventFactHandle(1, "mole", 1, 1, 6, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
    final Object[][] data = { { foo, "startedby", bar, Boolean.TRUE }, { foo, "startedby", drool, Boolean.FALSE }, { foo, "startedby", mole, Boolean.FALSE }, { bar, "startedby", foo, Boolean.FALSE }, { foo, "not startedby", bar, Boolean.FALSE }, { foo, "not startedby", drool, Boolean.TRUE }, { foo, "not startedby", mole, Boolean.TRUE }, { bar, "not startedby", foo, Boolean.TRUE }, { foo, "startedby[1]", bar, Boolean.TRUE }, { foo, "startedby[1]", drool, Boolean.FALSE }, { foo, "startedby[1]", mole, Boolean.TRUE }, { bar, "startedby[1]", foo, Boolean.FALSE }, { foo, "not startedby[1]", bar, Boolean.FALSE }, { foo, "not startedby[1]", drool, Boolean.TRUE }, { foo, "not startedby[1]", mole, Boolean.FALSE }, { bar, "not startedby[1]", foo, Boolean.TRUE }, { foo, "startedby[3]", mole, Boolean.TRUE } };
    runEvaluatorTest(data, ValueType.OBJECT_TYPE);
}
Also used : DisconnectedWorkingMemoryEntryPoint(org.drools.core.common.DisconnectedWorkingMemoryEntryPoint) EventFactHandle(org.drools.core.common.EventFactHandle) DuringEvaluatorDefinition(org.drools.core.base.evaluators.DuringEvaluatorDefinition) Test(org.junit.Test)

Example 2 with DisconnectedWorkingMemoryEntryPoint

use of org.drools.core.common.DisconnectedWorkingMemoryEntryPoint in project drools by kiegroup.

the class TemporalEvaluatorFactoryTest method testDuring.

@Test
public void testDuring() {
    registry.addEvaluatorDefinition(DuringEvaluatorDefinition.class.getName());
    EventFactHandle foo = new EventFactHandle(1, "foo", 1, 2, 10, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
    EventFactHandle bar = new EventFactHandle(2, "bar", 1, 4, 7, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
    EventFactHandle drool = new EventFactHandle(1, "drool", 1, 1, 5, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
    EventFactHandle mole = new EventFactHandle(1, "mole", 1, 7, 6, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
    final Object[][] data = { { foo, "during", bar, Boolean.FALSE }, { foo, "during", drool, Boolean.FALSE }, { foo, "during", mole, Boolean.FALSE }, { bar, "during", foo, Boolean.TRUE }, { bar, "during", drool, Boolean.FALSE }, { bar, "during", mole, Boolean.FALSE }, { foo, "not during", bar, Boolean.TRUE }, { foo, "not during", drool, Boolean.TRUE }, { foo, "not during", mole, Boolean.TRUE }, { bar, "not during", foo, Boolean.FALSE }, { bar, "not during", drool, Boolean.TRUE }, { bar, "not during", mole, Boolean.TRUE }, { bar, "during[2]", foo, Boolean.TRUE }, { bar, "during[3]", foo, Boolean.TRUE }, { bar, "during[1]", foo, Boolean.FALSE }, { bar, "not during[2]", foo, Boolean.FALSE }, { bar, "not during[3]", foo, Boolean.FALSE }, { bar, "not during[1]", foo, Boolean.TRUE }, { bar, "during[1, 2]", foo, Boolean.TRUE }, { bar, "during[2, 3]", foo, Boolean.FALSE }, { bar, "during[3, 3]", foo, Boolean.FALSE }, { bar, "not during[1, 2]", foo, Boolean.FALSE }, { bar, "not during[2, 3]", foo, Boolean.TRUE }, { bar, "not during[3, 3]", foo, Boolean.TRUE }, { bar, "during[2, 2, 1, 1]", foo, Boolean.TRUE }, { bar, "during[1, 5, 1, 3]", foo, Boolean.TRUE }, { bar, "during[0, 1, 0, 3]", foo, Boolean.FALSE }, { bar, "not during[2, 2, 1, 1]", foo, Boolean.FALSE }, { bar, "not during[1, 5, 1, 3]", foo, Boolean.FALSE }, { bar, "not during[0, 1, 0, 3]", foo, Boolean.TRUE } };
    runEvaluatorTest(data, ValueType.OBJECT_TYPE);
}
Also used : DisconnectedWorkingMemoryEntryPoint(org.drools.core.common.DisconnectedWorkingMemoryEntryPoint) EventFactHandle(org.drools.core.common.EventFactHandle) DuringEvaluatorDefinition(org.drools.core.base.evaluators.DuringEvaluatorDefinition) Test(org.junit.Test)

Example 3 with DisconnectedWorkingMemoryEntryPoint

use of org.drools.core.common.DisconnectedWorkingMemoryEntryPoint in project drools by kiegroup.

the class TemporalEvaluatorFactoryTest method testOverlapedBy.

@Test
public void testOverlapedBy() {
    registry.addEvaluatorDefinition(DuringEvaluatorDefinition.class.getName());
    EventFactHandle foo = new EventFactHandle(1, "foo", 1, 7, 8, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
    EventFactHandle bar = new EventFactHandle(2, "bar", 1, 2, 8, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
    EventFactHandle drool = new EventFactHandle(1, "drool", 1, 11, 5, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
    EventFactHandle mole = new EventFactHandle(1, "mole", 1, 7, 3, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
    final Object[][] data = { { foo, "overlappedby", bar, Boolean.TRUE }, { foo, "overlappedby", drool, Boolean.FALSE }, { foo, "overlappedby", mole, Boolean.FALSE }, { foo, "not overlappedby", bar, Boolean.FALSE }, { foo, "not overlappedby", drool, Boolean.TRUE }, { foo, "not overlappedby", mole, Boolean.TRUE }, { foo, "overlappedby[3]", bar, Boolean.TRUE }, { foo, "overlappedby[3]", drool, Boolean.FALSE }, { foo, "overlappedby[3]", mole, Boolean.FALSE }, { foo, "overlappedby[2]", bar, Boolean.FALSE }, { foo, "overlappedby[6]", mole, Boolean.FALSE }, { foo, "not overlappedby[3]", bar, Boolean.FALSE }, { foo, "not overlappedby[3]", drool, Boolean.TRUE }, { foo, "not overlappedby[3]", mole, Boolean.TRUE }, { foo, "not overlappedby[2]", bar, Boolean.TRUE }, { foo, "not overlappedby[6]", mole, Boolean.TRUE }, { foo, "overlappedby[1,3]", bar, Boolean.TRUE }, { foo, "overlappedby[1,3]", drool, Boolean.FALSE }, { foo, "overlappedby[1,3]", mole, Boolean.FALSE }, { foo, "overlappedby[4,6]", bar, Boolean.FALSE }, { foo, "overlappedby[1,8]", mole, Boolean.FALSE }, { foo, "not overlappedby[1,3]", bar, Boolean.FALSE }, { foo, "not overlappedby[1,3]", drool, Boolean.TRUE }, { foo, "not overlappedby[1,3]", mole, Boolean.TRUE }, { foo, "not overlappedby[4,6]", bar, Boolean.TRUE }, { foo, "not overlappedby[1,8]", mole, Boolean.TRUE } };
    runEvaluatorTest(data, ValueType.OBJECT_TYPE);
}
Also used : DisconnectedWorkingMemoryEntryPoint(org.drools.core.common.DisconnectedWorkingMemoryEntryPoint) EventFactHandle(org.drools.core.common.EventFactHandle) DuringEvaluatorDefinition(org.drools.core.base.evaluators.DuringEvaluatorDefinition) Test(org.junit.Test)

Example 4 with DisconnectedWorkingMemoryEntryPoint

use of org.drools.core.common.DisconnectedWorkingMemoryEntryPoint in project drools by kiegroup.

the class TemporalEvaluatorFactoryTest method testFinishedBy.

@Test
public void testFinishedBy() {
    registry.addEvaluatorDefinition(DuringEvaluatorDefinition.class.getName());
    EventFactHandle foo = new EventFactHandle(1, "foo", 1, 2, 10, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
    EventFactHandle bar = new EventFactHandle(2, "bar", 1, 5, 7, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
    EventFactHandle drool = new EventFactHandle(1, "drool", 1, 2, 10, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
    EventFactHandle mole = new EventFactHandle(1, "mole", 1, 7, 6, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
    final Object[][] data = { { foo, "finishedby", bar, Boolean.TRUE }, { foo, "finishedby", drool, Boolean.FALSE }, { foo, "finishedby", mole, Boolean.FALSE }, { bar, "finishedby", foo, Boolean.FALSE }, { foo, "not finishedby", bar, Boolean.FALSE }, { foo, "not finishedby", drool, Boolean.TRUE }, { foo, "not finishedby", mole, Boolean.TRUE }, { bar, "not finishedby", foo, Boolean.TRUE }, { foo, "finishedby[1]", bar, Boolean.TRUE }, { foo, "finishedby[1]", drool, Boolean.FALSE }, { foo, "finishedby[1]", mole, Boolean.TRUE }, { bar, "finishedby[1]", foo, Boolean.FALSE }, { foo, "not finishedby[1]", bar, Boolean.FALSE }, { foo, "not finishedby[1]", drool, Boolean.TRUE }, { foo, "not finishedby[1]", mole, Boolean.FALSE }, { bar, "not finishedby[1]", foo, Boolean.TRUE }, { foo, "finishedby[3]", mole, Boolean.TRUE } };
    runEvaluatorTest(data, ValueType.OBJECT_TYPE);
}
Also used : DisconnectedWorkingMemoryEntryPoint(org.drools.core.common.DisconnectedWorkingMemoryEntryPoint) EventFactHandle(org.drools.core.common.EventFactHandle) DuringEvaluatorDefinition(org.drools.core.base.evaluators.DuringEvaluatorDefinition) Test(org.junit.Test)

Example 5 with DisconnectedWorkingMemoryEntryPoint

use of org.drools.core.common.DisconnectedWorkingMemoryEntryPoint in project drools by kiegroup.

the class TemporalEvaluatorFactoryTest method testIncludes.

@Test
public void testIncludes() {
    registry.addEvaluatorDefinition(DuringEvaluatorDefinition.class.getName());
    EventFactHandle foo = new EventFactHandle(1, "foo", 1, 2, 10, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
    EventFactHandle bar = new EventFactHandle(2, "bar", 1, 4, 7, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
    EventFactHandle drool = new EventFactHandle(1, "drool", 1, 1, 5, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
    EventFactHandle mole = new EventFactHandle(1, "mole", 1, 7, 6, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
    final Object[][] data = { { bar, "includes", foo, Boolean.FALSE }, { drool, "includes", foo, Boolean.FALSE }, { mole, "includes", foo, Boolean.FALSE }, { foo, "includes", bar, Boolean.TRUE }, { drool, "includes", bar, Boolean.FALSE }, { mole, "includes", bar, Boolean.FALSE }, { bar, "not includes", foo, Boolean.TRUE }, { drool, "not includes", foo, Boolean.TRUE }, { mole, "not includes", foo, Boolean.TRUE }, { foo, "not includes", bar, Boolean.FALSE }, { drool, "not includes", bar, Boolean.TRUE }, { mole, "not includes", bar, Boolean.TRUE }, { foo, "includes[2]", bar, Boolean.TRUE }, { foo, "includes[3]", bar, Boolean.TRUE }, { foo, "includes[1]", bar, Boolean.FALSE }, { foo, "not includes[2]", bar, Boolean.FALSE }, { foo, "not includes[3]", bar, Boolean.FALSE }, { foo, "not includes[1]", bar, Boolean.TRUE }, { foo, "includes[1, 2]", bar, Boolean.TRUE }, { foo, "includes[2, 3]", bar, Boolean.FALSE }, { foo, "includes[3, 3]", bar, Boolean.FALSE }, { foo, "not includes[1, 2]", bar, Boolean.FALSE }, { foo, "not includes[2, 3]", bar, Boolean.TRUE }, { foo, "not includes[3, 3]", bar, Boolean.TRUE }, { foo, "includes[2, 2, 1, 1]", bar, Boolean.TRUE }, { foo, "includes[1, 5, 1, 3]", bar, Boolean.TRUE }, { foo, "includes[0, 1, 0, 3]", bar, Boolean.FALSE }, { foo, "not includes[2, 2, 1, 1]", bar, Boolean.FALSE }, { foo, "not includes[1, 5, 1, 3]", bar, Boolean.FALSE }, { foo, "not includes[0, 1, 0, 3]", bar, Boolean.TRUE } };
    runEvaluatorTest(data, ValueType.OBJECT_TYPE);
}
Also used : DisconnectedWorkingMemoryEntryPoint(org.drools.core.common.DisconnectedWorkingMemoryEntryPoint) EventFactHandle(org.drools.core.common.EventFactHandle) DuringEvaluatorDefinition(org.drools.core.base.evaluators.DuringEvaluatorDefinition) Test(org.junit.Test)

Aggregations

DisconnectedWorkingMemoryEntryPoint (org.drools.core.common.DisconnectedWorkingMemoryEntryPoint)15 Test (org.junit.Test)15 EventFactHandle (org.drools.core.common.EventFactHandle)13 DuringEvaluatorDefinition (org.drools.core.base.evaluators.DuringEvaluatorDefinition)10 AfterEvaluatorDefinition (org.drools.core.base.evaluators.AfterEvaluatorDefinition)1 BeforeEvaluatorDefinition (org.drools.core.base.evaluators.BeforeEvaluatorDefinition)1 CoincidesEvaluatorDefinition (org.drools.core.base.evaluators.CoincidesEvaluatorDefinition)1 ObjectFieldImpl (org.drools.core.base.field.ObjectFieldImpl)1 DefaultFactHandle (org.drools.core.common.DefaultFactHandle)1 InternalFactHandle (org.drools.core.common.InternalFactHandle)1 MvelConstraintTestUtil (org.drools.core.rule.MvelConstraintTestUtil)1 MvelConstraint (org.drools.core.rule.constraint.MvelConstraint)1 InternalReadAccessor (org.drools.core.spi.InternalReadAccessor)1 Cheese (org.drools.core.test.model.Cheese)1