Package org.kie.internal.runtime

Examples of org.kie.internal.runtime.StatefulKnowledgeSession.addEventListener()


         KnowledgeBase kbase = loadKnowledgeBaseFromString( str );
         StatefulKnowledgeSession ksession = createKnowledgeSession( kbase );

         org.kie.api.event.rule.AgendaEventListener ael = mock( org.kie.api.event.rule.AgendaEventListener.class );
         ksession.addEventListener( ael );

         RuleNameEqualsAgendaFilter af = new RuleNameEqualsAgendaFilter( "Aaa" );

         int rules = ksession.fireAllRules( af );
         assertEquals( 1,
View Full Code Here


         //building stuff
         KnowledgeBase kbase = loadKnowledgeBaseFromString( rule.toString() );
         StatefulKnowledgeSession ksession = createKnowledgeSession( kbase );
         org.kie.api.event.rule.AgendaEventListener ael = mock( org.kie.api.event.rule.AgendaEventListener.class );
         ksession.addEventListener( ael );

         Cheesery c1 = new Cheesery();
         c1.addCheese( new Cheese( "stilton", 20 ) );
         Cheesery c2 = new Cheesery();
         c2.addCheese( new Cheese( "brie", 10 ) );
View Full Code Here

                      "end";
         KnowledgeBase kbase = loadKnowledgeBaseFromString( str );
         StatefulKnowledgeSession ksession = createKnowledgeSession( kbase );

         org.kie.api.event.rule.AgendaEventListener ael = mock( org.kie.api.event.rule.AgendaEventListener.class );
         ksession.addEventListener( ael );

         int rulesFired = ksession.fireAllRules();
         assertEquals( 2,
                       rulesFired );
View Full Code Here

         // load up the knowledge base
         KnowledgeBase kbase = loadKnowledgeBaseFromString( str );
         StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

         org.kie.api.event.rule.AgendaEventListener ael = mock( org.kie.api.event.rule.AgendaEventListener.class );
         ksession.addEventListener( ael );

         ksession.insert( new Person( "Bob", 19 ) );
         ksession.insert( new Cheese( "brie", 10 ) );
         ksession.fireAllRules();
View Full Code Here

        kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
        kbase = SerializationHelper.serializeObject(kbase);

        final StatefulKnowledgeSession session = createKnowledgeSession(kbase);
        RuleRuntimeEventListener wmel = mock( RuleRuntimeEventListener.class );
        session.addEventListener( wmel );
       
        Person bob = new Person( "bob" );
        bob.setStatus( "hungry" );
        Person mark = new Person( "mark" );
        mark.setStatus( "thirsty" );
View Full Code Here

     public void testFactBindings() throws Exception {
         KnowledgeBase kbase = SerializationHelper.serializeObject( loadKnowledgeBase( "test_FactBindings.drl" ) );
         StatefulKnowledgeSession ksession = createKnowledgeSession( kbase );

         RuleRuntimeEventListener wmel = mock( RuleRuntimeEventListener.class );
         ksession.addEventListener( wmel );

         final Person bigCheese = new Person( "big cheese" );
         final Cheese cheddar = new Cheese( "cheddar",
                                            15 );
         bigCheese.setCheese( cheddar );
View Full Code Here

     public void testMapNullConstraint() throws Exception {
         KnowledgeBase kbase = loadKnowledgeBase( "test_mapNullConstraints.drl" );
         StatefulKnowledgeSession ksession = createKnowledgeSession( kbase );

         org.kie.api.event.rule.AgendaEventListener ael = mock( org.kie.api.event.rule.AgendaEventListener.class );
         ksession.addEventListener( ael );
         new WorkingMemoryConsoleLogger( ksession );

         Map addresses = new HashMap();
         addresses.put( "home",
                        new Address( "home street" ) );
View Full Code Here

     public void testEventModel() throws Exception {
         KnowledgeBase kbase = SerializationHelper.serializeObject( loadKnowledgeBase( "test_EventModel.drl" ) );
         StatefulKnowledgeSession wm = createKnowledgeSession( kbase );

         RuleRuntimeEventListener wmel = mock( RuleRuntimeEventListener.class );
         wm.addEventListener( wmel );

         final Cheese stilton = new Cheese( "stilton",
                                            15 );

         final FactHandle stiltonHandle = wm.insert( stilton );
View Full Code Here

    public void execTestAccumulateMultipleFunctions( String fileName ) throws Exception {
        KnowledgeBase kbase = loadKnowledgeBase( fileName );
        StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);

        AgendaEventListener ael = mock( AgendaEventListener.class );
        ksession.addEventListener( ael );

        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
                                                          10 ),
                                              new Cheese( "stilton",
                                                          3 ),
View Full Code Here

    public void execTestAccumulateMultipleFunctionsConstraint( String fileName ) throws Exception {
        KnowledgeBase kbase = loadKnowledgeBase( fileName );
        StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);

        AgendaEventListener ael = mock( AgendaEventListener.class );
        ksession.addEventListener( ael );

        final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
                                                          10 ),
                                              new Cheese( "stilton",
                                                          3 ),
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.