Package org.drools.lang.descr

Examples of org.drools.lang.descr.ExprConstraintDescr


                                                         text )).getLhs();

        assertEquals( 1,
                      descrs.getDescrs().size() );
        PatternDescr pat = (PatternDescr) descrs.getDescrs().get( 0 );
        ExprConstraintDescr fieldConstr = (ExprConstraintDescr) pat.getConstraint().getDescrs().get( 0 );

        assertEquals( "bar > 1 || == 1",
                      fieldConstr.getExpression() );
    }
View Full Code Here


        assertEquals( 1,
                      eventB.getConstraint().getDescrs().size() );
        assertEquals( 1,
                      eventB.getConstraint().getDescrs().size() );

        final ExprConstraintDescr fcdB = (ExprConstraintDescr) eventB.getConstraint().getDescrs().get( 0 );
        assertEquals( "this after[1,10] $a || this not after[15,20] $a",
                      fcdB.getExpression() );

        final PatternDescr eventC = (PatternDescr) rule.getLhs().getDescrs().get( 2 );
        assertEquals( "$c",
                      eventC.getIdentifier() );
        assertEquals( "EventC",
                      eventC.getObjectType() );
        assertEquals( 1,
                      eventC.getConstraint().getDescrs().size() );
        final ExprConstraintDescr fcdC = (ExprConstraintDescr) eventC.getConstraint().getDescrs().get( 0 );
        assertEquals( "this finishes $b",
                      fcdC.getExpression() );

        final PatternDescr eventD = (PatternDescr) rule.getLhs().getDescrs().get( 3 );
        assertEquals( "$d",
                      eventD.getIdentifier() );
        assertEquals( "EventD",
                      eventD.getObjectType() );
        assertEquals( 1,
                      eventD.getConstraint().getDescrs().size() );
        final ExprConstraintDescr fcdD = (ExprConstraintDescr) eventD.getConstraint().getDescrs().get( 0 );
        assertEquals( "this not starts $a",
                      fcdD.getExpression() );

        final PatternDescr eventE = (PatternDescr) rule.getLhs().getDescrs().get( 4 );
        assertEquals( "$e",
                      eventE.getIdentifier() );
        assertEquals( "EventE",
                      eventE.getObjectType() );
        assertEquals( 1,
                      eventE.getConstraint().getDescrs().size() );

        ExprConstraintDescr fcdE = (ExprConstraintDescr) eventE.getConstraint().getDescrs().get( 0 );
        assertEquals( "this not before[1, 10] $b || after[1, 10] $c && this after[1, 5] $d",
                      fcdE.getExpression() );
    }
View Full Code Here

        RuleDescr rule = pkg.getRules().get( 0 );
        PatternDescr pattern = (PatternDescr) rule.getLhs().getDescrs().get( 0 );

        assertEquals( 1,
                      pattern.getDescrs().size() );
        ExprConstraintDescr fcd = (ExprConstraintDescr) pattern.getDescrs().get( 0 );
        assertEquals( "symbol==\"ACME\"",
                      fcd.getExpression() );

        assertNotNull( pattern.getSource() );
        EntryPointDescr entry = (EntryPointDescr) pattern.getSource();
        assertEquals( "StreamA",
                      entry.getEntryId() );
View Full Code Here

        RuleDescr rule = pkg.getRules().get( 0 );
        PatternDescr pattern = (PatternDescr) rule.getLhs().getDescrs().get( 0 );

        assertEquals( 1,
                      pattern.getDescrs().size() );
        ExprConstraintDescr fcd = (ExprConstraintDescr) pattern.getDescrs().get( 0 );
        assertEquals( "symbol==\"ACME\"",
                      fcd.getExpression() );

        assertNotNull( pattern.getSource() );
        EntryPointDescr entry = (EntryPointDescr) pattern.getSource();
        assertEquals( "StreamA",
                      entry.getEntryId() );
View Full Code Here

        RuleDescr rule = pkg.getRules().get( 0 );
        PatternDescr pattern = (PatternDescr) rule.getLhs().getDescrs().get( 0 );

        assertEquals( 1,
                      pattern.getDescrs().size() );
        ExprConstraintDescr fcd = (ExprConstraintDescr) pattern.getDescrs().get( 0 );
        assertEquals( "symbol==\"ACME\"",
                      fcd.getExpression() );

        List<BehaviorDescr> behaviors = pattern.getBehaviors();
        assertNotNull( behaviors );
        assertEquals( 1,
                      behaviors.size() );
View Full Code Here

        PatternDescr patternDescr = (PatternDescr) notDescr.getDescrs().get( 0 );
        assertEquals( "$r",
                      patternDescr.getIdentifier() );
        assertEquals( 1,
                      patternDescr.getDescrs().size() );
        ExprConstraintDescr fieldConstraintDescr = (ExprConstraintDescr) patternDescr.getDescrs().get( 0 );
        assertEquals( "operator == Operator.EQUAL",
                      fieldConstraintDescr.getExpression() );
    }
View Full Code Here

        PatternDescr patternDescr = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
        assertEquals( "$r",
                      patternDescr.getIdentifier() );
        assertEquals( 1,
                      patternDescr.getDescrs().size() );
        ExprConstraintDescr fieldConstraintDescr = (ExprConstraintDescr) patternDescr.getDescrs().get( 0 );
        assertEquals( "operator == Operator.EQUAL",
                      fieldConstraintDescr.getExpression() );
    }
View Full Code Here

        PatternDescr pattern = (PatternDescr) ((RuleDescr) parse( "rule",
                                                                  text )).getLhs().getDescrs().get( 0 );

        assertEquals( 1,
                      pattern.getDescrs().size() );
        ExprConstraintDescr fcd = (ExprConstraintDescr) pattern.getDescrs().get( 0 );
        assertEquals( "name == null",
                      fcd.getExpression() );
        assertEquals( 0,
                      fcd.getPosition() );
        assertEquals( ExprConstraintDescr.Type.NAMED,
                      fcd.getType() );
    }
View Full Code Here

        PatternDescr pattern = (PatternDescr) ((RuleDescr) parse( "rule",
                                                                  text )).getLhs().getDescrs().get( 0 );

        assertEquals( 2,
                      pattern.getDescrs().size() );
        ExprConstraintDescr fcd = (ExprConstraintDescr) pattern.getDescrs().get( 0 );
        assertEquals( "\"Mark\"",
                      fcd.getExpression() );
        assertEquals( 0,
                      fcd.getPosition() );
        assertEquals( ExprConstraintDescr.Type.POSITIONAL,
                      fcd.getType() );
        fcd = (ExprConstraintDescr) pattern.getDescrs().get( 1 );
        assertEquals( "42",
                      fcd.getExpression() );
        assertEquals( 1,
                      fcd.getPosition() );
        assertEquals( ExprConstraintDescr.Type.POSITIONAL,
                      fcd.getType() );
    }
View Full Code Here

        assertTrue( pattern.isQuery() );

        assertEquals( 2,
                      pattern.getDescrs().size() );
        ExprConstraintDescr fcd = (ExprConstraintDescr) pattern.getDescrs().get( 0 );
        assertEquals( "\"Mark\"",
                      fcd.getExpression() );
        assertEquals( 0,
                      fcd.getPosition() );
        assertEquals( ExprConstraintDescr.Type.POSITIONAL,
                      fcd.getType() );
        fcd = (ExprConstraintDescr) pattern.getDescrs().get( 1 );
        assertEquals( "42",
                      fcd.getExpression() );
        assertEquals( 1,
                      fcd.getPosition() );
        assertEquals( ExprConstraintDescr.Type.POSITIONAL,
                      fcd.getType() );
    }
View Full Code Here

TOP

Related Classes of org.drools.lang.descr.ExprConstraintDescr

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.