Package org.drools.brms.client.modeldriven.brl

Examples of org.drools.brms.client.modeldriven.brl.FactPattern


    public void testBindingList() {
        final RuleModel model = new RuleModel();

        model.lhs = new IPattern[3];
        final FactPattern x = new FactPattern( "Car" );
        model.lhs[0] = x;
        x.boundName = "x";

        final FactPattern y = new FactPattern( "Car" );
        model.lhs[1] = y;
        y.boundName = "y";

        final FactPattern other = new FactPattern( "House" );
        model.lhs[2] = other;

        final List b = model.getBoundFacts();
        assertEquals( 2,
                      b.size() );
View Full Code Here


    }
   
    public void testAllVariableBindings() {
        final RuleModel model = new RuleModel();
        model.lhs = new IPattern[2];
        final FactPattern x = new FactPattern( "Car" );
        model.lhs[0] = x;
        x.boundName = "boundFact";       
       
        SingleFieldConstraint sfc = new SingleFieldConstraint("q");
        x.addConstraint( sfc );
        sfc.fieldBinding = "field1";
       
        SingleFieldConstraint sfc2 = new SingleFieldConstraint("q");
        x.addConstraint( sfc2 );
        sfc2.fieldBinding = "field2";
       
       
        model.lhs[1] = new CompositeFactPattern();
    
View Full Code Here

   
    public void testGetVariableNameForRHS() {
        RuleModel m = new RuleModel();
        m.name = "blah";
       
        FactPattern pat = new FactPattern();
        pat.boundName = "pat";
        pat.factType = "Person";
       
        m.addLhsItem( pat );
       
View Full Code Here

    public void testRemoveItemLhs() {
        final RuleModel model = new RuleModel();

        model.lhs = new IPattern[3];
        final FactPattern x = new FactPattern( "Car" );
        model.lhs[0] = x;
        x.boundName = "x";

        final FactPattern y = new FactPattern( "Car" );
        model.lhs[1] = y;
        y.boundName = "y";

        final FactPattern other = new FactPattern( "House" );
        model.lhs[2] = other;

        assertEquals( 3,
                      model.lhs.length );
        assertEquals( x,
View Full Code Here

                      model.rhs[1] );
    }

    public void testAddItemLhs() {
        final RuleModel model = new RuleModel();
        final FactPattern x = new FactPattern();
        model.addLhsItem( x );
        assertEquals( 1,
                      model.lhs.length );

        final FactPattern y = new FactPattern();
        model.addLhsItem( y );

        assertEquals( 2,
                      model.lhs.length );
        assertEquals( x,
View Full Code Here

    public void testIsDSLEnhanced() throws Exception {
        RuleModel m = new RuleModel();
       
        assertFalse(m.hasDSLSentences());
       
        m.addLhsItem( new FactPattern() );
        assertFalse(m.hasDSLSentences());
       
        m.addRhsItem( new ActionSetField("q") );
       
        assertFalse(m.hasDSLSentences());
View Full Code Here

import org.drools.brms.client.modeldriven.brl.SingleFieldConstraint;

public class FactPatternTest extends TestCase {

    public void testAddConstraint() {
        final FactPattern p = new FactPattern();
        final SingleFieldConstraint x = new SingleFieldConstraint( "x" );
        p.addConstraint( x );

        assertEquals( 1,
                      p.constraintList.constraints.length );
        assertEquals( x,
                      p.constraintList.constraints[0] );

        final SingleFieldConstraint y = new SingleFieldConstraint( "y" );

        p.addConstraint( y );
        assertEquals( 2,
                      p.constraintList.constraints.length );
        assertEquals( x,
                      p.constraintList.constraints[0] );
        assertEquals( y,
View Full Code Here

                      p.constraintList.constraints[1] );

    }
   
    public void testWithCompositeNesting() {
        final FactPattern p = new FactPattern();
        final SingleFieldConstraint x = new SingleFieldConstraint( "x" );
        p.addConstraint( x );

        assertEquals( 1,
                      p.constraintList.constraints.length );
        assertEquals( x,
                      p.constraintList.constraints[0] );

        final CompositeFieldConstraint y = new CompositeFieldConstraint();

        y.addConstraint( new SingleFieldConstraint("y") );
        y.addConstraint( new SingleFieldConstraint("z") );       
        p.addConstraint( y );
       
        assertEquals( 2,
                      p.constraintList.constraints.length );
        assertEquals( x,
                      p.constraintList.constraints[0] );
View Full Code Here

      
       
    }

    public void testRemoveConstraint() {
        final FactPattern p = new FactPattern();
        final SingleFieldConstraint x = new SingleFieldConstraint( "x" );
        p.addConstraint( x );
        final SingleFieldConstraint y = new SingleFieldConstraint( "y" );
        p.addConstraint( y );

        assertEquals( 2,
                      p.constraintList.constraints.length );

        p.removeConstraint( 1 );

        assertEquals( 1,
                      p.constraintList.constraints.length );

        assertEquals( x,
View Full Code Here

       
       
    }
   
    public void testIsBound() {
        FactPattern pat = new FactPattern();
        pat.boundName = "x";
        assertTrue(pat.isBound());
       
        pat = new FactPattern();
        assertFalse(pat.isBound());
    }
View Full Code Here

TOP

Related Classes of org.drools.brms.client.modeldriven.brl.FactPattern

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.