Package org.drools

Examples of org.drools.WorkingMemory.fireAllRules()


        final WorkingMemory workingMemory = ruleBase.newStatefulSession();

        workingMemory.insert( new Precondition( "genericcode",
                                                "genericvalue" ) );
        workingMemory.fireAllRules();

        final RuleBase ruleBaseWM = workingMemory.getRuleBase();
        ruleBaseWM.removePackage( packageName );
        final PackageBuilder builder1 = new PackageBuilder();
        builder1.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_RemovePackage.drl" ) ) );
View Full Code Here


        final RuleBase ruleBaseWM = workingMemory.getRuleBase();
        ruleBaseWM.removePackage( packageName );
        final PackageBuilder builder1 = new PackageBuilder();
        builder1.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_RemovePackage.drl" ) ) );
        ruleBaseWM.addPackage( serialisePackage( builder1.getPackage() ) );
        workingMemory.fireAllRules();

        ruleBaseWM.removePackage( packageName );
        ruleBaseWM.addPackage( serialisePackage( builder1.getPackage() ) );

        ruleBaseWM.removePackage( packageName );
View Full Code Here

        final PackageBuilder builder = new PackageBuilder();
        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_DynamicRules.drl" ) ) );
        final Package pkg = builder.getPackage();
        ruleBase.addPackage( serialisePackage( pkg ) );

        workingMemory.fireAllRules();
    }

    public void testDynamicRules2() throws Exception {
        final RuleBase ruleBase = getRuleBase();
        final WorkingMemory workingMemory = ruleBase.newStatefulSession();
View Full Code Here

        final PackageBuilder builder = new PackageBuilder();
        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_DynamicRules2.drl" ) ) );
        final Package pkg = serialisePackage( builder.getPackage() );
        ruleBase.addPackage( pkg );

        workingMemory.fireAllRules();
    }

    public void testRuleBaseAddRemove() throws Exception {
        RuleBase ruleBase = RuleBaseFactory.newRuleBase();
View Full Code Here

        order.addItem( item3 );
        order.addItem( item4 );
        order.addItem( item5 );
       
        workingMemory.insert( order );
        workingMemory.fireAllRules();
        assertEquals( 1, results.size() );
        assertEquals( 3, ((List) results.get(0)).size() );
        results.clear();

        final RuleBase ruleBaseWM = workingMemory.getRuleBase();
View Full Code Here

        final RuleBase ruleBaseWM = workingMemory.getRuleBase();
        ruleBaseWM.removePackage( packageName );
        final PackageBuilder builder1 = new PackageBuilder();
        builder1.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_DynamicRulesWithSubnetwork.drl" ) ) );
        ruleBaseWM.addPackage( serialisePackage( builder1.getPackage() ) );
        workingMemory.fireAllRules();
        assertEquals( 1, results.size() );
        assertEquals( 3, ((List) results.get(0)).size() );
        results.clear();

        ruleBaseWM.removePackage( packageName );
View Full Code Here

                                               "drink",
                                               30 );
        workingMemory.insert( p1 );
        workingMemory.insert( p2 );

        workingMemory.fireAllRules();

    }

    public void testNullConstraint() throws Exception {
        final PackageBuilder builder = new PackageBuilder();
View Full Code Here

        p2.setArrayAttribute( null );

        workingMemory.insert( p1 );
        workingMemory.insert( p2 );

        workingMemory.fireAllRules();
        assertEquals( 2,
                      foo.size() );

    }
View Full Code Here

                                          15 );
        workingMemory.insert( cheese );
        final List list = new ArrayList();
        workingMemory.setGlobal( "list",
                                 list );
        workingMemory.fireAllRules();

        assertEquals( 4,
                      list.size() );

        assertEquals( "rule1",
View Full Code Here

        workingMemory.insert( cheesery );

        Person p = new Person( "stilton" );
        workingMemory.insert( p );

        workingMemory.fireAllRules();

        // from using a global
        assertEquals( 2,
                      list1.size() );
        assertEquals( cheddar,
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.