Package org.drools

Examples of org.drools.StatefulSession.update()


                                    } );
        final RuleBase ruleBase = getRuleBase( conf );
        ruleBase.addPackage( pkg );
        StatefulSession session = ruleBase.newStatefulSession();
        FactHandle fh = session.insert( "xxx" );
        session.update( fh,
                        "xxx" );
        session.retract( fh );

        assertEquals( "inserted",
                      list.get( 0 ) );
View Full Code Here


                             results.get( fireCount - 1 ).getClass().getName() );

        // ---------------- 2nd scenario
        final int index = 1;
        cheese[index].setPrice( 9 );
        wm.update( cheeseHandles[index],
                   cheese[index] );

        wm.fireAllRules();

        assertEquals( ++fireCount,
View Full Code Here

        assertEquals( ArrayList.class.getName(),
                             results.get( fireCount - 1 ).getClass().getName() );

        // ---------------- 3rd scenario
        bob.setLikes( "brie" );
        wm.update( bobHandle,
                   bob );
        wm.fireAllRules();

        assertEquals( fireCount,
                             results.size() );
View Full Code Here

        assertEquals( "MAIN",
                      session.getAgenda().getFocusName() );

        // on the fifth day God created the birds and sea creatures
        cells[0][0].setState( Cell.LIVE );
        session.update( handles[0][0],
                              cells[0][0] );
        session.setFocus( "birth" );
        session.setFocus( "calculate" );
        fired = session.fireAllRules( 100 );
View Full Code Here

        assertEquals( "MAIN",
                      session.getAgenda().getFocusName() );

        // on the sixth day God created the animals that walk over the land and the Man
        cells[1][1].setState( Cell.LIVE );
        session.update( handles[1][1],
                              cells[1][1] );
        session.setFocus( "calculate" );
        session.fireAllRules( 100 );
        //        logger.writeToDisk();
View Full Code Here

        assertEquals( "MAIN",
                      session.getAgenda().getFocusName() );

        // on the seventh day, while God rested, man start killing them all
        cells[0][0].setState( Cell.DEAD );
        session.update( handles[0][0],
                              cells[0][0] );
        session.setFocus( "calculate" );
        session.fireAllRules( 100 );

        expected = new int[][]{{3, 2, 2}, {2, 2, 2}, {2, 2, 1}};
View Full Code Here

        final AgendaGroup group1 = agenda.getAgendaGroup( "group1" );
        agenda.setFocus( group1 );
        assertEquals( 3, group1.size() );
        agenda.fireNextItem( null );
        assertEquals( 2, group1.size() );
        wm.update( brieHandle, brie );
        assertEquals( 2, group1.size() );

        AgendaGroup group2 = agenda.getAgendaGroup( "group2" );
        agenda.setFocus( group2 );
View Full Code Here

        assertEquals( 3, rfg.size() );

        agenda.activateRuleFlowGroup( "ruleflow2" );
        agenda.fireNextItem( null );
        assertEquals( 2, rfg.size() );
        wm.update( brieHandle, brie );
        assertEquals( 2, group2.size() );
       
        wm.dispose();
    }
View Full Code Here

        assertEquals( 0, fired );
        assertEquals( "MAIN", session.getAgenda().getFocusName() );

        // on the fifth day God created the birds and sea creatures
        cells[0][0].setState( Cell.LIVE );
        session.update( handles[0][0], cells[0][0] );
        session.setFocus( "birth" );
        session.setFocus( "calculate" );
        fired = session.fireAllRules( 100 );

        // logger.writeToDisk();
View Full Code Here

        assertEquals( "MAIN", session.getAgenda().getFocusName() );

        // on the sixth day God created the animals that walk over the land and
        // the Man
        cells[1][1].setState( Cell.LIVE );
        session.update( handles[1][1], cells[1][1] );
        session.setFocus( "calculate" );
        session.fireAllRules( 100 );
        // logger.writeToDisk();

        expected = new int[][]{{1, 2, 1}, {2, 1, 1}, {1, 1, 1}};
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.