Package org.drools

Examples of org.drools.Message


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

        workingMemory.insert( new Attribute() );
        workingMemory.insert( new Message() );
        workingMemory.fireAllRules();

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


        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
        final List list = new ArrayList();
        workingMemory.setGlobal( "list",
                                 list );
        workingMemory.insert( new Message( "hola" ) );

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

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

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

        workingMemory.insert( message );
        workingMemory.insert( "boo" );
        workingMemory.fireAllRules();
        assertTrue( message.isFired() );
        assertEquals( message,
                      list.get( 0 ) );

    }
View Full Code Here

            ksession = kAgent.getKnowledgeBase().newStatefulKnowledgeSession();

            TruthMaintenanceSystem tms = ((StatefulKnowledgeSessionImpl)ksession).session.getTruthMaintenanceSystem();


            Message message = new Message( );
            message.setMessage("Hello World");
            message.setStatus(Message.HELLO);
            FactHandle fact = ksession.insert(message);

            Message message2 = new Message();
            message2.setMessage("Hello World 2");
            message2.setStatus(Message.HELLO);
            FactHandle fact2 = ksession.insert(message2);

            Message message3 = new Message();
            message3.setMessage("Hello World 3");
            message3.setStatus(Message.HELLO);
            FactHandle fact3 = ksession.insert(message3);

            ksession.fireAllRules();

            assertEquals( 12, ksession.getObjects().size() );
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

        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.