Package org.drools.workbench.models.datamodel.rule

Examples of org.drools.workbench.models.datamodel.rule.FromCompositeFactPattern


        FactPattern pattern = new FactPattern( "Address" );

        SingleFieldConstraint constraint = new SingleFieldConstraint( "street" );
        pattern.addConstraint( constraint );

        FromCompositeFactPattern fromCompositeFactPattern = new FromCompositeFactPattern();
        fromCompositeFactPattern.setFactPattern( pattern );
        ExpressionFormLine expression = new ExpressionFormLine();
        expression.setBinding( "person.addresses" );
        fromCompositeFactPattern.setExpression( expression );

        model.lhs = new IPattern[]{ boundPattern, fromCompositeFactPattern };

        assertTrue( validator.isValid() );
    }
View Full Code Here


    }

    @Test
    public void testEmptyFrom() throws Exception {

        model.lhs = new IPattern[]{ new FromCompositeFactPattern() };

        assertFalse( validator.isValid() );

        assertEquals( 2, validator.getErrors().size() );
        assertEquals( MISSING_FACT_PATTERN, validator.getErrors().get( 0 ) );
View Full Code Here

    public void testValidFromCompositeFactPattern() throws Exception {

        FactPattern factPattern = new FactPattern( "SomeList" );
        factPattern.setBoundName( "list" );

        FromCompositeFactPattern fromCompositeFactPattern = new FromCompositeFactPattern();
        fromCompositeFactPattern.setFactPattern( new FactPattern( "Person" ) );
        ExpressionFormLine expression = new ExpressionFormLine();
        expression.appendPart( new ExpressionVariable( "list", "SomeList", "SomeList" ) );
        fromCompositeFactPattern.setExpression( expression );
        model.lhs = new IPattern[]{ fromCompositeFactPattern };

        assertTrue( validator.isValid() );
    }
View Full Code Here

        FactPattern pattern = new FactPattern( "Address" );

        SingleFieldConstraint constraint = new SingleFieldConstraint( "street" );
        pattern.addConstraint( constraint );

        FromCompositeFactPattern fromCompositeFactPattern = new FromCompositeFactPattern();
        fromCompositeFactPattern.setFactPattern( pattern );
        ExpressionFormLine expression = new ExpressionFormLine();
        fromCompositeFactPattern.setExpression( expression );

        model.lhs = new IPattern[]{ fromCompositeFactPattern };

        assertFalse( validator.isValid() );
        assertEquals( 1, validator.getErrors().size() );
View Full Code Here

    @Test
    public void testMissingValueInFromCollect() throws Exception {
        FactPattern pattern = new FactPattern( "Person" );
        pattern.setBoundName("person");

        FromCompositeFactPattern fromCompositeFactPattern = new FromCollectCompositeFactPattern();
        fromCompositeFactPattern.setFactPattern( pattern );
        model.lhs = new IPattern[]{ fromCompositeFactPattern };

        assertFalse( validator.isValid() );
        assertEquals( 1, validator.getErrors().size() );
        assertEquals( MISSING_FACT_PATTERN, validator.getErrors().get( 0 ) );
View Full Code Here

TOP

Related Classes of org.drools.workbench.models.datamodel.rule.FromCompositeFactPattern

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.