Package org.drools.compiler

Examples of org.drools.compiler.Cheese


    @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

    @Test
    public void testReturnValueException() throws Exception {
        KnowledgeBase kbase = SerializationHelper.serializeObject( loadKnowledgeBase( "test_ReturnValueException.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 ReturnValue" );
View Full Code Here

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

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

        ksession.fireAllRules();
View Full Code Here

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

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

        final Cheesery cheesery = new Cheesery();
        cheesery.getCheeses().add( stilton );
View Full Code Here

        ksession.fireAllRules();

        assertEquals( 0,
                      list.size() );
        Cheese brie = new Cheese( "brie" );
        ksession.insert( brie );

        ksession.fireAllRules();

        assertEquals( 2,
View Full Code Here

                            nonmatchlist );

        ksession.setGlobal( "cheeseType",
                            "stilton" );

        final Cheese stilton1 = new Cheese( "stilton",
                                            5 );
        final Cheese stilton2 = new Cheese( "stilton",
                                            7 );
        final Cheese brie = new Cheese( "brie",
                                        4 );
        ksession.insert( stilton1 );
        ksession.insert( stilton2 );
        ksession.insert( brie );
View Full Code Here

        ksession.fireAllRules();

        assertEquals( 0,
                      list.size() );

        ksession.insert( new Cheese( bob.getLikes(),
                                     10 ) );
        ksession.fireAllRules();

        assertEquals( 1,
                      list.size() );
View Full Code Here

        KnowledgeBase kbase = SerializationHelper.serializeObject(loadKnowledgeBaseFromString(str));
        StatefulKnowledgeSession ksession = createKnowledgeSession( kbase, option );
       
        // insert some data into the session
        for ( int i = 0; i < 10000; i++ ) {
            ksession.insert( new Cheese( i % 2 == 0 ? "stilton" : "brie" ) );
        }

        // query the session
        List<Cheese> cheeses;
        for ( int i = 0; i < 100; i++ ) {
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.