Search in sources :

Example 6 with DisconnectedWorkingMemoryEntryPoint

use of org.drools.kiesession.entrypoints.DisconnectedWorkingMemoryEntryPoint in project drools by kiegroup.

the class TemporalEvaluatorFactoryTest method testOverlaps.

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

Example 7 with DisconnectedWorkingMemoryEntryPoint

use of org.drools.kiesession.entrypoints.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.kiesession.entrypoints.DisconnectedWorkingMemoryEntryPoint) EventFactHandle(org.drools.core.common.EventFactHandle) Test(org.junit.Test)

Example 8 with DisconnectedWorkingMemoryEntryPoint

use of org.drools.kiesession.entrypoints.DisconnectedWorkingMemoryEntryPoint in project drools by kiegroup.

the class TemporalEvaluatorFactoryTest method testMetBy.

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

Example 9 with DisconnectedWorkingMemoryEntryPoint

use of org.drools.kiesession.entrypoints.DisconnectedWorkingMemoryEntryPoint in project drools by kiegroup.

the class TemporalEvaluatorFactoryTest method testBefore.

@Test
public void testBefore() {
    registry.addEvaluatorDefinition(BeforeEvaluatorDefinition.class.getName());
    EventFactHandle foo = new EventFactHandle(1, "foo", 1, 1, 2, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
    EventFactHandle bar = new EventFactHandle(2, "bar", 1, 2, 2, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
    EventFactHandle drool = new EventFactHandle(1, "drool", 1, 5, 3, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
    final Object[][] data = { { foo, "before", drool, Boolean.TRUE }, { foo, "before", bar, Boolean.FALSE }, { drool, "before", foo, Boolean.FALSE }, { drool, "before", bar, Boolean.FALSE }, { bar, "before", drool, Boolean.TRUE }, { bar, "before", foo, Boolean.FALSE }, { foo, "not before", drool, Boolean.FALSE }, { foo, "not before", bar, Boolean.TRUE }, { drool, "not before", foo, Boolean.TRUE }, { drool, "not before", bar, Boolean.TRUE }, { bar, "not before", drool, Boolean.FALSE }, { bar, "not before", foo, Boolean.TRUE }, { foo, "before[2]", drool, Boolean.TRUE }, { foo, "before[3]", drool, Boolean.FALSE }, { foo, "before[-1]", bar, Boolean.TRUE }, { foo, "before[-2]", bar, Boolean.TRUE }, { bar, "before[1]", drool, Boolean.TRUE }, { bar, "before[2]", drool, Boolean.FALSE }, { bar, "before[-3]", foo, Boolean.TRUE }, { bar, "before[-2]", foo, Boolean.FALSE }, { drool, "before[-6]", bar, Boolean.TRUE }, { drool, "before[-5]", bar, Boolean.FALSE }, { drool, "before[-7]", foo, Boolean.TRUE }, { drool, "before[-8]", foo, Boolean.TRUE }, { foo, "not before[2]", drool, Boolean.FALSE }, { foo, "not before[3]", drool, Boolean.TRUE }, { foo, "not before[-1]", bar, Boolean.FALSE }, { foo, "not before[-2]", bar, Boolean.FALSE }, { bar, "not before[1]", drool, Boolean.FALSE }, { bar, "not before[2]", drool, Boolean.TRUE }, { bar, "not before[-3]", foo, Boolean.FALSE }, { bar, "not before[-2]", foo, Boolean.TRUE }, { drool, "not before[-6]", bar, Boolean.FALSE }, { drool, "not before[-5]", bar, Boolean.TRUE }, { drool, "not before[-7]", foo, Boolean.FALSE }, { drool, "not before[-8]", foo, Boolean.FALSE }, { foo, "before[2,4]", drool, Boolean.TRUE }, { foo, "before[3,4]", drool, Boolean.FALSE }, { foo, "before[-1,1]", bar, Boolean.TRUE }, { foo, "before[0,-2]", bar, Boolean.TRUE }, { bar, "before[0,4]", drool, Boolean.TRUE }, { bar, "before[2,4]", drool, Boolean.FALSE }, { bar, "before[-4,0]", foo, Boolean.TRUE }, { bar, "before[-2,0]", foo, Boolean.FALSE }, { drool, "before[-6,-3]", bar, Boolean.TRUE }, { drool, "before[-5,-3]", bar, Boolean.FALSE }, { drool, "before[-7,-4]", foo, Boolean.TRUE }, { drool, "before[-6,-4]", foo, Boolean.FALSE }, { foo, "not before[2,4]", drool, Boolean.FALSE }, { foo, "not before[3,4]", drool, Boolean.TRUE }, { foo, "not before[-1,1]", bar, Boolean.FALSE }, { foo, "not before[0,-2]", bar, Boolean.FALSE }, { bar, "not before[0,4]", drool, Boolean.FALSE }, { bar, "not before[2,4]", drool, Boolean.TRUE }, { bar, "not before[-4,0]", foo, Boolean.FALSE }, { bar, "not before[-2,0]", foo, Boolean.TRUE }, { drool, "not before[-6,-3]", bar, Boolean.FALSE }, { drool, "not before[-5,-3]", bar, Boolean.TRUE }, { drool, "not before[-7,-4]", foo, Boolean.FALSE }, { drool, "not before[-6,-4]", foo, Boolean.TRUE } };
    runEvaluatorTest(data, ValueType.OBJECT_TYPE);
}
Also used : DisconnectedWorkingMemoryEntryPoint(org.drools.kiesession.entrypoints.DisconnectedWorkingMemoryEntryPoint) EventFactHandle(org.drools.core.common.EventFactHandle) Test(org.junit.Test)

Example 10 with DisconnectedWorkingMemoryEntryPoint

use of org.drools.kiesession.entrypoints.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.kiesession.entrypoints.DisconnectedWorkingMemoryEntryPoint) EventFactHandle(org.drools.core.common.EventFactHandle) Test(org.junit.Test)

Aggregations

DisconnectedWorkingMemoryEntryPoint (org.drools.kiesession.entrypoints.DisconnectedWorkingMemoryEntryPoint)14 Test (org.junit.Test)14 EventFactHandle (org.drools.core.common.EventFactHandle)13 InternalFactHandle (org.drools.core.common.InternalFactHandle)1 AlphaNode (org.drools.core.reteoo.AlphaNode)1 ReteooFactHandleFactory (org.drools.core.reteoo.ReteooFactHandleFactory)1 Cheese (org.drools.mvel.model.Cheese)1