Search in sources :

Example 11 with EvalDescr

use of org.drools.drl.ast.descr.EvalDescr in project drools by kiegroup.

the class RuleParserTest method testEvalMultiple.

@Test
public void testEvalMultiple() throws Exception {
    final PackageDescr pkg = (PackageDescr) parseResource("compilationUnit", "eval_multiple.drl");
    assertEquals(1, pkg.getRules().size());
    final RuleDescr rule = (RuleDescr) pkg.getRules().get(0);
    assertEquals(4, rule.getLhs().getDescrs().size());
    final EvalDescr eval = (EvalDescr) rule.getLhs().getDescrs().get(0);
    assertEqualsIgnoreWhitespace("abc(\"foo\") + 5", (String) eval.getContent());
    final PatternDescr pattern = (PatternDescr) rule.getLhs().getDescrs().get(1);
    assertEquals("Foo", pattern.getObjectType());
}
Also used : PatternDescr(org.drools.drl.ast.descr.PatternDescr) EvalDescr(org.drools.drl.ast.descr.EvalDescr) RuleDescr(org.drools.drl.ast.descr.RuleDescr) PackageDescr(org.drools.drl.ast.descr.PackageDescr) Test(org.junit.Test)

Aggregations

EvalDescr (org.drools.drl.ast.descr.EvalDescr)11 RuleDescr (org.drools.drl.ast.descr.RuleDescr)6 Test (org.junit.Test)5 Declaration (org.drools.core.rule.Declaration)4 PackageDescr (org.drools.drl.ast.descr.PackageDescr)4 KnowledgeBuilderImpl (org.drools.compiler.builder.impl.KnowledgeBuilderImpl)3 AnalysisResult (org.drools.compiler.compiler.AnalysisResult)3 InternalKnowledgePackage (org.drools.core.definitions.InternalKnowledgePackage)3 EvalCondition (org.drools.core.rule.EvalCondition)3 AndDescr (org.drools.drl.ast.descr.AndDescr)3 PatternDescr (org.drools.drl.ast.descr.PatternDescr)3 KnowledgeBuilderConfigurationImpl (org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl)2 BoundIdentifiers (org.drools.compiler.compiler.BoundIdentifiers)2 DialectCompiletimeRegistry (org.drools.compiler.compiler.DialectCompiletimeRegistry)2 GlobalDescr (org.drools.drl.ast.descr.GlobalDescr)2 Cheese (org.drools.mvel.compiler.Cheese)2 MVELEvalExpression (org.drools.mvel.expr.MVELEvalExpression)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1