Package org.drools.compiler

Examples of org.drools.compiler.Cheese


    @Test
    public void testModifyRetractWithFunction() throws Exception {
        KnowledgeBase kbase = SerializationHelper.serializeObject( loadKnowledgeBase( "test_RetractModifyWithFunction.drl" ) );
        StatefulKnowledgeSession ksession = createKnowledgeSession( kbase );

        final Cheese stilton = new Cheese( "stilton",
                                           7 );
        final Cheese muzzarella = new Cheese( "muzzarella",
                                              9 );
        final int sum = stilton.getPrice() + muzzarella.getPrice();
        final org.kie.api.runtime.rule.FactHandle stiltonHandle = ksession.insert( stilton );
        final org.kie.api.runtime.rule.FactHandle muzzarellaHandle = ksession.insert( muzzarella );

        ksession.fireAllRules();
View Full Code Here


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

        final Cheese stilton = new Cheese( "stilton",
                                           12 );
        final Cheese stilton2 = new Cheese( "stilton2",
                                            12 );
        final Cheese agedStilton = new Cheese( "aged stilton",
                                               12 );
        final Cheese brie = new Cheese( "brie",
                                        10 );
        final Cheese brie2 = new Cheese( "brie2",
                                         10 );
        final Cheese muzzarella = new Cheese( "muzzarella",
                                              10 );
        final Cheese muzzarella2 = new Cheese( "muzzarella2",
                                               10 );
        final Cheese provolone = new Cheese( "provolone",
                                             10 );
        final Cheese provolone2 = new Cheese( "another cheese (provolone)",
                                              10 );
        ksession.insert( stilton );
        ksession.insert( stilton2 );
        ksession.insert( agedStilton );
        ksession.insert( brie );
View Full Code Here

        ksession.setGlobal( "results",
                            list );

        final Person bob = new Person( "bob",
                                       "stilton" );
        final Cheese stilton = new Cheese( "stilton",
                                           12 );
        ksession.insert( bob );
        ksession.insert( stilton );

        ksession.fireAllRules();
View Full Code Here

        ksession.setGlobal( "results",
                            list );

        final Person bob = new Person( "bob",
                                       "stilton" );
        final Cheese stilton = new Cheese( "stilton",
                                           12 );
        ksession.insert( bob );
        ksession.insert( stilton );

        ksession.fireAllRules();
View Full Code Here

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

        ksession.insert( new Cheese() );

        ksession.fireAllRules();

        assertEquals( 0,
                      results.size() );
View Full Code Here

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

            ksession.insert( new Cheese( "stilton",
                                         10 ) );
            ksession.insert( new Cheese( "brie",
                                         5 ) );

            ksession.fireAllRules();

            assertEquals( results.toString(),
View Full Code Here

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

        ksession.insert( new Cheese( "stilton",
                                     10 ) );
        ksession.insert( new Cheese( "brie",
                                     5 ) );

        ksession.fireAllRules();

        assertEquals( results.toString(),
                      0,
                      results.size() );

        ksession.insert( new Cheese( "muzzarella",
                                     7 ) );

        ksession.fireAllRules();

        assertEquals( results.toString(),
View Full Code Here

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

        ksession.insert( new Cheese( "stilton",
                                     15 ) );

        ksession.fireAllRules();

        assertEquals( 2,
View Full Code Here

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

        final Cheesery cheesery = new Cheesery();
        cheesery.addCheese( new Cheese( "stilton",
                                        15 ) );
        cheesery.addCheese( new Cheese( "brie",
                                        10 ) );

        ksession.setGlobal( "cheesery",
                            cheesery );
View Full Code Here

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

        ksession.insert( new Cheese( "stilton",
                                     15 ) );
        ksession.insert( new Cheese( "",
                                     10 ) );
        ksession.insert( new Cheese( null,
                                     8 ) );

        ksession.fireAllRules();

        assertEquals( 3,
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.