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

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


                      fp0.getNumberOfConstraints() );

        IPattern p1 = m.lhs[ 1 ];
        assertTrue( p1 instanceof FromCompositeFactPattern );

        FromCompositeFactPattern fcfp1 = (FromCompositeFactPattern) p1;
        FactPattern fp1 = fcfp1.getFactPattern();
        ExpressionFormLine efl1 = fcfp1.getExpression();

        assertNotNull( fp1 );
        assertNotNull( efl1 );

        assertEquals( "Number",
View Full Code Here


                      fp1sfc.getValue() );
        assertEquals( BaseSingleFieldConstraint.TYPE_PREDICATE,
                      fp1sfc.getConstraintValueType() );

        assertTrue( fp1.getRightPattern() instanceof FromCompositeFactPattern );
        FromCompositeFactPattern fp2 = (FromCompositeFactPattern) fp1.getRightPattern();
        assertNotNull( fp2.getFactPattern() );

        FactPattern fp3 = fp2.getFactPattern();
        assertEquals( "Transaction",
                      fp3.getFactType() );
        assertEquals( 0,
                      fp3.getNumberOfConstraints() );

        assertNotNull( fp2.getExpression() );
        ExpressionFormLine efl = fp2.getExpression();
        assertEquals( 3,
                      efl.getParts().size() );
        assertTrue( efl.getParts().get( 0 ) instanceof ExpressionVariable );
        ExpressionVariable ev = (ExpressionVariable) efl.getParts().get( 0 );
        assertEquals( "$trans",
View Full Code Here

                      fp1sfc.getValue() );
        assertEquals( BaseSingleFieldConstraint.TYPE_PREDICATE,
                      fp1sfc.getConstraintValueType() );

        assertTrue( fp1.getRightPattern() instanceof FromCompositeFactPattern );
        FromCompositeFactPattern fp2 = (FromCompositeFactPattern) fp1.getRightPattern();
        assertNotNull( fp2.getFactPattern() );

        FactPattern fp3 = fp2.getFactPattern();
        assertEquals( "Transaction",
                      fp3.getFactType() );
        assertEquals( 0,
                      fp3.getNumberOfConstraints() );

        assertNotNull( fp2.getExpression() );
        ExpressionFormLine efl = fp2.getExpression();
        assertEquals( 3,
                      efl.getParts().size() );
        assertTrue( efl.getParts().get( 0 ) instanceof ExpressionVariable );
        ExpressionVariable ev = (ExpressionVariable) efl.getParts().get( 0 );
        assertEquals( "$trans",
View Full Code Here

        SingleFieldConstraint constraint = new SingleFieldConstraint( "street" );
        constraint.setOperator( "!=" );
        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 };

        assertFalse( validator.isValid() );
        assertEquals( 1, validator.getErrors().size() );
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();
        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

                      fp1sfc.getValue() );
        assertEquals( BaseSingleFieldConstraint.TYPE_PREDICATE,
                      fp1sfc.getConstraintValueType() );

        assertTrue( fp1.getRightPattern() instanceof FromCompositeFactPattern );
        FromCompositeFactPattern fp2 = (FromCompositeFactPattern) fp1.getRightPattern();
        assertNotNull( fp2.getFactPattern() );

        FactPattern fp3 = fp2.getFactPattern();
        assertEquals( "Transaction",
                      fp3.getFactType() );
        assertEquals( 0,
                      fp3.getNumberOfConstraints() );

        assertNotNull( fp2.getExpression() );
        ExpressionFormLine efl = fp2.getExpression();
        assertEquals( 3,
                      efl.getParts().size() );
        assertTrue( efl.getParts().get( 0 ) instanceof ExpressionVariable );
        ExpressionVariable ev = (ExpressionVariable) efl.getParts().get( 0 );
        assertEquals( "$trans",
View Full Code Here

        RuleModel m = RuleModelDRLPersistenceImpl.getInstance().unmarshal( drl,
                                                                           Collections.EMPTY_LIST,
                                                                           dmo );
        assertTrue( m.lhs[ 1 ] instanceof FromCompositeFactPattern );
        FromCompositeFactPattern factPattern = (FromCompositeFactPattern) m.lhs[ 1 ];
        assertNotNull( factPattern.getFactPattern().getConstraintList() );
        assertEquals( 1, factPattern.getFactPattern().getConstraintList().getNumberOfConstraints() );
        SingleFieldConstraint constraint = (SingleFieldConstraint) factPattern.getFactPattern().getFieldConstraints()[ 0 ];
        assertEquals( "Itinerario", constraint.getFactType() );
        assertEquals( "destino", constraint.getFieldName() );
        assertEquals( DataType.TYPE_STRING, constraint.getFieldType() );
        assertEquals( "USA", constraint.getValue() );
        assertEquals( "==", constraint.getOperator() );
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.