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

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


        assertEquals( 2,
                      fp.getNumberOfConstraints() );
        assertTrue( fp.getConstraint( 0 ) instanceof SingleFieldConstraint );

        SingleFieldConstraint sfp0 = (SingleFieldConstraint) fp.getConstraint( 0 );
        assertEquals( "Room",
                      sfp0.getFactType() );
        assertEquals( "decoration",
                      sfp0.getFieldName() );
        assertEquals( "==",
                      sfp0.getOperator() );
        assertEquals( "tapestry",
                      sfp0.getValue() );
        assertEquals( BaseSingleFieldConstraint.TYPE_LITERAL,
                      sfp0.getConstraintValueType() );
        assertEquals( DataType.TYPE_STRING,
                      sfp0.getFieldType() );

        SingleFieldConstraint sfp1 = (SingleFieldConstraint) fp.getConstraint( 1 );
        assertEquals( "Room",
                      sfp1.getFactType() );
        assertEquals( "strangeField",
                      sfp1.getFieldName() );
        assertEquals( "==",
                      sfp1.getOperator() );
        assertEquals( "11",
                      sfp1.getValue() );
        assertEquals( BaseSingleFieldConstraint.TYPE_LITERAL,
                      sfp1.getConstraintValueType() );
        assertEquals( DataType.TYPE_NUMERIC_INTEGER,
                      sfp1.getFieldType() );
    }
View Full Code Here


        assertEquals( "items",
                      fcfp.getFactPattern().getBoundName() );
        assertEquals( 1,
                      fcfp.getFactPattern().getNumberOfConstraints() );
        assertTrue( fcfp.getFactPattern().getConstraint( 0 ) instanceof SingleFieldConstraint );
        final SingleFieldConstraint sfc0 = (SingleFieldConstraint) fcfp.getFactPattern().getConstraint( 0 );
        assertNull( sfc0.getFactType() );
        assertNull( sfc0.getFieldName() );
        assertEquals( "size == c.items.size",
                      sfc0.getValue() );
        assertEquals( BaseSingleFieldConstraint.TYPE_PREDICATE,
                      sfc0.getConstraintValueType() );

        assertNotNull( fcfp.getRightPattern() );
        assertTrue( fcfp.getRightPattern() instanceof FactPattern );
        final FactPattern rfp = (FactPattern) fcfp.getRightPattern();
        assertEquals( "Item",
                      rfp.getFactType() );
        assertEquals( "var",
                      rfp.getBoundName() );
        assertEquals( 1,
                      rfp.getNumberOfConstraints() );
        assertTrue( rfp.getConstraint( 0 ) instanceof SingleFieldConstraint );
        final SingleFieldConstraint sfc1 = (SingleFieldConstraint) rfp.getConstraint( 0 );
        assertEquals( "Item",
                      sfc1.getFactType() );
        assertEquals( "price",
                      sfc1.getFieldName() );
        assertEquals( "10",
                      sfc1.getValue() );
        assertEquals( ">",
                      sfc1.getOperator() );
        assertEquals( BaseSingleFieldConstraint.TYPE_LITERAL,
                      sfc1.getConstraintValueType() );

        assertEqualsIgnoreWhitespace( drl,
                                      RuleModelDRLPersistenceImpl.getInstance().marshal( m ) );
    }
View Full Code Here

        assertEquals( "items",
                      fcfp.getFactPattern().getBoundName() );
        assertEquals( 1,
                      fcfp.getFactPattern().getNumberOfConstraints() );
        assertTrue( fcfp.getFactPattern().getConstraint( 0 ) instanceof SingleFieldConstraint );
        final SingleFieldConstraint sfc0 = (SingleFieldConstraint) fcfp.getFactPattern().getConstraint( 0 );
        assertNull( sfc0.getFactType() );
        assertNull( sfc0.getFieldName() );
        assertEquals( "size == c.items.size",
                      sfc0.getValue() );
        assertEquals( BaseSingleFieldConstraint.TYPE_PREDICATE,
                      sfc0.getConstraintValueType() );

        assertNotNull( fcfp.getRightPattern() );
        assertTrue( fcfp.getRightPattern() instanceof FactPattern );
        final FactPattern rfp = (FactPattern) fcfp.getRightPattern();
        assertEquals( "Item",
                      rfp.getFactType() );
        assertEquals( "var",
                      rfp.getBoundName() );
        assertEquals( 1,
                      rfp.getNumberOfConstraints() );
        assertTrue( rfp.getConstraint( 0 ) instanceof SingleFieldConstraint );
        final SingleFieldConstraint sfc1 = (SingleFieldConstraint) rfp.getConstraint( 0 );
        assertEquals( "Item",
                      sfc1.getFactType() );
        assertEquals( "price",
                      sfc1.getFieldName() );
        assertEquals( "10",
                      sfc1.getValue() );
        assertEquals( ">",
                      sfc1.getOperator() );
        assertEquals( BaseSingleFieldConstraint.TYPE_LITERAL,
                      sfc1.getConstraintValueType() );

        assertEqualsIgnoreWhitespace( drl,
                                      RuleModelDRLPersistenceImpl.getInstance().marshal( m ) );
    }
View Full Code Here

        assertEquals( 1,
                      fp.getConstraintList().getConstraints().length );
        assertTrue( fp.getConstraint( 0 ) instanceof SingleFieldConstraint );

        SingleFieldConstraint sfp = (SingleFieldConstraint) fp.getConstraint( 0 );
        assertEquals( "Applicant",
                      sfp.getFactType() );
        assertEquals( "age",
                      sfp.getFieldName() );
        assertEquals( "<",
                      sfp.getOperator() );
        assertEquals( "55",
                      sfp.getValue() );
        assertEquals( BaseSingleFieldConstraint.TYPE_LITERAL,
                      sfp.getConstraintValueType() );
    }
View Full Code Here

        assertEquals( 1,
                      fp.getConstraintList().getConstraints().length );
        assertTrue( fp.getConstraint( 0 ) instanceof SingleFieldConstraint );

        SingleFieldConstraint sfp = (SingleFieldConstraint) fp.getConstraint( 0 );
        assertEquals( "Applicant",
                      sfp.getFactType() );
        assertEquals( "age",
                      sfp.getFieldName() );
        assertEquals( "<",
                      sfp.getOperator() );
        assertEquals( "55",
                      sfp.getValue() );
        assertEquals( BaseSingleFieldConstraint.TYPE_LITERAL,
                      sfp.getConstraintValueType() );
        assertEquals( "$a",
                      sfp.getFieldBinding() );
    }
View Full Code Here

        assertEquals( 2,
                      fp.getConstraintList().getConstraints().length );
        assertTrue( fp.getConstraint( 0 ) instanceof SingleFieldConstraint );

        SingleFieldConstraint sfp0 = (SingleFieldConstraint) fp.getConstraint( 0 );
        assertEquals( "Applicant",
                      sfp0.getFactType() );
        assertEquals( "age",
                      sfp0.getFieldName() );
        assertEquals( BaseSingleFieldConstraint.TYPE_UNDEFINED,
                      sfp0.getConstraintValueType() );
        assertEquals( "$a",
                      sfp0.getFieldBinding() );

        assertTrue( fp.getConstraint( 1 ) instanceof SingleFieldConstraint );

        SingleFieldConstraint sfp1 = (SingleFieldConstraint) fp.getConstraint( 1 );
        assertEquals( "Applicant",
                      sfp1.getFactType() );
        assertEquals( "name",
                      sfp1.getFieldName() );
        assertEquals( BaseSingleFieldConstraint.TYPE_UNDEFINED,
                      sfp1.getConstraintValueType() );
        assertEquals( "$n",
                      sfp1.getFieldBinding() );
    }
View Full Code Here

        assertEquals( 2,
                      cfp.getNumberOfConstraints() );
        assertTrue( cfp.getConstraint( 0 ) instanceof SingleFieldConstraint );
        assertTrue( cfp.getConstraint( 1 ) instanceof SingleFieldConstraint );

        SingleFieldConstraint sfp1 = (SingleFieldConstraint) cfp.getConstraint( 0 );
        assertEquals( "Applicant",
                      sfp1.getFactType() );
        assertEquals( "age",
                      sfp1.getFieldName() );
        assertEquals( "<",
                      sfp1.getOperator() );
        assertEquals( "55",
                      sfp1.getValue() );
        assertEquals( BaseSingleFieldConstraint.TYPE_LITERAL,
                      sfp1.getConstraintValueType() );

        SingleFieldConstraint sfp2 = (SingleFieldConstraint) cfp.getConstraint( 1 );
        assertEquals( "Applicant",
                      sfp2.getFactType() );
        assertEquals( "age",
                      sfp2.getFieldName() );
        assertEquals( ">",
                      sfp2.getOperator() );
        assertEquals( "70",
                      sfp2.getValue() );
        assertEquals( BaseSingleFieldConstraint.TYPE_LITERAL,
                      sfp2.getConstraintValueType() );
    }
View Full Code Here

        assertEquals( 1,
                      fp.getConstraintList().getConstraints().length );
        assertTrue( fp.getConstraint( 0 ) instanceof SingleFieldConstraint );

        SingleFieldConstraint sfp = (SingleFieldConstraint) fp.getConstraint( 0 );
        assertEquals( "Applicant",
                      sfp.getFactType() );
        assertEquals( "age",
                      sfp.getFieldName() );
        assertEquals( "== null",
                      sfp.getOperator() );
        assertNull( sfp.getValue() );
        assertEquals( BaseSingleFieldConstraint.TYPE_UNDEFINED,
                      sfp.getConstraintValueType() );
    }
View Full Code Here

        assertEquals( 1,
                      fp.getConstraintList().getConstraints().length );
        assertTrue( fp.getConstraint( 0 ) instanceof SingleFieldConstraint );

        SingleFieldConstraint sfp = (SingleFieldConstraint) fp.getConstraint( 0 );
        assertEquals( "Applicant",
                      sfp.getFactType() );
        assertEquals( "age",
                      sfp.getFieldName() );
        assertEquals( "!= null",
                      sfp.getOperator() );
        assertNull( sfp.getValue() );
        assertEquals( BaseSingleFieldConstraint.TYPE_UNDEFINED,
                      sfp.getConstraintValueType() );
    }
View Full Code Here

        assertEquals( 2,
                      cfp.getNumberOfConstraints() );
        assertTrue( cfp.getConstraint( 0 ) instanceof SingleFieldConstraint );
        assertTrue( cfp.getConstraint( 1 ) instanceof SingleFieldConstraint );

        SingleFieldConstraint sfp1 = (SingleFieldConstraint) cfp.getConstraint( 0 );
        assertEquals( "Applicant",
                      sfp1.getFactType() );
        assertEquals( "age",
                      sfp1.getFieldName() );
        assertEquals( "!= null",
                      sfp1.getOperator() );
        assertNull( sfp1.getValue() );
        assertEquals( BaseSingleFieldConstraint.TYPE_UNDEFINED,
                      sfp1.getConstraintValueType() );

        SingleFieldConstraint sfp2 = (SingleFieldConstraint) cfp.getConstraint( 1 );
        assertEquals( "Applicant",
                      sfp2.getFactType() );
        assertEquals( "age",
                      sfp2.getFieldName() );
        assertEquals( ">",
                      sfp2.getOperator() );
        assertEquals( "70",
                      sfp2.getValue() );
        assertEquals( BaseSingleFieldConstraint.TYPE_LITERAL,
                      sfp2.getConstraintValueType() );
    }
View Full Code Here

TOP

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

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.