Package org.drools.compiler

Examples of org.drools.compiler.Cheese


                                                 null,
                                                 43 );
         ben.setBigDecimal( new BigDecimal( "43" ) );

         session.insert( bill );
         session.insert( new Cheese( "gorgonzola", 43 ) );
         session.insert( ben );
         session = SerializationHelper.getSerialisedStatefulKnowledgeSession( session,
                                                                              true );
         session.fireAllRules();
View Full Code Here


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

         final Cheese cheddar = new Cheese( "cheddar",
                                            5 );
         final FactHandle h = session.insert( cheddar );

         session.fireAllRules();

         // just one added
         assertEquals( "got cheese",
                       list.get( 0 ) );
         assertEquals( 1,
                       list.size() );

         session.delete( h );
         session.fireAllRules();

         // still just one
         assertEquals( 1,
                       list.size() );

         session.insert( new Cheese( "stilton",
                                     5 ) );
         session = SerializationHelper.getSerialisedStatefulKnowledgeSession( session,
                                                                              true );
         session.fireAllRules();
View Full Code Here

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

         final Cheese stilton = new Cheese( "stilton",
                                            5 );
         ksession.insert( stilton );
         ksession = SerializationHelper.getSerialisedStatefulKnowledgeSession( ksession,
                                                                               true );
         ksession.fireAllRules();
View Full Code Here

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

         final Cheese stilton = new Cheese( "stilton",
                                            5 );
         ksession.insert( stilton );
         ksession = SerializationHelper.getSerialisedStatefulKnowledgeSession( ksession,
                                                                               true );
         ksession.fireAllRules();
View Full Code Here

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

         final Cheesery cheesery = new Cheesery();
         final Cheese stilton = new Cheese( "stilton",
                                            12 );
         final Cheese cheddar = new Cheese( "cheddar",
                                            15 );
         cheesery.addCheese( stilton );
         cheesery.addCheese( cheddar );
         ksession.setGlobal( "cheesery",
                             cheesery );
View Full Code Here

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

         Cheesery cheesery = new Cheesery();
         cheesery.addCheese( new Cheese( "stilton",
                                         22 ) );

         session.insert( cheesery );

         // TODO java.io.EOFException
View Full Code Here

     @Test
     public void testPredicateAsFirstPattern() throws Exception {
         KnowledgeBase kbase = loadKnowledgeBase( "predicate_as_first_pattern.drl" );
         StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

         final Cheese mussarela = new Cheese( "Mussarela",
                                              35 );
         ksession.insert( mussarela );
         final Cheese provolone = new Cheese( "Provolone",
                                              20 );
         ksession.insert( provolone );

         ksession.fireAllRules();

         assertEquals( "The rule is being incorrectly fired",
                       35,
                       mussarela.getPrice() );
         assertEquals( "Rule is incorrectly being fired",
                       20,
                       provolone.getPrice() );
     }
View Full Code Here

     @Test
     public void testConsequenceException() throws Exception {
         KnowledgeBase kbase = loadKnowledgeBase( "test_ConsequenceException.drl" );
         StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

         final Cheese brie = new Cheese( "brie",
                                         12 );
         ksession.insert( brie );

         try {
             ksession.fireAllRules();
View Full Code Here

     @Test
     public void testEvalException() throws Exception {
         KnowledgeBase kbase = SerializationHelper.serializeObject( loadKnowledgeBase( "test_EvalException.drl" ) );
         StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

         final Cheese brie = new Cheese( "brie",
                                         12 );
         try {
             ksession.insert( brie );
             ksession.fireAllRules();
             fail( "Should throw an Exception from the Eval" );
View Full Code Here

     @Test
     public void testPredicateException() throws Exception {
         KnowledgeBase kbase = SerializationHelper.serializeObject( loadKnowledgeBase( "test_PredicateException.drl" ) );
         StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

         final Cheese brie = new Cheese( "brie",
                                         12 );
         try {
             ksession.insert( brie );
             ksession.fireAllRules();
             fail( "Should throw an Exception from the Predicate" );
View Full Code Here

TOP

Related Classes of org.drools.compiler.Cheese

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.