Package org.kie.api.runtime

Examples of org.kie.api.runtime.KieSession.update()


        org.kie.api.runtime.rule.FactHandle homerHandle = ksession.insert(homer);
        homer.setFather(abraham);
        ksession.update(homerHandle, homer);
        bart.setFather(homer);
        ksession.update(bartHandle, bart);
        ksession.fireAllRules();
        assertEquals(120, ((TotalHolder) ksession.getGlobal("totalHolder")).getTotal());
    }   

    public static class Holder {
View Full Code Here


        ksession.getAgenda().getAgendaGroup( "g1" ).setFocus();

        ksession.fireAllRules();

        ksession.update( fh, p ); // normally NPE thrown here, for BUG
       
        assertEquals( 36, p.getAge() );
    }

View Full Code Here

        ksession.fireAllRules();
        assertEquals( 1, list.size() );


        timeService.advanceTime( 17, TimeUnit.SECONDS );
        ksession.update( fh, 5000l );
        ksession.fireAllRules();
        assertEquals( 2, list.size() );
    }

    @Test(timeout=10000)
View Full Code Here

        ksession.fireAllRules();
        assertEquals( 1, list.size() );


        timeService.advanceTime( 17, TimeUnit.SECONDS );
        ksession.update( fh, 5000l );
        ksession.fireAllRules();
        assertEquals( 2, list.size() );
    }

    @Test(timeout=10000)
View Full Code Here

        // the activation state of the rule is not changed so the timer isn't reset
        // since the timer alredy fired it will only use only the period that now will be set to 2000
        fact1.setField2( 300 );
        fact1.setField4( 2000 );
        ksession.updatefh, fact1 );
        ksession.fireAllRules();

        // 100 has passed of the 1000, from the previous schedule
        // so that should be deducted from the 2000 period above, meaning
        //  we only need to increment another 1950
View Full Code Here

        // problems should be detected
        sensor.setPressure( 200 );
        sensor.setTemperature( 200 );
       
        handle = getFactHandle( handle, ksession );
        ksession.update( handle, sensor );

        ksession = SerializationHelper.getSerialisedStatefulKnowledgeSession( ksession, true );

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

                      cheeseList.size() );

        // europe=[ 1, 2 ], america=[ 3 ]
        p3.setStatus( "america" );
        c3FactHandle = getFactHandle( c3FactHandle, ksession );
        ksession.update( c3FactHandle,
                              p3 );
        ksession = SerializationHelper.getSerialisedStatefulKnowledgeSession(ksession, true);
        ksession.fireAllRules();
        ksession = SerializationHelper.getSerialisedStatefulKnowledgeSession(ksession, true);
        cheeseList = ksession.getObjects(new ClassObjectFilter(Cheese.class));
View Full Code Here

                      cheeseList.size() );

        // europe=[ 1 ], america=[ 2, 3 ]
        p2.setStatus( "america" );
        c2FactHandle = getFactHandle( c2FactHandle, ksession );
        ksession.update( c2FactHandle,
                              p2 );
        ksession = SerializationHelper.getSerialisedStatefulKnowledgeSession(ksession, true);
        ksession.fireAllRules();
        ksession = SerializationHelper.getSerialisedStatefulKnowledgeSession(ksession, true);
        cheeseList = ksession.getObjects(new ClassObjectFilter(Cheese.class));
View Full Code Here

                      cheeseList.size() );

        // europe=[ ], america=[ 1, 2, 3 ]
        p1.setStatus( "america" );
        c1FactHandle = getFactHandle( c1FactHandle, ksession );
        ksession.update( c1FactHandle,
                              p1 );
        ksession = SerializationHelper.getSerialisedStatefulKnowledgeSession(ksession, true);
        ksession.fireAllRules();
        ksession = SerializationHelper.getSerialisedStatefulKnowledgeSession(ksession, true);
        cheeseList = ksession.getObjects(new ClassObjectFilter(Cheese.class));
View Full Code Here

                      cheeseList.size() );

        // europe=[ 2 ], america=[ 1, 3 ]
        p2.setStatus( "europe" );
        c2FactHandle = getFactHandle( c2FactHandle, ksession );
        ksession.update( c2FactHandle,
                              p2 );
        ksession = SerializationHelper.getSerialisedStatefulKnowledgeSession(ksession, true);
        ksession.fireAllRules();
        ksession = SerializationHelper.getSerialisedStatefulKnowledgeSession(ksession, true);
        cheeseList = ksession.getObjects(new ClassObjectFilter(Cheese.class));
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.