Package org.drools.core.common

Examples of org.drools.core.common.AbstractWorkingMemory


                     agendaGroup.size());
    }

    @Test
    public void testAgendaGroupLockOnActive() {
        final AbstractWorkingMemory workingMemory = (AbstractWorkingMemory) ruleBase.newStatefulSession();
        final InternalAgenda agenda = (InternalAgenda) workingMemory.getAgenda();

        // create the agendaGroup
        final InternalAgendaGroup agendaGroup = new AgendaGroupQueueImpl("agendaGroup",
                                                                         ruleBase);
        agenda.addAgendaGroup(agendaGroup);
View Full Code Here


                     agendaGroup.size());
    }

    @Test
    public void testActivationGroup() {
        final AbstractWorkingMemory workingMemory = (AbstractWorkingMemory) ruleBase.newStatefulSession();

        final InternalAgenda agenda = (InternalAgenda) workingMemory.getAgenda();

        final List list = new ArrayList();

        // create the consequence
        final Consequence consequence = new Consequence() {
View Full Code Here

     * executed.  When the two remaining groups are activated, the rule with the
     * highest priority is executed first.
     */
    @Test
    public void testRuleFlowGroup() {
        final AbstractWorkingMemory workingMemory = (AbstractWorkingMemory) ruleBase.newStatefulSession();

        final InternalAgenda agenda = (InternalAgenda) workingMemory.getAgenda();

        final List list = new ArrayList();

        // create the consequence
        final Consequence consequence = new Consequence() {
View Full Code Here

     * for an active RuleFlowGroup, those activations get added to the agenda
     * directly as well.
     */
    @Test
    public void testRuleFlowGroup1() {
        final AbstractWorkingMemory workingMemory = (AbstractWorkingMemory) ruleBase.newStatefulSession();

        final InternalAgenda agenda = (InternalAgenda) workingMemory.getAgenda();

        // create rule1
        final Consequence consequence1 = new Consequence() {
            private static final long serialVersionUID = 510l;

View Full Code Here

     * RuleFlowGroup test that makes sure that, if an activation in an active
     * RuleFlowGroup gets deactivated, the activation is no longer executed.
     */
    @Test
    public void testRuleFlowGroup2() {
        final AbstractWorkingMemory workingMemory = (AbstractWorkingMemory) ruleBase.newStatefulSession();

        final InternalAgenda agenda = (InternalAgenda) workingMemory.getAgenda();

        // create rule1
        final Consequence consequence1 = new Consequence() {
            private static final long serialVersionUID = 510l;

View Full Code Here

     * all activations for that group are no longer on the agenda.  When
     * reactivating the RuleFlowGroup however, they get added to the agenda again.
     */
    @Test
    public void testRuleFlowGroup3() {
        final AbstractWorkingMemory workingMemory = (AbstractWorkingMemory) ruleBase.newStatefulSession();

        final InternalAgenda agenda = (InternalAgenda) workingMemory.getAgenda();

        // create rule0
        final Consequence consequence0 = new Consequence() {
            private static final long serialVersionUID = 510l;

View Full Code Here

    /**
     * Test auto-deactivation of empty ruleflow group.
     */
    @Test
    public void testRuleFlowGroup5() {
        final AbstractWorkingMemory workingMemory = (AbstractWorkingMemory) ruleBase.newStatefulSession();

        final InternalAgenda agenda = (InternalAgenda) workingMemory.getAgenda();

        // create rule0
        final Consequence consequence0 = new Consequence() {
            private static final long serialVersionUID = 510l;

View Full Code Here

        //        assertFalse( ruleFlowGroup0.isActive() );
    }

    @Test
    public void testRuleFlowGroupLockOnActive() {
        final AbstractWorkingMemory workingMemory = (AbstractWorkingMemory) ruleBase.newStatefulSession();
        final InternalAgenda agenda = (InternalAgenda) workingMemory.getAgenda();

        // create the agendaGroup
        //final AgendaGroupImpl agendaGroup = new AgendaGroupImpl( "agendaGroup" );
        //agenda.addAgendaGroup( agendaGroup );
View Full Code Here

        final RuleTerminalNodeLeftTuple tuple2_1 = new RuleTerminalNodeLeftTuple(new DefaultFactHandle(2, "cheese"), node2, true);
        final RuleTerminalNodeLeftTuple tuple2_2 = new RuleTerminalNodeLeftTuple(new DefaultFactHandle(3, "cheese"), node2, true);
        final RuleTerminalNodeLeftTuple tuple3_1 = new RuleTerminalNodeLeftTuple(new DefaultFactHandle(4, "cheese"), node3, true);
        final RuleTerminalNodeLeftTuple tuple3_2 = new RuleTerminalNodeLeftTuple(new DefaultFactHandle(5, "cheese"), node3, true);

        InternalWorkingMemory workingMemory = new AbstractWorkingMemory(0,
                                                                        ruleBase);

        final InternalAgenda agenda = (InternalAgenda) workingMemory.getAgenda();

        final AgendaGroup agendaGroup1 = agenda.getAgendaGroup("agendaGroup1");
        final AgendaGroup agendaGroup2 = agenda.getAgendaGroup("agendaGroup2");

        // focus at this point is MAIN
View Full Code Here

    }

    @Test
    public void testNullErrorOnGetScheduledActivations() {
        final AbstractWorkingMemory workingMemory = (AbstractWorkingMemory) ruleBase.newStatefulSession();
        try {
            ((InternalAgenda) workingMemory.getAgenda()).getScheduledActivations();
        } catch (NullPointerException e) {
            fail("Exception Should not have been thrown");
        }

    }
View Full Code Here

TOP

Related Classes of org.drools.core.common.AbstractWorkingMemory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.