Package org.drools

Examples of org.drools.Message


        StatefulSession session = ruleBase.newStatefulSession();
        session.setGlobal( "results",
                           new ArrayList() );

        session = getSerialisedStatefulSession( session );
        session.insert( new Message() );
        session = getSerialisedStatefulSession( session );
        List results = (List) session.getGlobal( "results" );

        session.insert( new Message() );
        session.insert( new Message() );
        session.fireAllRules();
        assertEquals( 3,
                      ((Number) results.get( 0 )).intValue() );

        session = getSerialisedStatefulSession( session );

        session.insert( new Message() );
        session.insert( new Message() );
        session = getSerialisedStatefulSession( session );

        assertEquals( 1,
                      session.getAgenda().getActivations().length );
        session.fireAllRules();
View Full Code Here


        ruleBase.addPackage( pkg );
        StatefulSession session = ruleBase.newStatefulSession();
        session.fireAllRules();

        session = getSerialisedStatefulSession( session );
        session.insert( new Message() );
        session.insert( new Message() );
        session.insert( new Message() );
        session.insert( new Message() );
        session.insert( new Message() );

        assertEquals( 1,
                      session.getAgenda().getActivations().length );
    }
View Full Code Here

        kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );

        kbase    = SerializationHelper.serializeObject( kbase );
        StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession();
       
        ksession.execute( new Message( "help" ) );
    }
View Full Code Here

                list.add( event );
            }
           
        });
       
        ksession.execute( new Message( "help" ) );
       
        assertEquals( 4, list.size() );
    }
View Full Code Here

        final List list = new ArrayList();
        workingMemory.setGlobal( "list",
                                 list );

        // go !
        final Message message = new Message( "hola" );
        workingMemory.insert( message );
        workingMemory.fireAllRules();
        assertFalse( message.isFired() );

    }
View Full Code Here

        KnowledgeBase kbase = loadKnowledgeBaseFromString( str );

        kbase = SerializationHelper.serializeObject( kbase );
        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

        ksession.insert( new Message( "help" ) );
        ksession.fireAllRules();
        ksession.dispose();
    }
View Full Code Here

        List list = new ArrayList();
        ksession.setGlobal( "list",
                            list );

        ksession.insert( new Attribute() );
        ksession.insert( new Message() );
        ksession = SerializationHelper.getSerialisedStatefulKnowledgeSession( ksession,
                                                                              true );
        ksession.fireAllRules();

        assertEquals( 1,
View Full Code Here

        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
        final List list = new ArrayList();
        ksession.setGlobal( "list",
                            list );
        ksession.insert( new Message( "hola" ) );

        ksession.fireAllRules();
        assertEquals( 0,
                      list.size() );
View Full Code Here

        final List list = new ArrayList();
        ksession.setGlobal( "list",
                            list );

        // go !
        final Message message = new Message( "hola" );
        message.addToList( "hello" );
        message.setNumber( 42 );

        ksession.insert( message );
        ksession.insert( "boo" );
        //        workingMemory    = SerializationHelper.serializeObject(workingMemory);
        ksession.fireAllRules();
        assertTrue( message.isFired() );
        assertEquals( message,
                      ((List) ksession.getGlobal( "list" )).get( 0 ) );

    }
View Full Code Here

        kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
        List<String> list = new ArrayList<String>();
        ksession.setGlobal( "list",
                            list );
        ksession.insert( new Message() );
        ksession.fireAllRules();
        assertEquals( 1,
                      list.size() );
        assertEquals( "Hello World",
                      list.get( 0 ) );
View Full Code Here

TOP

Related Classes of org.drools.Message

Copyright © 2018 www.massapicom. 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.