Package org.drools

Examples of org.drools.StatefulSession.update()


        assertEqualsMatrix( size, cells, expected );
        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}};
        assertEqualsMatrix( size, cells, expected );
View Full Code Here


           
            // this solves problems where inserting something into the containment feature
            // of a property which then needs to be accessed (e.g. onAccess, onEdit)
            // does not correctly update the parent object for new results
            if (o.eContainer() != null && factMemory.containsKey(o.eContainer())) {
              workingMemory.update(factMemory.get(o.eContainer()), o.eContainer());
            }
           
          }
        }
       
View Full Code Here

        assertEquals( "should not have fired",
                      0,
                      list.size() );

        cheese2.setType( "stilton" );
        session.update( p,
                        bob );
        session.fireAllRules();

        assertEquals( 1,
                      list.size() );
View Full Code Here

                                    } );
        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

        assertEquals( "should not have fired",
                      0,
                      list.size() );

        cheese2.setType( "stilton" );
        session.update( p,
                        bob );
        session.fireAllRules();

        assertEquals( 1,
                      list.size() );
View Full Code Here

        assertEquals( "JavaRuleConstraint was here",
                      outList.get( 1 ) );

        outList.clear();
        inList.remove( new Integer( 3 ) );
        session.update( handle,
                        inList );
        session.startProcess( "ConstraintDialects" );
        assertEquals( 1,
                      outList.size() );
        assertEquals( "JavaRuleConstraint was here",
View Full Code Here

        assertEquals( "JavaRuleConstraint was here",
                      outList.get( 0 ) );

        outList.clear();
        inList.remove( new Integer( 25 ) );
        session.update( handle,
                        inList );
        try {
            session.startProcess( "ConstraintDialects" );
            fail( "This should have thrown an exception" );
        } catch ( Exception e ) {
View Full Code Here

        assertEquals( "JavaRuleConstraint was here",
                      outList.get( 3 ) );

        outList.clear();
        inList.remove( new Integer( 1 ) );
        session.update( handle,
                        inList );
        session.startProcess( "ConstraintDialects" );
        assertEquals( 3,
                      outList.size() );
        assertEquals( "JavaCodeConstraint was here",
View Full Code Here

        assertEquals( "JavaRuleConstraint was here",
                      outList.get( 2 ) );

        outList.clear();
        inList.remove( new Integer( 6 ) );
        session.update( handle,
                        inList );
        session.startProcess( "ConstraintDialects" );
        assertEquals( 2,
                      outList.size() );
        assertEquals( "JavaCodeConstraint was here",
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();

        Assert.assertEquals( ++fireCount,
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.