Package org.drools.compiler

Examples of org.drools.compiler.Message


        KnowledgeBase kbase = loadKnowledgeBaseFromString( str );

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

        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 = createKnowledgeSession( kbase );
        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" );
        //        ksession    = SerializationHelper.serializeObject(ksession);
        ksession.fireAllRules();
        assertTrue( message.isFired() );
        assertEquals( message,
                      ((List) ksession.getGlobal( "list" )).get( 0 ) );

    }
View Full Code Here

        StatefulKnowledgeSession ksession = createKnowledgeSession( kbase );
        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

        KnowledgeBase kbase = loadKnowledgeBase("test_KnowledgeContextMVEL.drl");
        StatefulKnowledgeSession ksession = createKnowledgeSession( kbase );
        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

        //building stuff
        KnowledgeBase kbase = loadKnowledgeBaseFromString( rule.toString() );
        StatefulKnowledgeSession ksession = createKnowledgeSession( kbase );

        ksession.insert( new Message( "test" ) );
        int rules = ksession.fireAllRules();
        assertEquals( 1, rules );
        ksession.dispose();
    }
View Full Code Here

        //building stuff
        KnowledgeBase kbase = loadKnowledgeBaseFromString( rule.toString() );
        StatefulKnowledgeSession ksession = createKnowledgeSession( kbase );

        ksession.insert( new Message( "test" ) );
        int rules = ksession.fireAllRules();
        assertEquals( 1, rules );

        ksession.dispose();
View Full Code Here

        assertNotNull( ksession );
       
        List<String> context = new ArrayList<String>();
        ksession.setGlobal("context", context);
       
        FactHandle b = ksession.insert( new Message( "b" ) );
        ksession.delete(b);
        int fired = ksession.fireAllRules(1);
       
        assertEquals( 0, fired );
        ksession.dispose();
View Full Code Here

        KnowledgeBuilderConfiguration kbConf = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
        KnowledgeBase kbase = loadKnowledgeBaseFromString( kbConf, drl );
        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

        ksession.insert(new Message("Hello World"));
        ksession.fireAllRules();
    }
View Full Code Here

TOP

Related Classes of org.drools.compiler.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.