Search in sources :

Example 1 with PhreakJoinNode

use of org.drools.core.phreak.PhreakJoinNode in project drools by kiegroup.

the class Scenario method run.

public Scenario run() {
    previousResultTuples = bm.getSegmentMemory().getFirst().getStagedLeftTuples();
    actualResultLeftTuples = new TupleSetsImpl<LeftTuple>();
    if (phreakNode == PhreakJoinNode.class) {
        new PhreakJoinNode().doNode((JoinNode) betaNode, sinkNode, bm, wm, leftTuples, actualResultLeftTuples, previousResultTuples);
    } else if (phreakNode == PhreakNotNode.class) {
        new PhreakNotNode().doNode((NotNode) betaNode, sinkNode, bm, wm, leftTuples, actualResultLeftTuples, previousResultTuples);
    } else if (phreakNode == PhreakExistsNode.class) {
        new PhreakExistsNode().doNode((ExistsNode) betaNode, sinkNode, bm, wm, leftTuples, actualResultLeftTuples, previousResultTuples);
    }
    if (expectedResultBuilder != null) {
        assertEquals(expectedResultBuilder.get(), actualResultLeftTuples, expectedResultBuilder.isTestStagedInsert(), expectedResultBuilder.isTestStagedDelete(), expectedResultBuilder.isTestStagedUpdate());
    }
    if (!preStagedBuilders.isEmpty()) {
        for (StagedBuilder stagedBuilder : preStagedBuilders) {
            TupleSets<LeftTuple> expected = stagedBuilder.get();
            TupleSets<LeftTuple> actual = stagedBuilder.getSegmentMemory().getStagedLeftTuples();
            assertEquals(expected, actual, stagedBuilder.isTestStagedInsert(), stagedBuilder.isTestStagedDelete(), stagedBuilder.isTestStagedUpdate());
        }
    }
    SegmentMemory smem = bm.getSegmentMemory();
    SegmentPropagator.propagate(smem, actualResultLeftTuples, wm);
    if (testLeftMemory) {
        equalsLeftMemory(leftMemory);
    }
    if (testRightMemory) {
        equalsRightMemory(rightMemory);
    }
    if (!postStagedBuilders.isEmpty()) {
        for (StagedBuilder stagedBuilder : postStagedBuilders) {
            TupleSets<LeftTuple> expected = stagedBuilder.get();
            TupleSets<LeftTuple> actual = stagedBuilder.getSegmentMemory().getStagedLeftTuples();
            assertEquals(expected, actual, stagedBuilder.isTestStagedInsert(), stagedBuilder.isTestStagedDelete(), stagedBuilder.isTestStagedUpdate());
        }
    }
    return this;
}
Also used : PhreakNotNode(org.drools.core.phreak.PhreakNotNode) NotNode(org.drools.core.reteoo.NotNode) PhreakNotNode(org.drools.core.phreak.PhreakNotNode) SegmentMemory(org.drools.core.reteoo.SegmentMemory) PhreakExistsNode(org.drools.core.phreak.PhreakExistsNode) PhreakJoinNode(org.drools.core.phreak.PhreakJoinNode) LeftTuple(org.drools.core.reteoo.LeftTuple)

Aggregations

PhreakExistsNode (org.drools.core.phreak.PhreakExistsNode)1 PhreakJoinNode (org.drools.core.phreak.PhreakJoinNode)1 PhreakNotNode (org.drools.core.phreak.PhreakNotNode)1 LeftTuple (org.drools.core.reteoo.LeftTuple)1 NotNode (org.drools.core.reteoo.NotNode)1 SegmentMemory (org.drools.core.reteoo.SegmentMemory)1