61586159616061616162616361646165616661676168
List list = new ArrayList(); ksession.setGlobal("list", list); Person p = new Person( "Toni" ); ksession.insert( p); ksession.insert( new Pet( "Toni" ) ); ksession.fireAllRules(); assertEquals( 1, list.size() ); assertSame( p, list.get( 0 ) );
61976198619962006201620262036204620562066207
KnowledgeBase kbase = SerializationHelper.serializeObject( loadKnowledgeBaseFromString( rule ) ); StatefulKnowledgeSession session = createKnowledgeSession( kbase ); Person toni = new Person( "Toni", 12 ); toni.setPet( new Pet( "Mittens" ) ); session.insert( new ArrayList() ); session.insert( toni ); session.fireAllRules();
62346235623662376238623962406241624262436244
63146315631663176318631963206321632263236324632563266327
KnowledgeBase kbase = SerializationHelper.serializeObject( loadKnowledgeBaseFromString( rule ) ); StatefulKnowledgeSession session = createKnowledgeSession( kbase ); assertNotNull( session ); Pet pet1 = new Pet( "Toni" ); pet1.getAttributes().put( "key", "value" ); Pet pet2 = new Pet( "Toni" ); session.insert( pet1 ); session.insert( pet2 ); session.fireAllRules();
63686369637063716372637363746375637663776378
RuleRuntimeEventListener wml = Mockito.mock( RuleRuntimeEventListener.class ); ksession.addEventListener( wml ); org.kie.api.runtime.rule.FactHandle personFH = ksession.insert( new Person( "Toni" ) ); org.kie.api.runtime.rule.FactHandle petFH = ksession.insert( new Pet( "Toni" ) ); int fired = ksession.fireAllRules(); assertEquals( 1, fired );
65116512651365146515651665176518651965206521
List list = new ArrayList(); ksession.setGlobal( "list", list ); Person p = new Person(); p.setPet( new Pet() ); ksession.insert( p ); ksession.fireAllRules(); assertEquals( 1, list.size() ); assertSame(p, list.get(0));
64516452645364546455645664576458645964606461
65316532653365346535653665376538653965406541654265436544
65976598659966006601660266036604660566066607
org.kie.api.event.rule.WorkingMemoryEventListener wml = Mockito.mock( org.kie.api.event.rule.WorkingMemoryEventListener.class ); ksession.addEventListener( wml ); org.kie.api.runtime.rule.FactHandle personFH = ksession.insert( new Person( "Toni" ) ); org.kie.api.runtime.rule.FactHandle petFH = ksession.insert( new Pet( "Toni" ) ); int fired = ksession.fireAllRules(); assertEquals( 1, fired );
6382638363846385638663876388
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() ); StatefulKnowledgeSession ksession = createKnowledgeSession( kbase ); ksession.insert( new Person( "Toni" ) ); ksession.insert( new Pet( "Toni" ) ); }