Package org.drools.core

Examples of org.drools.core.WorkingMemory.fireAllRules()


                "stilton",
                42 ) );
        final List<String> list = new ArrayList<String>();
        wm.setGlobal( "list",
                list );
        wm.fireAllRules();
        assertEquals( 1,
                list.size() );
    }

    @Test
View Full Code Here


        Policy policy = new Policy();

        wm.insert(driver);
        wm.insert(policy);

        wm.fireAllRules();

        System.out.println("BASE PRICE IS: " + policy.getBasePrice());
        System.out.println("DISCOUNT IS: " + policy.getDiscountPercent());

        int basePrice = policy.getBasePrice();
View Full Code Here

                             42));
        final List<String> list = new ArrayList<String>();
        wm.setGlobal("list",
                     list);

        wm.fireAllRules();

        assertEquals(1, list.size());

    }
View Full Code Here

                                 list2 );

        Cheese c = new Cheese( "stilton",
                               10 );
        workingMemory.insert( c );
        workingMemory.fireAllRules();
        assertEquals( 2,
                      list.size() );
        assertEquals( BigInteger.valueOf( 30 ),
                      list.get( 0 ) );
        assertEquals( Integer.valueOf( 22 ),
View Full Code Here

                                          "stilton" ) );
        workingMemory.insert( new Person( "mark",
                                          "brie" ) );

        try {
            workingMemory.fireAllRules();

            assertEquals( "should have fired twice",
                          2,
                          list.size() );
View Full Code Here

        if ( bld.hasErrors() ) {
            fail( bld.getErrors().toString() );
        }

        rb.addPackage( bld.getPackage() );
        wm.fireAllRules();
        System.out.println( counter + ":" + (counter == NUM_FACTS ? "passed" : "failed" ));
    }

    public static void incCounter() {
        ++counter;
View Full Code Here

        workingMemory.setGlobal( "a",
                                 a );
        workingMemory.setGlobal( "l",
                                 l );

        workingMemory.fireAllRules();
        list = IteratorToList.convert( workingMemory.iterateObjects( new ClassObjectFilter( a.getClass() ) ) );
        assertEquals( "a still in WM",
                      0,
                      list.size() );
        assertEquals( "Rule should not loop",
View Full Code Here

        workingMemory.setGlobal( "person",
                                 person );
        workingMemory.setGlobal( "list",
                                 list );

        workingMemory.fireAllRules();

        // not sure about desired state of working memory.
        assertEquals( "Rules have not fired (looped) expected number of times",
                      10,
                      list.size() );
View Full Code Here

                                        1 ) );

        workingMemory.insert( bob );
        workingMemory.insert( cheesery );

        workingMemory.fireAllRules();

        assertEquals( 1,
                      results.size() );
        List cheeses = (List) results.get( 0 );
        assertEquals( 2,
View Full Code Here

            cheeseHandles[i] = wm.insert( cheese[i] );
        }

        // ---------------- 1st scenario
        int fireCount = 0;
        wm.fireAllRules();
        assertEquals( ++fireCount,  results.size() );
        assertEquals( 3, ((Collection) results.get( fireCount - 1 )).size() );
        assertEquals( ArrayList.class.getName(),  results.get( fireCount - 1 ).getClass().getName() );

        // ---------------- 2nd scenario
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.