Package org.drools.compiler

Examples of org.drools.compiler.Cheese


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

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


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

        String expected = "s\tti\"lto\nn";
        final Cheese stilton = new Cheese( expected,
                                           5 );
        session.insert( stilton );
        session = SerializationHelper.getSerialisedStatefulKnowledgeSession( session,
                                                                             true );
View Full Code Here

        RuleRuntimeEventListener wmel = mock( RuleRuntimeEventListener.class );
        ksession.addEventListener( wmel );

        final Person bigCheese = new Person( "big cheese" );
        final Cheese cheddar = new Cheese( "cheddar",
                                           15 );
        bigCheese.setCheese( cheddar );

        final org.kie.api.runtime.rule.FactHandle bigCheeseHandle = ksession.insert( bigCheese );
        final org.kie.api.runtime.rule.FactHandle cheddarHandle = ksession.insert( cheddar );
View Full Code Here

                                                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 org.kie.api.runtime.rule.FactHandle h = session.insert( cheddar );

        session.fireAllRules();

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

        session.retract( 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

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.