Package org.drools.compiler

Examples of org.drools.compiler.Message


         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

                "end\n";

        KnowledgeBase kbase = loadKnowledgeBaseFromString( drl );
        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

        Message m1 = new Message( "msg1" );
        ksession.insert(m1);
        assertEquals(2, ksession.fireAllRules());

        Message m2 = (Message) ksession.getGlobal( "m2" );

        assertEquals( "msg1", m1.getMessage() );
        assertEquals( "msg2", m1.getMessage2() );
        assertEquals( "msg3", m1.getMessage3() );

        assertEquals( "msg1", m2.getMessage() );
        assertEquals( "Two", m2.getMessage2() ); // r1 does not fire for m2
        assertEquals( "Three", m2.getMessage3() );
    }
View Full Code Here

        KieModule km = deployJar(ks, jar);

        // Create a session and fire rules
        KieContainer kc = ks.newKieContainer(km.getReleaseId());
        KieSession ksession = kc.newKieSession();
        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.